diff --git a/core/Access.php b/core/Access.php index ad0690dd971..e9597fc420c 100644 --- a/core/Access.php +++ b/core/Access.php @@ -13,6 +13,7 @@ use Piwik\Access\CapabilitiesProvider; use Piwik\API\Request; use Piwik\Access\RolesProvider; +use Piwik\Http\BadRequestException; use Piwik\Request\AuthenticationToken; use Piwik\Container\StaticContainer; use Piwik\Plugins\SitesManager\API as SitesManagerApi; @@ -78,6 +79,11 @@ class Access */ private $auth = null; + /** + * @var bool + */ + private $sessionExpired = false; + /** * Gets the singleton instance. Creates it if necessary. * @@ -627,7 +633,7 @@ public function checkUserHasCapability($idSites, $capability) /** * @param int|array|string $idSites * @return array - * @throws \Piwik\NoAccessException + * @throws BadRequestException */ protected function getIdSites($idSites) { @@ -638,7 +644,7 @@ protected function getIdSites($idSites) $idSites = Site::getIdSitesFromIdSitesString($idSites); if (empty($idSites)) { - $this->throwNoAccessException("The parameter 'idSite=' is missing from the request."); + throw new BadRequestException("The parameter 'idSite=' is missing from the request."); } return $idSites; @@ -745,14 +751,7 @@ private function throwNoAccessException($message) { if (Piwik::isUserIsAnonymous() && !Request::isRootRequestApiRequest()) { $message = Piwik::translate('General_YouMustBeLoggedIn'); - - // Try to detect whether user was previously logged in so that we can display a different message - $referrer = Url::getReferrer(); - $matomoUrl = SettingsPiwik::getPiwikUrl(); - if ( - $referrer && $matomoUrl && Url::isValidHost(Url::getHostFromUrl($referrer)) && - strpos($referrer, $matomoUrl) === 0 - ) { + if ($this->sessionExpired) { $message = Piwik::translate('General_YourSessionHasExpired'); } } @@ -760,6 +759,16 @@ private function throwNoAccessException($message) throw new NoAccessException($message); } + public function setSessionExpired(bool $sessionExpired): void + { + $this->sessionExpired = $sessionExpired; + } + + public function wasSessionExpired(): bool + { + return $this->sessionExpired; + } + /** * Returns true if the current user is logged in or not. * diff --git a/core/FrontController.php b/core/FrontController.php index d910cac6c61..ad372583e2e 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -70,6 +70,7 @@ class FrontController extends Singleton public const DEFAULT_MODULE = 'CoreHome'; public const DEFAULT_LOGIN = 'anonymous'; public const DEFAULT_TOKEN_AUTH = 'anonymous'; + private const SESSION_TIMEOUT_COOKIE_NAME = 'matomo_session_timed_out'; // public for tests public static $requestId = null; @@ -425,6 +426,9 @@ public function init() $sessionAuth = $this->makeSessionAuthenticator(); if ($sessionAuth) { $loggedIn = Access::getInstance()->reloadAccess($sessionAuth); + if (!$loggedIn && $sessionAuth->wasSessionExpired()) { + Access::getInstance()->setSessionExpired(true); + } } // ... if session auth fails try normal auth (which will login the anonymous user) @@ -449,7 +453,8 @@ public function init() $this->makeAuthenticator($sessionAuth); // Piwik\Auth must be set to the correct Login plugin } - + $this->consumeSessionTimeoutCookie(); + $this->sendSessionTimedOutHeaderIfNeeded(); // Force the auth to use the token_auth if specified, so that embed dashboard // and all other non widgetized controller methods works fine @@ -806,6 +811,21 @@ private static function setRequestIdHeader() Common::sendHeader("X-Matomo-Request-Id: $requestId"); } + private function consumeSessionTimeoutCookie(): void + { + $cookie = new Cookie(self::SESSION_TIMEOUT_COOKIE_NAME); + + if (!$cookie->isCookieFound()) { + return; + } + + $cookie->delete(); + + if (Piwik::isUserIsAnonymous()) { + Access::getInstance()->setSessionExpired(true); + } + } + private function isSupportedBrowserCheckNeeded() { if (defined('PIWIK_ENABLE_DISPATCH') && !PIWIK_ENABLE_DISPATCH) { @@ -845,4 +865,12 @@ private function isSupportedBrowserCheckNeeded() return false; } + + private function sendSessionTimedOutHeaderIfNeeded() + { + if (!Access::getInstance()->wasSessionExpired()) { + return; + } + Common::sendHeader('X-Matomo-Session-Timed-Out: 1'); + } } diff --git a/core/Session/SessionAuth.php b/core/Session/SessionAuth.php index 928875dff64..9a41ccec53d 100644 --- a/core/Session/SessionAuth.php +++ b/core/Session/SessionAuth.php @@ -46,6 +46,11 @@ class SessionAuth implements Auth private $tokenAuth; + /** + * @var bool + */ + private $sessionExpired = false; + public function __construct(?UsersModel $userModel = null, $shouldDestroySession = true) { $this->userModel = $userModel ?: new UsersModel(); @@ -97,6 +102,7 @@ public function setPasswordHash( public function authenticate() { + $this->sessionExpired = false; $sessionFingerprint = new SessionFingerprint(); $userModel = $this->userModel; @@ -243,9 +249,17 @@ private function isExpiredSession(SessionFingerprint $sessionFingerprint) } $isExpired = Date::now()->getTimestampUTC() > $expirationTime; + if ($isExpired) { + $this->sessionExpired = true; + } return $isExpired; } + public function wasSessionExpired(): bool + { + return $this->sessionExpired; + } + private function checkIfSessionFailedToRead() { if (Session\SaveHandler\DbTable::$wasSessionToLargeToRead) { diff --git a/plugins/CoreHome/tests/UI/AjaxHelperSessionTimeout_spec.js b/plugins/CoreHome/tests/UI/AjaxHelperSessionTimeout_spec.js new file mode 100644 index 00000000000..21b11c4b68d --- /dev/null +++ b/plugins/CoreHome/tests/UI/AjaxHelperSessionTimeout_spec.js @@ -0,0 +1,78 @@ +/*! + * Matomo - free/libre analytics platform + * + * AjaxHelper session timeout UI test. + * + * @link https://matomo.org + * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +describe('AjaxHelperSessionTimeout', function () { + this.fixture = "Piwik\\Tests\\Fixtures\\OneVisitorTwoVisits"; + + const reportUrl = '?module=CoreHome&action=index&idSite=1&period=day&date=yesterday'; + + async function loadReportPage() { + await page.goto(reportUrl); + await page.waitForNetworkIdle(); + await page.waitForFunction(() => window.ajaxHelper && window.piwikHelper); + } + + const cases = [ + { + name: 'should refresh when a request indicates the session has timed out', + headerValue: '1', + expectedRefresh: true, + }, + { + name: 'should not refresh when the session timeout header is missing', + headerValue: null, + expectedRefresh: false, + }, + ]; + + cases.forEach(({ name, headerValue, expectedRefresh }) => { + it(name, async function () { + await loadReportPage(); + + const refreshCalled = await page.evaluate((value) => { + document.cookie = 'matomo_session_timed_out=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; + window._ajaxSessionTimedOutRefresh = false; + const originalRefresh = window.piwikHelper.refreshAfter; + const originalAjax = window.$.ajax; + + window.piwikHelper.refreshAfter = (timeout) => { + window._ajaxSessionTimedOutRefresh = timeout === 0; + }; + + const mockXhr = { + status: 401, + statusText: 'error', + getResponseHeader: (name) => (name === 'X-Matomo-Session-Timed-Out' ? value : null), + then() { + return this; + }, + fail(callback) { + this._fail = callback; + return this; + }, + }; + + window.$.ajax = () => mockXhr; + + const helper = new window.ajaxHelper(); + helper.send(); + if (typeof mockXhr._fail === 'function') { + mockXhr._fail(mockXhr); + } + + window.$.ajax = originalAjax; + window.piwikHelper.refreshAfter = originalRefresh; + + return window._ajaxSessionTimedOutRefresh; + }, headerValue); + + expect(refreshCalled).to.equal(expectedRefresh); + }); + }); +}); diff --git a/plugins/CoreHome/tests/UI/WidgetLoader_spec.js b/plugins/CoreHome/tests/UI/WidgetLoader_spec.js deleted file mode 100644 index db03dbfff80..00000000000 --- a/plugins/CoreHome/tests/UI/WidgetLoader_spec.js +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * Matomo - free/libre analytics platform - * - * WidgetLoader screenshot tests. - * - * @link https://matomo.org - * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */ - -describe('WidgetLoader', function () { - this.fixture = "Piwik\\Tests\\Fixtures\\OneVisit"; - before(function () { - testEnvironment.testUseMockAuth = 0; - testEnvironment.save(); - }); - - after(function () { - testEnvironment.testUseMockAuth = 1; - testEnvironment.save(); - }); - - it('should redirect to the landing page when the session cookie is cleared during widget loading', async function () { - // We try to do an actual login - await page.goto(""); - await page.type("#login_form_login", superUserLogin); - await page.type("#login_form_password", superUserPassword); - await page.click('#login_form_submit'); - await page.waitForNetworkIdle(); - - // check dashboard is shown - await page.waitForSelector('#dashboard'); - expect(await page.$('#dashboard')).to.be.ok; - await page.clearCookies(); - - //Click on Dashboard menu item - const dashboardMenuSelector = 'div.reportingMenu ul li[data-category-id="Dashboard_Dashboard"] ul li:nth-child(1) a'; - await page.click(dashboardMenuSelector); - await page.waitForNetworkIdle(); - - const loginForm = await page.waitForSelector('#login_form_login'); - expect(loginForm).to.be.ok; - - const errorNotification = await page.waitForSelector('div.system.notification-error'); - expect(errorNotification).to.be.ok; - - const expectedText = 'Error: Your session has expired due to inactivity. Please log in to continue.'; - const notificationText = await page.$eval('div.system.notification-error .notification-body', el => el.textContent.trim()); - expect(notificationText).to.equal(expectedText); - - }); -}); diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.js b/plugins/CoreHome/vue/dist/CoreHome.umd.js index 619c9dbae79..b39520226ae 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.js @@ -1060,6 +1060,47 @@ class MatomoUrl_MatomoUrl { const instance = new MatomoUrl_MatomoUrl(); /* harmony default export */ var src_MatomoUrl_MatomoUrl = (instance); MatomoUrl_piwik.updatePeriodParamsFromUrl = instance.updatePeriodParamsFromUrl.bind(instance); +// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/CookieHelper/CookieHelper.ts +/* + * General utils for managing cookies in Typescript. + */ +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function setCookie(name, val, seconds) { + const date = new Date(); + // set default day to 3 days + if (!seconds) { + // eslint-disable-next-line no-param-reassign + seconds = 3 * 24 * 60 * 1000; + } + // Set it expire in n days + date.setTime(date.getTime() + seconds); + // Set it + document.cookie = `${name}=${val}; expires=${date.toUTCString()}; path=/`; +} +// eslint-disable-next-line consistent-return,@typescript-eslint/explicit-module-boundary-types +function getCookie(name) { + const value = `; ${document.cookie}`; + const parts = value.split(`; ${name}=`); + // if cookie not exist return null + // eslint-disable-next-line eqeqeq + if (parts.length == 2) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + const data = parts.pop().split(';').shift(); + if (typeof data !== 'undefined') { + return data; + } + } + return null; +} +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function deleteCookie(name) { + const date = new Date(); + // Set it expire in -1 days + date.setTime(date.getTime() + -1 * 24 * 60 * 60 * 1000); + // Set it + document.cookie = `${name}=; expires=${date.toUTCString()}; path=/`; +} // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/AjaxHelper/AjaxHelper.ts function AjaxHelper_defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /*! @@ -1070,6 +1111,7 @@ function AjaxHelper_defineProperty(obj, key, value) { if (key in obj) { Object.d */ + const { $: AjaxHelper_$ } = window; @@ -1494,7 +1536,9 @@ class AjaxHelper_AjaxHelper { return; } const isInApp = !document.querySelector('#login_form'); - if (xhr.status === 401 && isInApp) { + const sessionTimedOut = xhr.getResponseHeader('X-Matomo-Session-Timed-Out') === '1'; + if (sessionTimedOut && isInApp) { + setCookie('matomo_session_timed_out', '1', 60 * 1000); Matomo_Matomo.helper.refreshAfter(0); return; } @@ -1963,47 +2007,6 @@ class PopoverHandler_PopoverHandler { } } /* harmony default export */ var src_PopoverHandler_PopoverHandler = (new PopoverHandler_PopoverHandler()); -// CONCATENATED MODULE: ./plugins/CoreHome/vue/src/CookieHelper/CookieHelper.ts -/* - * General utils for managing cookies in Typescript. - */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -function setCookie(name, val, seconds) { - const date = new Date(); - // set default day to 3 days - if (!seconds) { - // eslint-disable-next-line no-param-reassign - seconds = 3 * 24 * 60 * 1000; - } - // Set it expire in n days - date.setTime(date.getTime() + seconds); - // Set it - document.cookie = `${name}=${val}; expires=${date.toUTCString()}; path=/`; -} -// eslint-disable-next-line consistent-return,@typescript-eslint/explicit-module-boundary-types -function getCookie(name) { - const value = `; ${document.cookie}`; - const parts = value.split(`; ${name}=`); - // if cookie not exist return null - // eslint-disable-next-line eqeqeq - if (parts.length == 2) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - const data = parts.pop().split(';').shift(); - if (typeof data !== 'undefined') { - return data; - } - } - return null; -} -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -function deleteCookie(name) { - const date = new Date(); - // Set it expire in -1 days - date.setTime(date.getTime() + -1 * 24 * 60 * 60 * 1000); - // Set it - document.cookie = `${name}=; expires=${date.toUTCString()}; path=/`; -} // CONCATENATED MODULE: ./plugins/CoreHome/vue/src/zenMode.ts /*! * Matomo - free/libre analytics platform diff --git a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js index 15d889edc38..305d22e7ca4 100644 --- a/plugins/CoreHome/vue/dist/CoreHome.umd.min.js +++ b/plugins/CoreHome/vue/dist/CoreHome.umd.min.js @@ -4,7 +4,7 @@ * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */window.hasBlockedContent=!1},"8bbf":function(t,o){t.exports=e},fae3:function(e,t,o){"use strict";if(o.r(t),o.d(t,"createVueApp",(function(){return me})),o.d(t,"importPluginUmd",(function(){return fe})),o.d(t,"useExternalPluginComponent",(function(){return ve})),o.d(t,"DirectiveUtilities",(function(){return je})),o.d(t,"debounce",(function(){return we})),o.d(t,"clone",(function(){return Se})),o.d(t,"VueEntryContainer",(function(){return De})),o.d(t,"ActivityIndicator",(function(){return _e})),o.d(t,"MatomoLoader",(function(){return Fe})),o.d(t,"translate",(function(){return a})),o.d(t,"translateOrDefault",(function(){return r})),o.d(t,"externalRawLink",(function(){return ae})),o.d(t,"externalLink",(function(){return re})),o.d(t,"Alert",(function(){return $e})),o.d(t,"AjaxHelper",(function(){return G})),o.d(t,"setCookie",(function(){return ee})),o.d(t,"getCookie",(function(){return te})),o.d(t,"deleteCookie",(function(){return oe})),o.d(t,"MatomoUrl",(function(){return H})),o.d(t,"Matomo",(function(){return I})),o.d(t,"Periods",(function(){return c})),o.d(t,"Day",(function(){return f})),o.d(t,"Week",(function(){return O})),o.d(t,"Month",(function(){return y})),o.d(t,"Year",(function(){return S})),o.d(t,"Range",(function(){return C})),o.d(t,"format",(function(){return d})),o.d(t,"getToday",(function(){return u})),o.d(t,"parseDate",(function(){return m})),o.d(t,"todayIsInRange",(function(){return p})),o.d(t,"getWeekNumber",(function(){return h})),o.d(t,"datesAreInTheSamePeriod",(function(){return g})),o.d(t,"NumberFormatter",(function(){return Q})),o.d(t,"formatNumber",(function(){return se})),o.d(t,"formatPercent",(function(){return le})),o.d(t,"formatCurrency",(function(){return ce})),o.d(t,"formatEvolution",(function(){return de})),o.d(t,"calculateAndFormatEvolution",(function(){return ue})),o.d(t,"DropdownMenu",(function(){return Ue})),o.d(t,"FocusAnywhereButHere",(function(){return Je})),o.d(t,"FocusIf",(function(){return Qe})),o.d(t,"Tooltips",(function(){return tt})),o.d(t,"MatomoDialog",(function(){return at})),o.d(t,"ExpandOnClick",(function(){return ht})),o.d(t,"ExpandOnHover",(function(){return jt})),o.d(t,"ShowSensitiveData",(function(){return wt})),o.d(t,"DropdownButton",(function(){return kt})),o.d(t,"SelectOnFocus",(function(){return Tt})),o.d(t,"CopyToClipboard",(function(){return xt})),o.d(t,"SideNav",(function(){return Bt})),o.d(t,"EnrichedHeadline",(function(){return Kt})),o.d(t,"ContentBlock",(function(){return so})),o.d(t,"Comparisons",(function(){return To})),o.d(t,"ComparisonsStore",(function(){return Eo})),o.d(t,"ComparisonsStoreInstance",(function(){return Do})),o.d(t,"MenuItemsDropdown",(function(){return $o})),o.d(t,"DatePicker",(function(){return Yo})),o.d(t,"DateRangePicker",(function(){return ti})),o.d(t,"PeriodDatePicker",(function(){return ri})),o.d(t,"Notification",(function(){return bi})),o.d(t,"NotificationGroup",(function(){return Ei})),o.d(t,"NotificationsStore",(function(){return ki})),o.d(t,"ShowHelpLink",(function(){return xi})),o.d(t,"SitesStore",(function(){return Mi})),o.d(t,"SiteSelector",(function(){return on})),o.d(t,"QuickAccess",(function(){return jn})),o.d(t,"FieldArray",(function(){return Dn})),o.d(t,"MultiPairField",(function(){return Ln})),o.d(t,"PeriodSelector",(function(){return fa})),o.d(t,"ReportingMenu",(function(){return Za})),o.d(t,"ReportingMenuStore",(function(){return za})),o.d(t,"ReportingPagesStore",(function(){return _a})),o.d(t,"ReportMetadataStore",(function(){return or})),o.d(t,"WidgetsStore",(function(){return Ka})),o.d(t,"WidgetLoader",(function(){return hr})),o.d(t,"WidgetContainer",(function(){return Or})),o.d(t,"WidgetByDimensionContainer",(function(){return Tr})),o.d(t,"Widget",(function(){return Lr})),o.d(t,"ReportingPage",(function(){return Jr})),o.d(t,"ReportExport",(function(){return js})),o.d(t,"Sparkline",(function(){return ks})),o.d(t,"Progressbar",(function(){return Vs})),o.d(t,"ContentIntro",(function(){return Ns})),o.d(t,"ContentTable",(function(){return xs})),o.d(t,"AjaxForm",(function(){return Fs})),o.d(t,"Passthrough",(function(){return Rs})),o.d(t,"DataTableActions",(function(){return Rl})),o.d(t,"VersionInfoHeaderMessage",(function(){return Zl})),o.d(t,"MobileLeftMenu",(function(){return lc})),o.d(t,"scrollToAnchorInUrl",(function(){return bc})),o.d(t,"SearchFiltersPersistenceStore",(function(){return mr})),o.d(t,"AutoClearPassword",(function(){return Oc})),o.d(t,"PasswordStrength",(function(){return Sc})),o.d(t,"EntityDuplicatorModal",(function(){return Uc})),o.d(t,"EntityDuplicatorAction",(function(){return Gc})),o.d(t,"EntityDuplicatorStore",(function(){return Qc})),o.d(t,"BaseDuplicatorAdapter",(function(){return Jc})),"undefined"!==typeof window){var i=window.document.currentScript,n=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);n&&(o.p=n[1])}o("2342"); + */window.hasBlockedContent=!1},"8bbf":function(t,o){t.exports=e},fae3:function(e,t,o){"use strict";if(o.r(t),o.d(t,"createVueApp",(function(){return me})),o.d(t,"importPluginUmd",(function(){return fe})),o.d(t,"useExternalPluginComponent",(function(){return ve})),o.d(t,"DirectiveUtilities",(function(){return je})),o.d(t,"debounce",(function(){return we})),o.d(t,"clone",(function(){return Se})),o.d(t,"VueEntryContainer",(function(){return De})),o.d(t,"ActivityIndicator",(function(){return _e})),o.d(t,"MatomoLoader",(function(){return Fe})),o.d(t,"translate",(function(){return a})),o.d(t,"translateOrDefault",(function(){return r})),o.d(t,"externalRawLink",(function(){return ae})),o.d(t,"externalLink",(function(){return re})),o.d(t,"Alert",(function(){return $e})),o.d(t,"AjaxHelper",(function(){return K})),o.d(t,"setCookie",(function(){return U})),o.d(t,"getCookie",(function(){return q})),o.d(t,"deleteCookie",(function(){return W})),o.d(t,"MatomoUrl",(function(){return H})),o.d(t,"Matomo",(function(){return I})),o.d(t,"Periods",(function(){return c})),o.d(t,"Day",(function(){return f})),o.d(t,"Week",(function(){return O})),o.d(t,"Month",(function(){return y})),o.d(t,"Year",(function(){return S})),o.d(t,"Range",(function(){return C})),o.d(t,"format",(function(){return d})),o.d(t,"getToday",(function(){return u})),o.d(t,"parseDate",(function(){return m})),o.d(t,"todayIsInRange",(function(){return p})),o.d(t,"getWeekNumber",(function(){return h})),o.d(t,"datesAreInTheSamePeriod",(function(){return g})),o.d(t,"NumberFormatter",(function(){return ee})),o.d(t,"formatNumber",(function(){return se})),o.d(t,"formatPercent",(function(){return le})),o.d(t,"formatCurrency",(function(){return ce})),o.d(t,"formatEvolution",(function(){return de})),o.d(t,"calculateAndFormatEvolution",(function(){return ue})),o.d(t,"DropdownMenu",(function(){return Ue})),o.d(t,"FocusAnywhereButHere",(function(){return Je})),o.d(t,"FocusIf",(function(){return Qe})),o.d(t,"Tooltips",(function(){return tt})),o.d(t,"MatomoDialog",(function(){return at})),o.d(t,"ExpandOnClick",(function(){return ht})),o.d(t,"ExpandOnHover",(function(){return jt})),o.d(t,"ShowSensitiveData",(function(){return wt})),o.d(t,"DropdownButton",(function(){return kt})),o.d(t,"SelectOnFocus",(function(){return Tt})),o.d(t,"CopyToClipboard",(function(){return xt})),o.d(t,"SideNav",(function(){return Bt})),o.d(t,"EnrichedHeadline",(function(){return Kt})),o.d(t,"ContentBlock",(function(){return so})),o.d(t,"Comparisons",(function(){return To})),o.d(t,"ComparisonsStore",(function(){return Eo})),o.d(t,"ComparisonsStoreInstance",(function(){return Do})),o.d(t,"MenuItemsDropdown",(function(){return $o})),o.d(t,"DatePicker",(function(){return Yo})),o.d(t,"DateRangePicker",(function(){return ti})),o.d(t,"PeriodDatePicker",(function(){return ri})),o.d(t,"Notification",(function(){return bi})),o.d(t,"NotificationGroup",(function(){return Ei})),o.d(t,"NotificationsStore",(function(){return ki})),o.d(t,"ShowHelpLink",(function(){return xi})),o.d(t,"SitesStore",(function(){return Mi})),o.d(t,"SiteSelector",(function(){return on})),o.d(t,"QuickAccess",(function(){return jn})),o.d(t,"FieldArray",(function(){return Dn})),o.d(t,"MultiPairField",(function(){return Ln})),o.d(t,"PeriodSelector",(function(){return fa})),o.d(t,"ReportingMenu",(function(){return Za})),o.d(t,"ReportingMenuStore",(function(){return za})),o.d(t,"ReportingPagesStore",(function(){return _a})),o.d(t,"ReportMetadataStore",(function(){return or})),o.d(t,"WidgetsStore",(function(){return Ka})),o.d(t,"WidgetLoader",(function(){return hr})),o.d(t,"WidgetContainer",(function(){return Or})),o.d(t,"WidgetByDimensionContainer",(function(){return Tr})),o.d(t,"Widget",(function(){return Lr})),o.d(t,"ReportingPage",(function(){return Jr})),o.d(t,"ReportExport",(function(){return js})),o.d(t,"Sparkline",(function(){return ks})),o.d(t,"Progressbar",(function(){return Vs})),o.d(t,"ContentIntro",(function(){return Ns})),o.d(t,"ContentTable",(function(){return xs})),o.d(t,"AjaxForm",(function(){return Fs})),o.d(t,"Passthrough",(function(){return Rs})),o.d(t,"DataTableActions",(function(){return Rl})),o.d(t,"VersionInfoHeaderMessage",(function(){return Zl})),o.d(t,"MobileLeftMenu",(function(){return lc})),o.d(t,"scrollToAnchorInUrl",(function(){return bc})),o.d(t,"SearchFiltersPersistenceStore",(function(){return mr})),o.d(t,"AutoClearPassword",(function(){return Oc})),o.d(t,"PasswordStrength",(function(){return Sc})),o.d(t,"EntityDuplicatorModal",(function(){return Uc})),o.d(t,"EntityDuplicatorAction",(function(){return Gc})),o.d(t,"EntityDuplicatorStore",(function(){return Qc})),o.d(t,"BaseDuplicatorAdapter",(function(){return Jc})),"undefined"!==typeof window){var i=window.document.currentScript,n=i&&i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);n&&(o.p=n[1])}o("2342"); /*! * Matomo - free/libre analytics platform * @@ -71,32 +71,32 @@ function a(e,...t){if(!e)return"";let o=t;return 1===t.length&&t[0]&&Array.isArr * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */const{piwik:L,broadcast:F}=window;function A(e,t){try{return c.parse(e,t),!0}catch(o){return!1}}class _{constructor(){M(this,"url",Object(E["ref"])(null)),M(this,"urlQuery",Object(E["computed"])(()=>this.url.value?this.url.value.search.replace(/^\?/,""):"")),M(this,"hashQuery",Object(E["computed"])(()=>this.url.value?this.url.value.hash.replace(/^[#/?]+/,""):"")),M(this,"urlParsed",Object(E["computed"])(()=>Object(E["readonly"])(this.parse(this.urlQuery.value)))),M(this,"hashParsed",Object(E["computed"])(()=>Object(E["readonly"])(this.parse(this.hashQuery.value)))),M(this,"parsed",Object(E["computed"])(()=>Object(E["readonly"])(Object.assign(Object.assign({},this.urlParsed.value),this.hashParsed.value)))),this.url.value=new URL(window.location.href),window.addEventListener("hashchange",e=>{this.url.value=new URL(e.newURL),this.updatePeriodParamsFromUrl(),this.updatePageTitle()}),this.updatePeriodParamsFromUrl(),this.updatePageTitle()}updateHashToUrl(e){const t="#"+e;window.location.hash===t?window.dispatchEvent(new HashChangeEvent("hashchange",{newURL:window.location.href,oldURL:window.location.href})):window.location.hash=t}updateHash(e){const t=this.getFinalHashParams(e),o=this.stringify(t);this.updateHashToUrl("?"+o)}updateUrl(e,t={}){const o="string"!==typeof e?this.stringify(e):e,i=Object.keys(t).length?this.getFinalHashParams(t,e):{},n=this.stringify(i);let a="?"+o;n.length&&(a=`${a}#?${n}`),window.broadcast.propagateNewPage("",void 0,void 0,void 0,a)}getFinalHashParams(e,t={}){const o="string"!==typeof e?e:this.parse(e),i="string"!==typeof e?t:this.parse(t);return Object.assign({period:i.period||this.parsed.value.period,date:i.date||this.parsed.value.date,segment:i.segment||this.parsed.value.segment},o)}updateLocation(e){I.helper.isReportingPage()?this.updateHash(e):this.updateUrl(e)}getSearchParam(e){const t=window.location.href.split("#"),o=new RegExp(e+"(\\[]|=)");if(t&&t[1]&&o.test(decodeURIComponent(t[1]))){const t=window.broadcast.getValueFromHash(e,window.location.href);if(t||"date"!==e&&"period"!==e&&"idSite"!==e)return t}return window.broadcast.getValueFromUrl(e,window.location.search)}parse(e){return F.getValuesFromUrl("?"+e,!0)}stringify(e){const t=Object.fromEntries(Object.entries(e).filter(([,e])=>""!==e&&null!==e&&void 0!==e));return $.param(t).replace(/%5B%5D/g,"[]").replace(/%2C/g,",").replace(/\+/g,"%20")}getMenuPathSuffix(){const e=this.getSearchParam("category"),t=this.getSearchParam("subcategory");return{category:decodeURIComponent(e),subcategory:decodeURIComponent(t)}}getDateAndPeriodFromUrl(){return{date:this.getSearchParam("date")||"",period:this.getSearchParam("period")||""}}updatePageTitle(){const{period:e,date:t}=this.getDateAndPeriodFromUrl(),{category:o,subcategory:i}=this.getMenuPathSuffix(),n=this.getSearchParam("segment")||"";L.updateTitle(t,e,o,i,n)}updatePeriodParamsFromUrl(){const{period:e,date:t}=this.getDateAndPeriodFromUrl();let o=t;if(!A(e,o))return;if(L.period===e&&L.currentDateString===o)return;L.period=e;const i=c.parse(e,o).getDateRange();L.startDateString=d(i[0]),L.endDateString=d(i[1]),"range"===L.period&&(o=`${L.startDateString},${L.endDateString}`),L.currentDateString=o}}const R=new _;var H=R;function U(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */const{piwik:L,broadcast:F}=window;function A(e,t){try{return c.parse(e,t),!0}catch(o){return!1}}class _{constructor(){M(this,"url",Object(E["ref"])(null)),M(this,"urlQuery",Object(E["computed"])(()=>this.url.value?this.url.value.search.replace(/^\?/,""):"")),M(this,"hashQuery",Object(E["computed"])(()=>this.url.value?this.url.value.hash.replace(/^[#/?]+/,""):"")),M(this,"urlParsed",Object(E["computed"])(()=>Object(E["readonly"])(this.parse(this.urlQuery.value)))),M(this,"hashParsed",Object(E["computed"])(()=>Object(E["readonly"])(this.parse(this.hashQuery.value)))),M(this,"parsed",Object(E["computed"])(()=>Object(E["readonly"])(Object.assign(Object.assign({},this.urlParsed.value),this.hashParsed.value)))),this.url.value=new URL(window.location.href),window.addEventListener("hashchange",e=>{this.url.value=new URL(e.newURL),this.updatePeriodParamsFromUrl(),this.updatePageTitle()}),this.updatePeriodParamsFromUrl(),this.updatePageTitle()}updateHashToUrl(e){const t="#"+e;window.location.hash===t?window.dispatchEvent(new HashChangeEvent("hashchange",{newURL:window.location.href,oldURL:window.location.href})):window.location.hash=t}updateHash(e){const t=this.getFinalHashParams(e),o=this.stringify(t);this.updateHashToUrl("?"+o)}updateUrl(e,t={}){const o="string"!==typeof e?this.stringify(e):e,i=Object.keys(t).length?this.getFinalHashParams(t,e):{},n=this.stringify(i);let a="?"+o;n.length&&(a=`${a}#?${n}`),window.broadcast.propagateNewPage("",void 0,void 0,void 0,a)}getFinalHashParams(e,t={}){const o="string"!==typeof e?e:this.parse(e),i="string"!==typeof e?t:this.parse(t);return Object.assign({period:i.period||this.parsed.value.period,date:i.date||this.parsed.value.date,segment:i.segment||this.parsed.value.segment},o)}updateLocation(e){I.helper.isReportingPage()?this.updateHash(e):this.updateUrl(e)}getSearchParam(e){const t=window.location.href.split("#"),o=new RegExp(e+"(\\[]|=)");if(t&&t[1]&&o.test(decodeURIComponent(t[1]))){const t=window.broadcast.getValueFromHash(e,window.location.href);if(t||"date"!==e&&"period"!==e&&"idSite"!==e)return t}return window.broadcast.getValueFromUrl(e,window.location.search)}parse(e){return F.getValuesFromUrl("?"+e,!0)}stringify(e){const t=Object.fromEntries(Object.entries(e).filter(([,e])=>""!==e&&null!==e&&void 0!==e));return $.param(t).replace(/%5B%5D/g,"[]").replace(/%2C/g,",").replace(/\+/g,"%20")}getMenuPathSuffix(){const e=this.getSearchParam("category"),t=this.getSearchParam("subcategory");return{category:decodeURIComponent(e),subcategory:decodeURIComponent(t)}}getDateAndPeriodFromUrl(){return{date:this.getSearchParam("date")||"",period:this.getSearchParam("period")||""}}updatePageTitle(){const{period:e,date:t}=this.getDateAndPeriodFromUrl(),{category:o,subcategory:i}=this.getMenuPathSuffix(),n=this.getSearchParam("segment")||"";L.updateTitle(t,e,o,i,n)}updatePeriodParamsFromUrl(){const{period:e,date:t}=this.getDateAndPeriodFromUrl();let o=t;if(!A(e,o))return;if(L.period===e&&L.currentDateString===o)return;L.period=e;const i=c.parse(e,o).getDateRange();L.startDateString=d(i[0]),L.endDateString=d(i[1]),"range"===L.period&&(o=`${L.startDateString},${L.endDateString}`),L.currentDateString=o}}const R=new _;var H=R;function U(e,t,o){const i=new Date;o||(o=432e4),i.setTime(i.getTime()+o),document.cookie=`${e}=${t}; expires=${i.toUTCString()}; path=/`}function q(e){const t="; "+document.cookie,o=t.split(`; ${e}=`);if(2==o.length){const e=o.pop().split(";").shift();if("undefined"!==typeof e)return e}return null}function W(e){const t=new Date;t.setTime(t.getTime()+-864e5),document.cookie=`${e}=; expires=${t.toUTCString()}; path=/`}function z(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */L.updatePeriodParamsFromUrl=R.updatePeriodParamsFromUrl.bind(R);const{$:q}=window;function W(e,t){"abort"!==t&&e&&0!==e.status&&("undefined"!==typeof Piwik_Popover?Piwik_Popover.isOpen()&&e&&500===e.status?q(document.body).html(piwikHelper.escape(e.responseText)):q("#loadingError").show():console.log("Request failed: "+e.responseText))}window.globalAjaxQueue=[],window.globalAjaxQueue.active=0,window.globalAjaxQueue.clean=function(){for(let e=this.length;e>=0;e-=1)this[e]&&4!==this[e].readyState||this.splice(e,1)},window.globalAjaxQueue.push=function(...e){return this.active+=e.length,this.clean(),Array.prototype.push.call(this,...e)},window.globalAjaxQueue.abort=function(){this.forEach(e=>e&&e.abort&&e.abort()),this.splice(0,this.length),this.active=0};class z extends Error{}class G{static fetch(e,t={}){const o=new G;t.withTokenInUrl&&o.withTokenInUrl(),t.errorElement&&o.setErrorElement(t.errorElement),t.redirectOnSuccess&&o.redirectOnSuccess(!0!==t.redirectOnSuccess?t.redirectOnSuccess:void 0),o.setFormat(t.format||"json"),Array.isArray(e)?o.setBulkRequests(...e):(Object.keys(e).forEach(e=>{if(/password/i.test(e))throw new Error(`Password parameters are not allowed to be sent as GET parameter. Please send ${e} as POST parameter instead.`)}),o.addParams(Object.assign(Object.assign({module:"API",format:t.format||"json"},e),{},{segment:e.segment?encodeURIComponent(e.segment):void 0}),"get")),t.postParams&&o.addParams(t.postParams,"post"),t.headers&&(o.headers=Object.assign(Object.assign({},o.headers),t.headers));let i=!0;return"undefined"===typeof t.createErrorNotification||t.createErrorNotification||(o.useCallbackInCaseOfError(),o.setErrorCallback(null),i=!1),t.abortController&&(o.abortController=t.abortController),t.returnResponseObject&&(o.resolveWithHelper=!0),!1===t.abortable&&(o.abortable=!1),o.send().then(e=>{const t=e instanceof G?e.requestHandle.responseJSON:e,i="API.getBulkRequest"===o.postParams.method&&Array.isArray(t)?t:[t],n=i.filter(e=>"error"===e.result).map(e=>e.message);if(n.length)throw new z(n.filter(e=>e.length).join("\n"));return e}).catch(e=>{if(i||e instanceof z)throw e;let t="Something went wrong";throw 504===e.status&&(t="Request was possibly aborted"),429===e.status&&(t="Rate Limit was exceed"),new Error(t)})}static post(e,t={},o={}){return G.fetch(e,Object.assign(Object.assign({},o),{},{postParams:t}))}static oneAtATime(e,t){let o=null;return(i,n)=>(o&&o.abort(),o=new AbortController,G.post(Object.assign(Object.assign({},i),{},{method:e}),n,Object.assign(Object.assign({},t),{},{abortController:o})).finally(()=>{o=null}))}constructor(){U(this,"format","json"),U(this,"timeout",null),U(this,"callback",null),U(this,"useRegularCallbackInCaseOfError",!1),U(this,"errorCallback",void 0),U(this,"withToken",!1),U(this,"completeCallback",void 0),U(this,"getParams",{}),U(this,"getUrl","?"),U(this,"postParams",{}),U(this,"loadingElement",null),U(this,"errorElement","#ajaxError"),U(this,"headers",{"X-Requested-With":"XMLHttpRequest"}),U(this,"requestHandle",null),U(this,"abortController",null),U(this,"abortable",!0),U(this,"defaultParams",["idSite","period","date","segment"]),U(this,"resolveWithHelper",!1),this.errorCallback=W}addParams(e,t){const o="string"===typeof e?window.broadcast.getValuesFromUrl(e):e,i=["compareSegments","comparePeriods","compareDates"];Object.keys(o).forEach(e=>{let n=o[e];(-1===i.indexOf(e)||n)&&("boolean"===typeof n&&(n=n?1:0),"get"===t.toLowerCase()?this.getParams[e]=n:"post"===t.toLowerCase()&&(this.postParams[e]=n))})}withTokenInUrl(){this.withToken=!0}setUrl(e){this.addParams(broadcast.getValuesFromUrl(e),"GET")}setBulkRequests(...e){const t=e.map(e=>"string"===typeof e?e:q.param(e));this.addParams({module:"API",method:"API.getBulkRequest",urls:t,format:"json"},"post")}setTimeout(e){this.timeout=e}setCallback(e){this.callback=e}useCallbackInCaseOfError(){this.useRegularCallbackInCaseOfError=!0}redirectOnSuccess(e){this.setCallback(()=>{piwikHelper.redirect(e)})}setErrorCallback(e){this.errorCallback=e}setCompleteCallback(e){this.completeCallback=e}setFormat(e){this.format=e}setLoadingElement(e){this.loadingElement=e||"#ajaxLoadingDiv"}setErrorElement(e){e&&(this.errorElement=e)}useGETDefaultParameter(e){if(e&&this.defaultParams)for(let t=0;t{this.requestHandle&&this.requestHandle.abort()});const e=new Promise((e,t)=>{this.requestHandle.then(t=>{this.resolveWithHelper?e(this):e(t)}).fail(e=>{if(429===e.status)return console.log(`Warning: the '${q.param(this.getParams)}' request was rate limited!`),void t(e);if("abort"===e.statusText||0===e.status)return;const o=!document.querySelector("#login_form");401===e.status&&o?I.helper.refreshAfter(0):(console.log(`Warning: the ${q.param(this.getParams)} request failed!`),t(e))})});return e}abort(){this.requestHandle&&"function"===typeof this.requestHandle.abort&&(this.requestHandle.abort(),this.requestHandle=null)}buildAjaxCall(){const e=this,t=this.mixinDefaultGetParams(this.getParams);let o=this.getUrl;"?"!==o[o.length-1]&&(o+="&"),t.segment&&(o=`${o}segment=${t.segment}&`,delete t.segment),t.date&&(o=`${o}date=${decodeURIComponent(t.date.toString())}&`,delete t.date),o+=q.param(t);const i={type:"POST",async:!0,url:o,dataType:this.format||"json",complete:this.completeCallback,headers:this.headers?this.headers:void 0,error:function(...t){e.abortable&&(window.globalAjaxQueue.active-=1),e.errorCallback&&e.errorCallback.apply(this,t)},success:(t,o,i)=>{this.loadingElement&&q(this.loadingElement).hide();const n="API.getBulkRequest"===this.postParams.method&&Array.isArray(t)?t:[t],a=n.filter(e=>"error"===e.result).map(e=>e.message).filter(e=>e.length).reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{});if(a&&Object.keys(a).length&&!this.useRegularCallbackInCaseOfError){let e="";Object.keys(a).forEach(t=>{e.length&&(e+="
"),a[t]>1?e+=`${t} (${a[t]}x)`:e+=t});let t=null,o="toast";q(this.errorElement).length&&e.length&&(q(this.errorElement).show(),t=this.errorElement,o=null);const i=!document.querySelector("#login_form");if(e&&i){const i=window["require"]("piwik/UI"),n=new i.Notification;n.show(e,{placeat:t,context:"error",type:o,id:"ajaxHelper"}),n.scrollToNotification()}}else this.callback&&this.callback(t,o,i);e.abortable&&(window.globalAjaxQueue.active-=1),I.ajaxRequestFinished&&I.ajaxRequestFinished()},data:this.mixinDefaultPostParams(this.postParams),timeout:null!==this.timeout?this.timeout:void 0};return q.ajax(i)}isRequestToApiMethod(){return this.getParams&&"API"===this.getParams.module&&this.getParams.method||this.postParams&&"API"===this.postParams.module&&this.postParams.method}isWidgetizedRequest(){return"Widgetize"===broadcast.getValueFromUrl("module")}getDefaultPostParams(){return this.withToken||this.isRequestToApiMethod()||I.shouldPropagateTokenAuth?{token_auth:I.token_auth,force_api_session:broadcast.isWidgetizeRequestWithoutSession()?0:1}:{}}mixinDefaultPostParams(e){const t=this.getDefaultPostParams(),o=Object.assign(Object.assign({},t),e);return o}mixinDefaultGetParams(e){const t=H.getSearchParam("segment"),o={idSite:I.idSite?I.idSite.toString():broadcast.getValueFromUrl("idSite"),period:I.period||broadcast.getValueFromUrl("period"),segment:t},i=e;return i.token_auth&&(i.token_auth=null,delete i.token_auth),Object.keys(o).forEach(e=>{!this.useGETDefaultParameter(e)||null!==i[e]&&"undefined"!==typeof i[e]&&""!==i[e]||null!==this.postParams[e]&&"undefined"!==typeof this.postParams[e]&&""!==this.postParams[e]||!o[e]||(i[e]=o[e])}),!this.useGETDefaultParameter("date")||i.date||this.postParams.date||(i.date=I.currentDateString),i}getRequestHandle(){return this.requestHandle}}function Y(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */L.updatePeriodParamsFromUrl=R.updatePeriodParamsFromUrl.bind(R);const{$:G}=window;function Y(e,t){"abort"!==t&&e&&0!==e.status&&("undefined"!==typeof Piwik_Popover?Piwik_Popover.isOpen()&&e&&500===e.status?G(document.body).html(piwikHelper.escape(e.responseText)):G("#loadingError").show():console.log("Request failed: "+e.responseText))}window.globalAjaxQueue=[],window.globalAjaxQueue.active=0,window.globalAjaxQueue.clean=function(){for(let e=this.length;e>=0;e-=1)this[e]&&4!==this[e].readyState||this.splice(e,1)},window.globalAjaxQueue.push=function(...e){return this.active+=e.length,this.clean(),Array.prototype.push.call(this,...e)},window.globalAjaxQueue.abort=function(){this.forEach(e=>e&&e.abort&&e.abort()),this.splice(0,this.length),this.active=0};class J extends Error{}class K{static fetch(e,t={}){const o=new K;t.withTokenInUrl&&o.withTokenInUrl(),t.errorElement&&o.setErrorElement(t.errorElement),t.redirectOnSuccess&&o.redirectOnSuccess(!0!==t.redirectOnSuccess?t.redirectOnSuccess:void 0),o.setFormat(t.format||"json"),Array.isArray(e)?o.setBulkRequests(...e):(Object.keys(e).forEach(e=>{if(/password/i.test(e))throw new Error(`Password parameters are not allowed to be sent as GET parameter. Please send ${e} as POST parameter instead.`)}),o.addParams(Object.assign(Object.assign({module:"API",format:t.format||"json"},e),{},{segment:e.segment?encodeURIComponent(e.segment):void 0}),"get")),t.postParams&&o.addParams(t.postParams,"post"),t.headers&&(o.headers=Object.assign(Object.assign({},o.headers),t.headers));let i=!0;return"undefined"===typeof t.createErrorNotification||t.createErrorNotification||(o.useCallbackInCaseOfError(),o.setErrorCallback(null),i=!1),t.abortController&&(o.abortController=t.abortController),t.returnResponseObject&&(o.resolveWithHelper=!0),!1===t.abortable&&(o.abortable=!1),o.send().then(e=>{const t=e instanceof K?e.requestHandle.responseJSON:e,i="API.getBulkRequest"===o.postParams.method&&Array.isArray(t)?t:[t],n=i.filter(e=>"error"===e.result).map(e=>e.message);if(n.length)throw new J(n.filter(e=>e.length).join("\n"));return e}).catch(e=>{if(i||e instanceof J)throw e;let t="Something went wrong";throw 504===e.status&&(t="Request was possibly aborted"),429===e.status&&(t="Rate Limit was exceed"),new Error(t)})}static post(e,t={},o={}){return K.fetch(e,Object.assign(Object.assign({},o),{},{postParams:t}))}static oneAtATime(e,t){let o=null;return(i,n)=>(o&&o.abort(),o=new AbortController,K.post(Object.assign(Object.assign({},i),{},{method:e}),n,Object.assign(Object.assign({},t),{},{abortController:o})).finally(()=>{o=null}))}constructor(){z(this,"format","json"),z(this,"timeout",null),z(this,"callback",null),z(this,"useRegularCallbackInCaseOfError",!1),z(this,"errorCallback",void 0),z(this,"withToken",!1),z(this,"completeCallback",void 0),z(this,"getParams",{}),z(this,"getUrl","?"),z(this,"postParams",{}),z(this,"loadingElement",null),z(this,"errorElement","#ajaxError"),z(this,"headers",{"X-Requested-With":"XMLHttpRequest"}),z(this,"requestHandle",null),z(this,"abortController",null),z(this,"abortable",!0),z(this,"defaultParams",["idSite","period","date","segment"]),z(this,"resolveWithHelper",!1),this.errorCallback=Y}addParams(e,t){const o="string"===typeof e?window.broadcast.getValuesFromUrl(e):e,i=["compareSegments","comparePeriods","compareDates"];Object.keys(o).forEach(e=>{let n=o[e];(-1===i.indexOf(e)||n)&&("boolean"===typeof n&&(n=n?1:0),"get"===t.toLowerCase()?this.getParams[e]=n:"post"===t.toLowerCase()&&(this.postParams[e]=n))})}withTokenInUrl(){this.withToken=!0}setUrl(e){this.addParams(broadcast.getValuesFromUrl(e),"GET")}setBulkRequests(...e){const t=e.map(e=>"string"===typeof e?e:G.param(e));this.addParams({module:"API",method:"API.getBulkRequest",urls:t,format:"json"},"post")}setTimeout(e){this.timeout=e}setCallback(e){this.callback=e}useCallbackInCaseOfError(){this.useRegularCallbackInCaseOfError=!0}redirectOnSuccess(e){this.setCallback(()=>{piwikHelper.redirect(e)})}setErrorCallback(e){this.errorCallback=e}setCompleteCallback(e){this.completeCallback=e}setFormat(e){this.format=e}setLoadingElement(e){this.loadingElement=e||"#ajaxLoadingDiv"}setErrorElement(e){e&&(this.errorElement=e)}useGETDefaultParameter(e){if(e&&this.defaultParams)for(let t=0;t{this.requestHandle&&this.requestHandle.abort()});const e=new Promise((e,t)=>{this.requestHandle.then(t=>{this.resolveWithHelper?e(this):e(t)}).fail(e=>{if(429===e.status)return console.log(`Warning: the '${G.param(this.getParams)}' request was rate limited!`),void t(e);if("abort"===e.statusText||0===e.status)return;const o=!document.querySelector("#login_form"),i="1"===e.getResponseHeader("X-Matomo-Session-Timed-Out");if(i&&o)return U("matomo_session_timed_out","1",6e4),void I.helper.refreshAfter(0);console.log(`Warning: the ${G.param(this.getParams)} request failed!`),t(e)})});return e}abort(){this.requestHandle&&"function"===typeof this.requestHandle.abort&&(this.requestHandle.abort(),this.requestHandle=null)}buildAjaxCall(){const e=this,t=this.mixinDefaultGetParams(this.getParams);let o=this.getUrl;"?"!==o[o.length-1]&&(o+="&"),t.segment&&(o=`${o}segment=${t.segment}&`,delete t.segment),t.date&&(o=`${o}date=${decodeURIComponent(t.date.toString())}&`,delete t.date),o+=G.param(t);const i={type:"POST",async:!0,url:o,dataType:this.format||"json",complete:this.completeCallback,headers:this.headers?this.headers:void 0,error:function(...t){e.abortable&&(window.globalAjaxQueue.active-=1),e.errorCallback&&e.errorCallback.apply(this,t)},success:(t,o,i)=>{this.loadingElement&&G(this.loadingElement).hide();const n="API.getBulkRequest"===this.postParams.method&&Array.isArray(t)?t:[t],a=n.filter(e=>"error"===e.result).map(e=>e.message).filter(e=>e.length).reduce((e,t)=>(e[t]=(e[t]||0)+1,e),{});if(a&&Object.keys(a).length&&!this.useRegularCallbackInCaseOfError){let e="";Object.keys(a).forEach(t=>{e.length&&(e+="
"),a[t]>1?e+=`${t} (${a[t]}x)`:e+=t});let t=null,o="toast";G(this.errorElement).length&&e.length&&(G(this.errorElement).show(),t=this.errorElement,o=null);const i=!document.querySelector("#login_form");if(e&&i){const i=window["require"]("piwik/UI"),n=new i.Notification;n.show(e,{placeat:t,context:"error",type:o,id:"ajaxHelper"}),n.scrollToNotification()}}else this.callback&&this.callback(t,o,i);e.abortable&&(window.globalAjaxQueue.active-=1),I.ajaxRequestFinished&&I.ajaxRequestFinished()},data:this.mixinDefaultPostParams(this.postParams),timeout:null!==this.timeout?this.timeout:void 0};return G.ajax(i)}isRequestToApiMethod(){return this.getParams&&"API"===this.getParams.module&&this.getParams.method||this.postParams&&"API"===this.postParams.module&&this.postParams.method}isWidgetizedRequest(){return"Widgetize"===broadcast.getValueFromUrl("module")}getDefaultPostParams(){return this.withToken||this.isRequestToApiMethod()||I.shouldPropagateTokenAuth?{token_auth:I.token_auth,force_api_session:broadcast.isWidgetizeRequestWithoutSession()?0:1}:{}}mixinDefaultPostParams(e){const t=this.getDefaultPostParams(),o=Object.assign(Object.assign({},t),e);return o}mixinDefaultGetParams(e){const t=H.getSearchParam("segment"),o={idSite:I.idSite?I.idSite.toString():broadcast.getValueFromUrl("idSite"),period:I.period||broadcast.getValueFromUrl("period"),segment:t},i=e;return i.token_auth&&(i.token_auth=null,delete i.token_auth),Object.keys(o).forEach(e=>{!this.useGETDefaultParameter(e)||null!==i[e]&&"undefined"!==typeof i[e]&&""!==i[e]||null!==this.postParams[e]&&"undefined"!==typeof this.postParams[e]&&""!==this.postParams[e]||!o[e]||(i[e]=o[e])}),!this.useGETDefaultParameter("date")||i.date||this.postParams.date||(i.date=I.currentDateString),i}getRequestHandle(){return this.requestHandle}}function Q(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */window.ajaxHelper=G;const{$:J}=window;class K{constructor(){Y(this,"defaultMinFractionDigits",0),Y(this,"defaultMaxFractionDigits",2)}format(e,t,o,i){if(!J.isNumeric(e))return String(e);let n=e,a=t||I.numbers.patternNumber;const r=a.split(";");1===r.length&&r.push("-"+r[0]);const s=n<0;if(a=s?r[1]:r[0],n=Math.abs(n),o>=0){const e=10**o;n=Math.round(n*e)/e}const l=n.toString().split(".");let c=l[0],d=l[1]||"";const u=-1!==a.indexOf(",");if(u){const e=a.match(/#+0/),t=(null===e||void 0===e?void 0:e[0].length)||0;let o=(null===e||void 0===e?void 0:e[0].length)||0;const i=a.split(",");i.length>2&&(o=i[1].length);const n=c.split("").reverse();let r=[];r.push(n.splice(0,t).reverse().join(""));while(n.length)r.push(n.splice(0,o).reverse().join(""));r=r.reverse(),c=r.join(",")}if(i>0&&(d=d.replace(/0+$/,""),d.length{let i=e;Object.entries(t).some(([e,t])=>-1!==i.indexOf(e)&&(i=i.replace(e,t),!0)),o+=i}),o}valOrDefault(e,t){return"undefined"===typeof e?t:e}getMaxFractionDigitsForCompactFormat(e){return 1===e?1:0}determineCorrectCompactPattern(e,t){let o=0,i=0,n="";if(Math.round(t)<1e3)return["0",1];for(o=1e3;o<=1e19;o*=10){const r=o+"One",s=o+"Other";if(1===Math.round(t/o)&&""!==(null===e||void 0===e?void 0:e[r])?(i=o,n=r):Math.round(t/o)>=1&&""!==(null===e||void 0===e?void 0:e[s])&&(i=o,n=s),null!==e&&void 0!==e&&e[n]){var a;const i=(null===e||void 0===e||null===(a=e[n].match(/0/g))||void 0===a?void 0:a.length)||1;if(Math.round(t*10**i/(10*o))<10**i)break}}return[(null===e||void 0===e?void 0:e[n])||"0",i]}formatCompact(e,t,o){var i;const n=(null===(i=e.match(/0/g))||void 0===i?void 0:i.length)||0;let a=t;n>1&&(a/=10**(n-1));const r=this.getMaxFractionDigitsForCompactFormat(n),s=10**r,l=Math.round(o/a*s)/s,c=this.formatNumber(l,r,0);return e.replace(/(0+)/,c).replace(/('\.')/,".")}parseFormattedNumber(e){const t=e.indexOf(I.numbers.symbolMinus)>-1||e.startsWith("-"),o=e.split(I.numbers.symbolDecimal);return o.forEach((e,t)=>{o[t]=e.replace(/[^0-9]/g,"")}),(t?-1:1)*parseFloat(o.join("."))}formatNumber(e,t,o){return this.format(e,I.numbers.patternNumber,this.valOrDefault(t,this.defaultMaxFractionDigits),this.valOrDefault(o,this.defaultMinFractionDigits))}formatPercent(e,t,o){return this.format(e,I.numbers.patternPercent,this.valOrDefault(t,this.defaultMaxFractionDigits),this.valOrDefault(o,this.defaultMinFractionDigits))}formatCurrency(e,t,o,i){const n=this.format(e,I.numbers.patternCurrency,this.valOrDefault(o,this.defaultMaxFractionDigits),this.valOrDefault(i,this.defaultMinFractionDigits));return n.replace("¤",t)}formatNumberCompact(e){const t=e,[o,i]=this.determineCorrectCompactPattern(I.numbers.patternsCompactNumber||[],t);return Math.round(t)<1e3||"0"===o?this.formatNumber(t,this.getMaxFractionDigitsForCompactFormat(Math.round(t)),0):this.formatCompact(o,i,t)}formatCurrencyCompact(e,t){const o=e,[i,n]=this.determineCorrectCompactPattern(I.numbers.patternsCompactCurrency||[],o);return Math.round(o)<1e3||"0"===i?this.formatCurrency(o,t,this.getMaxFractionDigitsForCompactFormat(Math.round(o)),0):this.formatCompact(i,n,o).replace("¤",t)}formatEvolution(e,t,o,i){if(i)return this.formatPercent(Math.abs(e),t,o);const n=this.formatPercent(e,t,o);return`${e>0?I.numbers.symbolPlus:""}${n}`}calculateAndFormatEvolution(e,t,o){const i=parseInt(t,10),n=parseInt(e,10)-i;let a;a=0===n||Number.isNaN(n)?0:0===i||Number.isNaN(i)?100:n/i*100;let r=3;return Math.abs(a)>100?r=0:Math.abs(a)>10?r=1:Math.abs(a)>1&&(r=2),this.formatEvolution(a,r,0,o)}}var Q=new K;window.NumberFormatter=Q; + */window.ajaxHelper=K;const{$:X}=window;class Z{constructor(){Q(this,"defaultMinFractionDigits",0),Q(this,"defaultMaxFractionDigits",2)}format(e,t,o,i){if(!X.isNumeric(e))return String(e);let n=e,a=t||I.numbers.patternNumber;const r=a.split(";");1===r.length&&r.push("-"+r[0]);const s=n<0;if(a=s?r[1]:r[0],n=Math.abs(n),o>=0){const e=10**o;n=Math.round(n*e)/e}const l=n.toString().split(".");let c=l[0],d=l[1]||"";const u=-1!==a.indexOf(",");if(u){const e=a.match(/#+0/),t=(null===e||void 0===e?void 0:e[0].length)||0;let o=(null===e||void 0===e?void 0:e[0].length)||0;const i=a.split(",");i.length>2&&(o=i[1].length);const n=c.split("").reverse();let r=[];r.push(n.splice(0,t).reverse().join(""));while(n.length)r.push(n.splice(0,o).reverse().join(""));r=r.reverse(),c=r.join(",")}if(i>0&&(d=d.replace(/0+$/,""),d.length{let i=e;Object.entries(t).some(([e,t])=>-1!==i.indexOf(e)&&(i=i.replace(e,t),!0)),o+=i}),o}valOrDefault(e,t){return"undefined"===typeof e?t:e}getMaxFractionDigitsForCompactFormat(e){return 1===e?1:0}determineCorrectCompactPattern(e,t){let o=0,i=0,n="";if(Math.round(t)<1e3)return["0",1];for(o=1e3;o<=1e19;o*=10){const r=o+"One",s=o+"Other";if(1===Math.round(t/o)&&""!==(null===e||void 0===e?void 0:e[r])?(i=o,n=r):Math.round(t/o)>=1&&""!==(null===e||void 0===e?void 0:e[s])&&(i=o,n=s),null!==e&&void 0!==e&&e[n]){var a;const i=(null===e||void 0===e||null===(a=e[n].match(/0/g))||void 0===a?void 0:a.length)||1;if(Math.round(t*10**i/(10*o))<10**i)break}}return[(null===e||void 0===e?void 0:e[n])||"0",i]}formatCompact(e,t,o){var i;const n=(null===(i=e.match(/0/g))||void 0===i?void 0:i.length)||0;let a=t;n>1&&(a/=10**(n-1));const r=this.getMaxFractionDigitsForCompactFormat(n),s=10**r,l=Math.round(o/a*s)/s,c=this.formatNumber(l,r,0);return e.replace(/(0+)/,c).replace(/('\.')/,".")}parseFormattedNumber(e){const t=e.indexOf(I.numbers.symbolMinus)>-1||e.startsWith("-"),o=e.split(I.numbers.symbolDecimal);return o.forEach((e,t)=>{o[t]=e.replace(/[^0-9]/g,"")}),(t?-1:1)*parseFloat(o.join("."))}formatNumber(e,t,o){return this.format(e,I.numbers.patternNumber,this.valOrDefault(t,this.defaultMaxFractionDigits),this.valOrDefault(o,this.defaultMinFractionDigits))}formatPercent(e,t,o){return this.format(e,I.numbers.patternPercent,this.valOrDefault(t,this.defaultMaxFractionDigits),this.valOrDefault(o,this.defaultMinFractionDigits))}formatCurrency(e,t,o,i){const n=this.format(e,I.numbers.patternCurrency,this.valOrDefault(o,this.defaultMaxFractionDigits),this.valOrDefault(i,this.defaultMinFractionDigits));return n.replace("¤",t)}formatNumberCompact(e){const t=e,[o,i]=this.determineCorrectCompactPattern(I.numbers.patternsCompactNumber||[],t);return Math.round(t)<1e3||"0"===o?this.formatNumber(t,this.getMaxFractionDigitsForCompactFormat(Math.round(t)),0):this.formatCompact(o,i,t)}formatCurrencyCompact(e,t){const o=e,[i,n]=this.determineCorrectCompactPattern(I.numbers.patternsCompactCurrency||[],o);return Math.round(o)<1e3||"0"===i?this.formatCurrency(o,t,this.getMaxFractionDigitsForCompactFormat(Math.round(o)),0):this.formatCompact(i,n,o).replace("¤",t)}formatEvolution(e,t,o,i){if(i)return this.formatPercent(Math.abs(e),t,o);const n=this.formatPercent(e,t,o);return`${e>0?I.numbers.symbolPlus:""}${n}`}calculateAndFormatEvolution(e,t,o){const i=parseInt(t,10),n=parseInt(e,10)-i;let a;a=0===n||Number.isNaN(n)?0:0===i||Number.isNaN(i)?100:n/i*100;let r=3;return Math.abs(a)>100?r=0:Math.abs(a)>10?r=1:Math.abs(a)>1&&(r=2),this.formatEvolution(a,r,0,o)}}var ee=new Z;window.NumberFormatter=ee; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -const{$:X}=window;class Z{constructor(){this.setup()}setup(){Object(E["watch"])(()=>H.parsed.value.popover,()=>this.onPopoverParamChanged()),H.parsed.value.popover&&this.onPopoverParamChangedInitial()}onPopoverParamChangedInitial(){X(()=>{setTimeout(()=>{this.openOrClose()})})}onPopoverParamChanged(){X(()=>{this.openOrClose()})}openOrClose(){this.close();const e=H.parsed.value.popover;e?this.open(e):window.broadcast.resetPopoverStack()}close(){window.Piwik_Popover.close()}open(e){let t=decodeURIComponent(e);t=t.replace(/\$/g,"%"),t=decodeURIComponent(t);const o=t.split(":"),i=o[0];o.shift();const n=o.join(":");"undefined"===typeof window.broadcast.popoverHandlers[i]||window.broadcast.isLoginPage()||window.broadcast.popoverHandlers[i](n)}}new Z;function ee(e,t,o){const i=new Date;o||(o=432e4),i.setTime(i.getTime()+o),document.cookie=`${e}=${t}; expires=${i.toUTCString()}; path=/`}function te(e){const t="; "+document.cookie,o=t.split(`; ${e}=`);if(2==o.length){const e=o.pop().split(";").shift();if("undefined"!==typeof e)return e}return null}function oe(e){const t=new Date;t.setTime(t.getTime()+-864e5),document.cookie=`${e}=; expires=${t.toUTCString()}; path=/`} +const{$:te}=window;class oe{constructor(){this.setup()}setup(){Object(E["watch"])(()=>H.parsed.value.popover,()=>this.onPopoverParamChanged()),H.parsed.value.popover&&this.onPopoverParamChangedInitial()}onPopoverParamChangedInitial(){te(()=>{setTimeout(()=>{this.openOrClose()})})}onPopoverParamChanged(){te(()=>{this.openOrClose()})}openOrClose(){this.close();const e=H.parsed.value.popover;e?this.open(e):window.broadcast.resetPopoverStack()}close(){window.Piwik_Popover.close()}open(e){let t=decodeURIComponent(e);t=t.replace(/\$/g,"%"),t=decodeURIComponent(t);const o=t.split(":"),i=o[0];o.shift();const n=o.join(":");"undefined"===typeof window.broadcast.popoverHandlers[i]||window.broadcast.isLoginPage()||window.broadcast.popoverHandlers[i](n)}}new oe; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */const{$:ie}=window;function ne(){let e=!!parseInt(te("zenMode"),10);const t=ie(".top_controls .icon-arrowup");function o(){e?(ie("body").addClass("zenMode"),t.addClass("icon-arrowdown").removeClass("icon-arrowup"),t.prop("title",a("CoreHome_ExitZenMode"))):(ie("body").removeClass("zenMode"),t.removeClass("icon-arrowdown").addClass("icon-arrowup"),t.prop("title",a("CoreHome_EnterZenMode")))}I.helper.registerShortcut("z",a("CoreHome_ShortcutZenMode"),t=>{t.altKey||(e=!e,ee("zenMode",e?"1":"0"),o())}),t.click(()=>{window.Mousetrap.trigger("z")}),o()} + */const{$:ie}=window;function ne(){let e=!!parseInt(q("zenMode"),10);const t=ie(".top_controls .icon-arrowup");function o(){e?(ie("body").addClass("zenMode"),t.addClass("icon-arrowdown").removeClass("icon-arrowup"),t.prop("title",a("CoreHome_ExitZenMode"))):(ie("body").removeClass("zenMode"),t.removeClass("icon-arrowdown").addClass("icon-arrowup"),t.prop("title",a("CoreHome_EnterZenMode")))}I.helper.registerShortcut("z",a("CoreHome_ShortcutZenMode"),t=>{t.altKey||(e=!e,U("zenMode",e?"1":"0"),o())}),t.click(()=>{window.Mousetrap.trigger("z")}),o()} /*! * Matomo - free/libre analytics platform * @@ -109,7 +109,7 @@ function ae(e,...t){const o=t;return window._pk_externalRawLink?window._pk_exter * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function se(e,t,o){return Q.formatNumber(e,t,o)}function le(e,t,o){return Q.formatPercent(e,t,o)}function ce(e,t,o,i){return Q.formatCurrency(e,t,o,i)}function de(e,t,o,i){return Q.formatEvolution(e,t,o,i)}function ue(e,t,o){return Q.calculateAndFormatEvolution(e,t,o)} + */function se(e,t,o){return ee.formatNumber(e,t,o)}function le(e,t,o){return ee.formatPercent(e,t,o)}function ce(e,t,o,i){return ee.formatCurrency(e,t,o,i)}function de(e,t,o,i){return ee.formatEvolution(e,t,o,i)}function ue(e,t,o){return ee.calculateAndFormatEvolution(e,t,o)} /*! * Matomo - free/libre analytics platform * @@ -224,7 +224,7 @@ function qe(e,t,o){const i=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMo * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */const So=8,ko=3;function Co(e){return e?Array.isArray(e)?e:[e]:[]}class Eo{constructor(){wo(this,"privateState",Object(E["reactive"])({comparisonsDisabledFor:[]})),wo(this,"state",Object(E["readonly"])(this.privateState)),wo(this,"colors",{}),wo(this,"segmentComparisons",Object(E["computed"])(()=>this.parseSegmentComparisons())),wo(this,"periodComparisons",Object(E["computed"])(()=>this.parsePeriodComparisons())),wo(this,"isEnabled",Object(E["computed"])(()=>this.checkEnabledForCurrentPage())),"complete"===document.readyState||"interactive"===document.readyState?this.loadComparisonsDisabledFor():document.addEventListener("DOMContentLoaded",()=>{this.loadComparisonsDisabledFor()}),$(()=>{this.colors=this.getAllSeriesColors()}),Object(E["watch"])(()=>this.getComparisons(),()=>I.postEvent("piwikComparisonsChanged"),{deep:!0})}getComparisons(){return this.getSegmentComparisons().concat(this.getPeriodComparisons())}isComparing(){return this.isComparisonEnabled()&&(this.segmentComparisons.value.length>1||this.periodComparisons.value.length>1)}isComparingPeriods(){return this.getPeriodComparisons().length>1}getSegmentComparisons(){return this.isComparisonEnabled()?this.segmentComparisons.value:[]}getPeriodComparisons(){return this.isComparisonEnabled()?this.periodComparisons.value:[]}getSeriesColor(e,t,o=0){const i=this.getComparisonSeriesIndex(t.index,e.index)%So;if(0===o)return this.colors["series"+i];const n=o%ko;return this.colors[`series${i}-shade${n}`]}getSeriesColorName(e,t){let o="series"+e%So;return t>0&&(o+="-shade"+t%ko),o}isComparisonEnabled(){return this.isEnabled.value}getIndividualComparisonRowIndices(e){const t=this.getSegmentComparisons().length,o=e%t,i=Math.floor(e/t);return{segmentIndex:o,periodIndex:i}}getComparisonSeriesIndex(e,t){const o=this.getSegmentComparisons().length;return e*o+t}getAllComparisonSeries(){const e=[];let t=0;return this.getPeriodComparisons().forEach(o=>{this.getSegmentComparisons().forEach(i=>{e.push({index:t,params:Object.assign(Object.assign({},i.params),o.params),color:this.colors["series"+t]}),t+=1})}),e}removeSegmentComparison(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");const t=[...this.segmentComparisons.value];t.splice(e,1);const o={};0===e&&(o.segment=t[0].params.segment),this.updateQueryParamsFromComparisons(t,this.periodComparisons.value,o)}removeSegmentComparisonByDefinition(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");let t=null;this.getSegmentComparisons().forEach((o,i)=>{o&&o.params&&o.params.segment===e&&(t=i)}),null!==t&&this.removeSegmentComparison(t)}addSegmentComparison(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");const t=this.segmentComparisons.value.concat([{params:e,index:-1,title:""}]);this.updateQueryParamsFromComparisons(t,this.periodComparisons.value)}updateQueryParamsFromComparisons(e,t,o={}){const i={},n={};let a=!1,r=!1;e.forEach(e=>{a?i[e.params.segment]=!0:a=!0}),t.forEach(e=>{r?n[`${e.params.period}|${e.params.date}`]=!0:r=!0});const s=[],l=[];Object.keys(n).forEach(e=>{const t=e.split("|");s.push(t[0]),l.push(t[1])});const c={compareSegments:Object.keys(i),comparePeriods:s,compareDates:l},d=I.helper.isReportingPage()?H.hashParsed.value:H.urlParsed.value;H.updateLocation(Object.assign(Object.assign(Object.assign({},d),c),o))}getAllSeriesColors(){const{ColorManager:e}=I;if(!e)return[];const t=[];for(let o=0;o{this.privateState.comparisonsDisabledFor=e})}parseSegmentComparisons(){const{availableSegments:e}=yo.state,t=[...Co(H.parsed.value.compareSegments)];t.unshift(H.parsed.value.segment||"");const o=[];return t.forEach((t,i)=>{let n;e.forEach(e=>{e.definition!==t&&e.definition!==decodeURIComponent(t)&&decodeURIComponent(e.definition)!==t||(n=e)});let r=n?n.name:a("General_Unknown");""===t.trim()&&(r=a("SegmentEditor_DefaultAllVisits")),o.push({params:{segment:t},title:I.helper.htmlDecode(r),index:i})}),o}parsePeriodComparisons(){const e=[...Co(H.parsed.value.comparePeriods)],t=[...Co(H.parsed.value.compareDates)];e.unshift(H.parsed.value.period),t.unshift(H.parsed.value.date);const o=[];for(let n=0;nDo.isComparing()&&!window.broadcast.isNoDataPage()),t=Object(E["computed"])(()=>Do.getSegmentComparisons()),o=Object(E["computed"])(()=>Do.getPeriodComparisons()),i=Do.getSeriesColor.bind(Do);function n(){const e=window.$(this).attr("title");return e?window.vueSanitize(e.replace(/\n/g,"
")):e}return{isComparing:e,segmentComparisons:t,periodComparisons:o,getSeriesColor:i,transformTooltipContent:n}},methods:{comparisonHasSegment(e){return"undefined"!==typeof e.params.segment},removeSegmentComparison(e){window.$(this.$refs.root).tooltip("destroy"),Do.removeSegmentComparison(e)},getComparisonPeriodType(e){const{period:t}=e.params;if("range"===t)return a("CoreHome_PeriodRange");const o=a(`Intl_Period${t.substring(0,1).toUpperCase()}${t.substring(1)}`);return o.substring(0,1).toUpperCase()+o.substring(1)},getComparisonTooltip(e,t){if(this.comparisonTooltips&&Object.keys(this.comparisonTooltips).length)return(this.comparisonTooltips[t.index]||{})[e.index]},getTitleTooltip(e){return this.htmlentities(e.title)+"
"+this.htmlentities(decodeURIComponent(e.params.segment))},getUrlToSegment(e){const t=Object.assign({},H.hashParsed.value);return delete t.comparePeriods,delete t.compareDates,delete t.compareSegments,t.segment=e,`${window.location.search}#?${H.stringify(t)}`},onComparisonsChanged(){if(this.comparisonTooltips=null,!Do.isComparing())return;const e=Do.getPeriodComparisons(),t=Do.getSegmentComparisons();G.fetch({method:"API.getProcessedReport",apiModule:"VisitsSummary",apiAction:"get",compare:"1",compareSegments:H.getSearchParam("compareSegments"),comparePeriods:H.getSearchParam("comparePeriods"),compareDates:H.getSearchParam("compareDates"),format_metrics:"1"}).then(o=>{this.comparisonTooltips={},e.forEach(e=>{this.comparisonTooltips[e.index]={},t.forEach(t=>{const i=this.generateComparisonTooltip(o,e,t);this.comparisonTooltips[e.index][t.index]=i})})})},generateComparisonTooltip(e,t,o){if(!e.reportData.comparisons)return"";const i=Do.getComparisonSeriesIndex(t.index,0),n=e.reportData.comparisons[i],r=Do.getComparisonSeriesIndex(t.index,o.index),s=e.reportData.comparisons[r],l=e.reportData.comparisons[o.index];let c='
',d=(s.nb_visits/n.nb_visits*100).toFixed(2);return d+="%",c+=a("General_ComparisonCardTooltip1",[`'${this.htmlentities(s.compareSegmentPretty)}'`,s.comparePeriodPretty,d,s.nb_visits.toString(),n.nb_visits.toString()]),t.index>0&&(c+="

",c+=a("General_ComparisonCardTooltip2",[s.nb_visits_change.toString(),this.htmlentities(l.compareSegmentPretty),l.comparePeriodPretty])),c+="
",c},htmlentities(e){return I.helper.htmlEntities(e)}},mounted(){I.on("piwikComparisonsChanged",()=>{this.onComparisonsChanged()}),this.onComparisonsChanged()}});Po.render=vo;var To=Po;const Vo={ref:"root",class:"menuDropdown"},No=["title"],xo=["innerHTML"],Bo=Object(E["createElementVNode"])("span",{class:"icon-chevron-down reporting-menu-sub-icon"},null,-1),Io={class:"items"},Mo={key:0,class:"search"},Lo=["placeholder"],Fo=["title"],Ao=["title"];function _o(e,t,o,i,n,a){const r=Object(E["resolveDirective"])("focus-if"),s=Object(E["resolveDirective"])("focus-anywhere-but-here");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Vo,[Object(E["createElementVNode"])("span",{class:"title",onClick:t[0]||(t[0]=t=>e.showItems=!e.showItems),title:e.tooltip},[Object(E["createElementVNode"])("span",{class:"title-label",innerHTML:e.$sanitize(this.actualMenuTitle)},null,8,xo),Bo],8,No),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",Io,[e.showSearch&&e.showItems?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Mo,[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[1]||(t[1]=t=>e.searchTerm=t),onKeydown:t[2]||(t[2]=t=>e.onSearchTermKeydown(t)),placeholder:e.translate("General_Search")},null,40,Lo),[[E["vModelText"],e.searchTerm],[r,{focused:e.showItems}]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",{class:"search_ico icon-search",title:e.translate("General_Search")},null,8,Fo),[[E["vShow"],!e.searchTerm]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",{onClick:t[3]||(t[3]=t=>{e.searchTerm="",e.searchItems("")}),class:"reset icon-close",title:e.translate("General_Clear")},null,8,Ao),[[E["vShow"],e.searchTerm]])])):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",{onClick:t[4]||(t[4]=t=>e.selectItem(t))},[Object(E["renderSlot"])(e.$slots,"default")])],512),[[E["vShow"],e.showItems]])])),[[s,{blur:e.lostFocus}]])}const{$:Ro}=window;var Ho=Object(E["defineComponent"])({props:{menuTitle:String,tooltip:String,showSearch:Boolean,menuTitleChangeOnClick:Boolean},directives:{FocusAnywhereButHere:Je,FocusIf:Qe},emits:["afterSelect"],watch:{menuTitle(){this.actualMenuTitle=this.menuTitle}},data(){return{showItems:!1,searchTerm:"",actualMenuTitle:this.menuTitle}},methods:{lostFocus(){this.showItems=!1},selectItem(e){const t=e.target.classList;!t.contains("item")||t.contains("disabled")||t.contains("separator")||(this.menuTitleChangeOnClick&&(this.actualMenuTitle=(e.target.textContent||"").replace(/[\u0000-\u2666]/g,e=>`&#${e.charCodeAt(0)};`)),this.showItems=!1,Ro(this.$slots.default()[0].el).find(".item").removeClass("active"),t.add("active"),this.$emit("afterSelect",e.target))},onSearchTermKeydown(){setTimeout(()=>{this.searchItems(this.searchTerm)})},searchItems(e){const t=e.toLowerCase();Ro(this.$refs.root).find(".item").each((e,o)=>{const i=Ro(o);-1===i.text().toLowerCase().indexOf(t)?i.hide():i.show()})}}});Ho.render=_o;var $o=Ho;const Uo={ref:"root"};function qo(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Uo,null,512)}const Wo=1,{$:zo}=window;var Go=Object(E["defineComponent"])({props:{selectedDateStart:Date,selectedDateEnd:Date,highlightedDateStart:Date,highlightedDateEnd:Date,viewDate:[String,Date],stepMonths:Number,disableMonthDropdown:Boolean,options:Object},emits:["cellHover","cellHoverLeave","dateSelect"],setup(e,t){const o=Object(E["ref"])(null);function i(t,o){const i=t.children("a");if(e.selectedDateStart&&e.selectedDateEnd&&o>=e.selectedDateStart&&o<=e.selectedDateEnd?t.addClass("ui-datepicker-current-period"):t.removeClass("ui-datepicker-current-period"),e.highlightedDateStart&&e.highlightedDateEnd&&o>=e.highlightedDateStart&&o<=e.highlightedDateEnd){const e=i.length?i:t;e.addClass("ui-state-hover")}else t.removeClass("ui-state-hover"),i.removeClass("ui-state-hover")}function n(e,t,o){if(e.hasClass("ui-datepicker-other-month"))return a(e,t,o);const i=parseInt(e.children("a,span").text(),10);return new Date(o,t,i)}function a(e,t,o){let i;const a=e.parent(),r=a.children("td");if(a.is(":first-child")){const s=a.children("td:not(.ui-datepicker-other-month)").first();return i=n(s,t,o),i.setDate(r.index(e)-r.index(s)+1),i}const s=a.children("td:not(.ui-datepicker-other-month)").last();return i=n(s,t,o),i.setDate(i.getDate()+r.index(e)-r.index(s)),i}function r(){const e=zo(o.value),t=e.find("td[data-month]"),i=parseInt(t.attr("data-month"),10),n=parseInt(t.attr("data-year"),10);return[i,n]}function s(){const e=zo(o.value),t=e.find(".ui-datepicker-calendar"),a=r(),s=t.find("td"),l=s.first(),c=n(l,a[0],a[1]);s.each((function(){i(zo(this),c),c.setDate(c.getDate()+1)}))}function l(){if(!e.viewDate)return!1;let t;if("string"===typeof e.viewDate)try{t=m(e.viewDate)}catch(a){return!1}else t=e.viewDate;const i=zo(o.value),n=r();return(n[0]!==t.getMonth()||n[1]!==t.getFullYear())&&(i.datepicker("setDate",t),!0)}function c(){const e=zo(o.value);e.find("td[data-event]").off("click"),e.find(".ui-state-active").removeClass("ui-state-active"),e.find(".ui-datepicker-current-day").removeClass("ui-datepicker-current-day"),e.find(".ui-datepicker-prev,.ui-datepicker-next").attr("href","")}function d(){const t=zo(o.value),i=e.stepMonths||Wo;if(t.datepicker("option","stepMonths")===i)return!1;const n=zo(".ui-datepicker-month",t).val(),a=zo(".ui-datepicker-year",t).val();return t.datepicker("option","stepMonths",i).datepicker("setDate",new Date(a,n)),c(),!0}function u(){const t=zo(o.value),i=t.find(".ui-datepicker-month")[0];i&&(i.disabled=e.disableMonthDropdown)}function p(){if(!zo(this).hasClass("ui-state-hover"))return;const e=zo(this).parent(),t=e.parent();e.is(":first-child")?t.find("a").first().click():t.find("a").last().click()}function h(){u(),s()}return Object(E["watch"])(()=>Object.assign({},e),(e,t)=>{let o=!1;[e=>e.selectedDateStart,e=>e.selectedDateEnd,e=>e.highlightedDateStart,e=>e.highlightedDateEnd].forEach(i=>{if(o)return;const n=i(e),a=i(t);!n&&a&&(o=!0),n&&!a&&(o=!0),n&&a&&n.getTime()!==a.getTime()&&(o=!0)}),e.viewDate!==t.viewDate&&l()&&(o=!0),e.stepMonths!==t.stepMonths&&d(),e.disableMonthDropdown!==t.disableMonthDropdown&&u(),o&&s()}),Object(E["onMounted"])(()=>{const i=zo(o.value),a=e.options||{},m=Object.assign(Object.assign(Object.assign({},I.getBaseDatePickerOptions()),a),{},{onChangeMonthYear:()=>{setTimeout(()=>{c()})}});i.datepicker(m),i.on("mouseover","tbody td a",e=>{e.originalEvent&&s()}),i.on("mouseenter","tbody td",(function(){const e=r(),o=zo(this),i=n(o,e[0],e[1]);t.emit("cellHover",{date:i,$cell:o})})),i.on("mouseout","tbody td a",()=>{s()}),i.on("mouseleave","table",()=>t.emit("cellHoverLeave")).on("mouseenter","thead",()=>t.emit("cellHoverLeave")),i.on("click","tbody td.ui-datepicker-other-month",p),i.on("click",e=>{e.preventDefault();const t=zo(e.target).closest("a");(t.is(".ui-datepicker-next")||t.is(".ui-datepicker-prev"))&&h()}),i.on("click","td[data-month]",e=>{const o=zo(e.target).closest("td"),i=parseInt(o.attr("data-month"),10),n=parseInt(o.attr("data-year"),10),a=parseInt(o.children("a,span").text(),10);t.emit("dateSelect",{date:new Date(n,i,a)})});const g=d();l(),u(),g||c(),s()}),{root:o}}});Go.render=qo;var Yo=Go;const Jo={class:"dateRangePicker"},Ko={id:"calendarRangeFrom"},Qo={id:"calendarRangeTo"};function Xo(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("DatePicker");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Jo,[Object(E["createElementVNode"])("div",Ko,[Object(E["createElementVNode"])("h6",null,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_DateRangeFrom"))+" ",1),Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text",id:"inputCalendarFrom",name:"inputCalendarFrom",class:"browser-default","onUpdate:modelValue":t[0]||(t[0]=t=>e.startDateText=t),onKeydown:t[1]||(t[1]=t=>e.onRangeInputChanged("from",t)),onKeyup:t[2]||(t[2]=t=>e.handleEnterPress(t))},null,544),[[E["vModelText"],e.startDateText]])]),Object(E["createVNode"])(r,{id:"calendarFrom","view-date":e.startDate,"selected-date-start":e.fromPickerSelectedDates[0],"selected-date-end":e.fromPickerSelectedDates[1],"highlighted-date-start":e.fromPickerHighlightedDates[0],"highlighted-date-end":e.fromPickerHighlightedDates[1],onDateSelect:t[3]||(t[3]=t=>e.setStartRangeDate(t.date)),onCellHover:t[4]||(t[4]=t=>e.fromPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)),onCellHoverLeave:t[5]||(t[5]=t=>e.fromPickerHighlightedDates=[null,null])},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])]),Object(E["createElementVNode"])("div",Qo,[Object(E["createElementVNode"])("h6",null,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_DateRangeTo"))+" ",1),Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text",id:"inputCalendarTo",name:"inputCalendarTo",class:"browser-default","onUpdate:modelValue":t[6]||(t[6]=t=>e.endDateText=t),onKeydown:t[7]||(t[7]=t=>e.onRangeInputChanged("to",t)),onKeyup:t[8]||(t[8]=t=>e.handleEnterPress(t))},null,544),[[E["vModelText"],e.endDateText]])]),Object(E["createVNode"])(r,{id:"calendarTo","view-date":e.endDate,"selected-date-start":e.toPickerSelectedDates[0],"selected-date-end":e.toPickerSelectedDates[1],"highlighted-date-start":e.toPickerHighlightedDates[0],"highlighted-date-end":e.toPickerHighlightedDates[1],onDateSelect:t[9]||(t[9]=t=>e.setEndRangeDate(t.date)),onCellHover:t[10]||(t[10]=t=>e.toPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)),onCellHoverLeave:t[11]||(t[11]=t=>e.toPickerHighlightedDates=[null,null])},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])])])}const Zo="YYYY-MM-DD";var ei=Object(E["defineComponent"])({props:{startDate:String,endDate:String},components:{DatePicker:Yo},data(){let e=null;try{this.startDate&&(e=m(this.startDate))}catch(o){}let t=null;try{this.endDate&&(t=m(this.endDate))}catch(o){}return{fromPickerSelectedDates:[e,e],toPickerSelectedDates:[t,t],fromPickerHighlightedDates:[null,null],toPickerHighlightedDates:[null,null],startDateText:this.startDate,endDateText:this.endDate,startDateInvalid:!1,endDateInvalid:!1}},emits:["rangeChange","submit"],watch:{startDate(){this.startDateText=this.startDate,this.setStartRangeDateFromStr(this.startDate)},endDate(){this.endDateText=this.endDate,this.setEndRangeDateFromStr(this.endDate)}},mounted(){this.rangeChanged()},methods:{setStartRangeDate(e){this.fromPickerSelectedDates=[e,e],this.rangeChanged()},setEndRangeDate(e){this.toPickerSelectedDates=[e,e],this.rangeChanged()},onRangeInputChanged(e,t){setTimeout(()=>{"from"===e?this.setStartRangeDateFromStr(t.target.value):this.setEndRangeDateFromStr(t.target.value)})},getNewHighlightedDates(e,t){return t.hasClass("ui-datepicker-unselectable")?null:[e,e]},handleEnterPress(e){13===e.keyCode&&this.$emit("submit",{start:this.startDate,end:this.endDate})},setStartRangeDateFromStr(e){this.startDateInvalid=!0;let t=null;try{e&&e.length===Zo.length&&(t=m(e))}catch(o){}t&&(this.fromPickerSelectedDates=[t,t],this.startDateInvalid=!1,this.rangeChanged())},setEndRangeDateFromStr(e){this.endDateInvalid=!0;let t=null;try{e&&e.length===Zo.length&&(t=m(e))}catch(o){}t&&(this.toPickerSelectedDates=[t,t],this.endDateInvalid=!1,this.rangeChanged())},rangeChanged(){this.$emit("rangeChange",{start:this.fromPickerSelectedDates[0]?d(this.fromPickerSelectedDates[0]):null,end:this.toPickerSelectedDates[0]?d(this.toPickerSelectedDates[0]):null})}}});ei.render=Xo;var ti=ei;function oi(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("DatePicker");return Object(E["openBlock"])(),Object(E["createBlock"])(r,{"selected-date-start":e.selectedDates[0],"selected-date-end":e.selectedDates[1],"highlighted-date-start":e.highlightedDates[0],"highlighted-date-end":e.highlightedDates[1],"view-date":e.viewDate,"step-months":"year"===e.period?12:1,"disable-month-dropdown":"year"===e.period,onCellHover:t[0]||(t[0]=t=>e.onHoverNormalCell(t.date,t.$cell)),onCellHoverLeave:t[1]||(t[1]=t=>e.onHoverLeaveNormalCells()),onDateSelect:t[2]||(t[2]=t=>e.onDateSelected(t.date))},null,8,["selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end","view-date","step-months","disable-month-dropdown"])}const ii=new Date(I.minDateYear,I.minDateMonth-1,I.minDateDay),ni=new Date(I.maxDateYear,I.maxDateMonth-1,I.maxDateDay);var ai=Object(E["defineComponent"])({props:{period:{type:String,required:!0},date:[String,Date]},components:{DatePicker:Yo},emits:["select"],setup(e,t){const o=Object(E["ref"])(e.date),i=Object(E["ref"])([null,null]),n=Object(E["ref"])([null,null]);function a(t){const o=c.get(e.period).parse(t).getDateRange();return o[0]=iio[1]?o[1]:ni,o}function r(t,o){const i=tni,r=o.hasClass("ui-datepicker-other-month")&&("month"===e.period||"day"===e.period);n.value=i||r?[null,null]:a(t)}function s(){n.value=[null,null]}function l(e){t.emit("select",{date:e})}function d(){if(!e.period||!e.date)return i.value=[null,null],void(o.value=null);i.value=a(e.date),o.value=m(e.date)}return Object(E["watch"])(e,d),d(),{selectedDates:i,highlightedDates:n,viewDate:o,onHoverNormalCell:r,onHoverLeaveNormalCells:s,onDateSelected:l}}});ai.render=oi;var ri=ai;const si={key:0},li=["data-notification-instance-id"],ci={key:1},di={class:"notification-body"},ui=["innerHTML"],mi={key:1};function pi(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createBlock"])(E["Transition"],{name:"toast"===e.type?"slow-fade-out":void 0,onAfterLeave:t[1]||(t[1]=t=>e.toastClosed())},{default:Object(E["withCtx"])(()=>[e.deleted?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",si,[Object(E["createVNode"])(E["Transition"],{name:"toast"===e.type?"toast-slide-up":void 0,appear:""},{default:Object(E["withCtx"])(()=>[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(E["Transition"],{name:e.animate?"fade-in":void 0,appear:""},{default:Object(E["withCtx"])(()=>[Object(E["createElementVNode"])("div",{class:Object(E["normalizeClass"])(["notification system",e.cssClasses]),style:Object(E["normalizeStyle"])(e.style),ref:"root","data-notification-instance-id":e.notificationInstanceId},[e.canClose?(Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{key:0,type:"button",class:"close","data-dismiss":"alert",onClick:t[0]||(t[0]=t=>e.closeNotification(t))}," × ")):Object(E["createCommentVNode"])("",!0),e.title?(Object(E["openBlock"])(),Object(E["createElementBlock"])("strong",ci,Object(E["toDisplayString"])(e.title),1)):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",di,[e.message?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,innerHTML:e.$sanitize(e.message)},null,8,ui)):Object(E["createCommentVNode"])("",!0),e.message?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",mi,[Object(E["renderSlot"])(e.$slots,"default")]))])],14,li)]),_:3},8,["name"])])]),_:3},8,["name"])]))]),_:3},8,["name"])}const{$:hi}=window;var gi=Object(E["defineComponent"])({props:{notificationId:String,notificationInstanceId:String,title:String,context:String,type:String,noclear:Boolean,toastLength:{type:Number,default:12e3},style:[String,Object],animate:Boolean,message:String,cssClass:String},computed:{cssClasses(){const e={};return this.context&&(e["notification-"+this.context]=!0),this.cssClass&&(e[this.cssClass]=!0),e},canClose(){return"persistent"===this.type||!this.noclear}},emits:["closed"],data(){return{deleted:!1}},mounted(){const e=()=>{setTimeout(()=>{this.deleted=!0},this.toastLength)};"toast"===this.type&&e(),this.style&&hi(this.$refs.root).css(this.style)},methods:{toastClosed(){Object(E["nextTick"])(()=>{this.$emit("closed")})},closeNotification(e){this.canClose&&e&&e.target&&(this.deleted=!0,Object(E["nextTick"])(()=>{this.$emit("closed")})),this.markNotificationAsRead()},markNotificationAsRead(){this.notificationId&&G.post({module:"CoreHome",action:"markNotificationAsRead"},{notificationId:this.notificationId},{withTokenInUrl:!0})}}});gi.render=pi;var bi=gi;const fi={class:"notification-group"},vi=["innerHTML"];function Oi(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Notification");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",fi,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.notifications,(t,o)=>(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:t.id||"no-id-"+o,"notification-id":t.id,title:t.title,context:t.context,type:t.type,noclear:t.noclear,"toast-length":t.toastLength,style:Object(E["normalizeStyle"])(t.style),animate:t.animate,message:t.message,"notification-instance-id":t.notificationInstanceId,"css-class":t.class,onClosed:o=>e.removeNotification(t.id)},{default:Object(E["withCtx"])(()=>[Object(E["createElementVNode"])("div",{innerHTML:e.$sanitize(t.message)},null,8,vi)]),_:2},1032,["notification-id","title","context","type","noclear","toast-length","style","animate","message","notification-instance-id","css-class","onClosed"]))),128))])}function ji(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */const So=8,ko=3;function Co(e){return e?Array.isArray(e)?e:[e]:[]}class Eo{constructor(){wo(this,"privateState",Object(E["reactive"])({comparisonsDisabledFor:[]})),wo(this,"state",Object(E["readonly"])(this.privateState)),wo(this,"colors",{}),wo(this,"segmentComparisons",Object(E["computed"])(()=>this.parseSegmentComparisons())),wo(this,"periodComparisons",Object(E["computed"])(()=>this.parsePeriodComparisons())),wo(this,"isEnabled",Object(E["computed"])(()=>this.checkEnabledForCurrentPage())),"complete"===document.readyState||"interactive"===document.readyState?this.loadComparisonsDisabledFor():document.addEventListener("DOMContentLoaded",()=>{this.loadComparisonsDisabledFor()}),$(()=>{this.colors=this.getAllSeriesColors()}),Object(E["watch"])(()=>this.getComparisons(),()=>I.postEvent("piwikComparisonsChanged"),{deep:!0})}getComparisons(){return this.getSegmentComparisons().concat(this.getPeriodComparisons())}isComparing(){return this.isComparisonEnabled()&&(this.segmentComparisons.value.length>1||this.periodComparisons.value.length>1)}isComparingPeriods(){return this.getPeriodComparisons().length>1}getSegmentComparisons(){return this.isComparisonEnabled()?this.segmentComparisons.value:[]}getPeriodComparisons(){return this.isComparisonEnabled()?this.periodComparisons.value:[]}getSeriesColor(e,t,o=0){const i=this.getComparisonSeriesIndex(t.index,e.index)%So;if(0===o)return this.colors["series"+i];const n=o%ko;return this.colors[`series${i}-shade${n}`]}getSeriesColorName(e,t){let o="series"+e%So;return t>0&&(o+="-shade"+t%ko),o}isComparisonEnabled(){return this.isEnabled.value}getIndividualComparisonRowIndices(e){const t=this.getSegmentComparisons().length,o=e%t,i=Math.floor(e/t);return{segmentIndex:o,periodIndex:i}}getComparisonSeriesIndex(e,t){const o=this.getSegmentComparisons().length;return e*o+t}getAllComparisonSeries(){const e=[];let t=0;return this.getPeriodComparisons().forEach(o=>{this.getSegmentComparisons().forEach(i=>{e.push({index:t,params:Object.assign(Object.assign({},i.params),o.params),color:this.colors["series"+t]}),t+=1})}),e}removeSegmentComparison(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");const t=[...this.segmentComparisons.value];t.splice(e,1);const o={};0===e&&(o.segment=t[0].params.segment),this.updateQueryParamsFromComparisons(t,this.periodComparisons.value,o)}removeSegmentComparisonByDefinition(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");let t=null;this.getSegmentComparisons().forEach((o,i)=>{o&&o.params&&o.params.segment===e&&(t=i)}),null!==t&&this.removeSegmentComparison(t)}addSegmentComparison(e){if(!this.isComparisonEnabled())throw new Error("Comparison disabled.");const t=this.segmentComparisons.value.concat([{params:e,index:-1,title:""}]);this.updateQueryParamsFromComparisons(t,this.periodComparisons.value)}updateQueryParamsFromComparisons(e,t,o={}){const i={},n={};let a=!1,r=!1;e.forEach(e=>{a?i[e.params.segment]=!0:a=!0}),t.forEach(e=>{r?n[`${e.params.period}|${e.params.date}`]=!0:r=!0});const s=[],l=[];Object.keys(n).forEach(e=>{const t=e.split("|");s.push(t[0]),l.push(t[1])});const c={compareSegments:Object.keys(i),comparePeriods:s,compareDates:l},d=I.helper.isReportingPage()?H.hashParsed.value:H.urlParsed.value;H.updateLocation(Object.assign(Object.assign(Object.assign({},d),c),o))}getAllSeriesColors(){const{ColorManager:e}=I;if(!e)return[];const t=[];for(let o=0;o{this.privateState.comparisonsDisabledFor=e})}parseSegmentComparisons(){const{availableSegments:e}=yo.state,t=[...Co(H.parsed.value.compareSegments)];t.unshift(H.parsed.value.segment||"");const o=[];return t.forEach((t,i)=>{let n;e.forEach(e=>{e.definition!==t&&e.definition!==decodeURIComponent(t)&&decodeURIComponent(e.definition)!==t||(n=e)});let r=n?n.name:a("General_Unknown");""===t.trim()&&(r=a("SegmentEditor_DefaultAllVisits")),o.push({params:{segment:t},title:I.helper.htmlDecode(r),index:i})}),o}parsePeriodComparisons(){const e=[...Co(H.parsed.value.comparePeriods)],t=[...Co(H.parsed.value.compareDates)];e.unshift(H.parsed.value.period),t.unshift(H.parsed.value.date);const o=[];for(let n=0;nDo.isComparing()&&!window.broadcast.isNoDataPage()),t=Object(E["computed"])(()=>Do.getSegmentComparisons()),o=Object(E["computed"])(()=>Do.getPeriodComparisons()),i=Do.getSeriesColor.bind(Do);function n(){const e=window.$(this).attr("title");return e?window.vueSanitize(e.replace(/\n/g,"
")):e}return{isComparing:e,segmentComparisons:t,periodComparisons:o,getSeriesColor:i,transformTooltipContent:n}},methods:{comparisonHasSegment(e){return"undefined"!==typeof e.params.segment},removeSegmentComparison(e){window.$(this.$refs.root).tooltip("destroy"),Do.removeSegmentComparison(e)},getComparisonPeriodType(e){const{period:t}=e.params;if("range"===t)return a("CoreHome_PeriodRange");const o=a(`Intl_Period${t.substring(0,1).toUpperCase()}${t.substring(1)}`);return o.substring(0,1).toUpperCase()+o.substring(1)},getComparisonTooltip(e,t){if(this.comparisonTooltips&&Object.keys(this.comparisonTooltips).length)return(this.comparisonTooltips[t.index]||{})[e.index]},getTitleTooltip(e){return this.htmlentities(e.title)+"
"+this.htmlentities(decodeURIComponent(e.params.segment))},getUrlToSegment(e){const t=Object.assign({},H.hashParsed.value);return delete t.comparePeriods,delete t.compareDates,delete t.compareSegments,t.segment=e,`${window.location.search}#?${H.stringify(t)}`},onComparisonsChanged(){if(this.comparisonTooltips=null,!Do.isComparing())return;const e=Do.getPeriodComparisons(),t=Do.getSegmentComparisons();K.fetch({method:"API.getProcessedReport",apiModule:"VisitsSummary",apiAction:"get",compare:"1",compareSegments:H.getSearchParam("compareSegments"),comparePeriods:H.getSearchParam("comparePeriods"),compareDates:H.getSearchParam("compareDates"),format_metrics:"1"}).then(o=>{this.comparisonTooltips={},e.forEach(e=>{this.comparisonTooltips[e.index]={},t.forEach(t=>{const i=this.generateComparisonTooltip(o,e,t);this.comparisonTooltips[e.index][t.index]=i})})})},generateComparisonTooltip(e,t,o){if(!e.reportData.comparisons)return"";const i=Do.getComparisonSeriesIndex(t.index,0),n=e.reportData.comparisons[i],r=Do.getComparisonSeriesIndex(t.index,o.index),s=e.reportData.comparisons[r],l=e.reportData.comparisons[o.index];let c='
',d=(s.nb_visits/n.nb_visits*100).toFixed(2);return d+="%",c+=a("General_ComparisonCardTooltip1",[`'${this.htmlentities(s.compareSegmentPretty)}'`,s.comparePeriodPretty,d,s.nb_visits.toString(),n.nb_visits.toString()]),t.index>0&&(c+="

",c+=a("General_ComparisonCardTooltip2",[s.nb_visits_change.toString(),this.htmlentities(l.compareSegmentPretty),l.comparePeriodPretty])),c+="
",c},htmlentities(e){return I.helper.htmlEntities(e)}},mounted(){I.on("piwikComparisonsChanged",()=>{this.onComparisonsChanged()}),this.onComparisonsChanged()}});Po.render=vo;var To=Po;const Vo={ref:"root",class:"menuDropdown"},No=["title"],xo=["innerHTML"],Bo=Object(E["createElementVNode"])("span",{class:"icon-chevron-down reporting-menu-sub-icon"},null,-1),Io={class:"items"},Mo={key:0,class:"search"},Lo=["placeholder"],Fo=["title"],Ao=["title"];function _o(e,t,o,i,n,a){const r=Object(E["resolveDirective"])("focus-if"),s=Object(E["resolveDirective"])("focus-anywhere-but-here");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Vo,[Object(E["createElementVNode"])("span",{class:"title",onClick:t[0]||(t[0]=t=>e.showItems=!e.showItems),title:e.tooltip},[Object(E["createElementVNode"])("span",{class:"title-label",innerHTML:e.$sanitize(this.actualMenuTitle)},null,8,xo),Bo],8,No),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",Io,[e.showSearch&&e.showItems?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Mo,[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text","onUpdate:modelValue":t[1]||(t[1]=t=>e.searchTerm=t),onKeydown:t[2]||(t[2]=t=>e.onSearchTermKeydown(t)),placeholder:e.translate("General_Search")},null,40,Lo),[[E["vModelText"],e.searchTerm],[r,{focused:e.showItems}]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",{class:"search_ico icon-search",title:e.translate("General_Search")},null,8,Fo),[[E["vShow"],!e.searchTerm]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",{onClick:t[3]||(t[3]=t=>{e.searchTerm="",e.searchItems("")}),class:"reset icon-close",title:e.translate("General_Clear")},null,8,Ao),[[E["vShow"],e.searchTerm]])])):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",{onClick:t[4]||(t[4]=t=>e.selectItem(t))},[Object(E["renderSlot"])(e.$slots,"default")])],512),[[E["vShow"],e.showItems]])])),[[s,{blur:e.lostFocus}]])}const{$:Ro}=window;var Ho=Object(E["defineComponent"])({props:{menuTitle:String,tooltip:String,showSearch:Boolean,menuTitleChangeOnClick:Boolean},directives:{FocusAnywhereButHere:Je,FocusIf:Qe},emits:["afterSelect"],watch:{menuTitle(){this.actualMenuTitle=this.menuTitle}},data(){return{showItems:!1,searchTerm:"",actualMenuTitle:this.menuTitle}},methods:{lostFocus(){this.showItems=!1},selectItem(e){const t=e.target.classList;!t.contains("item")||t.contains("disabled")||t.contains("separator")||(this.menuTitleChangeOnClick&&(this.actualMenuTitle=(e.target.textContent||"").replace(/[\u0000-\u2666]/g,e=>`&#${e.charCodeAt(0)};`)),this.showItems=!1,Ro(this.$slots.default()[0].el).find(".item").removeClass("active"),t.add("active"),this.$emit("afterSelect",e.target))},onSearchTermKeydown(){setTimeout(()=>{this.searchItems(this.searchTerm)})},searchItems(e){const t=e.toLowerCase();Ro(this.$refs.root).find(".item").each((e,o)=>{const i=Ro(o);-1===i.text().toLowerCase().indexOf(t)?i.hide():i.show()})}}});Ho.render=_o;var $o=Ho;const Uo={ref:"root"};function qo(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Uo,null,512)}const Wo=1,{$:zo}=window;var Go=Object(E["defineComponent"])({props:{selectedDateStart:Date,selectedDateEnd:Date,highlightedDateStart:Date,highlightedDateEnd:Date,viewDate:[String,Date],stepMonths:Number,disableMonthDropdown:Boolean,options:Object},emits:["cellHover","cellHoverLeave","dateSelect"],setup(e,t){const o=Object(E["ref"])(null);function i(t,o){const i=t.children("a");if(e.selectedDateStart&&e.selectedDateEnd&&o>=e.selectedDateStart&&o<=e.selectedDateEnd?t.addClass("ui-datepicker-current-period"):t.removeClass("ui-datepicker-current-period"),e.highlightedDateStart&&e.highlightedDateEnd&&o>=e.highlightedDateStart&&o<=e.highlightedDateEnd){const e=i.length?i:t;e.addClass("ui-state-hover")}else t.removeClass("ui-state-hover"),i.removeClass("ui-state-hover")}function n(e,t,o){if(e.hasClass("ui-datepicker-other-month"))return a(e,t,o);const i=parseInt(e.children("a,span").text(),10);return new Date(o,t,i)}function a(e,t,o){let i;const a=e.parent(),r=a.children("td");if(a.is(":first-child")){const s=a.children("td:not(.ui-datepicker-other-month)").first();return i=n(s,t,o),i.setDate(r.index(e)-r.index(s)+1),i}const s=a.children("td:not(.ui-datepicker-other-month)").last();return i=n(s,t,o),i.setDate(i.getDate()+r.index(e)-r.index(s)),i}function r(){const e=zo(o.value),t=e.find("td[data-month]"),i=parseInt(t.attr("data-month"),10),n=parseInt(t.attr("data-year"),10);return[i,n]}function s(){const e=zo(o.value),t=e.find(".ui-datepicker-calendar"),a=r(),s=t.find("td"),l=s.first(),c=n(l,a[0],a[1]);s.each((function(){i(zo(this),c),c.setDate(c.getDate()+1)}))}function l(){if(!e.viewDate)return!1;let t;if("string"===typeof e.viewDate)try{t=m(e.viewDate)}catch(a){return!1}else t=e.viewDate;const i=zo(o.value),n=r();return(n[0]!==t.getMonth()||n[1]!==t.getFullYear())&&(i.datepicker("setDate",t),!0)}function c(){const e=zo(o.value);e.find("td[data-event]").off("click"),e.find(".ui-state-active").removeClass("ui-state-active"),e.find(".ui-datepicker-current-day").removeClass("ui-datepicker-current-day"),e.find(".ui-datepicker-prev,.ui-datepicker-next").attr("href","")}function d(){const t=zo(o.value),i=e.stepMonths||Wo;if(t.datepicker("option","stepMonths")===i)return!1;const n=zo(".ui-datepicker-month",t).val(),a=zo(".ui-datepicker-year",t).val();return t.datepicker("option","stepMonths",i).datepicker("setDate",new Date(a,n)),c(),!0}function u(){const t=zo(o.value),i=t.find(".ui-datepicker-month")[0];i&&(i.disabled=e.disableMonthDropdown)}function p(){if(!zo(this).hasClass("ui-state-hover"))return;const e=zo(this).parent(),t=e.parent();e.is(":first-child")?t.find("a").first().click():t.find("a").last().click()}function h(){u(),s()}return Object(E["watch"])(()=>Object.assign({},e),(e,t)=>{let o=!1;[e=>e.selectedDateStart,e=>e.selectedDateEnd,e=>e.highlightedDateStart,e=>e.highlightedDateEnd].forEach(i=>{if(o)return;const n=i(e),a=i(t);!n&&a&&(o=!0),n&&!a&&(o=!0),n&&a&&n.getTime()!==a.getTime()&&(o=!0)}),e.viewDate!==t.viewDate&&l()&&(o=!0),e.stepMonths!==t.stepMonths&&d(),e.disableMonthDropdown!==t.disableMonthDropdown&&u(),o&&s()}),Object(E["onMounted"])(()=>{const i=zo(o.value),a=e.options||{},m=Object.assign(Object.assign(Object.assign({},I.getBaseDatePickerOptions()),a),{},{onChangeMonthYear:()=>{setTimeout(()=>{c()})}});i.datepicker(m),i.on("mouseover","tbody td a",e=>{e.originalEvent&&s()}),i.on("mouseenter","tbody td",(function(){const e=r(),o=zo(this),i=n(o,e[0],e[1]);t.emit("cellHover",{date:i,$cell:o})})),i.on("mouseout","tbody td a",()=>{s()}),i.on("mouseleave","table",()=>t.emit("cellHoverLeave")).on("mouseenter","thead",()=>t.emit("cellHoverLeave")),i.on("click","tbody td.ui-datepicker-other-month",p),i.on("click",e=>{e.preventDefault();const t=zo(e.target).closest("a");(t.is(".ui-datepicker-next")||t.is(".ui-datepicker-prev"))&&h()}),i.on("click","td[data-month]",e=>{const o=zo(e.target).closest("td"),i=parseInt(o.attr("data-month"),10),n=parseInt(o.attr("data-year"),10),a=parseInt(o.children("a,span").text(),10);t.emit("dateSelect",{date:new Date(n,i,a)})});const g=d();l(),u(),g||c(),s()}),{root:o}}});Go.render=qo;var Yo=Go;const Jo={class:"dateRangePicker"},Ko={id:"calendarRangeFrom"},Qo={id:"calendarRangeTo"};function Xo(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("DatePicker");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Jo,[Object(E["createElementVNode"])("div",Ko,[Object(E["createElementVNode"])("h6",null,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_DateRangeFrom"))+" ",1),Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text",id:"inputCalendarFrom",name:"inputCalendarFrom",class:"browser-default","onUpdate:modelValue":t[0]||(t[0]=t=>e.startDateText=t),onKeydown:t[1]||(t[1]=t=>e.onRangeInputChanged("from",t)),onKeyup:t[2]||(t[2]=t=>e.handleEnterPress(t))},null,544),[[E["vModelText"],e.startDateText]])]),Object(E["createVNode"])(r,{id:"calendarFrom","view-date":e.startDate,"selected-date-start":e.fromPickerSelectedDates[0],"selected-date-end":e.fromPickerSelectedDates[1],"highlighted-date-start":e.fromPickerHighlightedDates[0],"highlighted-date-end":e.fromPickerHighlightedDates[1],onDateSelect:t[3]||(t[3]=t=>e.setStartRangeDate(t.date)),onCellHover:t[4]||(t[4]=t=>e.fromPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)),onCellHoverLeave:t[5]||(t[5]=t=>e.fromPickerHighlightedDates=[null,null])},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])]),Object(E["createElementVNode"])("div",Qo,[Object(E["createElementVNode"])("h6",null,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_DateRangeTo"))+" ",1),Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text",id:"inputCalendarTo",name:"inputCalendarTo",class:"browser-default","onUpdate:modelValue":t[6]||(t[6]=t=>e.endDateText=t),onKeydown:t[7]||(t[7]=t=>e.onRangeInputChanged("to",t)),onKeyup:t[8]||(t[8]=t=>e.handleEnterPress(t))},null,544),[[E["vModelText"],e.endDateText]])]),Object(E["createVNode"])(r,{id:"calendarTo","view-date":e.endDate,"selected-date-start":e.toPickerSelectedDates[0],"selected-date-end":e.toPickerSelectedDates[1],"highlighted-date-start":e.toPickerHighlightedDates[0],"highlighted-date-end":e.toPickerHighlightedDates[1],onDateSelect:t[9]||(t[9]=t=>e.setEndRangeDate(t.date)),onCellHover:t[10]||(t[10]=t=>e.toPickerHighlightedDates=e.getNewHighlightedDates(t.date,t.$cell)),onCellHoverLeave:t[11]||(t[11]=t=>e.toPickerHighlightedDates=[null,null])},null,8,["view-date","selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end"])])])}const Zo="YYYY-MM-DD";var ei=Object(E["defineComponent"])({props:{startDate:String,endDate:String},components:{DatePicker:Yo},data(){let e=null;try{this.startDate&&(e=m(this.startDate))}catch(o){}let t=null;try{this.endDate&&(t=m(this.endDate))}catch(o){}return{fromPickerSelectedDates:[e,e],toPickerSelectedDates:[t,t],fromPickerHighlightedDates:[null,null],toPickerHighlightedDates:[null,null],startDateText:this.startDate,endDateText:this.endDate,startDateInvalid:!1,endDateInvalid:!1}},emits:["rangeChange","submit"],watch:{startDate(){this.startDateText=this.startDate,this.setStartRangeDateFromStr(this.startDate)},endDate(){this.endDateText=this.endDate,this.setEndRangeDateFromStr(this.endDate)}},mounted(){this.rangeChanged()},methods:{setStartRangeDate(e){this.fromPickerSelectedDates=[e,e],this.rangeChanged()},setEndRangeDate(e){this.toPickerSelectedDates=[e,e],this.rangeChanged()},onRangeInputChanged(e,t){setTimeout(()=>{"from"===e?this.setStartRangeDateFromStr(t.target.value):this.setEndRangeDateFromStr(t.target.value)})},getNewHighlightedDates(e,t){return t.hasClass("ui-datepicker-unselectable")?null:[e,e]},handleEnterPress(e){13===e.keyCode&&this.$emit("submit",{start:this.startDate,end:this.endDate})},setStartRangeDateFromStr(e){this.startDateInvalid=!0;let t=null;try{e&&e.length===Zo.length&&(t=m(e))}catch(o){}t&&(this.fromPickerSelectedDates=[t,t],this.startDateInvalid=!1,this.rangeChanged())},setEndRangeDateFromStr(e){this.endDateInvalid=!0;let t=null;try{e&&e.length===Zo.length&&(t=m(e))}catch(o){}t&&(this.toPickerSelectedDates=[t,t],this.endDateInvalid=!1,this.rangeChanged())},rangeChanged(){this.$emit("rangeChange",{start:this.fromPickerSelectedDates[0]?d(this.fromPickerSelectedDates[0]):null,end:this.toPickerSelectedDates[0]?d(this.toPickerSelectedDates[0]):null})}}});ei.render=Xo;var ti=ei;function oi(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("DatePicker");return Object(E["openBlock"])(),Object(E["createBlock"])(r,{"selected-date-start":e.selectedDates[0],"selected-date-end":e.selectedDates[1],"highlighted-date-start":e.highlightedDates[0],"highlighted-date-end":e.highlightedDates[1],"view-date":e.viewDate,"step-months":"year"===e.period?12:1,"disable-month-dropdown":"year"===e.period,onCellHover:t[0]||(t[0]=t=>e.onHoverNormalCell(t.date,t.$cell)),onCellHoverLeave:t[1]||(t[1]=t=>e.onHoverLeaveNormalCells()),onDateSelect:t[2]||(t[2]=t=>e.onDateSelected(t.date))},null,8,["selected-date-start","selected-date-end","highlighted-date-start","highlighted-date-end","view-date","step-months","disable-month-dropdown"])}const ii=new Date(I.minDateYear,I.minDateMonth-1,I.minDateDay),ni=new Date(I.maxDateYear,I.maxDateMonth-1,I.maxDateDay);var ai=Object(E["defineComponent"])({props:{period:{type:String,required:!0},date:[String,Date]},components:{DatePicker:Yo},emits:["select"],setup(e,t){const o=Object(E["ref"])(e.date),i=Object(E["ref"])([null,null]),n=Object(E["ref"])([null,null]);function a(t){const o=c.get(e.period).parse(t).getDateRange();return o[0]=iio[1]?o[1]:ni,o}function r(t,o){const i=tni,r=o.hasClass("ui-datepicker-other-month")&&("month"===e.period||"day"===e.period);n.value=i||r?[null,null]:a(t)}function s(){n.value=[null,null]}function l(e){t.emit("select",{date:e})}function d(){if(!e.period||!e.date)return i.value=[null,null],void(o.value=null);i.value=a(e.date),o.value=m(e.date)}return Object(E["watch"])(e,d),d(),{selectedDates:i,highlightedDates:n,viewDate:o,onHoverNormalCell:r,onHoverLeaveNormalCells:s,onDateSelected:l}}});ai.render=oi;var ri=ai;const si={key:0},li=["data-notification-instance-id"],ci={key:1},di={class:"notification-body"},ui=["innerHTML"],mi={key:1};function pi(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createBlock"])(E["Transition"],{name:"toast"===e.type?"slow-fade-out":void 0,onAfterLeave:t[1]||(t[1]=t=>e.toastClosed())},{default:Object(E["withCtx"])(()=>[e.deleted?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",si,[Object(E["createVNode"])(E["Transition"],{name:"toast"===e.type?"toast-slide-up":void 0,appear:""},{default:Object(E["withCtx"])(()=>[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(E["Transition"],{name:e.animate?"fade-in":void 0,appear:""},{default:Object(E["withCtx"])(()=>[Object(E["createElementVNode"])("div",{class:Object(E["normalizeClass"])(["notification system",e.cssClasses]),style:Object(E["normalizeStyle"])(e.style),ref:"root","data-notification-instance-id":e.notificationInstanceId},[e.canClose?(Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{key:0,type:"button",class:"close","data-dismiss":"alert",onClick:t[0]||(t[0]=t=>e.closeNotification(t))}," × ")):Object(E["createCommentVNode"])("",!0),e.title?(Object(E["openBlock"])(),Object(E["createElementBlock"])("strong",ci,Object(E["toDisplayString"])(e.title),1)):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",di,[e.message?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,innerHTML:e.$sanitize(e.message)},null,8,ui)):Object(E["createCommentVNode"])("",!0),e.message?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",mi,[Object(E["renderSlot"])(e.$slots,"default")]))])],14,li)]),_:3},8,["name"])])]),_:3},8,["name"])]))]),_:3},8,["name"])}const{$:hi}=window;var gi=Object(E["defineComponent"])({props:{notificationId:String,notificationInstanceId:String,title:String,context:String,type:String,noclear:Boolean,toastLength:{type:Number,default:12e3},style:[String,Object],animate:Boolean,message:String,cssClass:String},computed:{cssClasses(){const e={};return this.context&&(e["notification-"+this.context]=!0),this.cssClass&&(e[this.cssClass]=!0),e},canClose(){return"persistent"===this.type||!this.noclear}},emits:["closed"],data(){return{deleted:!1}},mounted(){const e=()=>{setTimeout(()=>{this.deleted=!0},this.toastLength)};"toast"===this.type&&e(),this.style&&hi(this.$refs.root).css(this.style)},methods:{toastClosed(){Object(E["nextTick"])(()=>{this.$emit("closed")})},closeNotification(e){this.canClose&&e&&e.target&&(this.deleted=!0,Object(E["nextTick"])(()=>{this.$emit("closed")})),this.markNotificationAsRead()},markNotificationAsRead(){this.notificationId&&K.post({module:"CoreHome",action:"markNotificationAsRead"},{notificationId:this.notificationId},{withTokenInUrl:!0})}}});gi.render=pi;var bi=gi;const fi={class:"notification-group"},vi=["innerHTML"];function Oi(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Notification");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",fi,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.notifications,(t,o)=>(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:t.id||"no-id-"+o,"notification-id":t.id,title:t.title,context:t.context,type:t.type,noclear:t.noclear,"toast-length":t.toastLength,style:Object(E["normalizeStyle"])(t.style),animate:t.animate,message:t.message,"notification-instance-id":t.notificationInstanceId,"css-class":t.class,onClosed:o=>e.removeNotification(t.id)},{default:Object(E["withCtx"])(()=>[Object(E["createElementVNode"])("div",{innerHTML:e.$sanitize(t.message)},null,8,vi)]),_:2},1032,["notification-id","title","context","type","noclear","toast-length","style","animate","message","notification-instance-id","css-class","onClosed"]))),128))])}function ji(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * @@ -242,13 +242,13 @@ function qe(e,t,o){const i=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMo * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */class Ii{constructor(){Bi(this,"state",Object(E["reactive"])({initialSites:[],isInitialized:!1})),Bi(this,"stateFiltered",Object(E["reactive"])({initialSites:[],isInitialized:!1,excludedSites:[],onlySitesWithAdminAccess:!1,onlySitesWithAtLeastWriteAccess:!1,siteTypesToExclude:[]})),Bi(this,"currentRequestAbort",null),Bi(this,"limitRequest",void 0),Bi(this,"initialSites",Object(E["computed"])(()=>Object(E["readonly"])(this.state.initialSites))),Bi(this,"initialSitesFiltered",Object(E["computed"])(()=>Object(E["readonly"])(this.stateFiltered.initialSites)))}isFiltered(e=!1,t=[],o=!1,i=[]){return t.length>0||e||o||i.length>0}matchesCurrentFilteredState(e=!1,t=[],o=!1,i=[]){return!this.stateFiltered.isInitialized&&!this.isFiltered(e,t,o,i)||this.stateFiltered.isInitialized&&t.length===this.stateFiltered.excludedSites.length&&t.every((e,t)=>e===this.stateFiltered.excludedSites[t])&&e===this.stateFiltered.onlySitesWithAdminAccess&&o===this.stateFiltered.onlySitesWithAtLeastWriteAccess&&i.length===this.stateFiltered.siteTypesToExclude.length&&i.every((e,t)=>e===this.stateFiltered.siteTypesToExclude[t])}loadInitialSites(e=!1,t=[],o=!1,i=[]){return this.state.isInitialized&&!this.isFiltered(e,t,o,i)?Promise.resolve(Object(E["readonly"])(this.state.initialSites)):this.stateFiltered.isInitialized&&this.matchesCurrentFilteredState(e,t,o,i)?Promise.resolve(Object(E["readonly"])(this.stateFiltered.initialSites)):this.isFiltered(e,t,o,i)?this.searchSite("%",e,t,o,i).then(n=>(this.stateFiltered.isInitialized=!0,this.stateFiltered.excludedSites=t,this.stateFiltered.onlySitesWithAdminAccess=e,this.stateFiltered.onlySitesWithAtLeastWriteAccess=o,this.stateFiltered.siteTypesToExclude=i,null!==n&&(this.stateFiltered.initialSites=n),n)):this.state.isInitialized?Promise.resolve(Object(E["readonly"])(this.state.initialSites)):this.searchSite("%",e,t,o,i).then(e=>(this.state.isInitialized=!0,null!==e&&(this.state.initialSites=e),e))}loadSite(e){"all"===e?H.updateUrl(Object.assign(Object.assign({},H.urlParsed.value),{},{module:"MultiSites",action:"index",date:H.parsed.value.date,period:H.parsed.value.period})):H.updateUrl(Object.assign(Object.assign({},H.urlParsed.value),{},{segment:"",idSite:e}),Object.assign(Object.assign({},H.hashParsed.value),{},{segment:"",idSite:e}))}searchSite(e,t=!1,o=[],i=!1,n=[]){return e?(this.currentRequestAbort&&this.currentRequestAbort.abort(),this.limitRequest||(this.limitRequest=G.fetch({method:"SitesManager.getNumWebsitesToDisplayPerPage"})),this.limitRequest.then(a=>{const r=a.value;let s="view";return t?s="admin":i&&(s="write"),this.currentRequestAbort=new AbortController,G.fetch({method:"SitesManager.getSitesWithMinimumAccess",permission:s,limit:r,pattern:e,sitesToExclude:o,siteTypesToExclude:n},{abortController:this.currentRequestAbort,abortable:!1})}).then(e=>e?this.processWebsitesList(e):null).finally(()=>{this.currentRequestAbort=null})):this.loadInitialSites(t,o,i,n)}processWebsitesList(e){let t=e;return t&&t.length?(t=t.map(e=>Object.assign(Object.assign({},e),{},{name:e.group?`[${e.group}] ${e.name}`:e.name})),t.sort((e,t)=>e.name.toLowerCase()t.name.toLowerCase()?1:0),t):[]}}var Mi=new Ii;const Li=["value","name"],Fi=["title"],Ai=["textContent"],_i={key:1,class:"placeholder"},Ri={class:"dropdown"},Hi={class:"custom_select_search"},$i=["placeholder"],Ui={key:0},qi={class:"custom_select_container"},Wi=["onClick"],zi=["innerHTML","href","title"],Gi={class:"custom_select_ul_list"},Yi={class:"noresult"},Ji={key:1};function Ki(e,t,o,i,n,a){var r,s,l,c;const d=Object(E["resolveComponent"])("AllSitesLink"),u=Object(E["resolveDirective"])("tooltips"),m=Object(E["resolveDirective"])("focus-if"),p=Object(E["resolveDirective"])("focus-anywhere-but-here");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:Object(E["normalizeClass"])(["siteSelector piwikSelector borderedControl",{expanded:e.showSitesList,disabled:!e.hasMultipleSites}])},[e.name?(Object(E["openBlock"])(),Object(E["createElementBlock"])("input",{key:0,type:"hidden",value:null===(r=e.displayedModelValue)||void 0===r?void 0:r.id,name:e.name},null,8,Li)):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{ref:"selectorLink",onClick:t[0]||(t[0]=(...t)=>e.onClickSelector&&e.onClickSelector(...t)),onKeydown:t[1]||(t[1]=t=>e.onPressEnter(t)),href:"javascript:void(0)",class:Object(E["normalizeClass"])([{loading:e.isLoading},"title"]),tabindex:"4",title:e.selectorLinkTitle},[Object(E["createElementVNode"])("span",{class:Object(E["normalizeClass"])(["icon icon-chevron-down",{iconHidden:e.isLoading,collapsed:!e.showSitesList}])},null,2),Object(E["createElementVNode"])("span",null,[null!==(s=e.displayedModelValue)&&void 0!==s&&s.name||!e.placeholder?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,textContent:Object(E["toDisplayString"])((null===(l=e.displayedModelValue)||void 0===l?void 0:l.name)||e.firstSiteName)},null,8,Ai)):Object(E["createCommentVNode"])("",!0),null!==(c=e.displayedModelValue)&&void 0!==c&&c.name||!e.placeholder?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",_i,Object(E["toDisplayString"])(e.placeholder),1))])],42,Fi)),[[u]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",Ri,[Object(E["withDirectives"])(Object(E["createElementVNode"])("div",Hi,[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text",onClick:t[2]||(t[2]=t=>{e.searchTerm="",e.loadInitialSites()}),"onUpdate:modelValue":t[3]||(t[3]=t=>e.searchTerm=t),tabindex:"4",class:"websiteSearch inp browser-default",placeholder:e.translate("General_Search")},null,8,$i),[[E["vModelText"],e.searchTerm],[m,{focused:e.shouldFocusOnSearch}]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("img",{title:"Clear",onClick:t[4]||(t[4]=t=>{e.searchTerm="",e.loadInitialSites()}),class:"reset",src:"plugins/CoreHome/images/reset_search.png"},null,512),[[E["vShow"],e.searchTerm]])],512),[[E["vShow"],e.autocompleteMinSites<=e.sites.length||e.searchTerm]]),"top"===e.allSitesLocation&&e.showAllSitesItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Ui,[Object(E["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[5]||(t[5]=t=>e.onAllSitesClick(t))},null,8,["href","all-sites-text"])])):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",qi,[Object(E["createElementVNode"])("ul",{class:"custom_select_ul_list",onClick:t[7]||(t[7]=t=>e.showSitesList=!1)},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.sites,(o,i)=>Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{onClick:t=>e.switchSite(Object.assign(Object.assign({},o),{},{id:o.idsite}),t),key:i},[Object(E["createElementVNode"])("a",{onClick:t[6]||(t[6]=e=>e.preventDefault()),innerHTML:e.$sanitize(e.getMatchedSiteName(o.name)),tabindex:"4",href:e.getUrlForSiteId(o.idsite),title:o.name},null,8,zi)],8,Wi)),[[E["vShow"],!(!e.showSelectedSite&&""+e.activeSiteId===""+o.idsite)]])),128))]),Object(E["withDirectives"])(Object(E["createElementVNode"])("ul",Gi,[Object(E["createElementVNode"])("li",null,[Object(E["createElementVNode"])("div",Yi,Object(E["toDisplayString"])(e.translate("SitesManager_NotFound")+" "+e.searchTerm),1)])],512),[[E["vShow"],!e.sites.length&&e.searchTerm]])])),[[u,{content:e.tooltipContent}]]),"bottom"===e.allSitesLocation&&e.showAllSitesItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Ji,[Object(E["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[8]||(t[8]=t=>e.onAllSitesClick(t))},null,8,["href","all-sites-text"])])):Object(E["createCommentVNode"])("",!0)],512),[[E["vShow"],e.showSitesList]])],2)),[[p,{blur:e.onBlur}]])}const Qi=["innerHTML","href"];function Xi(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{onClick:t[1]||(t[1]=e=>this.onClick(e)),class:"custom_select_all"},[Object(E["createElementVNode"])("a",{onClick:t[0]||(t[0]=e=>e.preventDefault()),innerHTML:e.$sanitize(e.allSitesText),tabindex:"4",href:e.href},null,8,Qi)])}var Zi=Object(E["defineComponent"])({props:{href:String,allSitesText:String},emits:["click"],methods:{onClick(e){this.$emit("click",e)}}});Zi.render=Xi;var en=Zi,tn=Object(E["defineComponent"])({props:{modelValue:Object,showSelectedSite:{type:Boolean,default:!1},showAllSitesItem:{type:Boolean,default:!0},switchSiteOnSelect:{type:Boolean,default:!0},onlySitesWithAdminAccess:{type:Boolean,default:!1},name:{type:String,default:""},allSitesText:{type:String,default:a("General_MultiSitesSummary")},allSitesLocation:{type:String,default:"bottom"},placeholder:String,defaultToFirstSite:Boolean,sitesToExclude:{type:Array,default:()=>[]},onlySitesWithAtLeastWriteAccess:{type:Boolean,default:!1},siteTypesToExclude:{type:Array,default:()=>[]}},emits:["update:modelValue","blur"],components:{AllSitesLink:en},directives:{FocusAnywhereButHere:Je,FocusIf:Qe,Tooltips:tt},watch:{searchTerm(){this.onSearchTermChanged()}},data(){return{searchTerm:"",activeSiteId:""+I.idSite,showSitesList:!1,isLoading:!1,sites:[],autocompleteMinSites:parseInt(I.config.autocomplete_min_sites,10)}},created(){this.searchSite=we(this.searchSite),!this.modelValue&&I.idSite&&this.$emit("update:modelValue",{id:I.idSite,name:I.helper.htmlDecode(I.siteName)})},mounted(){window.initTopControls(),this.loadInitialSites().then(()=>{this.shouldDefaultToFirstSite&&this.$emit("update:modelValue",{id:this.sites[0].idsite,name:this.sites[0].name})});const e=a("CoreHome_ShortcutWebsiteSelector");I.helper.registerShortcut("w",e,e=>{if(e.altKey)return;e.preventDefault?e.preventDefault():e.returnValue=!1;const t=this.$refs.selectorLink;t&&(t.click(),t.focus())})},computed:{shouldFocusOnSearch(){return this.showSitesList&&this.autocompleteMinSites<=this.sites.length||this.searchTerm},selectorLinkTitle(){return this.hasMultipleSites&&this.displayedModelValue?a("CoreHome_ChangeCurrentWebsite",this.htmlEntities(this.displayedModelValue.name)):""},hasMultipleSites(){const e=Mi.matchesCurrentFilteredState(this.onlySitesWithAdminAccess,this.sitesToExclude?this.sitesToExclude:[],this.onlySitesWithAtLeastWriteAccess,this.siteTypesToExclude?this.siteTypesToExclude:[])&&Mi.initialSitesFiltered.value&&Mi.initialSitesFiltered.value.length?Mi.initialSitesFiltered.value:Mi.initialSites.value;return e&&e.length>1},firstSiteName(){const e=Mi.initialSitesFiltered.value&&Mi.initialSitesFiltered.value.length?Mi.initialSitesFiltered.value:Mi.initialSites.value;return e&&e.length>0?e[0].name:""},urlAllSites(){const e=H.stringify(Object.assign(Object.assign({},H.urlParsed.value),{},{module:"MultiSites",action:"index",date:H.parsed.value.date,period:H.parsed.value.period}));return"?"+e},shouldDefaultToFirstSite(){var e;return!(null!==(e=this.modelValue)&&void 0!==e&&e.id)&&(!this.hasMultipleSites||this.defaultToFirstSite)&&this.sites[0]},displayedModelValue(){return this.modelValue?this.modelValue:I.idSite?{id:I.idSite,name:I.helper.htmlDecode(I.siteName)}:this.shouldDefaultToFirstSite?{id:this.sites[0].idsite,name:this.sites[0].name}:null},tooltipContent(){return function(){const e=$(this).attr("title")||"";return I.helper.htmlEntities(e)}}},methods:{onSearchTermChanged(){this.searchTerm?(this.isLoading=!0,this.searchSite(this.searchTerm)):(this.isLoading=!1,this.loadInitialSites())},onAllSitesClick(e){this.switchSite({id:"all",name:this.$props.allSitesText},e),this.showSitesList=!1},switchSite(e,t){const o=-1!==navigator.userAgent.indexOf("Mac OS X")?t.metaKey:t.ctrlKey;t&&o&&t.target&&t.target.href?window.open(t.target.href,"_blank"):(this.$emit("update:modelValue",{id:e.id,name:e.name}),this.switchSiteOnSelect&&this.activeSiteId!==e.id&&Mi.loadSite(e.id))},onBlur(){this.showSitesList=!1,this.$emit("blur")},onClickSelector(){this.hasMultipleSites&&(this.showSitesList=!this.showSitesList,this.isLoading||this.searchTerm||this.loadInitialSites())},onPressEnter(e){"Enter"===e.key&&(e.preventDefault(),this.showSitesList=!this.showSitesList,this.showSitesList&&!this.isLoading&&this.loadInitialSites())},getMatchedSiteName(e){const t=e.toUpperCase().indexOf(this.searchTerm.toUpperCase());if(-1===t||this.isLoading)return this.htmlEntities(e);const o=this.htmlEntities(e.substring(0,t)),i=this.htmlEntities(e.substring(t+this.searchTerm.length));return`${o}${this.searchTerm}${i}`},loadInitialSites(){return Mi.loadInitialSites(this.onlySitesWithAdminAccess,this.sitesToExclude?this.sitesToExclude:[],this.onlySitesWithAtLeastWriteAccess,this.siteTypesToExclude?this.siteTypesToExclude:[]).then(e=>{this.sites=e||[]})},searchSite(e){this.isLoading=!0,Mi.searchSite(e,this.onlySitesWithAdminAccess,this.sitesToExclude?this.sitesToExclude:[],this.onlySitesWithAtLeastWriteAccess,this.siteTypesToExclude?this.siteTypesToExclude:[]).then(t=>{e===this.searchTerm&&t&&(this.sites=t)}).finally(()=>{this.isLoading=!1})},getUrlForSiteId(e){const t=H.stringify(Object.assign(Object.assign({},H.urlParsed.value),{},{segment:"",idSite:e})),o=H.stringify(Object.assign(Object.assign({},H.hashParsed.value),{},{segment:"",idSite:e}));return`?${t}#?${o}`},htmlEntities(e){return I.helper.htmlEntities(e)}}});tn.render=Ki;var on=tn;const nn={ref:"root",class:"quickAccessInside"},an=["title","placeholder"],rn={class:"dropdown"},sn={class:"no-result"},ln=["onClick"],cn=["onMouseenter","onClick"],dn={class:"quickAccessMatomoSearch"},un=["onMouseenter","onClick"],mn=["textContent"],pn={class:"quick-access-category helpCategory"},hn=["href"];function gn(e,t,o,i,n,a){const r=Object(E["resolveDirective"])("focus-if"),s=Object(E["resolveDirective"])("tooltips"),l=Object(E["resolveDirective"])("focus-anywhere-but-here");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",nn,[Object(E["createElementVNode"])("span",{class:"icon-search",onMouseenter:t[0]||(t[0]=t=>e.searchActive=!0)},null,32),Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{class:"s",onKeydown:t[1]||(t[1]=t=>e.onKeypress(t)),onFocus:t[2]||(t[2]=t=>e.searchActive=!0),"onUpdate:modelValue":t[3]||(t[3]=t=>e.searchTerm=t),type:"text",tabindex:"2",title:e.quickAccessTitle,placeholder:e.translate("General_Search"),ref:"input"},null,40,an),[[E["vModelText"],e.searchTerm],[r,{focused:e.searchActive}],[s]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",rn,[Object(E["withDirectives"])(Object(E["createElementVNode"])("ul",null,[Object(E["createElementVNode"])("li",sn,Object(E["toDisplayString"])(e.translate("General_SearchNoResults")),1)],512),[[E["vShow"],!(e.numMenuItems>0||e.sites.length)]]),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menuItems,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",{key:t.title},[Object(E["createElementVNode"])("li",{class:"quick-access-category",onClick:o=>{e.searchTerm=t.title,e.searchMenu(e.searchTerm)}},Object(E["toDisplayString"])(t.title),9,ln),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.items,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["result",{selected:t.menuIndex===e.searchIndex}]),onMouseenter:o=>e.searchIndex=t.menuIndex,onClick:o=>e.selectMenuItem(t.index),key:t.index},[Object(E["createElementVNode"])("a",null,Object(E["toDisplayString"])(t.name.trim()),1)],42,cn))),128))]))),128)),Object(E["createElementVNode"])("ul",dn,[Object(E["withDirectives"])(Object(E["createElementVNode"])("li",{class:"quick-access-category websiteCategory"},Object(E["toDisplayString"])(e.translate("SitesManager_Sites")),513),[[E["vShow"],e.hasSitesSelector&&e.sites.length||e.isLoading]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("li",{class:"no-result"},Object(E["toDisplayString"])(e.translate("MultiSites_LoadingWebsites")),513),[[E["vShow"],e.hasSitesSelector&&e.isLoading]]),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.sites,(t,o)=>Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["result",{selected:e.numMenuItems+o===e.searchIndex}]),onMouseenter:t=>e.searchIndex=e.numMenuItems+o,onClick:o=>e.selectSite(t.idsite),key:t.idsite},[Object(E["createElementVNode"])("a",{textContent:Object(E["toDisplayString"])(t.name)},null,8,mn)],42,un)),[[E["vShow"],e.hasSitesSelector&&!e.isLoading]])),128))]),Object(E["createElementVNode"])("ul",null,[Object(E["createElementVNode"])("li",pn,Object(E["toDisplayString"])(e.translate("General_HelpResources")),1),Object(E["createElementVNode"])("li",{class:Object(E["normalizeClass"])([{selected:"help"===e.searchIndex},"quick-access-help"]),onMouseenter:t[4]||(t[4]=t=>e.searchIndex="help")},[Object(E["createElementVNode"])("a",{href:"https://matomo.org?mtm_campaign=App_Help&mtm_source=Matomo_App&mtm_keyword=QuickSearch&s="+encodeURIComponent(e.searchTerm),target:"_blank"},Object(E["toDisplayString"])(e.translate("CoreHome_SearchOnMatomo",e.searchTerm)),9,hn)],34)])],512),[[E["vShow"],e.searchTerm&&e.searchActive]])])),[[l,{blur:e.onBlur}]])}const{ListingFormatter:bn}=window;function fn(e){const t=e.getBoundingClientRect(),o=window.$(window);return t.top>=0&&t.left>=0&&t.bottom<=o.height()&&t.right<=o.width()}function vn(e){e&&e.scrollIntoView&&e.scrollIntoView()}var On=Object(E["defineComponent"])({directives:{FocusAnywhereButHere:Je,FocusIf:Qe,Tooltips:tt},watch:{searchActive(e){const t=this.$refs.root;if(!t||!t.parentElement)return;const o=t.parentElement.classList;o.toggle("active",e),o.toggle("expanded",e)}},mounted(){const e=this.$refs.root;e&&e.parentElement&&e.parentElement.classList.add("quick-access","piwikSelector"),"undefined"!==typeof window.initTopControls&&window.initTopControls&&window.initTopControls(),I.helper.registerShortcut("f",a("CoreHome_ShortcutSearch"),e=>{e.altKey||(e.preventDefault(),vn(this.$refs.root),this.activateSearch())})},data(){const e=!!document.querySelector(".segmentEditorPanel");return{menuItems:[],numMenuItems:0,searchActive:!1,searchTerm:"",searchIndex:0,menuIndexCounter:-1,topMenuItems:null,leftMenuItems:null,segmentItems:null,hasSegmentSelector:e,sites:[],isLoading:!1}},created(){this.searchMenu=we(this.searchMenu.bind(this))},computed:{hasSitesSelector(){return!!document.querySelector('.top_controls .siteSelector,.top_controls [vue-entry="CoreHome.SiteSelector"]')},quickAccessTitle(){const e=[a("CoreHome_MenuEntries")];return this.hasSegmentSelector&&e.push(a("CoreHome_Segments")),this.hasSitesSelector&&e.push(a("SitesManager_Sites")),a("CoreHome_QuickAccessTitle",bn.formatAnd(e))}},emits:["itemSelected","blur"],methods:{onKeypress(e){const t=this.searchTerm&&this.searchActive,o=9===e.which,i=27===e.which;38===e.which?(this.highlightPreviousItem(),e.preventDefault()):40===e.which?(this.highlightNextItem(),e.preventDefault()):13===e.which?this.clickQuickAccessMenuItem():o&&t||i&&t?this.deactivateSearch():setTimeout(()=>{this.searchActive=!0,this.searchMenu(this.searchTerm)})},highlightPreviousItem(){this.searchIndex-1<0?this.searchIndex=0:this.searchIndex-=1,this.makeSureSelectedItemIsInViewport()},highlightNextItem(){const e=this.$refs.root.querySelectorAll("li.result").length;e<=this.searchIndex+1?this.searchIndex=e-1:this.searchIndex+=1,this.makeSureSelectedItemIsInViewport()},clickQuickAccessMenuItem(){const e=this.getCurrentlySelectedElement();e&&setTimeout(()=>{e.click(),this.$emit("itemSelected",e)},20)},deactivateSearch(){this.searchTerm="",this.searchActive=!1,this.$refs.input&&this.$refs.input.blur()},makeSureSelectedItemIsInViewport(){const e=this.getCurrentlySelectedElement();e&&!fn(e)&&vn(e)},getCurrentlySelectedElement(){const e=this.$refs.root.querySelectorAll("li.result");if(e&&e.length&&e.item(this.searchIndex))return e.item(this.searchIndex)},searchMenu(e){const t=e.toLowerCase();let o=-1;const i={},n=[],a=e=>{const t=Object.assign({},e);o+=1,t.menuIndex=o;const{category:a}=t;a in i||(n.push({title:a,items:[]}),i[a]=n.length-1);const r=i[a];n[r].items.push(t)};this.resetSearchIndex(),this.hasSitesSelector&&(this.isLoading=!0,Mi.searchSite(t).then(e=>{e&&(this.sites=e)}).finally(()=>{this.isLoading=!1}));const r=e=>-1!==e.name.toLowerCase().indexOf(t)||-1!==e.category.toLowerCase().indexOf(t);null===this.topMenuItems&&(this.topMenuItems=this.getTopMenuItems()),null===this.leftMenuItems&&(this.leftMenuItems=this.getLeftMenuItems()),null===this.segmentItems&&(this.segmentItems=this.getSegmentItems());const s=this.topMenuItems.filter(r),l=this.leftMenuItems.filter(r),c=this.segmentItems.filter(r);s.forEach(a),l.forEach(a),c.forEach(a),this.numMenuItems=s.length+l.length+c.length,this.menuItems=n},resetSearchIndex(){this.searchIndex=0,this.makeSureSelectedItemIsInViewport()},selectSite(e){Mi.loadSite(e)},selectMenuItem(e){const t=document.querySelector(`[quick_access='${e}']`);if(t){this.deactivateSearch();const e=t.getAttribute("href");if(e&&e.length>10&&t&&t.click)try{t.click()}catch(o){window.$(t).click()}else window.$(t).click()}},onBlur(){this.searchActive=!1,this.$emit("blur")},activateSearch(){this.searchActive=!0},getTopMenuItems(){const e=a("CoreHome_Menu"),t=[];return document.querySelectorAll("nav .sidenav li > a, nav .sidenav li > div > a").forEach(o=>{var i;let n=null===(i=o.textContent)||void 0===i?void 0:i.trim();var a;(!n||null!=o.parentElement&&null!=o.parentElement.tagName&&"DIV"===o.parentElement.tagName)&&(n=null===(a=o.getAttribute("title"))||void 0===a?void 0:a.trim());n&&(t.push({name:n,index:this.menuIndexCounter+=1,category:e}),o.setAttribute("quick_access",""+this.menuIndexCounter))}),t},getLeftMenuItems(){const e=[];return document.querySelectorAll("#secondNavBar .menuTab").forEach(t=>{var o;const i=window.$(t).find("> .item");let n=(null===(o=i[0])||void 0===o?void 0:o.innerText.trim())||"";n&&-1!==n.lastIndexOf("\n")&&(n=n.slice(0,n.lastIndexOf("\n")).trim()),window.$(t).find("li .item").each((t,o)=>{var i;const a=null===(i=o.textContent)||void 0===i?void 0:i.trim();a&&(e.push({name:a,category:n,index:this.menuIndexCounter+=1}),o.setAttribute("quick_access",""+this.menuIndexCounter))})}),e},getSegmentItems(){if(!this.hasSegmentSelector)return[];const e=a("CoreHome_Segments"),t=[];return document.querySelectorAll(".segmentList [data-idsegment]").forEach(o=>{var i;const n=null===(i=o.querySelector(".segname"))||void 0===i||null===(i=i.textContent)||void 0===i?void 0:i.trim();n&&(t.push({name:n,category:e,index:this.menuIndexCounter+=1}),o.setAttribute("quick_access",""+this.menuIndexCounter))}),t}}});On.render=gn;var jn=On;const yn={class:"fieldArray form-group"},wn={key:0,class:"fieldUiControl"},Sn=["onClick","title"];function kn(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Field");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",yn,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.modelValue,(t,o)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:Object(E["normalizeClass"])(["fieldArrayTable multiple valign-wrapper",{["fieldArrayTable"+o]:!0}]),key:o},[e.field.uiControl?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",wn,[Object(E["createVNode"])(r,{"full-width":!0,"model-value":t,options:e.field.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(t,o),"model-modifiers":e.field.modelModifiers,placeholder:" ",uicontrol:e.field.uiControl,title:e.field.title,name:`${e.name}-${o}`,id:`${e.id}-${o}`,"template-file":e.field.templateFile,component:e.field.component},null,8,["model-value","options","onUpdate:modelValue","model-modifiers","uicontrol","title","name","id","template-file","component"])])):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])(Object(E["createElementVNode"])("span",{onClick:t=>e.removeEntry(o),class:"icon-minus valign",title:e.translate("General_Remove")},null,8,Sn),[[E["vShow"],o+1!==e.modelValue.length]])],2))),128))])}const Cn=ve("CorePluginsAdmin","Field");var En=Object(E["defineComponent"])({props:{modelValue:Array,name:String,id:String,field:Object,rows:String},components:{Field:Cn},emits:["update:modelValue"],watch:{modelValue(e){this.checkEmptyModelValue(e)}},mounted(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue(e){e&&e.length&&""===e.slice(-1)[0]||this.rows&&!((this.modelValue||[]).length-1&&this.modelValue){const t=this.modelValue.filter((t,o)=>o!==e);this.$emit("update:modelValue",t)}}}});En.render=kn;var Dn=En;const Pn={class:"multiPairField form-group"},Tn={key:1,class:"fieldUiControl fieldUiControl2"},Vn={key:2,class:"fieldUiControl fieldUiControl3"},Nn={key:3,class:"fieldUiControl fieldUiControl4"},xn=["onClick","title"];function Bn(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Field");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Pn,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.modelValue,(t,o)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:Object(E["normalizeClass"])(["multiPairFieldTable multiple valign-wrapper",{["multiPairFieldTable"+o]:!0,[`has${e.fieldCount}Fields`]:!0}]),key:o},[e.field1?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,class:Object(E["normalizeClass"])(["fieldUiControl fieldUiControl1",{hasMultiFields:e.field1.type&&e.field2.type}])},[Object(E["createVNode"])(r,{"full-width":!0,"model-value":t[e.field1.key],options:e.field1.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field1.key,t),"model-modifiers":e.field1.modelModifiers,placeholder:" ",uicontrol:e.field1.uiControl,name:`${e.name}-p1-${o}`,id:`${e.id}-p1-${o}`,title:e.field1.title,"template-file":e.field1.templateFile,component:e.field1.component},null,8,["model-value","options","onUpdate:modelValue","model-modifiers","uicontrol","name","id","title","template-file","component"])],2)):Object(E["createCommentVNode"])("",!0),e.field2?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Tn,[Object(E["createVNode"])(r,{"full-width":!0,options:e.field2.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field2.key,t),"model-value":t[e.field2.key],"model-modifiers":e.field2.modelModifiers,placeholder:" ",uicontrol:e.field2.uiControl,name:`${e.name}-p2-${o}`,id:`${e.id}-p2-${o}`,title:e.field2.title,"template-file":e.field2.templateFile,component:e.field2.component},null,8,["options","onUpdate:modelValue","model-value","model-modifiers","uicontrol","name","id","title","template-file","component"])])):Object(E["createCommentVNode"])("",!0),e.field3?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Vn,[Object(E["createVNode"])(r,{"full-width":!0,options:e.field3.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field3.key,t),"model-value":t[e.field3.key],"model-modifiers":e.field3.modelModifiers,placeholder:" ",uicontrol:e.field3.uiControl,name:`${e.name}-p3-${o}`,id:`${e.id}-p3-${o}`,title:e.field3.title,"template-file":e.field3.templateFile,component:e.field3.component},null,8,["options","onUpdate:modelValue","model-value","model-modifiers","uicontrol","name","id","title","template-file","component"])])):Object(E["createCommentVNode"])("",!0),e.field4?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Nn,[Object(E["createVNode"])(r,{"full-width":!0,options:e.field4.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field4.key,t),"model-value":t[e.field4.key],"model-modifiers":e.field4.modelModifiers,placeholder:" ",uicontrol:e.field4.uiControl,name:`${e.name}-p4-${o}`,id:`${e.id}-p4-${o}`,title:e.field4.title,"template-file":e.field4.templateFile,component:e.field4.component},null,8,["options","onUpdate:modelValue","model-value","model-modifiers","uicontrol","name","id","title","template-file","component"])])):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])(Object(E["createElementVNode"])("span",{onClick:t=>e.removeEntry(o),class:"icon-minus valign",title:e.translate("General_Remove")},null,8,xn),[[E["vShow"],o+1!==e.modelValue.length]])],2))),128))])}const In=ve("CorePluginsAdmin","Field");var Mn=Object(E["defineComponent"])({props:{modelValue:Array,name:String,id:String,field1:Object,field2:Object,field3:Object,field4:Object,rows:Number},components:{Field:In},computed:{fieldCount(){return this.field1&&this.field2&&this.field3&&this.field4?4:this.field1&&this.field2&&this.field3?3:this.field1&&this.field2?2:this.field1?1:0}},emits:["update:modelValue"],watch:{modelValue(e){this.checkEmptyModelValue(e)}},mounted(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue(e){e&&e.length&&!this.isEmptyValue(e.slice(-1)[0])||this.rows&&!(this.modelValue.length-1&&this.modelValue){const t=this.modelValue.filter((t,o)=>o!==e);this.$emit("update:modelValue",t)}},isEmptyValue(e){const{fieldCount:t}=this;if(4===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key]&&!e[this.field4.key])return!1}else if(3===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key])return!1}else if(2===t){if(!e[this.field1.key]&&!e[this.field2.key])return!1}else if(1===t&&!e[this.field1.key])return!1;return!0},makeEmptyValue(){const e={};return this.field1&&this.field1.key&&(e[this.field1.key]=""),this.field2&&this.field2.key&&(e[this.field2.key]=""),this.field3&&this.field3.key&&(e[this.field3.key]=""),this.field4&&this.field4.key&&(e[this.field4.key]=""),e}}});Mn.render=Bn;var Ln=Mn;const Fn=["disabled"],An=Object(E["createElementVNode"])("span",{class:"icon-chevron-left"},null,-1),_n=[An],Rn=["title"],Hn=Object(E["createElementVNode"])("span",{class:"icon icon-calendar"},null,-1),$n={id:"periodMore",class:"dropdown"},Un={class:"flex"},qn={key:0,class:"period-date"},Wn={class:"period-type"},zn={id:"otherPeriods"},Gn=["onDblclick","title"],Yn=["id","checked","onChange","onDblclick"],Jn={key:0,class:"compare-checkbox"},Kn={id:"comparePeriodToDropdown"},Qn={key:1,class:"compare-date-range"},Xn={id:"comparePeriodStartDate"},Zn=Object(E["createElementVNode"])("span",{class:"compare-dates-separator"},null,-1),ea={id:"comparePeriodEndDate"},ta={class:"apply-button-container"},oa=["disabled","value"],ia={key:2,id:"ajaxLoadingCalendar"},na={class:"loadingSegment"},aa=["disabled"],ra=Object(E["createElementVNode"])("span",{class:"icon-chevron-right"},null,-1),sa=[ra];function la(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("DateRangePicker"),s=Object(E["resolveComponent"])("PeriodDatePicker"),l=Object(E["resolveComponent"])("Field"),c=Object(E["resolveComponent"])("ActivityIndicator"),d=Object(E["resolveDirective"])("tooltips"),u=Object(E["resolveDirective"])("expand-on-click");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{ref:"root",class:Object(E["normalizeClass"])(["periodSelector piwikSelector",{"periodSelector-withPrevNext":e.canShowMovePeriod}])},[e.canShowMovePeriod?(Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{key:0,class:"move-period move-period-prev",onClick:t[0]||(t[0]=t=>e.movePeriod(-1)),disabled:e.isPeriodMoveDisabled(-1)},_n,8,Fn)):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{ref:"title",id:"date",class:"title",tabindex:"4",title:e.translate("General_ChooseDate",e.currentlyViewingText)},[Hn,Object(E["createTextVNode"])(" "+Object(E["toDisplayString"])(e.currentlyViewingText),1)],8,Rn)),[[d]]),Object(E["createElementVNode"])("div",$n,[Object(E["createElementVNode"])("div",Un,[Object(E["createElementVNode"])("div",null,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{class:"period-range","start-date":e.startRangeDate,"end-date":e.endRangeDate,onRangeChange:t[1]||(t[1]=t=>e.onRangeChange(t.start,t.end)),onSubmit:t[2]||(t[2]=t=>e.onApplyClicked())},null,8,["start-date","end-date"]),[[E["vShow"],"range"===e.selectedPeriod]]),"range"!==e.selectedPeriod?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",qn,[Object(E["createVNode"])(s,{id:"datepicker",period:e.selectedPeriod,date:e.periodValue===e.selectedPeriod?e.dateValue:null,onSelect:t[3]||(t[3]=t=>e.setPiwikPeriodAndDate(e.selectedPeriod,t.date))},null,8,["period","date"])])):Object(E["createCommentVNode"])("",!0)]),Object(E["createElementVNode"])("div",Wn,[Object(E["createElementVNode"])("h6",null,Object(E["toDisplayString"])(e.translate("General_Period")),1),Object(E["createElementVNode"])("div",zn,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.periodsFiltered,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("p",{key:o},[Object(E["createElementVNode"])("label",{class:Object(E["normalizeClass"])({"selected-period-label":o===e.selectedPeriod}),onDblclick:t=>e.changeViewedPeriod(o),title:o===e.periodValue?"":e.translate("General_DoubleClickToChangePeriod")},[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"radio",name:"period",id:"period_id_"+o,"onUpdate:modelValue":t[4]||(t[4]=t=>e.selectedPeriod=t),checked:e.selectedPeriod===o,onChange:t=>e.selectedPeriod=o,onDblclick:t=>e.changeViewedPeriod(o)},null,40,Yn),[[E["vModelRadio"],e.selectedPeriod]]),Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.getPeriodDisplayText(o)),1)],42,Gn)]))),128))])])]),e.isComparisonEnabled?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Jn,[Object(E["createElementVNode"])("label",null,[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{id:"comparePeriodTo",type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=t=>e.isComparing=t)},null,512),[[E["vModelCheckbox"],e.isComparing]]),Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translate("General_CompareTo")),1)]),Object(E["createElementVNode"])("div",Kn,[Object(E["createVNode"])(l,{modelValue:e.comparePeriodType,"onUpdate:modelValue":t[6]||(t[6]=t=>e.comparePeriodType=t),style:Object(E["normalizeStyle"])({visibility:e.isComparing?"visible":"hidden"}),name:"comparePeriodToDropdown",uicontrol:"select",options:e.comparePeriodDropdownOptions,"full-width":!0,disabled:!e.isComparing},null,8,["modelValue","style","options","disabled"])])])):Object(E["createCommentVNode"])("",!0),e.isComparing&&"custom"===e.comparePeriodType?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Qn,[Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",Xn,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(l,{modelValue:e.compareStartDate,"onUpdate:modelValue":t[7]||(t[7]=t=>e.compareStartDate=t),name:"comparePeriodStartDate",uicontrol:"text","full-width":!0,title:e.translate("CoreHome_StartDate"),placeholder:"YYYY-MM-DD"},null,8,["modelValue","title"])])]),Zn,Object(E["createElementVNode"])("div",ea,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(l,{modelValue:e.compareEndDate,"onUpdate:modelValue":t[8]||(t[8]=t=>e.compareEndDate=t),name:"comparePeriodEndDate",uicontrol:"text","full-width":!0,title:e.translate("CoreHome_EndDate"),placeholder:"YYYY-MM-DD"},null,8,["modelValue","title"])])])])])):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",ta,[Object(E["createElementVNode"])("input",{type:"submit",id:"calendarApply",class:"btn",onClick:t[9]||(t[9]=t=>e.onApplyClicked()),disabled:!e.isApplyEnabled(),value:e.translate("General_Apply")},null,8,oa)]),e.isLoadingNewPage?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ia,[Object(E["createVNode"])(c,{loading:!0}),Object(E["createElementVNode"])("div",na,Object(E["toDisplayString"])(e.translate("SegmentEditor_LoadingSegmentedDataMayTakeSomeTime")),1)])):Object(E["createCommentVNode"])("",!0)]),e.canShowMovePeriod?(Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{key:1,class:"move-period move-period-next",onClick:t[10]||(t[10]=t=>e.movePeriod(1)),disabled:e.isPeriodMoveDisabled(1)},sa,8,aa)):Object(E["createCommentVNode"])("",!0)],2)),[[u,{expander:"title",onExpand:e.onExpand,onClosed:e.onClosed}]])}const ca=ve("CorePluginsAdmin","Field"),da=I.helper.htmlDecode(" "),ua=["custom","previousPeriod","previousYear"],ma=[{key:"custom",value:a("General_Custom")},{key:"previousPeriod",value:a("General_PreviousPeriod").replace(/\s+/,da)},{key:"previousYear",value:a("General_PreviousYear").replace(/\s+/,da)}],pa=new Date(I.minDateYear,I.minDateMonth-1,I.minDateDay),ha=new Date(I.maxDateYear,I.maxDateMonth-1,I.maxDateDay);function ga(e){return"[object Date]"===Object.prototype.toString.call(e)&&!Number.isNaN(e.getTime())}var ba=Object(E["defineComponent"])({props:{periods:Array},components:{DateRangePicker:ti,PeriodDatePicker:ri,Field:ca,ActivityIndicator:_e},directives:{ExpandOnClick:ht,Tooltips:tt},data(){const e=H.parsed.value.period;return{comparePeriodDropdownOptions:ma,periodValue:e,dateValue:null,selectedPeriod:e,startRangeDate:null,endRangeDate:null,isRangeValid:null,isLoadingNewPage:!1,isComparing:null,comparePeriodType:"previousPeriod",compareStartDate:"",compareEndDate:""}},mounted(){I.on("hidePeriodSelector",()=>{window.$(this.$refs.root).parent("#periodString").hide()}),I.on("matomoPageChange",()=>{window.$(this.$refs.root).parent("#periodString").show()}),this.isComparing=Do.isComparingPeriods(),Object(E["watch"])(()=>Do.isComparingPeriods(),e=>{this.isComparing=e}),this.updateSelectedValuesFromHash(),Object(E["watch"])(()=>H.parsed.value,this.updateSelectedValuesFromHash),this.updateComparisonValuesFromStore(),Object(E["watch"])(()=>Do.getPeriodComparisons(),this.updateComparisonValuesFromStore),window.initTopControls(),this.handleZIndexPositionRelativeCompareDropdownIssue()},computed:{currentlyViewingText(){let e;if("range"===this.periodValue){if(!this.startRangeDate||!this.endRangeDate)return a("General_Error");e=`${this.startRangeDate},${this.endRangeDate}`}else{if(!this.dateValue)return a("General_Error");e=d(this.dateValue)}try{return c.parse(this.periodValue,e).getPrettyString()}catch(t){return a("General_Error")}},isComparisonEnabled(){return Do.isComparisonEnabled()},periodsFiltered(){return(this.periods||[]).filter(e=>c.isRecognizedPeriod(e))},selectedComparisonParams(){if(!this.isComparing)return{};if("custom"===this.comparePeriodType)return{comparePeriods:["range"],comparePeriodType:"custom",compareDates:[`${this.compareStartDate},${this.compareEndDate}`]};if("previousPeriod"===this.comparePeriodType)return{comparePeriods:[this.selectedPeriod],comparePeriodType:"previousPeriod",compareDates:[this.previousPeriodDateToSelectedPeriod]};if("previousYear"===this.comparePeriodType){const e="range"===this.selectedPeriod?`${this.startRangeDate},${this.endRangeDate}`:d(this.dateValue),t=c.parse(this.selectedPeriod,e).getDateRange();return t[0].setFullYear(t[0].getFullYear()-1),t[1].setFullYear(t[1].getFullYear()-1),"range"===this.selectedPeriod?{comparePeriods:["range"],comparePeriodType:"previousYear",compareDates:[`${d(t[0])},${d(t[1])}`]}:{comparePeriods:[this.selectedPeriod],comparePeriodType:"previousYear",compareDates:[d(t[0])]}}return console.warn("Unknown compare period type: "+this.comparePeriodType),{}},previousPeriodDateToSelectedPeriod(){if("range"===this.selectedPeriod){const e=m(this.startRangeDate),t=m(this.endRangeDate),o=C.getLastNRange("day",2,e).startDate,i=Math.floor((t.valueOf()-e.valueOf())/864e5),n=C.getLastNRange("day",1+i,o);return`${d(n.startDate)},${d(n.endDate)}`}const e=C.getLastNRange(this.selectedPeriod,2,this.dateValue).startDate;return d(e)},selectedDateString(){if("range"===this.selectedPeriod){const e=this.startRangeDate,t=this.endRangeDate,o=m(e),i=m(t);return!ga(o)||!ga(i)||o>i?(window.$("#alert").find("h2").text(a("General_InvalidDateRange")),I.helper.modalConfirm("#alert",{}),null):`${e},${t}`}return d(this.dateValue)},isErrorDisplayed(){return this.currentlyViewingText===a("General_Error")},isRangeSelection(){return"range"===this.periodValue},canShowMovePeriod(){return!this.isRangeSelection&&!this.isErrorDisplayed}},methods:{onExpand(e){const t=0===e.detail;t&&window.$(this.$refs.root).find(".ui-datepicker-month").focus()},onClosed(e){const t=0===e.detail;t&&window.$(this.$refs.title).focus()},handleZIndexPositionRelativeCompareDropdownIssue(){const e=window.$(this.$refs.root);e.on("focus","#comparePeriodToDropdown .select-dropdown",()=>{e.addClass("compare-dropdown-open")}).on("blur","#comparePeriodToDropdown .select-dropdown",()=>{e.removeClass("compare-dropdown-open")})},changeViewedPeriod(e){e!==this.periodValue&&"range"!==e&&this.setPiwikPeriodAndDate(e,this.dateValue)},setPiwikPeriodAndDate(e,t){this.periodValue=e,this.selectedPeriod=e,this.dateValue=t;const o=d(t);this.setRangeStartEndFromPeriod(e,o),this.propagateNewUrlParams(o,this.selectedPeriod),window.initTopControls()},propagateNewUrlParams(e,t){const o=this.selectedComparisonParams;let i;I.helper.isReportingPage()?(this.closePeriodSelector(),i=H.hashParsed.value):(this.isLoadingNewPage=!0,i=H.parsed.value);const n=Object.assign({},i);delete n.comparePeriods,delete n.comparePeriodType,delete n.compareDates,H.updateLocation(Object.assign(Object.assign({},n),{},{date:e,period:t},o))},onApplyClicked(){if("range"===this.selectedPeriod){const e=this.selectedDateString;if(!e)return;return this.periodValue="range",void this.propagateNewUrlParams(e,"range")}this.setPiwikPeriodAndDate(this.selectedPeriod,this.dateValue)},updateComparisonValuesFromStore(){this.comparePeriodType="previousPeriod",this.compareStartDate="",this.compareEndDate="";const e=Do.getPeriodComparisons();if(e.length<2)return;const t=H.parsed.value.comparePeriodType;if(!ua.includes(t))return;if(this.comparePeriodType=t,"custom"!==this.comparePeriodType||"range"!==e[1].params.period)return;let o;try{o=c.parse(e[1].params.period,e[1].params.date)}catch(a){return}const[i,n]=o.getDateRange();this.compareStartDate=d(i),this.compareEndDate=d(n)},updateSelectedValuesFromHash(){const e=H.parsed.value.date,t=H.parsed.value.period;this.periodValue=t,this.selectedPeriod=t,this.dateValue=null,this.startRangeDate=null,this.endRangeDate=null;try{c.parse(t,e)}catch(o){return}if("range"===t){const o=c.get(t).parse(e),[i,n]=o.getDateRange();this.dateValue=i,this.startRangeDate=d(i),this.endRangeDate=d(n)}else this.dateValue=m(e),this.setRangeStartEndFromPeriod(t,e)},setRangeStartEndFromPeriod(e,t){const o=c.parse(e,t).getDateRange();this.startRangeDate=d(o[0]ha?ha:o[1])},getPeriodDisplayText(e){return c.get(e).getDisplayText()},onRangeChange(e,t){e&&t?(this.isRangeValid=!0,this.startRangeDate=e,this.endRangeDate=t):this.isRangeValid=!1},isApplyEnabled(){return!("range"===this.selectedPeriod&&!this.isRangeValid)&&!(this.isComparing&&"custom"===this.comparePeriodType&&!this.isCompareRangeValid())},closePeriodSelector(){this.$refs.root.classList.remove("expanded")},isCompareRangeValid(){try{m(this.compareStartDate)}catch(e){return!1}try{m(this.compareEndDate)}catch(e){return!1}return!0},movePeriod(e){if(!this.canMovePeriod(e))return;let t=new Date;switch(null!=this.dateValue&&(t=this.dateValue),this.periodValue){case"day":t.setDate(t.getDate()+e);break;case"week":t.setDate(t.getDate()+7*e);break;case"month":t.setMonth(t.getMonth()+e);break;case"year":t.setFullYear(t.getFullYear()+e);break;default:break}this.dateValueha&&(this.dateValue=ha),this.onApplyClicked()},isPeriodMoveDisabled(e){return null===this.dateValue?this.isRangeSelection:this.isRangeSelection||!this.canMovePeriod(e)},canMovePeriod(e){if(null===this.dateValue)return!1;const t=-1===e?pa:ha;return!g(this.dateValue,t,this.periodValue)}}});ba.render=la;var fa=ba;const va={class:"reportingMenu"},Oa=["aria-label"],ja=["data-category-id"],ya=["onClick"],wa={class:"hidden"},Sa={key:2,role:"menu"},ka=["href","onClick","title"],Ca=["href","onClick"],Ea=["onClick"],Da=Object(E["createElementVNode"])("span",{class:"icon-help"},null,-1),Pa=[Da],Ta={id:"mobile-left-menu",class:"sidenav sidenav--reporting-menu-mobile hide-on-large-only"},Va=["data-category-id"],Na={key:1,class:"collapsible collapsible-accordion"},xa={class:"collapsible-header"},Ba={class:"collapsible-body"},Ia=["onClick","href"],Ma=["onClick","href"];function La(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("MenuItemsDropdown"),s=Object(E["resolveDirective"])("side-nav");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",va,[Object(E["createElementVNode"])("ul",{class:"navbar hide-on-med-and-down collapsible",role:"menu","aria-label":e.translate("CoreHome_MainNavigation")},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menu,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["menuTab",{active:t.id===e.activeCategory}]),role:"menuitem",key:t.id,"data-category-id":t.id},[t.component?(Object(E["openBlock"])(),Object(E["createBlock"])(Object(E["resolveDynamicComponent"])(t.component),{key:0,onAction:o=>e.loadCategory(t)},null,40,["onAction"])):Object(E["createCommentVNode"])("",!0),t.component?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,class:"item",tabindex:"5",href:"",onClick:Object(E["withModifiers"])(o=>e.loadCategory(t),["prevent"])},[Object(E["createElementVNode"])("span",{class:Object(E["normalizeClass"])("menu-icon "+(t.icon?t.icon:t.subcategories&&t.id===e.activeCategory?"icon-chevron-down":"icon-chevron-right"))},null,2),Object(E["createTextVNode"])(Object(E["toDisplayString"])(t.name)+" ",1),Object(E["createElementVNode"])("span",wa,Object(E["toDisplayString"])(e.translate("CoreHome_Menu")),1)],8,ya)),t.component?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",Sa,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.subcategories,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{role:"menuitem",class:Object(E["normalizeClass"])({active:(o.id===e.displayedSubcategory||o.isGroup&&e.activeSubsubcategory===e.displayedSubcategory)&&t.id===e.displayedCategory}),key:o.id},[o.isGroup?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0,"show-search":!0,"menu-title":e.htmlEntities(o.name)},{default:Object(E["withCtx"])(()=>[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(o.subcategories,i=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{class:Object(E["normalizeClass"])(["item",{active:i.id===e.activeSubsubcategory&&o.id===e.displayedSubcategory&&t.id===e.displayedCategory}]),tabindex:"5",href:"#?"+e.makeUrl(t,i),onClick:o=>e.loadSubcategory(t,i,o),title:i.tooltip,key:i.id},Object(E["toDisplayString"])(i.name),11,ka))),128))]),_:2},1032,["menu-title"])):Object(E["createCommentVNode"])("",!0),o.isGroup?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,href:"#?"+e.makeUrl(t,o),class:"item",onClick:i=>e.loadSubcategory(t,o,i),tabindex:"5"},Object(E["toDisplayString"])(o.name),9,Ca)),o.help?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:2,class:Object(E["normalizeClass"])(["item-help-icon",{active:e.helpShownCategory&&e.helpShownCategory.subcategory===o.id&&e.helpShownCategory.category===t.id&&o.help}]),tabindex:"5",href:"javascript:",onClick:i=>e.showHelp(t,o,i)},Pa,10,Ea)):Object(E["createCommentVNode"])("",!0)],2))),128))]))],10,ja))),128))],8,Oa),Object(E["createElementVNode"])("ul",Ta,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menu,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:"no-padding",key:t.id,"data-category-id":t.id},[t.component?(Object(E["openBlock"])(),Object(E["createBlock"])(Object(E["resolveDynamicComponent"])(t.component),{key:0,onAction:o=>e.loadCategory(t)},null,40,["onAction"])):Object(E["createCommentVNode"])("",!0),t.component?Object(E["createCommentVNode"])("",!0):Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",Na,[Object(E["createElementVNode"])("li",null,[Object(E["createElementVNode"])("a",xa,[Object(E["createElementVNode"])("i",{class:Object(E["normalizeClass"])(t.icon?t.icon:"icon-chevron-down")},null,2),Object(E["createTextVNode"])(Object(E["toDisplayString"])(t.name),1)]),Object(E["createElementVNode"])("div",Ba,[Object(E["createElementVNode"])("ul",null,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.subcategories,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:o.id},[o.isGroup?(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],{key:0},Object(E["renderList"])(o.subcategories,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{onClick:i=>e.loadSubcategory(t,o),href:"#?"+e.makeUrl(t,o),key:o.id},Object(E["toDisplayString"])(o.name),9,Ia))),128)):Object(E["createCommentVNode"])("",!0),o.isGroup?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,onClick:i=>e.loadSubcategory(t,o),href:"#?"+e.makeUrl(t,o)},Object(E["toDisplayString"])(o.name),9,Ma))]))),128))])])])])),[[s,{activator:e.sideNavActivator}]])],8,Va))),128))])])}function Fa(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */class Ii{constructor(){Bi(this,"state",Object(E["reactive"])({initialSites:[],isInitialized:!1})),Bi(this,"stateFiltered",Object(E["reactive"])({initialSites:[],isInitialized:!1,excludedSites:[],onlySitesWithAdminAccess:!1,onlySitesWithAtLeastWriteAccess:!1,siteTypesToExclude:[]})),Bi(this,"currentRequestAbort",null),Bi(this,"limitRequest",void 0),Bi(this,"initialSites",Object(E["computed"])(()=>Object(E["readonly"])(this.state.initialSites))),Bi(this,"initialSitesFiltered",Object(E["computed"])(()=>Object(E["readonly"])(this.stateFiltered.initialSites)))}isFiltered(e=!1,t=[],o=!1,i=[]){return t.length>0||e||o||i.length>0}matchesCurrentFilteredState(e=!1,t=[],o=!1,i=[]){return!this.stateFiltered.isInitialized&&!this.isFiltered(e,t,o,i)||this.stateFiltered.isInitialized&&t.length===this.stateFiltered.excludedSites.length&&t.every((e,t)=>e===this.stateFiltered.excludedSites[t])&&e===this.stateFiltered.onlySitesWithAdminAccess&&o===this.stateFiltered.onlySitesWithAtLeastWriteAccess&&i.length===this.stateFiltered.siteTypesToExclude.length&&i.every((e,t)=>e===this.stateFiltered.siteTypesToExclude[t])}loadInitialSites(e=!1,t=[],o=!1,i=[]){return this.state.isInitialized&&!this.isFiltered(e,t,o,i)?Promise.resolve(Object(E["readonly"])(this.state.initialSites)):this.stateFiltered.isInitialized&&this.matchesCurrentFilteredState(e,t,o,i)?Promise.resolve(Object(E["readonly"])(this.stateFiltered.initialSites)):this.isFiltered(e,t,o,i)?this.searchSite("%",e,t,o,i).then(n=>(this.stateFiltered.isInitialized=!0,this.stateFiltered.excludedSites=t,this.stateFiltered.onlySitesWithAdminAccess=e,this.stateFiltered.onlySitesWithAtLeastWriteAccess=o,this.stateFiltered.siteTypesToExclude=i,null!==n&&(this.stateFiltered.initialSites=n),n)):this.state.isInitialized?Promise.resolve(Object(E["readonly"])(this.state.initialSites)):this.searchSite("%",e,t,o,i).then(e=>(this.state.isInitialized=!0,null!==e&&(this.state.initialSites=e),e))}loadSite(e){"all"===e?H.updateUrl(Object.assign(Object.assign({},H.urlParsed.value),{},{module:"MultiSites",action:"index",date:H.parsed.value.date,period:H.parsed.value.period})):H.updateUrl(Object.assign(Object.assign({},H.urlParsed.value),{},{segment:"",idSite:e}),Object.assign(Object.assign({},H.hashParsed.value),{},{segment:"",idSite:e}))}searchSite(e,t=!1,o=[],i=!1,n=[]){return e?(this.currentRequestAbort&&this.currentRequestAbort.abort(),this.limitRequest||(this.limitRequest=K.fetch({method:"SitesManager.getNumWebsitesToDisplayPerPage"})),this.limitRequest.then(a=>{const r=a.value;let s="view";return t?s="admin":i&&(s="write"),this.currentRequestAbort=new AbortController,K.fetch({method:"SitesManager.getSitesWithMinimumAccess",permission:s,limit:r,pattern:e,sitesToExclude:o,siteTypesToExclude:n},{abortController:this.currentRequestAbort,abortable:!1})}).then(e=>e?this.processWebsitesList(e):null).finally(()=>{this.currentRequestAbort=null})):this.loadInitialSites(t,o,i,n)}processWebsitesList(e){let t=e;return t&&t.length?(t=t.map(e=>Object.assign(Object.assign({},e),{},{name:e.group?`[${e.group}] ${e.name}`:e.name})),t.sort((e,t)=>e.name.toLowerCase()t.name.toLowerCase()?1:0),t):[]}}var Mi=new Ii;const Li=["value","name"],Fi=["title"],Ai=["textContent"],_i={key:1,class:"placeholder"},Ri={class:"dropdown"},Hi={class:"custom_select_search"},$i=["placeholder"],Ui={key:0},qi={class:"custom_select_container"},Wi=["onClick"],zi=["innerHTML","href","title"],Gi={class:"custom_select_ul_list"},Yi={class:"noresult"},Ji={key:1};function Ki(e,t,o,i,n,a){var r,s,l,c;const d=Object(E["resolveComponent"])("AllSitesLink"),u=Object(E["resolveDirective"])("tooltips"),m=Object(E["resolveDirective"])("focus-if"),p=Object(E["resolveDirective"])("focus-anywhere-but-here");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:Object(E["normalizeClass"])(["siteSelector piwikSelector borderedControl",{expanded:e.showSitesList,disabled:!e.hasMultipleSites}])},[e.name?(Object(E["openBlock"])(),Object(E["createElementBlock"])("input",{key:0,type:"hidden",value:null===(r=e.displayedModelValue)||void 0===r?void 0:r.id,name:e.name},null,8,Li)):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{ref:"selectorLink",onClick:t[0]||(t[0]=(...t)=>e.onClickSelector&&e.onClickSelector(...t)),onKeydown:t[1]||(t[1]=t=>e.onPressEnter(t)),href:"javascript:void(0)",class:Object(E["normalizeClass"])([{loading:e.isLoading},"title"]),tabindex:"4",title:e.selectorLinkTitle},[Object(E["createElementVNode"])("span",{class:Object(E["normalizeClass"])(["icon icon-chevron-down",{iconHidden:e.isLoading,collapsed:!e.showSitesList}])},null,2),Object(E["createElementVNode"])("span",null,[null!==(s=e.displayedModelValue)&&void 0!==s&&s.name||!e.placeholder?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,textContent:Object(E["toDisplayString"])((null===(l=e.displayedModelValue)||void 0===l?void 0:l.name)||e.firstSiteName)},null,8,Ai)):Object(E["createCommentVNode"])("",!0),null!==(c=e.displayedModelValue)&&void 0!==c&&c.name||!e.placeholder?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",_i,Object(E["toDisplayString"])(e.placeholder),1))])],42,Fi)),[[u]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",Ri,[Object(E["withDirectives"])(Object(E["createElementVNode"])("div",Hi,[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"text",onClick:t[2]||(t[2]=t=>{e.searchTerm="",e.loadInitialSites()}),"onUpdate:modelValue":t[3]||(t[3]=t=>e.searchTerm=t),tabindex:"4",class:"websiteSearch inp browser-default",placeholder:e.translate("General_Search")},null,8,$i),[[E["vModelText"],e.searchTerm],[m,{focused:e.shouldFocusOnSearch}]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("img",{title:"Clear",onClick:t[4]||(t[4]=t=>{e.searchTerm="",e.loadInitialSites()}),class:"reset",src:"plugins/CoreHome/images/reset_search.png"},null,512),[[E["vShow"],e.searchTerm]])],512),[[E["vShow"],e.autocompleteMinSites<=e.sites.length||e.searchTerm]]),"top"===e.allSitesLocation&&e.showAllSitesItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Ui,[Object(E["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[5]||(t[5]=t=>e.onAllSitesClick(t))},null,8,["href","all-sites-text"])])):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",qi,[Object(E["createElementVNode"])("ul",{class:"custom_select_ul_list",onClick:t[7]||(t[7]=t=>e.showSitesList=!1)},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.sites,(o,i)=>Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{onClick:t=>e.switchSite(Object.assign(Object.assign({},o),{},{id:o.idsite}),t),key:i},[Object(E["createElementVNode"])("a",{onClick:t[6]||(t[6]=e=>e.preventDefault()),innerHTML:e.$sanitize(e.getMatchedSiteName(o.name)),tabindex:"4",href:e.getUrlForSiteId(o.idsite),title:o.name},null,8,zi)],8,Wi)),[[E["vShow"],!(!e.showSelectedSite&&""+e.activeSiteId===""+o.idsite)]])),128))]),Object(E["withDirectives"])(Object(E["createElementVNode"])("ul",Gi,[Object(E["createElementVNode"])("li",null,[Object(E["createElementVNode"])("div",Yi,Object(E["toDisplayString"])(e.translate("SitesManager_NotFound")+" "+e.searchTerm),1)])],512),[[E["vShow"],!e.sites.length&&e.searchTerm]])])),[[u,{content:e.tooltipContent}]]),"bottom"===e.allSitesLocation&&e.showAllSitesItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Ji,[Object(E["createVNode"])(d,{href:e.urlAllSites,"all-sites-text":e.allSitesText,onClick:t[8]||(t[8]=t=>e.onAllSitesClick(t))},null,8,["href","all-sites-text"])])):Object(E["createCommentVNode"])("",!0)],512),[[E["vShow"],e.showSitesList]])],2)),[[p,{blur:e.onBlur}]])}const Qi=["innerHTML","href"];function Xi(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{onClick:t[1]||(t[1]=e=>this.onClick(e)),class:"custom_select_all"},[Object(E["createElementVNode"])("a",{onClick:t[0]||(t[0]=e=>e.preventDefault()),innerHTML:e.$sanitize(e.allSitesText),tabindex:"4",href:e.href},null,8,Qi)])}var Zi=Object(E["defineComponent"])({props:{href:String,allSitesText:String},emits:["click"],methods:{onClick(e){this.$emit("click",e)}}});Zi.render=Xi;var en=Zi,tn=Object(E["defineComponent"])({props:{modelValue:Object,showSelectedSite:{type:Boolean,default:!1},showAllSitesItem:{type:Boolean,default:!0},switchSiteOnSelect:{type:Boolean,default:!0},onlySitesWithAdminAccess:{type:Boolean,default:!1},name:{type:String,default:""},allSitesText:{type:String,default:a("General_MultiSitesSummary")},allSitesLocation:{type:String,default:"bottom"},placeholder:String,defaultToFirstSite:Boolean,sitesToExclude:{type:Array,default:()=>[]},onlySitesWithAtLeastWriteAccess:{type:Boolean,default:!1},siteTypesToExclude:{type:Array,default:()=>[]}},emits:["update:modelValue","blur"],components:{AllSitesLink:en},directives:{FocusAnywhereButHere:Je,FocusIf:Qe,Tooltips:tt},watch:{searchTerm(){this.onSearchTermChanged()}},data(){return{searchTerm:"",activeSiteId:""+I.idSite,showSitesList:!1,isLoading:!1,sites:[],autocompleteMinSites:parseInt(I.config.autocomplete_min_sites,10)}},created(){this.searchSite=we(this.searchSite),!this.modelValue&&I.idSite&&this.$emit("update:modelValue",{id:I.idSite,name:I.helper.htmlDecode(I.siteName)})},mounted(){window.initTopControls(),this.loadInitialSites().then(()=>{this.shouldDefaultToFirstSite&&this.$emit("update:modelValue",{id:this.sites[0].idsite,name:this.sites[0].name})});const e=a("CoreHome_ShortcutWebsiteSelector");I.helper.registerShortcut("w",e,e=>{if(e.altKey)return;e.preventDefault?e.preventDefault():e.returnValue=!1;const t=this.$refs.selectorLink;t&&(t.click(),t.focus())})},computed:{shouldFocusOnSearch(){return this.showSitesList&&this.autocompleteMinSites<=this.sites.length||this.searchTerm},selectorLinkTitle(){return this.hasMultipleSites&&this.displayedModelValue?a("CoreHome_ChangeCurrentWebsite",this.htmlEntities(this.displayedModelValue.name)):""},hasMultipleSites(){const e=Mi.matchesCurrentFilteredState(this.onlySitesWithAdminAccess,this.sitesToExclude?this.sitesToExclude:[],this.onlySitesWithAtLeastWriteAccess,this.siteTypesToExclude?this.siteTypesToExclude:[])&&Mi.initialSitesFiltered.value&&Mi.initialSitesFiltered.value.length?Mi.initialSitesFiltered.value:Mi.initialSites.value;return e&&e.length>1},firstSiteName(){const e=Mi.initialSitesFiltered.value&&Mi.initialSitesFiltered.value.length?Mi.initialSitesFiltered.value:Mi.initialSites.value;return e&&e.length>0?e[0].name:""},urlAllSites(){const e=H.stringify(Object.assign(Object.assign({},H.urlParsed.value),{},{module:"MultiSites",action:"index",date:H.parsed.value.date,period:H.parsed.value.period}));return"?"+e},shouldDefaultToFirstSite(){var e;return!(null!==(e=this.modelValue)&&void 0!==e&&e.id)&&(!this.hasMultipleSites||this.defaultToFirstSite)&&this.sites[0]},displayedModelValue(){return this.modelValue?this.modelValue:I.idSite?{id:I.idSite,name:I.helper.htmlDecode(I.siteName)}:this.shouldDefaultToFirstSite?{id:this.sites[0].idsite,name:this.sites[0].name}:null},tooltipContent(){return function(){const e=$(this).attr("title")||"";return I.helper.htmlEntities(e)}}},methods:{onSearchTermChanged(){this.searchTerm?(this.isLoading=!0,this.searchSite(this.searchTerm)):(this.isLoading=!1,this.loadInitialSites())},onAllSitesClick(e){this.switchSite({id:"all",name:this.$props.allSitesText},e),this.showSitesList=!1},switchSite(e,t){const o=-1!==navigator.userAgent.indexOf("Mac OS X")?t.metaKey:t.ctrlKey;t&&o&&t.target&&t.target.href?window.open(t.target.href,"_blank"):(this.$emit("update:modelValue",{id:e.id,name:e.name}),this.switchSiteOnSelect&&this.activeSiteId!==e.id&&Mi.loadSite(e.id))},onBlur(){this.showSitesList=!1,this.$emit("blur")},onClickSelector(){this.hasMultipleSites&&(this.showSitesList=!this.showSitesList,this.isLoading||this.searchTerm||this.loadInitialSites())},onPressEnter(e){"Enter"===e.key&&(e.preventDefault(),this.showSitesList=!this.showSitesList,this.showSitesList&&!this.isLoading&&this.loadInitialSites())},getMatchedSiteName(e){const t=e.toUpperCase().indexOf(this.searchTerm.toUpperCase());if(-1===t||this.isLoading)return this.htmlEntities(e);const o=this.htmlEntities(e.substring(0,t)),i=this.htmlEntities(e.substring(t+this.searchTerm.length));return`${o}${this.searchTerm}${i}`},loadInitialSites(){return Mi.loadInitialSites(this.onlySitesWithAdminAccess,this.sitesToExclude?this.sitesToExclude:[],this.onlySitesWithAtLeastWriteAccess,this.siteTypesToExclude?this.siteTypesToExclude:[]).then(e=>{this.sites=e||[]})},searchSite(e){this.isLoading=!0,Mi.searchSite(e,this.onlySitesWithAdminAccess,this.sitesToExclude?this.sitesToExclude:[],this.onlySitesWithAtLeastWriteAccess,this.siteTypesToExclude?this.siteTypesToExclude:[]).then(t=>{e===this.searchTerm&&t&&(this.sites=t)}).finally(()=>{this.isLoading=!1})},getUrlForSiteId(e){const t=H.stringify(Object.assign(Object.assign({},H.urlParsed.value),{},{segment:"",idSite:e})),o=H.stringify(Object.assign(Object.assign({},H.hashParsed.value),{},{segment:"",idSite:e}));return`?${t}#?${o}`},htmlEntities(e){return I.helper.htmlEntities(e)}}});tn.render=Ki;var on=tn;const nn={ref:"root",class:"quickAccessInside"},an=["title","placeholder"],rn={class:"dropdown"},sn={class:"no-result"},ln=["onClick"],cn=["onMouseenter","onClick"],dn={class:"quickAccessMatomoSearch"},un=["onMouseenter","onClick"],mn=["textContent"],pn={class:"quick-access-category helpCategory"},hn=["href"];function gn(e,t,o,i,n,a){const r=Object(E["resolveDirective"])("focus-if"),s=Object(E["resolveDirective"])("tooltips"),l=Object(E["resolveDirective"])("focus-anywhere-but-here");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",nn,[Object(E["createElementVNode"])("span",{class:"icon-search",onMouseenter:t[0]||(t[0]=t=>e.searchActive=!0)},null,32),Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{class:"s",onKeydown:t[1]||(t[1]=t=>e.onKeypress(t)),onFocus:t[2]||(t[2]=t=>e.searchActive=!0),"onUpdate:modelValue":t[3]||(t[3]=t=>e.searchTerm=t),type:"text",tabindex:"2",title:e.quickAccessTitle,placeholder:e.translate("General_Search"),ref:"input"},null,40,an),[[E["vModelText"],e.searchTerm],[r,{focused:e.searchActive}],[s]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",rn,[Object(E["withDirectives"])(Object(E["createElementVNode"])("ul",null,[Object(E["createElementVNode"])("li",sn,Object(E["toDisplayString"])(e.translate("General_SearchNoResults")),1)],512),[[E["vShow"],!(e.numMenuItems>0||e.sites.length)]]),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menuItems,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",{key:t.title},[Object(E["createElementVNode"])("li",{class:"quick-access-category",onClick:o=>{e.searchTerm=t.title,e.searchMenu(e.searchTerm)}},Object(E["toDisplayString"])(t.title),9,ln),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.items,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["result",{selected:t.menuIndex===e.searchIndex}]),onMouseenter:o=>e.searchIndex=t.menuIndex,onClick:o=>e.selectMenuItem(t.index),key:t.index},[Object(E["createElementVNode"])("a",null,Object(E["toDisplayString"])(t.name.trim()),1)],42,cn))),128))]))),128)),Object(E["createElementVNode"])("ul",dn,[Object(E["withDirectives"])(Object(E["createElementVNode"])("li",{class:"quick-access-category websiteCategory"},Object(E["toDisplayString"])(e.translate("SitesManager_Sites")),513),[[E["vShow"],e.hasSitesSelector&&e.sites.length||e.isLoading]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("li",{class:"no-result"},Object(E["toDisplayString"])(e.translate("MultiSites_LoadingWebsites")),513),[[E["vShow"],e.hasSitesSelector&&e.isLoading]]),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.sites,(t,o)=>Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["result",{selected:e.numMenuItems+o===e.searchIndex}]),onMouseenter:t=>e.searchIndex=e.numMenuItems+o,onClick:o=>e.selectSite(t.idsite),key:t.idsite},[Object(E["createElementVNode"])("a",{textContent:Object(E["toDisplayString"])(t.name)},null,8,mn)],42,un)),[[E["vShow"],e.hasSitesSelector&&!e.isLoading]])),128))]),Object(E["createElementVNode"])("ul",null,[Object(E["createElementVNode"])("li",pn,Object(E["toDisplayString"])(e.translate("General_HelpResources")),1),Object(E["createElementVNode"])("li",{class:Object(E["normalizeClass"])([{selected:"help"===e.searchIndex},"quick-access-help"]),onMouseenter:t[4]||(t[4]=t=>e.searchIndex="help")},[Object(E["createElementVNode"])("a",{href:"https://matomo.org?mtm_campaign=App_Help&mtm_source=Matomo_App&mtm_keyword=QuickSearch&s="+encodeURIComponent(e.searchTerm),target:"_blank"},Object(E["toDisplayString"])(e.translate("CoreHome_SearchOnMatomo",e.searchTerm)),9,hn)],34)])],512),[[E["vShow"],e.searchTerm&&e.searchActive]])])),[[l,{blur:e.onBlur}]])}const{ListingFormatter:bn}=window;function fn(e){const t=e.getBoundingClientRect(),o=window.$(window);return t.top>=0&&t.left>=0&&t.bottom<=o.height()&&t.right<=o.width()}function vn(e){e&&e.scrollIntoView&&e.scrollIntoView()}var On=Object(E["defineComponent"])({directives:{FocusAnywhereButHere:Je,FocusIf:Qe,Tooltips:tt},watch:{searchActive(e){const t=this.$refs.root;if(!t||!t.parentElement)return;const o=t.parentElement.classList;o.toggle("active",e),o.toggle("expanded",e)}},mounted(){const e=this.$refs.root;e&&e.parentElement&&e.parentElement.classList.add("quick-access","piwikSelector"),"undefined"!==typeof window.initTopControls&&window.initTopControls&&window.initTopControls(),I.helper.registerShortcut("f",a("CoreHome_ShortcutSearch"),e=>{e.altKey||(e.preventDefault(),vn(this.$refs.root),this.activateSearch())})},data(){const e=!!document.querySelector(".segmentEditorPanel");return{menuItems:[],numMenuItems:0,searchActive:!1,searchTerm:"",searchIndex:0,menuIndexCounter:-1,topMenuItems:null,leftMenuItems:null,segmentItems:null,hasSegmentSelector:e,sites:[],isLoading:!1}},created(){this.searchMenu=we(this.searchMenu.bind(this))},computed:{hasSitesSelector(){return!!document.querySelector('.top_controls .siteSelector,.top_controls [vue-entry="CoreHome.SiteSelector"]')},quickAccessTitle(){const e=[a("CoreHome_MenuEntries")];return this.hasSegmentSelector&&e.push(a("CoreHome_Segments")),this.hasSitesSelector&&e.push(a("SitesManager_Sites")),a("CoreHome_QuickAccessTitle",bn.formatAnd(e))}},emits:["itemSelected","blur"],methods:{onKeypress(e){const t=this.searchTerm&&this.searchActive,o=9===e.which,i=27===e.which;38===e.which?(this.highlightPreviousItem(),e.preventDefault()):40===e.which?(this.highlightNextItem(),e.preventDefault()):13===e.which?this.clickQuickAccessMenuItem():o&&t||i&&t?this.deactivateSearch():setTimeout(()=>{this.searchActive=!0,this.searchMenu(this.searchTerm)})},highlightPreviousItem(){this.searchIndex-1<0?this.searchIndex=0:this.searchIndex-=1,this.makeSureSelectedItemIsInViewport()},highlightNextItem(){const e=this.$refs.root.querySelectorAll("li.result").length;e<=this.searchIndex+1?this.searchIndex=e-1:this.searchIndex+=1,this.makeSureSelectedItemIsInViewport()},clickQuickAccessMenuItem(){const e=this.getCurrentlySelectedElement();e&&setTimeout(()=>{e.click(),this.$emit("itemSelected",e)},20)},deactivateSearch(){this.searchTerm="",this.searchActive=!1,this.$refs.input&&this.$refs.input.blur()},makeSureSelectedItemIsInViewport(){const e=this.getCurrentlySelectedElement();e&&!fn(e)&&vn(e)},getCurrentlySelectedElement(){const e=this.$refs.root.querySelectorAll("li.result");if(e&&e.length&&e.item(this.searchIndex))return e.item(this.searchIndex)},searchMenu(e){const t=e.toLowerCase();let o=-1;const i={},n=[],a=e=>{const t=Object.assign({},e);o+=1,t.menuIndex=o;const{category:a}=t;a in i||(n.push({title:a,items:[]}),i[a]=n.length-1);const r=i[a];n[r].items.push(t)};this.resetSearchIndex(),this.hasSitesSelector&&(this.isLoading=!0,Mi.searchSite(t).then(e=>{e&&(this.sites=e)}).finally(()=>{this.isLoading=!1}));const r=e=>-1!==e.name.toLowerCase().indexOf(t)||-1!==e.category.toLowerCase().indexOf(t);null===this.topMenuItems&&(this.topMenuItems=this.getTopMenuItems()),null===this.leftMenuItems&&(this.leftMenuItems=this.getLeftMenuItems()),null===this.segmentItems&&(this.segmentItems=this.getSegmentItems());const s=this.topMenuItems.filter(r),l=this.leftMenuItems.filter(r),c=this.segmentItems.filter(r);s.forEach(a),l.forEach(a),c.forEach(a),this.numMenuItems=s.length+l.length+c.length,this.menuItems=n},resetSearchIndex(){this.searchIndex=0,this.makeSureSelectedItemIsInViewport()},selectSite(e){Mi.loadSite(e)},selectMenuItem(e){const t=document.querySelector(`[quick_access='${e}']`);if(t){this.deactivateSearch();const e=t.getAttribute("href");if(e&&e.length>10&&t&&t.click)try{t.click()}catch(o){window.$(t).click()}else window.$(t).click()}},onBlur(){this.searchActive=!1,this.$emit("blur")},activateSearch(){this.searchActive=!0},getTopMenuItems(){const e=a("CoreHome_Menu"),t=[];return document.querySelectorAll("nav .sidenav li > a, nav .sidenav li > div > a").forEach(o=>{var i;let n=null===(i=o.textContent)||void 0===i?void 0:i.trim();var a;(!n||null!=o.parentElement&&null!=o.parentElement.tagName&&"DIV"===o.parentElement.tagName)&&(n=null===(a=o.getAttribute("title"))||void 0===a?void 0:a.trim());n&&(t.push({name:n,index:this.menuIndexCounter+=1,category:e}),o.setAttribute("quick_access",""+this.menuIndexCounter))}),t},getLeftMenuItems(){const e=[];return document.querySelectorAll("#secondNavBar .menuTab").forEach(t=>{var o;const i=window.$(t).find("> .item");let n=(null===(o=i[0])||void 0===o?void 0:o.innerText.trim())||"";n&&-1!==n.lastIndexOf("\n")&&(n=n.slice(0,n.lastIndexOf("\n")).trim()),window.$(t).find("li .item").each((t,o)=>{var i;const a=null===(i=o.textContent)||void 0===i?void 0:i.trim();a&&(e.push({name:a,category:n,index:this.menuIndexCounter+=1}),o.setAttribute("quick_access",""+this.menuIndexCounter))})}),e},getSegmentItems(){if(!this.hasSegmentSelector)return[];const e=a("CoreHome_Segments"),t=[];return document.querySelectorAll(".segmentList [data-idsegment]").forEach(o=>{var i;const n=null===(i=o.querySelector(".segname"))||void 0===i||null===(i=i.textContent)||void 0===i?void 0:i.trim();n&&(t.push({name:n,category:e,index:this.menuIndexCounter+=1}),o.setAttribute("quick_access",""+this.menuIndexCounter))}),t}}});On.render=gn;var jn=On;const yn={class:"fieldArray form-group"},wn={key:0,class:"fieldUiControl"},Sn=["onClick","title"];function kn(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Field");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",yn,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.modelValue,(t,o)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:Object(E["normalizeClass"])(["fieldArrayTable multiple valign-wrapper",{["fieldArrayTable"+o]:!0}]),key:o},[e.field.uiControl?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",wn,[Object(E["createVNode"])(r,{"full-width":!0,"model-value":t,options:e.field.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(t,o),"model-modifiers":e.field.modelModifiers,placeholder:" ",uicontrol:e.field.uiControl,title:e.field.title,name:`${e.name}-${o}`,id:`${e.id}-${o}`,"template-file":e.field.templateFile,component:e.field.component},null,8,["model-value","options","onUpdate:modelValue","model-modifiers","uicontrol","title","name","id","template-file","component"])])):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])(Object(E["createElementVNode"])("span",{onClick:t=>e.removeEntry(o),class:"icon-minus valign",title:e.translate("General_Remove")},null,8,Sn),[[E["vShow"],o+1!==e.modelValue.length]])],2))),128))])}const Cn=ve("CorePluginsAdmin","Field");var En=Object(E["defineComponent"])({props:{modelValue:Array,name:String,id:String,field:Object,rows:String},components:{Field:Cn},emits:["update:modelValue"],watch:{modelValue(e){this.checkEmptyModelValue(e)}},mounted(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue(e){e&&e.length&&""===e.slice(-1)[0]||this.rows&&!((this.modelValue||[]).length-1&&this.modelValue){const t=this.modelValue.filter((t,o)=>o!==e);this.$emit("update:modelValue",t)}}}});En.render=kn;var Dn=En;const Pn={class:"multiPairField form-group"},Tn={key:1,class:"fieldUiControl fieldUiControl2"},Vn={key:2,class:"fieldUiControl fieldUiControl3"},Nn={key:3,class:"fieldUiControl fieldUiControl4"},xn=["onClick","title"];function Bn(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Field");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Pn,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.modelValue,(t,o)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:Object(E["normalizeClass"])(["multiPairFieldTable multiple valign-wrapper",{["multiPairFieldTable"+o]:!0,[`has${e.fieldCount}Fields`]:!0}]),key:o},[e.field1?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,class:Object(E["normalizeClass"])(["fieldUiControl fieldUiControl1",{hasMultiFields:e.field1.type&&e.field2.type}])},[Object(E["createVNode"])(r,{"full-width":!0,"model-value":t[e.field1.key],options:e.field1.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field1.key,t),"model-modifiers":e.field1.modelModifiers,placeholder:" ",uicontrol:e.field1.uiControl,name:`${e.name}-p1-${o}`,id:`${e.id}-p1-${o}`,title:e.field1.title,"template-file":e.field1.templateFile,component:e.field1.component},null,8,["model-value","options","onUpdate:modelValue","model-modifiers","uicontrol","name","id","title","template-file","component"])],2)):Object(E["createCommentVNode"])("",!0),e.field2?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Tn,[Object(E["createVNode"])(r,{"full-width":!0,options:e.field2.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field2.key,t),"model-value":t[e.field2.key],"model-modifiers":e.field2.modelModifiers,placeholder:" ",uicontrol:e.field2.uiControl,name:`${e.name}-p2-${o}`,id:`${e.id}-p2-${o}`,title:e.field2.title,"template-file":e.field2.templateFile,component:e.field2.component},null,8,["options","onUpdate:modelValue","model-value","model-modifiers","uicontrol","name","id","title","template-file","component"])])):Object(E["createCommentVNode"])("",!0),e.field3?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Vn,[Object(E["createVNode"])(r,{"full-width":!0,options:e.field3.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field3.key,t),"model-value":t[e.field3.key],"model-modifiers":e.field3.modelModifiers,placeholder:" ",uicontrol:e.field3.uiControl,name:`${e.name}-p3-${o}`,id:`${e.id}-p3-${o}`,title:e.field3.title,"template-file":e.field3.templateFile,component:e.field3.component},null,8,["options","onUpdate:modelValue","model-value","model-modifiers","uicontrol","name","id","title","template-file","component"])])):Object(E["createCommentVNode"])("",!0),e.field4?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Nn,[Object(E["createVNode"])(r,{"full-width":!0,options:e.field4.availableValues,"onUpdate:modelValue":t=>e.onEntryChange(o,e.field4.key,t),"model-value":t[e.field4.key],"model-modifiers":e.field4.modelModifiers,placeholder:" ",uicontrol:e.field4.uiControl,name:`${e.name}-p4-${o}`,id:`${e.id}-p4-${o}`,title:e.field4.title,"template-file":e.field4.templateFile,component:e.field4.component},null,8,["options","onUpdate:modelValue","model-value","model-modifiers","uicontrol","name","id","title","template-file","component"])])):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])(Object(E["createElementVNode"])("span",{onClick:t=>e.removeEntry(o),class:"icon-minus valign",title:e.translate("General_Remove")},null,8,xn),[[E["vShow"],o+1!==e.modelValue.length]])],2))),128))])}const In=ve("CorePluginsAdmin","Field");var Mn=Object(E["defineComponent"])({props:{modelValue:Array,name:String,id:String,field1:Object,field2:Object,field3:Object,field4:Object,rows:Number},components:{Field:In},computed:{fieldCount(){return this.field1&&this.field2&&this.field3&&this.field4?4:this.field1&&this.field2&&this.field3?3:this.field1&&this.field2?2:this.field1?1:0}},emits:["update:modelValue"],watch:{modelValue(e){this.checkEmptyModelValue(e)}},mounted(){this.checkEmptyModelValue(this.modelValue)},methods:{checkEmptyModelValue(e){e&&e.length&&!this.isEmptyValue(e.slice(-1)[0])||this.rows&&!(this.modelValue.length-1&&this.modelValue){const t=this.modelValue.filter((t,o)=>o!==e);this.$emit("update:modelValue",t)}},isEmptyValue(e){const{fieldCount:t}=this;if(4===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key]&&!e[this.field4.key])return!1}else if(3===t){if(!e[this.field1.key]&&!e[this.field2.key]&&!e[this.field3.key])return!1}else if(2===t){if(!e[this.field1.key]&&!e[this.field2.key])return!1}else if(1===t&&!e[this.field1.key])return!1;return!0},makeEmptyValue(){const e={};return this.field1&&this.field1.key&&(e[this.field1.key]=""),this.field2&&this.field2.key&&(e[this.field2.key]=""),this.field3&&this.field3.key&&(e[this.field3.key]=""),this.field4&&this.field4.key&&(e[this.field4.key]=""),e}}});Mn.render=Bn;var Ln=Mn;const Fn=["disabled"],An=Object(E["createElementVNode"])("span",{class:"icon-chevron-left"},null,-1),_n=[An],Rn=["title"],Hn=Object(E["createElementVNode"])("span",{class:"icon icon-calendar"},null,-1),$n={id:"periodMore",class:"dropdown"},Un={class:"flex"},qn={key:0,class:"period-date"},Wn={class:"period-type"},zn={id:"otherPeriods"},Gn=["onDblclick","title"],Yn=["id","checked","onChange","onDblclick"],Jn={key:0,class:"compare-checkbox"},Kn={id:"comparePeriodToDropdown"},Qn={key:1,class:"compare-date-range"},Xn={id:"comparePeriodStartDate"},Zn=Object(E["createElementVNode"])("span",{class:"compare-dates-separator"},null,-1),ea={id:"comparePeriodEndDate"},ta={class:"apply-button-container"},oa=["disabled","value"],ia={key:2,id:"ajaxLoadingCalendar"},na={class:"loadingSegment"},aa=["disabled"],ra=Object(E["createElementVNode"])("span",{class:"icon-chevron-right"},null,-1),sa=[ra];function la(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("DateRangePicker"),s=Object(E["resolveComponent"])("PeriodDatePicker"),l=Object(E["resolveComponent"])("Field"),c=Object(E["resolveComponent"])("ActivityIndicator"),d=Object(E["resolveDirective"])("tooltips"),u=Object(E["resolveDirective"])("expand-on-click");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{ref:"root",class:Object(E["normalizeClass"])(["periodSelector piwikSelector",{"periodSelector-withPrevNext":e.canShowMovePeriod}])},[e.canShowMovePeriod?(Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{key:0,class:"move-period move-period-prev",onClick:t[0]||(t[0]=t=>e.movePeriod(-1)),disabled:e.isPeriodMoveDisabled(-1)},_n,8,Fn)):Object(E["createCommentVNode"])("",!0),Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{ref:"title",id:"date",class:"title",tabindex:"4",title:e.translate("General_ChooseDate",e.currentlyViewingText)},[Hn,Object(E["createTextVNode"])(" "+Object(E["toDisplayString"])(e.currentlyViewingText),1)],8,Rn)),[[d]]),Object(E["createElementVNode"])("div",$n,[Object(E["createElementVNode"])("div",Un,[Object(E["createElementVNode"])("div",null,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{class:"period-range","start-date":e.startRangeDate,"end-date":e.endRangeDate,onRangeChange:t[1]||(t[1]=t=>e.onRangeChange(t.start,t.end)),onSubmit:t[2]||(t[2]=t=>e.onApplyClicked())},null,8,["start-date","end-date"]),[[E["vShow"],"range"===e.selectedPeriod]]),"range"!==e.selectedPeriod?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",qn,[Object(E["createVNode"])(s,{id:"datepicker",period:e.selectedPeriod,date:e.periodValue===e.selectedPeriod?e.dateValue:null,onSelect:t[3]||(t[3]=t=>e.setPiwikPeriodAndDate(e.selectedPeriod,t.date))},null,8,["period","date"])])):Object(E["createCommentVNode"])("",!0)]),Object(E["createElementVNode"])("div",Wn,[Object(E["createElementVNode"])("h6",null,Object(E["toDisplayString"])(e.translate("General_Period")),1),Object(E["createElementVNode"])("div",zn,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.periodsFiltered,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("p",{key:o},[Object(E["createElementVNode"])("label",{class:Object(E["normalizeClass"])({"selected-period-label":o===e.selectedPeriod}),onDblclick:t=>e.changeViewedPeriod(o),title:o===e.periodValue?"":e.translate("General_DoubleClickToChangePeriod")},[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{type:"radio",name:"period",id:"period_id_"+o,"onUpdate:modelValue":t[4]||(t[4]=t=>e.selectedPeriod=t),checked:e.selectedPeriod===o,onChange:t=>e.selectedPeriod=o,onDblclick:t=>e.changeViewedPeriod(o)},null,40,Yn),[[E["vModelRadio"],e.selectedPeriod]]),Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.getPeriodDisplayText(o)),1)],42,Gn)]))),128))])])]),e.isComparisonEnabled?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Jn,[Object(E["createElementVNode"])("label",null,[Object(E["withDirectives"])(Object(E["createElementVNode"])("input",{id:"comparePeriodTo",type:"checkbox","onUpdate:modelValue":t[5]||(t[5]=t=>e.isComparing=t)},null,512),[[E["vModelCheckbox"],e.isComparing]]),Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translate("General_CompareTo")),1)]),Object(E["createElementVNode"])("div",Kn,[Object(E["createVNode"])(l,{modelValue:e.comparePeriodType,"onUpdate:modelValue":t[6]||(t[6]=t=>e.comparePeriodType=t),style:Object(E["normalizeStyle"])({visibility:e.isComparing?"visible":"hidden"}),name:"comparePeriodToDropdown",uicontrol:"select",options:e.comparePeriodDropdownOptions,"full-width":!0,disabled:!e.isComparing},null,8,["modelValue","style","options","disabled"])])])):Object(E["createCommentVNode"])("",!0),e.isComparing&&"custom"===e.comparePeriodType?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Qn,[Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",Xn,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(l,{modelValue:e.compareStartDate,"onUpdate:modelValue":t[7]||(t[7]=t=>e.compareStartDate=t),name:"comparePeriodStartDate",uicontrol:"text","full-width":!0,title:e.translate("CoreHome_StartDate"),placeholder:"YYYY-MM-DD"},null,8,["modelValue","title"])])]),Zn,Object(E["createElementVNode"])("div",ea,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(l,{modelValue:e.compareEndDate,"onUpdate:modelValue":t[8]||(t[8]=t=>e.compareEndDate=t),name:"comparePeriodEndDate",uicontrol:"text","full-width":!0,title:e.translate("CoreHome_EndDate"),placeholder:"YYYY-MM-DD"},null,8,["modelValue","title"])])])])])):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",ta,[Object(E["createElementVNode"])("input",{type:"submit",id:"calendarApply",class:"btn",onClick:t[9]||(t[9]=t=>e.onApplyClicked()),disabled:!e.isApplyEnabled(),value:e.translate("General_Apply")},null,8,oa)]),e.isLoadingNewPage?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ia,[Object(E["createVNode"])(c,{loading:!0}),Object(E["createElementVNode"])("div",na,Object(E["toDisplayString"])(e.translate("SegmentEditor_LoadingSegmentedDataMayTakeSomeTime")),1)])):Object(E["createCommentVNode"])("",!0)]),e.canShowMovePeriod?(Object(E["openBlock"])(),Object(E["createElementBlock"])("button",{key:1,class:"move-period move-period-next",onClick:t[10]||(t[10]=t=>e.movePeriod(1)),disabled:e.isPeriodMoveDisabled(1)},sa,8,aa)):Object(E["createCommentVNode"])("",!0)],2)),[[u,{expander:"title",onExpand:e.onExpand,onClosed:e.onClosed}]])}const ca=ve("CorePluginsAdmin","Field"),da=I.helper.htmlDecode(" "),ua=["custom","previousPeriod","previousYear"],ma=[{key:"custom",value:a("General_Custom")},{key:"previousPeriod",value:a("General_PreviousPeriod").replace(/\s+/,da)},{key:"previousYear",value:a("General_PreviousYear").replace(/\s+/,da)}],pa=new Date(I.minDateYear,I.minDateMonth-1,I.minDateDay),ha=new Date(I.maxDateYear,I.maxDateMonth-1,I.maxDateDay);function ga(e){return"[object Date]"===Object.prototype.toString.call(e)&&!Number.isNaN(e.getTime())}var ba=Object(E["defineComponent"])({props:{periods:Array},components:{DateRangePicker:ti,PeriodDatePicker:ri,Field:ca,ActivityIndicator:_e},directives:{ExpandOnClick:ht,Tooltips:tt},data(){const e=H.parsed.value.period;return{comparePeriodDropdownOptions:ma,periodValue:e,dateValue:null,selectedPeriod:e,startRangeDate:null,endRangeDate:null,isRangeValid:null,isLoadingNewPage:!1,isComparing:null,comparePeriodType:"previousPeriod",compareStartDate:"",compareEndDate:""}},mounted(){I.on("hidePeriodSelector",()=>{window.$(this.$refs.root).parent("#periodString").hide()}),I.on("matomoPageChange",()=>{window.$(this.$refs.root).parent("#periodString").show()}),this.isComparing=Do.isComparingPeriods(),Object(E["watch"])(()=>Do.isComparingPeriods(),e=>{this.isComparing=e}),this.updateSelectedValuesFromHash(),Object(E["watch"])(()=>H.parsed.value,this.updateSelectedValuesFromHash),this.updateComparisonValuesFromStore(),Object(E["watch"])(()=>Do.getPeriodComparisons(),this.updateComparisonValuesFromStore),window.initTopControls(),this.handleZIndexPositionRelativeCompareDropdownIssue()},computed:{currentlyViewingText(){let e;if("range"===this.periodValue){if(!this.startRangeDate||!this.endRangeDate)return a("General_Error");e=`${this.startRangeDate},${this.endRangeDate}`}else{if(!this.dateValue)return a("General_Error");e=d(this.dateValue)}try{return c.parse(this.periodValue,e).getPrettyString()}catch(t){return a("General_Error")}},isComparisonEnabled(){return Do.isComparisonEnabled()},periodsFiltered(){return(this.periods||[]).filter(e=>c.isRecognizedPeriod(e))},selectedComparisonParams(){if(!this.isComparing)return{};if("custom"===this.comparePeriodType)return{comparePeriods:["range"],comparePeriodType:"custom",compareDates:[`${this.compareStartDate},${this.compareEndDate}`]};if("previousPeriod"===this.comparePeriodType)return{comparePeriods:[this.selectedPeriod],comparePeriodType:"previousPeriod",compareDates:[this.previousPeriodDateToSelectedPeriod]};if("previousYear"===this.comparePeriodType){const e="range"===this.selectedPeriod?`${this.startRangeDate},${this.endRangeDate}`:d(this.dateValue),t=c.parse(this.selectedPeriod,e).getDateRange();return t[0].setFullYear(t[0].getFullYear()-1),t[1].setFullYear(t[1].getFullYear()-1),"range"===this.selectedPeriod?{comparePeriods:["range"],comparePeriodType:"previousYear",compareDates:[`${d(t[0])},${d(t[1])}`]}:{comparePeriods:[this.selectedPeriod],comparePeriodType:"previousYear",compareDates:[d(t[0])]}}return console.warn("Unknown compare period type: "+this.comparePeriodType),{}},previousPeriodDateToSelectedPeriod(){if("range"===this.selectedPeriod){const e=m(this.startRangeDate),t=m(this.endRangeDate),o=C.getLastNRange("day",2,e).startDate,i=Math.floor((t.valueOf()-e.valueOf())/864e5),n=C.getLastNRange("day",1+i,o);return`${d(n.startDate)},${d(n.endDate)}`}const e=C.getLastNRange(this.selectedPeriod,2,this.dateValue).startDate;return d(e)},selectedDateString(){if("range"===this.selectedPeriod){const e=this.startRangeDate,t=this.endRangeDate,o=m(e),i=m(t);return!ga(o)||!ga(i)||o>i?(window.$("#alert").find("h2").text(a("General_InvalidDateRange")),I.helper.modalConfirm("#alert",{}),null):`${e},${t}`}return d(this.dateValue)},isErrorDisplayed(){return this.currentlyViewingText===a("General_Error")},isRangeSelection(){return"range"===this.periodValue},canShowMovePeriod(){return!this.isRangeSelection&&!this.isErrorDisplayed}},methods:{onExpand(e){const t=0===e.detail;t&&window.$(this.$refs.root).find(".ui-datepicker-month").focus()},onClosed(e){const t=0===e.detail;t&&window.$(this.$refs.title).focus()},handleZIndexPositionRelativeCompareDropdownIssue(){const e=window.$(this.$refs.root);e.on("focus","#comparePeriodToDropdown .select-dropdown",()=>{e.addClass("compare-dropdown-open")}).on("blur","#comparePeriodToDropdown .select-dropdown",()=>{e.removeClass("compare-dropdown-open")})},changeViewedPeriod(e){e!==this.periodValue&&"range"!==e&&this.setPiwikPeriodAndDate(e,this.dateValue)},setPiwikPeriodAndDate(e,t){this.periodValue=e,this.selectedPeriod=e,this.dateValue=t;const o=d(t);this.setRangeStartEndFromPeriod(e,o),this.propagateNewUrlParams(o,this.selectedPeriod),window.initTopControls()},propagateNewUrlParams(e,t){const o=this.selectedComparisonParams;let i;I.helper.isReportingPage()?(this.closePeriodSelector(),i=H.hashParsed.value):(this.isLoadingNewPage=!0,i=H.parsed.value);const n=Object.assign({},i);delete n.comparePeriods,delete n.comparePeriodType,delete n.compareDates,H.updateLocation(Object.assign(Object.assign({},n),{},{date:e,period:t},o))},onApplyClicked(){if("range"===this.selectedPeriod){const e=this.selectedDateString;if(!e)return;return this.periodValue="range",void this.propagateNewUrlParams(e,"range")}this.setPiwikPeriodAndDate(this.selectedPeriod,this.dateValue)},updateComparisonValuesFromStore(){this.comparePeriodType="previousPeriod",this.compareStartDate="",this.compareEndDate="";const e=Do.getPeriodComparisons();if(e.length<2)return;const t=H.parsed.value.comparePeriodType;if(!ua.includes(t))return;if(this.comparePeriodType=t,"custom"!==this.comparePeriodType||"range"!==e[1].params.period)return;let o;try{o=c.parse(e[1].params.period,e[1].params.date)}catch(a){return}const[i,n]=o.getDateRange();this.compareStartDate=d(i),this.compareEndDate=d(n)},updateSelectedValuesFromHash(){const e=H.parsed.value.date,t=H.parsed.value.period;this.periodValue=t,this.selectedPeriod=t,this.dateValue=null,this.startRangeDate=null,this.endRangeDate=null;try{c.parse(t,e)}catch(o){return}if("range"===t){const o=c.get(t).parse(e),[i,n]=o.getDateRange();this.dateValue=i,this.startRangeDate=d(i),this.endRangeDate=d(n)}else this.dateValue=m(e),this.setRangeStartEndFromPeriod(t,e)},setRangeStartEndFromPeriod(e,t){const o=c.parse(e,t).getDateRange();this.startRangeDate=d(o[0]ha?ha:o[1])},getPeriodDisplayText(e){return c.get(e).getDisplayText()},onRangeChange(e,t){e&&t?(this.isRangeValid=!0,this.startRangeDate=e,this.endRangeDate=t):this.isRangeValid=!1},isApplyEnabled(){return!("range"===this.selectedPeriod&&!this.isRangeValid)&&!(this.isComparing&&"custom"===this.comparePeriodType&&!this.isCompareRangeValid())},closePeriodSelector(){this.$refs.root.classList.remove("expanded")},isCompareRangeValid(){try{m(this.compareStartDate)}catch(e){return!1}try{m(this.compareEndDate)}catch(e){return!1}return!0},movePeriod(e){if(!this.canMovePeriod(e))return;let t=new Date;switch(null!=this.dateValue&&(t=this.dateValue),this.periodValue){case"day":t.setDate(t.getDate()+e);break;case"week":t.setDate(t.getDate()+7*e);break;case"month":t.setMonth(t.getMonth()+e);break;case"year":t.setFullYear(t.getFullYear()+e);break;default:break}this.dateValueha&&(this.dateValue=ha),this.onApplyClicked()},isPeriodMoveDisabled(e){return null===this.dateValue?this.isRangeSelection:this.isRangeSelection||!this.canMovePeriod(e)},canMovePeriod(e){if(null===this.dateValue)return!1;const t=-1===e?pa:ha;return!g(this.dateValue,t,this.periodValue)}}});ba.render=la;var fa=ba;const va={class:"reportingMenu"},Oa=["aria-label"],ja=["data-category-id"],ya=["onClick"],wa={class:"hidden"},Sa={key:2,role:"menu"},ka=["href","onClick","title"],Ca=["href","onClick"],Ea=["onClick"],Da=Object(E["createElementVNode"])("span",{class:"icon-help"},null,-1),Pa=[Da],Ta={id:"mobile-left-menu",class:"sidenav sidenav--reporting-menu-mobile hide-on-large-only"},Va=["data-category-id"],Na={key:1,class:"collapsible collapsible-accordion"},xa={class:"collapsible-header"},Ba={class:"collapsible-body"},Ia=["onClick","href"],Ma=["onClick","href"];function La(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("MenuItemsDropdown"),s=Object(E["resolveDirective"])("side-nav");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",va,[Object(E["createElementVNode"])("ul",{class:"navbar hide-on-med-and-down collapsible",role:"menu","aria-label":e.translate("CoreHome_MainNavigation")},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menu,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["menuTab",{active:t.id===e.activeCategory}]),role:"menuitem",key:t.id,"data-category-id":t.id},[t.component?(Object(E["openBlock"])(),Object(E["createBlock"])(Object(E["resolveDynamicComponent"])(t.component),{key:0,onAction:o=>e.loadCategory(t)},null,40,["onAction"])):Object(E["createCommentVNode"])("",!0),t.component?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,class:"item",tabindex:"5",href:"",onClick:Object(E["withModifiers"])(o=>e.loadCategory(t),["prevent"])},[Object(E["createElementVNode"])("span",{class:Object(E["normalizeClass"])("menu-icon "+(t.icon?t.icon:t.subcategories&&t.id===e.activeCategory?"icon-chevron-down":"icon-chevron-right"))},null,2),Object(E["createTextVNode"])(Object(E["toDisplayString"])(t.name)+" ",1),Object(E["createElementVNode"])("span",wa,Object(E["toDisplayString"])(e.translate("CoreHome_Menu")),1)],8,ya)),t.component?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",Sa,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.subcategories,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{role:"menuitem",class:Object(E["normalizeClass"])({active:(o.id===e.displayedSubcategory||o.isGroup&&e.activeSubsubcategory===e.displayedSubcategory)&&t.id===e.displayedCategory}),key:o.id},[o.isGroup?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0,"show-search":!0,"menu-title":e.htmlEntities(o.name)},{default:Object(E["withCtx"])(()=>[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(o.subcategories,i=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{class:Object(E["normalizeClass"])(["item",{active:i.id===e.activeSubsubcategory&&o.id===e.displayedSubcategory&&t.id===e.displayedCategory}]),tabindex:"5",href:"#?"+e.makeUrl(t,i),onClick:o=>e.loadSubcategory(t,i,o),title:i.tooltip,key:i.id},Object(E["toDisplayString"])(i.name),11,ka))),128))]),_:2},1032,["menu-title"])):Object(E["createCommentVNode"])("",!0),o.isGroup?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,href:"#?"+e.makeUrl(t,o),class:"item",onClick:i=>e.loadSubcategory(t,o,i),tabindex:"5"},Object(E["toDisplayString"])(o.name),9,Ca)),o.help?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:2,class:Object(E["normalizeClass"])(["item-help-icon",{active:e.helpShownCategory&&e.helpShownCategory.subcategory===o.id&&e.helpShownCategory.category===t.id&&o.help}]),tabindex:"5",href:"javascript:",onClick:i=>e.showHelp(t,o,i)},Pa,10,Ea)):Object(E["createCommentVNode"])("",!0)],2))),128))]))],10,ja))),128))],8,Oa),Object(E["createElementVNode"])("ul",Ta,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menu,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:"no-padding",key:t.id,"data-category-id":t.id},[t.component?(Object(E["openBlock"])(),Object(E["createBlock"])(Object(E["resolveDynamicComponent"])(t.component),{key:0,onAction:o=>e.loadCategory(t)},null,40,["onAction"])):Object(E["createCommentVNode"])("",!0),t.component?Object(E["createCommentVNode"])("",!0):Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",Na,[Object(E["createElementVNode"])("li",null,[Object(E["createElementVNode"])("a",xa,[Object(E["createElementVNode"])("i",{class:Object(E["normalizeClass"])(t.icon?t.icon:"icon-chevron-down")},null,2),Object(E["createTextVNode"])(Object(E["toDisplayString"])(t.name),1)]),Object(E["createElementVNode"])("div",Ba,[Object(E["createElementVNode"])("ul",null,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.subcategories,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:o.id},[o.isGroup?(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],{key:0},Object(E["renderList"])(o.subcategories,o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{onClick:i=>e.loadSubcategory(t,o),href:"#?"+e.makeUrl(t,o),key:o.id},Object(E["toDisplayString"])(o.name),9,Ia))),128)):Object(E["createCommentVNode"])("",!0),o.isGroup?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,onClick:i=>e.loadSubcategory(t,o),href:"#?"+e.makeUrl(t,o)},Object(E["toDisplayString"])(o.name),9,Ma))]))),128))])])])])),[[s,{activator:e.sideNavActivator}]])],8,Va))),128))])])}function Fa(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */class Aa{constructor(){Fa(this,"privateState",Object(E["reactive"])({pages:[]})),Fa(this,"state",Object(E["computed"])(()=>Object(E["readonly"])(this.privateState))),Fa(this,"fetchAllPagesPromise",void 0),Fa(this,"pages",Object(E["computed"])(()=>this.state.value.pages))}findPageInCategory(e){return this.pages.value.find(t=>t&&t.category&&t.category.id===e&&t.subcategory&&t.subcategory.id)}findPage(e,t){return this.pages.value.find(o=>o&&o.category&&o.subcategory&&o.category.id===e&&""+o.subcategory.id===t)}reloadAllPages(){return delete this.fetchAllPagesPromise,this.getAllPages()}getAllPages(){return this.fetchAllPagesPromise||(this.fetchAllPagesPromise=G.fetch({method:"API.getReportPagesMetadata",filter_limit:"-1"}).then(e=>(this.privateState.pages=e,this.pages.value))),this.fetchAllPagesPromise.then(()=>this.pages.value)}}var _a=new Aa; + */class Aa{constructor(){Fa(this,"privateState",Object(E["reactive"])({pages:[]})),Fa(this,"state",Object(E["computed"])(()=>Object(E["readonly"])(this.privateState))),Fa(this,"fetchAllPagesPromise",void 0),Fa(this,"pages",Object(E["computed"])(()=>this.state.value.pages))}findPageInCategory(e){return this.pages.value.find(t=>t&&t.category&&t.category.id===e&&t.subcategory&&t.subcategory.id)}findPage(e,t){return this.pages.value.find(o=>o&&o.category&&o.subcategory&&o.category.id===e&&""+o.subcategory.id===t)}reloadAllPages(){return delete this.fetchAllPagesPromise,this.getAllPages()}getAllPages(){return this.fetchAllPagesPromise||(this.fetchAllPagesPromise=K.fetch({method:"API.getReportPagesMetadata",filter_limit:"-1"}).then(e=>(this.privateState.pages=e,this.pages.value))),this.fetchAllPagesPromise.then(()=>this.pages.value)}}var _a=new Aa; /*! * Matomo - free/libre analytics platform * @@ -284,31 +284,31 @@ function qe(e,t,o){const i=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMo * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */class tr{constructor(){er(this,"privateState",Object(E["reactive"])({reports:[]})),er(this,"state",Object(E["readonly"])(this.privateState)),er(this,"reports",Object(E["computed"])(()=>this.state.reports)),er(this,"reportsPromise",void 0)}findReport(e,t){return this.reports.value.find(o=>o.module===e&&o.action===t)}fetchReportMetadata(){return this.reportsPromise||(this.reportsPromise=G.fetch({method:"API.getReportMetadata",filter_limit:"-1",idSite:I.idSite||H.parsed.value.idSite}).then(e=>(this.privateState.reports=e,e))),this.reportsPromise.then(()=>this.reports.value)}}var or=new tr;const ir={class:"widgetLoader"},nr={key:0},ar={key:1,class:"notification system notification-error"},rr=["href"],sr={key:2,class:"notification system notification-error"},lr={class:"theWidgetContent",ref:"widgetContent"};function cr(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("ActivityIndicator");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ir,[Object(E["createVNode"])(r,{"loading-message":e.finalLoadingMessage,loading:e.loading},null,8,["loading-message","loading"]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",null,[e.widgetName?(Object(E["openBlock"])(),Object(E["createElementBlock"])("h2",nr,Object(E["toDisplayString"])(e.widgetName),1)):Object(E["createCommentVNode"])("",!0),e.loadingFailedRateLimit?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",sr,Object(E["toDisplayString"])(e.translate("General_ErrorRateLimit")),1)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ar,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),e.hasErrorFaqLink?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/faq/troubleshooting/faq_19489/")},Object(E["toDisplayString"])(e.translate("General_ErrorRequestFaqLink")),9,rr)):Object(E["createCommentVNode"])("",!0)]))],512),[[E["vShow"],e.loadingFailed]]),Object(E["createElementVNode"])("div",lr,null,512)])}function dr(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */class tr{constructor(){er(this,"privateState",Object(E["reactive"])({reports:[]})),er(this,"state",Object(E["readonly"])(this.privateState)),er(this,"reports",Object(E["computed"])(()=>this.state.reports)),er(this,"reportsPromise",void 0)}findReport(e,t){return this.reports.value.find(o=>o.module===e&&o.action===t)}fetchReportMetadata(){return this.reportsPromise||(this.reportsPromise=K.fetch({method:"API.getReportMetadata",filter_limit:"-1",idSite:I.idSite||H.parsed.value.idSite}).then(e=>(this.privateState.reports=e,e))),this.reportsPromise.then(()=>this.reports.value)}}var or=new tr;const ir={class:"widgetLoader"},nr={key:0},ar={key:1,class:"notification system notification-error"},rr=["href"],sr={key:2,class:"notification system notification-error"},lr={class:"theWidgetContent",ref:"widgetContent"};function cr(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("ActivityIndicator");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ir,[Object(E["createVNode"])(r,{"loading-message":e.finalLoadingMessage,loading:e.loading},null,8,["loading-message","loading"]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",null,[e.widgetName?(Object(E["openBlock"])(),Object(E["createElementBlock"])("h2",nr,Object(E["toDisplayString"])(e.widgetName),1)):Object(E["createCommentVNode"])("",!0),e.loadingFailedRateLimit?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",sr,Object(E["toDisplayString"])(e.translate("General_ErrorRateLimit")),1)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ar,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_ErrorRequest","",""))+" ",1),e.hasErrorFaqLink?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:0,rel:"noreferrer noopener",target:"_blank",href:e.externalRawLink("https://matomo.org/faq/troubleshooting/faq_19489/")},Object(E["toDisplayString"])(e.translate("General_ErrorRequestFaqLink")),9,rr)):Object(E["createCommentVNode"])("",!0)]))],512),[[E["vShow"],e.loadingFailed]]),Object(E["createElementVNode"])("div",lr,null,512)])}function dr(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */class ur{constructor(){dr(this,"privateState",Object(E["reactive"])({module:"",action:"",category:"",subcategory:"",idSite:"",widgetSearchFilters:{}})),dr(this,"state",Object(E["computed"])(()=>Object(E["readonly"])(this.privateState))),I.on("matomoPageChange",()=>{this.isCurrentPage()||this.resetSearchFilters(),this.updateCurrentRoutingFromUrl()})}resetSearchFilters(){this.privateState.widgetSearchFilters={}}getSearchFilters(e){return this.state.value.widgetSearchFilters[e]||{}}setSearchFilters(e,t){e&&(this.privateState.widgetSearchFilters[e]=t)}updateCurrentRoutingFromUrl(){const e=H.parsed.value;this.privateState.module=e.module,this.privateState.action=e.action,this.privateState.category=e.category,this.privateState.subcategory=e.subcategory,this.privateState.idSite=e.idSite}isCurrentPage(){const e=H.parsed.value;return this.state.value.module===e.module&&this.state.value.action===e.action&&this.state.value.category===e.category&&this.state.value.subcategory===e.subcategory&&this.state.value.idSite===e.idSite}}var mr=new ur,pr=Object(E["defineComponent"])({props:{widgetParams:Object,widgetName:String,loadingMessage:String},components:{ActivityIndicator:_e},data(){return{loading:!1,loadingFailed:!1,loadingFailedRateLimit:!1,changeCounter:0,lastWidgetAbortController:null}},watch:{widgetParams(e){e&&this.loadWidgetUrl(e,this.changeCounter+=1)}},computed:{finalLoadingMessage(){return this.loadingMessage?this.loadingMessage:this.widgetName?a("General_LoadingPopover",this.widgetName):a("General_LoadingData")},hasErrorFaqLink(){const e=I.config.enable_general_settings_admin,t=I.config.enable_plugins_admin;return I.hasSuperUserAccess&&(e||t)}},mounted(){this.widgetParams&&this.loadWidgetUrl(this.widgetParams,this.changeCounter+=1)},beforeUnmount(){this.cleanupLastWidgetContent()},methods:{abortHttpRequestIfNeeded(){this.lastWidgetAbortController&&(this.lastWidgetAbortController.abort(),this.lastWidgetAbortController=null)},cleanupLastWidgetContent(){const e=this.$refs.widgetContent;I.helper.destroyVueComponent(e),e&&(e.innerHTML="")},getWidgetUrl(e){const t=H.parsed.value;let o=Object.assign({},e||{});const i=Object.keys(Object.assign(Object.assign({},H.hashParsed.value),{},{idSite:"",period:"",date:"",segment:"",widget:""}));return i.forEach(e=>{"category"!==e&&"subcategory"!==e&&(e in o||(o[e]=t[e]))}),Do.isComparisonEnabled()&&(o=Object.assign(Object.assign({},o),{},{comparePeriods:t.comparePeriods,compareDates:t.compareDates,compareSegments:t.compareSegments})),e&&"showtitle"in e||(o.showtitle="1"),I.shouldPropagateTokenAuth&&t.token_auth&&(I.broadcast.isWidgetizeRequestWithoutSession()||(o.force_api_session="1"),o.token_auth=t.token_auth),o.random=Math.floor(1e4*Math.random()),o},loadWidgetUrl(e,t){this.loading=!0,this.abortHttpRequestIfNeeded(),this.cleanupLastWidgetContent(),this.lastWidgetAbortController=new AbortController;let o={};e.uniqueId&&(o=mr.getSearchFilters(e.uniqueId)),G.fetch(this.getWidgetUrl(Object.assign(e,o)),{format:"html",abortController:this.lastWidgetAbortController}).then(o=>{if(t!==this.changeCounter||"string"!==typeof o)return;this.lastWidgetAbortController=null,this.loading=!1,this.loadingFailed=!1;const i=this.$refs.widgetContent;window.$(i).html(o);const n=window.$(i).children();if(this.widgetName){let e=n.find("> .card-content .card-title");e.length||(e=n.find("> h2")),e.length&&e.html(I.helper.htmlEntities(this.widgetName))}I.helper.compileVueEntryComponents(n),ki.parseNotificationDivs(),setTimeout(()=>{I.postEvent("widget:loaded",{parameters:e,element:n})})}).catch(e=>{t===this.changeCounter&&(this.lastWidgetAbortController=null,this.cleanupLastWidgetContent(),this.loading=!1,"abort"!==e.xhrStatus&&(429===e.status&&(this.loadingFailedRateLimit=!0),this.loadingFailed=!0))})}}});pr.render=cr;var hr=pr;const gr={class:"widget-container"};function br(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Widget");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",gr,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.actualContainer,(e,t)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:t},[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(r,{widget:e,"prevent-recursion":!0},null,8,["widget"])])]))),128))])}const fr=ve("CoreHome","Widget");var vr=Object(E["defineComponent"])({props:{container:{type:Array,required:!0}},components:{Widget:fr},computed:{actualContainer(){var e,t,o;const i=this.container;if(null===i||void 0===i||null===(e=i[0])||void 0===e||!e.parameters)return i;const[n]=i,a="1"===(null===(t=n.parameters)||void 0===t?void 0:t.widget)||1===(null===(o=n.parameters)||void 0===o?void 0:o.widget),r=a&&"graphEvolution"===n.viewDataTable,s=r?Object.assign(Object.assign({},n),{},{parameters:Object.assign(Object.assign({},n.parameters),{},{showtitle:"0"})}):n;return[s,...i.slice(1)]}}});vr.render=br;var Or=vr;const jr={class:"reportsByDimensionView"},yr={class:"entityList"},wr={class:"listCircle"},Sr=["onClick"],kr={class:"dimension"},Cr={class:"reportContainer"},Er=Object(E["createElementVNode"])("div",{class:"clear"},null,-1);function Dr(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("WidgetLoader");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",jr,[Object(E["createElementVNode"])("div",yr,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.widgetsByCategory,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:"dimensionCategory",key:t.name},[Object(E["createTextVNode"])(Object(E["toDisplayString"])(t.name)+" ",1),Object(E["createElementVNode"])("ul",wr,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.widgets,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["reportDimension",{activeDimension:e.selectedWidget.uniqueId===t.uniqueId}]),key:t.uniqueId,onClick:o=>e.selectWidget(t)},[Object(E["createElementVNode"])("span",kr,Object(E["toDisplayString"])(t.name),1)],10,Sr))),128))])]))),128))]),Object(E["createElementVNode"])("div",Cr,[e.selectedWidget.parameters?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0,"widget-params":e.selectedWidget.parameters,class:"dimensionReport"},null,8,["widget-params"])):Object(E["createCommentVNode"])("",!0)]),Er])}var Pr=Object(E["defineComponent"])({props:{widgets:Array},components:{WidgetLoader:hr},data(){return{selectedWidget:null}},created(){[this.selectedWidget]=this.widgetsSorted},computed:{widgetsSorted(){return Ra(this.widgets)},widgetsByCategory(){const e={};return this.widgetsSorted.forEach(t=>{var o;const i=null===(o=t.subcategory)||void 0===o?void 0:o.name;i&&(e[i]||(e[i]={name:i,order:t.order,widgets:[]}),e[i].widgets.push(t))}),Ra(Object.values(e))}},methods:{selectWidget(e){this.selectedWidget=Object.assign({},e)}}});Pr.render=Dr;var Tr=Pr;const Vr=["id"],Nr={key:1},xr={key:2};function Br(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("WidgetLoader"),s=Object(E["resolveComponent"])("WidgetContainer"),l=Object(E["resolveComponent"])("WidgetByDimensionContainer"),c=Object(E["resolveDirective"])("tooltips");return e.actualWidget&&e.showWidget?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,class:Object(E["normalizeClass"])(["matomo-widget",{isFirstWidgetInPage:e.actualWidget.isFirstInPage}]),id:e.actualWidget.uniqueId},[!e.actualWidget.isContainer&&e.actualWidget.parameters?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0,"widget-params":e.actualWidget.parameters,"widget-name":e.actualWidget.name},null,8,["widget-params","widget-name"])):Object(E["createCommentVNode"])("",!0),e.actualWidget.isContainer&&"ByDimension"!==e.actualWidget.layout&&!this.preventRecursion?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Nr,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(s,{container:e.actualWidget.widgets},null,8,["container"])])])):Object(E["createCommentVNode"])("",!0),e.actualWidget.isContainer&&"ByDimension"===e.actualWidget.layout?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",xr,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(l,{widgets:e.actualWidget.widgets},null,8,["widgets"])])])):Object(E["createCommentVNode"])("",!0)],10,Vr)),[[c,{content:e.tooltipContent}]]):Object(E["createCommentVNode"])("",!0)}function Ir(e,t){let o=void 0;return Object.values(e||{}).some(e=>(o=e.find(e=>{var o;return e&&e.isContainer&&(null===(o=e.parameters)||void 0===o?void 0:o.containerId)===t}),o)),o}var Mr=Object(E["defineComponent"])({props:{widget:Object,widgetized:Boolean,containerid:String,preventRecursion:Boolean},components:{WidgetLoader:hr,WidgetContainer:Or,WidgetByDimensionContainer:Tr},directives:{Tooltips:tt},data(){return{showWidget:!1}},setup(){function e(){const e=window.$(this);if(e.hasClass("matomo-form-field"))return"";const t=window.$(this).attr("title")||"";return window.vueSanitize(t.replace(/\n/g,"
"))}return{tooltipContent:e}},created(){const{actualWidget:e}=this;if(e&&e.middlewareParameters){const t=e.middlewareParameters;G.fetch(t).then(e=>{this.showWidget=!!e})}else this.showWidget=!0},computed:{allWidgets(){return Ka.widgets.value},actualWidget(){const e=this.widget;if(e){const t=Object.assign({},e);if(e&&e.isReport&&!e.documentation){const o=or.findReport(e.module,e.action);o&&o.documentation&&(t.documentation=o.documentation)}return e.uniqueId&&(t.parameters=Object.assign(Object.assign({},t.parameters),{},{uniqueId:e.uniqueId})),t}if(this.containerid){const e=Ir(this.allWidgets,this.containerid);if(e){const t=Object.assign({},e);if(this.widgetized){t.isFirstInPage=!0,t.parameters=Object.assign(Object.assign({},t.parameters),{},{widget:"1"});const e=Ya(t);e&&(t.widgets=e.map(e=>Object.assign(Object.assign({},e),{},{parameters:Object.assign(Object.assign({},e.parameters),{},{widget:"1",containerId:this.containerid})})))}return t}}return null}}});Mr.render=Br;var Lr=Mr;const Fr={class:"reporting-page"},Ar={key:1,class:"col s12 l6 leftWidgetColumn"},_r={key:2,class:"col s12 l6 rightWidgetColumn"};function Rr(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("ActivityIndicator"),s=Object(E["resolveComponent"])("Widget");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Fr,[Object(E["createVNode"])(r,{loading:e.loading},null,8,["loading"]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",null,Object(E["toDisplayString"])(e.translate("CoreHome_NoSuchPage")),513),[[E["vShow"],e.hasNoPage]]),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.widgets,e=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:"row",key:e.uniqueId},[e.group?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createBlock"])(s,{key:0,class:"col s12 fullWidgetColumn",widget:e},null,8,["widget"])),e.group?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Ar,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.left,e=>(Object(E["openBlock"])(),Object(E["createBlock"])(s,{widget:e,key:e.uniqueId},null,8,["widget"]))),128))])):Object(E["createCommentVNode"])("",!0),e.group?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",_r,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.right,e=>(Object(E["openBlock"])(),Object(E["createBlock"])(s,{widget:e,key:e.uniqueId},null,8,["widget"]))),128))])):Object(E["createCommentVNode"])("",!0)]))),128))])}function Hr(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */class ur{constructor(){dr(this,"privateState",Object(E["reactive"])({module:"",action:"",category:"",subcategory:"",idSite:"",widgetSearchFilters:{}})),dr(this,"state",Object(E["computed"])(()=>Object(E["readonly"])(this.privateState))),I.on("matomoPageChange",()=>{this.isCurrentPage()||this.resetSearchFilters(),this.updateCurrentRoutingFromUrl()})}resetSearchFilters(){this.privateState.widgetSearchFilters={}}getSearchFilters(e){return this.state.value.widgetSearchFilters[e]||{}}setSearchFilters(e,t){e&&(this.privateState.widgetSearchFilters[e]=t)}updateCurrentRoutingFromUrl(){const e=H.parsed.value;this.privateState.module=e.module,this.privateState.action=e.action,this.privateState.category=e.category,this.privateState.subcategory=e.subcategory,this.privateState.idSite=e.idSite}isCurrentPage(){const e=H.parsed.value;return this.state.value.module===e.module&&this.state.value.action===e.action&&this.state.value.category===e.category&&this.state.value.subcategory===e.subcategory&&this.state.value.idSite===e.idSite}}var mr=new ur,pr=Object(E["defineComponent"])({props:{widgetParams:Object,widgetName:String,loadingMessage:String},components:{ActivityIndicator:_e},data(){return{loading:!1,loadingFailed:!1,loadingFailedRateLimit:!1,changeCounter:0,lastWidgetAbortController:null}},watch:{widgetParams(e){e&&this.loadWidgetUrl(e,this.changeCounter+=1)}},computed:{finalLoadingMessage(){return this.loadingMessage?this.loadingMessage:this.widgetName?a("General_LoadingPopover",this.widgetName):a("General_LoadingData")},hasErrorFaqLink(){const e=I.config.enable_general_settings_admin,t=I.config.enable_plugins_admin;return I.hasSuperUserAccess&&(e||t)}},mounted(){this.widgetParams&&this.loadWidgetUrl(this.widgetParams,this.changeCounter+=1)},beforeUnmount(){this.cleanupLastWidgetContent()},methods:{abortHttpRequestIfNeeded(){this.lastWidgetAbortController&&(this.lastWidgetAbortController.abort(),this.lastWidgetAbortController=null)},cleanupLastWidgetContent(){const e=this.$refs.widgetContent;I.helper.destroyVueComponent(e),e&&(e.innerHTML="")},getWidgetUrl(e){const t=H.parsed.value;let o=Object.assign({},e||{});const i=Object.keys(Object.assign(Object.assign({},H.hashParsed.value),{},{idSite:"",period:"",date:"",segment:"",widget:""}));return i.forEach(e=>{"category"!==e&&"subcategory"!==e&&(e in o||(o[e]=t[e]))}),Do.isComparisonEnabled()&&(o=Object.assign(Object.assign({},o),{},{comparePeriods:t.comparePeriods,compareDates:t.compareDates,compareSegments:t.compareSegments})),e&&"showtitle"in e||(o.showtitle="1"),I.shouldPropagateTokenAuth&&t.token_auth&&(I.broadcast.isWidgetizeRequestWithoutSession()||(o.force_api_session="1"),o.token_auth=t.token_auth),o.random=Math.floor(1e4*Math.random()),o},loadWidgetUrl(e,t){this.loading=!0,this.abortHttpRequestIfNeeded(),this.cleanupLastWidgetContent(),this.lastWidgetAbortController=new AbortController;let o={};e.uniqueId&&(o=mr.getSearchFilters(e.uniqueId)),K.fetch(this.getWidgetUrl(Object.assign(e,o)),{format:"html",abortController:this.lastWidgetAbortController}).then(o=>{if(t!==this.changeCounter||"string"!==typeof o)return;this.lastWidgetAbortController=null,this.loading=!1,this.loadingFailed=!1;const i=this.$refs.widgetContent;window.$(i).html(o);const n=window.$(i).children();if(this.widgetName){let e=n.find("> .card-content .card-title");e.length||(e=n.find("> h2")),e.length&&e.html(I.helper.htmlEntities(this.widgetName))}I.helper.compileVueEntryComponents(n),ki.parseNotificationDivs(),setTimeout(()=>{I.postEvent("widget:loaded",{parameters:e,element:n})})}).catch(e=>{t===this.changeCounter&&(this.lastWidgetAbortController=null,this.cleanupLastWidgetContent(),this.loading=!1,"abort"!==e.xhrStatus&&(429===e.status&&(this.loadingFailedRateLimit=!0),this.loadingFailed=!0))})}}});pr.render=cr;var hr=pr;const gr={class:"widget-container"};function br(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Widget");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",gr,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.actualContainer,(e,t)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:t},[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(r,{widget:e,"prevent-recursion":!0},null,8,["widget"])])]))),128))])}const fr=ve("CoreHome","Widget");var vr=Object(E["defineComponent"])({props:{container:{type:Array,required:!0}},components:{Widget:fr},computed:{actualContainer(){var e,t,o;const i=this.container;if(null===i||void 0===i||null===(e=i[0])||void 0===e||!e.parameters)return i;const[n]=i,a="1"===(null===(t=n.parameters)||void 0===t?void 0:t.widget)||1===(null===(o=n.parameters)||void 0===o?void 0:o.widget),r=a&&"graphEvolution"===n.viewDataTable,s=r?Object.assign(Object.assign({},n),{},{parameters:Object.assign(Object.assign({},n.parameters),{},{showtitle:"0"})}):n;return[s,...i.slice(1)]}}});vr.render=br;var Or=vr;const jr={class:"reportsByDimensionView"},yr={class:"entityList"},wr={class:"listCircle"},Sr=["onClick"],kr={class:"dimension"},Cr={class:"reportContainer"},Er=Object(E["createElementVNode"])("div",{class:"clear"},null,-1);function Dr(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("WidgetLoader");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",jr,[Object(E["createElementVNode"])("div",yr,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.widgetsByCategory,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:"dimensionCategory",key:t.name},[Object(E["createTextVNode"])(Object(E["toDisplayString"])(t.name)+" ",1),Object(E["createElementVNode"])("ul",wr,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.widgets,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:Object(E["normalizeClass"])(["reportDimension",{activeDimension:e.selectedWidget.uniqueId===t.uniqueId}]),key:t.uniqueId,onClick:o=>e.selectWidget(t)},[Object(E["createElementVNode"])("span",kr,Object(E["toDisplayString"])(t.name),1)],10,Sr))),128))])]))),128))]),Object(E["createElementVNode"])("div",Cr,[e.selectedWidget.parameters?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0,"widget-params":e.selectedWidget.parameters,class:"dimensionReport"},null,8,["widget-params"])):Object(E["createCommentVNode"])("",!0)]),Er])}var Pr=Object(E["defineComponent"])({props:{widgets:Array},components:{WidgetLoader:hr},data(){return{selectedWidget:null}},created(){[this.selectedWidget]=this.widgetsSorted},computed:{widgetsSorted(){return Ra(this.widgets)},widgetsByCategory(){const e={};return this.widgetsSorted.forEach(t=>{var o;const i=null===(o=t.subcategory)||void 0===o?void 0:o.name;i&&(e[i]||(e[i]={name:i,order:t.order,widgets:[]}),e[i].widgets.push(t))}),Ra(Object.values(e))}},methods:{selectWidget(e){this.selectedWidget=Object.assign({},e)}}});Pr.render=Dr;var Tr=Pr;const Vr=["id"],Nr={key:1},xr={key:2};function Br(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("WidgetLoader"),s=Object(E["resolveComponent"])("WidgetContainer"),l=Object(E["resolveComponent"])("WidgetByDimensionContainer"),c=Object(E["resolveDirective"])("tooltips");return e.actualWidget&&e.showWidget?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,class:Object(E["normalizeClass"])(["matomo-widget",{isFirstWidgetInPage:e.actualWidget.isFirstInPage}]),id:e.actualWidget.uniqueId},[!e.actualWidget.isContainer&&e.actualWidget.parameters?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0,"widget-params":e.actualWidget.parameters,"widget-name":e.actualWidget.name},null,8,["widget-params","widget-name"])):Object(E["createCommentVNode"])("",!0),e.actualWidget.isContainer&&"ByDimension"!==e.actualWidget.layout&&!this.preventRecursion?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Nr,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(s,{container:e.actualWidget.widgets},null,8,["container"])])])):Object(E["createCommentVNode"])("",!0),e.actualWidget.isContainer&&"ByDimension"===e.actualWidget.layout?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",xr,[Object(E["createElementVNode"])("div",null,[Object(E["createVNode"])(l,{widgets:e.actualWidget.widgets},null,8,["widgets"])])])):Object(E["createCommentVNode"])("",!0)],10,Vr)),[[c,{content:e.tooltipContent}]]):Object(E["createCommentVNode"])("",!0)}function Ir(e,t){let o=void 0;return Object.values(e||{}).some(e=>(o=e.find(e=>{var o;return e&&e.isContainer&&(null===(o=e.parameters)||void 0===o?void 0:o.containerId)===t}),o)),o}var Mr=Object(E["defineComponent"])({props:{widget:Object,widgetized:Boolean,containerid:String,preventRecursion:Boolean},components:{WidgetLoader:hr,WidgetContainer:Or,WidgetByDimensionContainer:Tr},directives:{Tooltips:tt},data(){return{showWidget:!1}},setup(){function e(){const e=window.$(this);if(e.hasClass("matomo-form-field"))return"";const t=window.$(this).attr("title")||"";return window.vueSanitize(t.replace(/\n/g,"
"))}return{tooltipContent:e}},created(){const{actualWidget:e}=this;if(e&&e.middlewareParameters){const t=e.middlewareParameters;K.fetch(t).then(e=>{this.showWidget=!!e})}else this.showWidget=!0},computed:{allWidgets(){return Ka.widgets.value},actualWidget(){const e=this.widget;if(e){const t=Object.assign({},e);if(e&&e.isReport&&!e.documentation){const o=or.findReport(e.module,e.action);o&&o.documentation&&(t.documentation=o.documentation)}return e.uniqueId&&(t.parameters=Object.assign(Object.assign({},t.parameters),{},{uniqueId:e.uniqueId})),t}if(this.containerid){const e=Ir(this.allWidgets,this.containerid);if(e){const t=Object.assign({},e);if(this.widgetized){t.isFirstInPage=!0,t.parameters=Object.assign(Object.assign({},t.parameters),{},{widget:"1"});const e=Ya(t);e&&(t.widgets=e.map(e=>Object.assign(Object.assign({},e),{},{parameters:Object.assign(Object.assign({},e.parameters),{},{widget:"1",containerId:this.containerid})})))}return t}}return null}}});Mr.render=Br;var Lr=Mr;const Fr={class:"reporting-page"},Ar={key:1,class:"col s12 l6 leftWidgetColumn"},_r={key:2,class:"col s12 l6 rightWidgetColumn"};function Rr(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("ActivityIndicator"),s=Object(E["resolveComponent"])("Widget");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Fr,[Object(E["createVNode"])(r,{loading:e.loading},null,8,["loading"]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",null,Object(E["toDisplayString"])(e.translate("CoreHome_NoSuchPage")),513),[[E["vShow"],e.hasNoPage]]),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.widgets,e=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{class:"row",key:e.uniqueId},[e.group?Object(E["createCommentVNode"])("",!0):(Object(E["openBlock"])(),Object(E["createBlock"])(s,{key:0,class:"col s12 fullWidgetColumn",widget:e},null,8,["widget"])),e.group?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Ar,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.left,e=>(Object(E["openBlock"])(),Object(E["createBlock"])(s,{widget:e,key:e.uniqueId},null,8,["widget"]))),128))])):Object(E["createCommentVNode"])("",!0),e.group?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",_r,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.right,e=>(Object(E["openBlock"])(),Object(E["createBlock"])(s,{widget:e,key:e.uniqueId},null,8,["widget"]))),128))])):Object(E["createCommentVNode"])("",!0)]))),128))])}function Hr(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */function $r(e){return!!(e.isContainer&&e.layout&&"ByDimension"===e.layout||"bydimension"===e.viewDataTable)||(!!e.isWide||e.viewDataTable&&("tableAllColumns"===e.viewDataTable||"sparklines"===e.viewDataTable||"graphEvolution"===e.viewDataTable))}function Ur(e){if(e&&e[0]){const t=[...e],o=e[0];return o.group?t[0]=Object.assign(Object.assign({},t[0]),{},{left:Ur(o.left||[]),right:Ur(o.right||[])}):t[0]=Object.assign(Object.assign({},t[0]),{},{isFirstInPage:!0}),t}return e}class qr{constructor(){Hr(this,"privateState",Object(E["reactive"])({})),Hr(this,"state",Object(E["computed"])(()=>Object(E["readonly"])(this.privateState))),Hr(this,"page",Object(E["computed"])(()=>this.state.value.page)),Hr(this,"widgets",Object(E["computed"])(()=>{const e=this.page.value;if(!e)return[];let t=[];const o={},i=e=>e.isReport&&o[`${e.module}.${e.action}`],n=e=>{if(!e.isReport)return[];const t=or.findReport(e.module,e.action);return t&&t.relatedReports?t.relatedReports:[]};if((e.widgets||[]).forEach(e=>{i(e)||(n(e).forEach(e=>{o[`${e.module}.${e.action}`]=!0}),t.push(e))}),t=Ra(t),1===t.length)return Ur(t);const a=[];for(let s=0;s(this.privateState.page=_a.findPage(e,t),this.page.value))}resetPage(){this.privateState.page=void 0}}var Wr=new qr;function zr(){const e="category=General_Visitors&subcategory=Live_VisitorLog",t=window.broadcast.buildReportingUrl(e);let o=a("CoreHome_PeriodHasOnlyRawData",``,"");I.visitorLogEnabled||(o=a("CoreHome_PeriodHasOnlyRawDataNoVisitsLog")),ki.show({id:"onlyRawData",animate:!1,context:"info",message:o,type:"transient"})}function Gr(){ki.remove("onlyRawData")}var Yr=Object(E["defineComponent"])({components:{ActivityIndicator:_e,Widget:Lr},data(){return{loading:!1,hasRawData:!1,hasNoVisits:!1,dateLastChecked:null,hasNoPage:!1}},created(){Wr.resetPage(),this.loading=!0,this.renderInitialPage(),Object(E["watch"])(()=>H.parsed.value,(e,t)=>{e.category===t.category&&e.subcategory===t.subcategory&&e.period===t.period&&e.date===t.date&&e.segment===t.segment&&JSON.stringify(e.compareDates)===JSON.stringify(t.compareDates)&&JSON.stringify(e.comparePeriods)===JSON.stringify(t.comparePeriods)&&JSON.stringify(e.compareSegments)===JSON.stringify(t.compareSegments)&&JSON.stringify(e.columns||"")===JSON.stringify(t.columns||"")||(e.date===t.date&&e.period===t.period||(Gr(),this.dateLastChecked=null,this.hasRawData=!1,this.hasNoVisits=!1),this.renderPage(e.category,e.subcategory,e.period,e.date,e.segment))}),I.on("loadPage",(e,t)=>{const o=H.parsed.value;this.renderPage(e,t,o.period,o.date,o.segment)})},computed:{widgets(){return Wr.widgets.value}},methods:{renderPage(e,t,o,i,n){if(!e||!t)return Wr.resetPage(),void(this.loading=!1);try{c.parse(o,i)}catch(s){return ki.show({id:"invalidDate",animate:!1,context:"error",message:a("CoreHome_DateInvalid"),type:"transient"}),Wr.resetPage(),void(this.loading=!1)}ki.remove("invalidDate"),I.postEvent("matomoPageChange",{}),ki.clearTransientNotifications(),c.parse(o,i).containsToday()&&this.showOnlyRawDataMessageIfRequired(e,t,o,i,n);const r={category:e,subcategory:t};if(I.postEvent("ReportingPage.loadPage",r),r.promise)return this.loading=!0,void Promise.resolve(r.promise).finally(()=>{this.loading=!1});Wr.fetchPage(e,t).then(()=>{const t=!Wr.page.value;if(t){const t=_a.findPageInCategory(e);if(t&&t.subcategory)return void H.updateHash(Object.assign(Object.assign({},H.hashParsed.value),{},{subcategory:t.subcategory.id}))}this.hasNoPage=t,this.loading=!1})},renderInitialPage(){const e=H.parsed.value;this.renderPage(e.category,e.subcategory,e.period,e.date,e.segment)},showOnlyRawDataMessageIfRequired(e,t,o,i,n){if(this.hasRawData&&this.hasNoVisits&&zr(),n)return void Gr();const a=["Live_VisitorLog","General_RealTime","UserCountryMap_RealTimeMap","MediaAnalytics_TypeAudienceLog","MediaAnalytics_TypeRealTime","FormAnalytics_TypeRealTime","Goals_AddNewGoal"],r=["HeatmapSessionRecording_Heatmaps","HeatmapSessionRecording_SessionRecordings","Marketplace_Marketplace"];if(-1!==a.indexOf(t)||-1!==r.indexOf(e)||-1!==t.toLowerCase().indexOf("manage"))return void Gr();const s=6e4;this.dateLastChecked&&(new Date).valueOf()-this.dateLastChecked.valueOf()(this.dateLastChecked=new Date,e.value>0?(this.hasNoVisits=!1,void Gr()):(this.hasNoVisits=!0,this.hasRawData?void zr():G.fetch({method:"Live.getMostRecentVisitsDateTime",date:i,period:o}).then(e=>{if(!e||""===e.value)return this.hasRawData=!1,void Gr();this.hasRawData=!0,zr()}))))}}});Yr.render=Rr;var Jr=Yr;const Kr={class:"report-export-popover row",id:"reportExport"},Qr={class:"col l6"},Xr={name:"format"},Zr={name:"option_flat"},es={name:"option_show_dimensions"},ts={name:"option_expanded"},os={name:"option_format_metrics"},is={class:"col l6"},ns={name:"filter_type"},as={class:"filter_limit"},rs={name:"filter_limit_all"},ss={key:0,name:"filter_limit"},ls={key:1,name:"filter_limit"},cs={class:"col l12"},ds=["value"],us=["innerHTML"],ms={class:"col l12"},ps=["href","title"],hs=["innerHTML"];function gs(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Field"),s=Object(E["resolveDirective"])("select-on-focus");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Kr,[Object(E["createElementVNode"])("div",Qr,[Object(E["createElementVNode"])("div",Xr,[Object(E["createVNode"])(r,{uicontrol:"radio",name:"format",title:e.translate("CoreHome_ExportFormat"),modelValue:e.reportFormat,"onUpdate:modelValue":t[0]||(t[0]=t=>e.reportFormat=t),"full-width":!0,options:e.availableReportFormats[e.reportType]},null,8,["title","modelValue","options"])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",Zr,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_flat",title:e.translate("CoreHome_FlattenReport"),modelValue:e.optionFlat,"onUpdate:modelValue":t[1]||(t[1]=t=>e.optionFlat=t)},null,8,["title","modelValue"]),[[E["vShow"],e.hasSubtables]])])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",es,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_show_dimensions",title:e.translate("CoreHome_IncludeDimensionsSeparately"),modelValue:e.optionShowDimensions,"onUpdate:modelValue":t[2]||(t[2]=t=>e.optionShowDimensions=t)},null,8,["title","modelValue"]),[[E["vShow"],e.hasMultipleDimensions&&e.optionFlat]])])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",ts,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_expanded",title:e.translate("CoreHome_ExpandSubtables"),modelValue:e.optionExpanded,"onUpdate:modelValue":t[3]||(t[3]=t=>e.optionExpanded=t)},null,8,["title","modelValue"]),[[E["vShow"],e.hasSubtables&&!e.optionFlat]])])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",os,[Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_format_metrics",title:e.translate("CoreHome_FormatMetrics"),modelValue:e.optionFormatMetrics,"onUpdate:modelValue":t[4]||(t[4]=t=>e.optionFormatMetrics=t)},null,8,["title","modelValue"])])])]),Object(E["createElementVNode"])("div",is,[Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",ns,[Object(E["createVNode"])(r,{uicontrol:"radio",name:"filter_type",title:e.translate("CoreHome_ReportType"),modelValue:e.reportType,"onUpdate:modelValue":t[5]||(t[5]=t=>e.reportType=t),"full-width":!0,options:e.availableReportTypes},null,8,["title","modelValue","options"])])]),Object(E["createElementVNode"])("div",as,[Object(E["withDirectives"])(Object(E["createElementVNode"])("div",rs,[Object(E["createVNode"])(r,{uicontrol:"radio",name:"filter_limit_all",title:e.translate("CoreHome_RowLimit"),modelValue:e.reportLimitAll,"onUpdate:modelValue":t[6]||(t[6]=t=>e.reportLimitAll=t),"full-width":!0,options:e.limitAllOptions},null,8,["title","modelValue","options"])],512),[[E["vShow"],!e.maxFilterLimit||e.maxFilterLimit<=0]]),"no"===e.reportLimitAll&&e.maxFilterLimit<=0?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ss,[Object(E["createVNode"])(r,{uicontrol:"number",name:"filter_limit",min:1,modelValue:e.reportLimit,"onUpdate:modelValue":t[7]||(t[7]=t=>e.reportLimit=t),"full-width":!0},null,8,["modelValue"])])):Object(E["createCommentVNode"])("",!0),"no"===e.reportLimitAll&&e.maxFilterLimit>0?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ls,[Object(E["createVNode"])(r,{uicontrol:"number",name:"filter_limit",min:1,max:e.maxFilterLimit,modelValue:e.reportLimit,"onUpdate:modelValue":t[8]||(t[8]=t=>e.reportLimit=t),value:e.reportLimit,"full-width":!0,title:e.filterLimitTooltip},null,8,["max","modelValue","value","title"])])):Object(E["createCommentVNode"])("",!0)])]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",cs,[Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("textarea",{readonly:"",class:"exportFullUrl",value:e.exportLinkWithoutToken},[Object(E["createTextVNode"])("\n ")],8,ds)),[[s,{}]]),Object(E["createElementVNode"])("div",{class:"tooltip",innerHTML:e.$sanitize(e.translate("CoreHome_ExportTooltipWithLink","","","ENTER_YOUR_TOKEN_AUTH_HERE"))},null,8,us)],512),[[E["vShow"],e.showUrl]]),Object(E["createElementVNode"])("div",ms,[Object(E["createElementVNode"])("a",{class:"btn",href:e.exportLink,target:"_new",title:e.translate("CoreHome_ExportTooltip")},Object(E["toDisplayString"])(e.translate("General_Export")),9,ps),Object(E["createElementVNode"])("a",{href:"javascript:",onClick:t[9]||(t[9]=t=>e.showUrl=!e.showUrl),class:"toggle-export-url"},[Object(E["withDirectives"])(Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translate("CoreHome_ShowExportUrl")),513),[[E["vShow"],!e.showUrl]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translate("CoreHome_HideExportUrl")),513),[[E["vShow"],e.showUrl]])])]),e.additionalContent?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,class:"col l12 report-export-popover-footer",innerHTML:e.$sanitize(e.additionalContent)},null,8,hs)):Object(E["createCommentVNode"])("",!0)])}const bs=ve("CorePluginsAdmin","Field");var fs=Object(E["defineComponent"])({components:{Field:bs},directives:{SelectOnFocus:Tt},props:{hasSubtables:Boolean,availableReportTypes:Object,availableReportFormats:{type:Object,required:!0},maxFilterLimit:Number,limitAllOptions:Object,dataTable:{type:Object,required:!0},requestParams:[Object,String],apiMethod:{type:String,required:!0},initialReportType:{type:String,default:"default"},initialReportLimit:{type:[String,Number],default:100},initialReportLimitAll:{type:String,default:"yes"},initialOptionFlat:{type:Boolean,default:!1},initialOptionShowDimensions:{type:Boolean,default:!1},initialOptionExpanded:{type:Boolean,default:!0},initialOptionFormatMetrics:{type:Boolean,default:!1},initialReportFormat:{type:String,default:"XML"}},mounted(){const e={content:this.additionalContent,dataTable:this.dataTable};I.postEvent("ReportExportPopover.additionalContent",e),this.additionalContent=e.content},data(){return{showUrl:!1,reportFormat:this.initialReportFormat,optionFlat:this.initialOptionFlat,optionShowDimensions:this.initialOptionShowDimensions,optionExpanded:this.initialOptionExpanded,optionFormatMetrics:this.initialOptionFormatMetrics,reportType:this.initialReportType,reportLimitAll:this.initialReportLimitAll,reportLimit:"string"===typeof this.initialReportLimit?parseInt(this.initialReportLimit,10):this.initialReportLimit,additionalContent:""}},watch:{reportType(e){this.availableReportFormats[e][this.reportFormat]||(this.reportFormat="XML")},reportLimit(e,t){this.maxFilterLimit&&this.maxFilterLimit>0&&e>this.maxFilterLimit&&(this.reportLimit=t)}},computed:{hasMultipleDimensions(){var e,t;return"function"===typeof(null===(e=this.dataTable)||void 0===e?void 0:e.getReportMetadata)&&Object.keys((null===(t=this.dataTable)||void 0===t?void 0:t.getReportMetadata().dimensions)||{}).length>1},filterLimitTooltip(){const e=a("CoreHome_RowLimit"),t=this.maxFilterLimit?a("General_ComputedMetricMax",this.maxFilterLimit.toString()):"";return`${e} (${t})`},exportLink(){return this.getExportLink(!0)},exportLinkWithoutToken(){return this.getExportLink(!1)}},methods:{getExportLink(e=!0){const{reportFormat:t,apiMethod:o,reportType:i}=this,n=this.dataTable;if(!t)return;let a={};const r="yes"===this.reportLimitAll?-1:this.reportLimit;this.requestParams&&"string"===typeof this.requestParams?a=JSON.parse(this.requestParams):this.requestParams&&"object"===typeof this.requestParams&&(a=this.requestParams);const{segment:s,label:l,idGoal:c,idDimension:d,idSite:u}=n.param;let{date:m,period:p}=n.param;"RSS"===t&&(m="last10"),"undefined"!==typeof n.param.dateUsedInGraph&&(m=n.param.dateUsedInGraph);const h=I.config.datatable_export_range_as_day.toLowerCase();-1!==h.indexOf(t.toLowerCase())&&"range"===n.param.period&&(p="day"),"range"===n.param.period&&"graphEvolution"===n.param.viewDataTable&&(p="day");const g={module:"API",format:t,idSite:u,period:p,date:m};if("processed"===i?(g.method="API.getProcessedReport",[g.apiModule,g.apiAction]=o.split(".")):g.method=o,n.param.compareDates&&n.param.compareDates.length&&(g.compareDates=n.param.compareDates,g.compare="1"),n.param.comparePeriods&&n.param.comparePeriods.length&&(g.comparePeriods=n.param.comparePeriods,g.compare="1"),n.param.compareSegments&&n.param.compareSegments.length&&(g.compareSegments=n.param.compareSegments,g.compare="1"),"undefined"!==typeof n.param.filter_pattern&&(g.filter_pattern=n.param.filter_pattern),"undefined"!==typeof n.param.filter_pattern_recursive&&(g.filter_pattern_recursive=n.param.filter_pattern_recursive),window.$.isPlainObject(a)&&Object.entries(a).forEach(([e,t])=>{let o=t;!0===o?o=1:!1===o&&(o=0),g[e]=o}),this.optionFlat&&(g.flat=1,this.optionShowDimensions&&(g.show_dimensions=1),"undefined"!==typeof n.param.include_aggregate_rows&&"1"===n.param.include_aggregate_rows&&(g.include_aggregate_rows=1)),!this.optionFlat&&this.optionExpanded&&(g.expanded=1),this.optionFormatMetrics&&(g.format_metrics=1),n.param.pivotBy&&(g.pivotBy=n.param.pivotBy,g.pivotByColumnLimit=20,n.props.pivot_by_column&&(g.pivotByColumn=n.props.pivot_by_column)),"CSV"!==t&&"TSV"!==t&&"RSS"!==t||(g.translateColumnNames=1,g.language=I.language),"undefined"!==typeof s&&(g.segment=decodeURIComponent(s)),"undefined"!==typeof c&&"-1"!==c&&(g.idGoal=c),"undefined"!==typeof d&&"-1"!==d&&(g.idDimension=d),l){const e=l.split(",");e.length>1?g.label=e:[g.label]=e}g.showMetadata=0,g.token_auth="ENTER_YOUR_TOKEN_AUTH_HERE",!0===e&&(g.token_auth=I.token_auth,g.force_api_session=1),g.filter_limit=r;const b=window.location.href.split("?")[0];return`${b}?${H.stringify(g)}`}}});fs.render=gs;var vs=fs; + */function $r(e){return!!(e.isContainer&&e.layout&&"ByDimension"===e.layout||"bydimension"===e.viewDataTable)||(!!e.isWide||e.viewDataTable&&("tableAllColumns"===e.viewDataTable||"sparklines"===e.viewDataTable||"graphEvolution"===e.viewDataTable))}function Ur(e){if(e&&e[0]){const t=[...e],o=e[0];return o.group?t[0]=Object.assign(Object.assign({},t[0]),{},{left:Ur(o.left||[]),right:Ur(o.right||[])}):t[0]=Object.assign(Object.assign({},t[0]),{},{isFirstInPage:!0}),t}return e}class qr{constructor(){Hr(this,"privateState",Object(E["reactive"])({})),Hr(this,"state",Object(E["computed"])(()=>Object(E["readonly"])(this.privateState))),Hr(this,"page",Object(E["computed"])(()=>this.state.value.page)),Hr(this,"widgets",Object(E["computed"])(()=>{const e=this.page.value;if(!e)return[];let t=[];const o={},i=e=>e.isReport&&o[`${e.module}.${e.action}`],n=e=>{if(!e.isReport)return[];const t=or.findReport(e.module,e.action);return t&&t.relatedReports?t.relatedReports:[]};if((e.widgets||[]).forEach(e=>{i(e)||(n(e).forEach(e=>{o[`${e.module}.${e.action}`]=!0}),t.push(e))}),t=Ra(t),1===t.length)return Ur(t);const a=[];for(let s=0;s(this.privateState.page=_a.findPage(e,t),this.page.value))}resetPage(){this.privateState.page=void 0}}var Wr=new qr;function zr(){const e="category=General_Visitors&subcategory=Live_VisitorLog",t=window.broadcast.buildReportingUrl(e);let o=a("CoreHome_PeriodHasOnlyRawData",``,"");I.visitorLogEnabled||(o=a("CoreHome_PeriodHasOnlyRawDataNoVisitsLog")),ki.show({id:"onlyRawData",animate:!1,context:"info",message:o,type:"transient"})}function Gr(){ki.remove("onlyRawData")}var Yr=Object(E["defineComponent"])({components:{ActivityIndicator:_e,Widget:Lr},data(){return{loading:!1,hasRawData:!1,hasNoVisits:!1,dateLastChecked:null,hasNoPage:!1}},created(){Wr.resetPage(),this.loading=!0,this.renderInitialPage(),Object(E["watch"])(()=>H.parsed.value,(e,t)=>{e.category===t.category&&e.subcategory===t.subcategory&&e.period===t.period&&e.date===t.date&&e.segment===t.segment&&JSON.stringify(e.compareDates)===JSON.stringify(t.compareDates)&&JSON.stringify(e.comparePeriods)===JSON.stringify(t.comparePeriods)&&JSON.stringify(e.compareSegments)===JSON.stringify(t.compareSegments)&&JSON.stringify(e.columns||"")===JSON.stringify(t.columns||"")||(e.date===t.date&&e.period===t.period||(Gr(),this.dateLastChecked=null,this.hasRawData=!1,this.hasNoVisits=!1),this.renderPage(e.category,e.subcategory,e.period,e.date,e.segment))}),I.on("loadPage",(e,t)=>{const o=H.parsed.value;this.renderPage(e,t,o.period,o.date,o.segment)})},computed:{widgets(){return Wr.widgets.value}},methods:{renderPage(e,t,o,i,n){if(!e||!t)return Wr.resetPage(),void(this.loading=!1);try{c.parse(o,i)}catch(s){return ki.show({id:"invalidDate",animate:!1,context:"error",message:a("CoreHome_DateInvalid"),type:"transient"}),Wr.resetPage(),void(this.loading=!1)}ki.remove("invalidDate"),I.postEvent("matomoPageChange",{}),ki.clearTransientNotifications(),c.parse(o,i).containsToday()&&this.showOnlyRawDataMessageIfRequired(e,t,o,i,n);const r={category:e,subcategory:t};if(I.postEvent("ReportingPage.loadPage",r),r.promise)return this.loading=!0,void Promise.resolve(r.promise).finally(()=>{this.loading=!1});Wr.fetchPage(e,t).then(()=>{const t=!Wr.page.value;if(t){const t=_a.findPageInCategory(e);if(t&&t.subcategory)return void H.updateHash(Object.assign(Object.assign({},H.hashParsed.value),{},{subcategory:t.subcategory.id}))}this.hasNoPage=t,this.loading=!1})},renderInitialPage(){const e=H.parsed.value;this.renderPage(e.category,e.subcategory,e.period,e.date,e.segment)},showOnlyRawDataMessageIfRequired(e,t,o,i,n){if(this.hasRawData&&this.hasNoVisits&&zr(),n)return void Gr();const a=["Live_VisitorLog","General_RealTime","UserCountryMap_RealTimeMap","MediaAnalytics_TypeAudienceLog","MediaAnalytics_TypeRealTime","FormAnalytics_TypeRealTime","Goals_AddNewGoal"],r=["HeatmapSessionRecording_Heatmaps","HeatmapSessionRecording_SessionRecordings","Marketplace_Marketplace"];if(-1!==a.indexOf(t)||-1!==r.indexOf(e)||-1!==t.toLowerCase().indexOf("manage"))return void Gr();const s=6e4;this.dateLastChecked&&(new Date).valueOf()-this.dateLastChecked.valueOf()(this.dateLastChecked=new Date,e.value>0?(this.hasNoVisits=!1,void Gr()):(this.hasNoVisits=!0,this.hasRawData?void zr():K.fetch({method:"Live.getMostRecentVisitsDateTime",date:i,period:o}).then(e=>{if(!e||""===e.value)return this.hasRawData=!1,void Gr();this.hasRawData=!0,zr()}))))}}});Yr.render=Rr;var Jr=Yr;const Kr={class:"report-export-popover row",id:"reportExport"},Qr={class:"col l6"},Xr={name:"format"},Zr={name:"option_flat"},es={name:"option_show_dimensions"},ts={name:"option_expanded"},os={name:"option_format_metrics"},is={class:"col l6"},ns={name:"filter_type"},as={class:"filter_limit"},rs={name:"filter_limit_all"},ss={key:0,name:"filter_limit"},ls={key:1,name:"filter_limit"},cs={class:"col l12"},ds=["value"],us=["innerHTML"],ms={class:"col l12"},ps=["href","title"],hs=["innerHTML"];function gs(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Field"),s=Object(E["resolveDirective"])("select-on-focus");return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Kr,[Object(E["createElementVNode"])("div",Qr,[Object(E["createElementVNode"])("div",Xr,[Object(E["createVNode"])(r,{uicontrol:"radio",name:"format",title:e.translate("CoreHome_ExportFormat"),modelValue:e.reportFormat,"onUpdate:modelValue":t[0]||(t[0]=t=>e.reportFormat=t),"full-width":!0,options:e.availableReportFormats[e.reportType]},null,8,["title","modelValue","options"])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",Zr,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_flat",title:e.translate("CoreHome_FlattenReport"),modelValue:e.optionFlat,"onUpdate:modelValue":t[1]||(t[1]=t=>e.optionFlat=t)},null,8,["title","modelValue"]),[[E["vShow"],e.hasSubtables]])])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",es,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_show_dimensions",title:e.translate("CoreHome_IncludeDimensionsSeparately"),modelValue:e.optionShowDimensions,"onUpdate:modelValue":t[2]||(t[2]=t=>e.optionShowDimensions=t)},null,8,["title","modelValue"]),[[E["vShow"],e.hasMultipleDimensions&&e.optionFlat]])])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",ts,[Object(E["withDirectives"])(Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_expanded",title:e.translate("CoreHome_ExpandSubtables"),modelValue:e.optionExpanded,"onUpdate:modelValue":t[3]||(t[3]=t=>e.optionExpanded=t)},null,8,["title","modelValue"]),[[E["vShow"],e.hasSubtables&&!e.optionFlat]])])]),Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",os,[Object(E["createVNode"])(r,{uicontrol:"checkbox",name:"option_format_metrics",title:e.translate("CoreHome_FormatMetrics"),modelValue:e.optionFormatMetrics,"onUpdate:modelValue":t[4]||(t[4]=t=>e.optionFormatMetrics=t)},null,8,["title","modelValue"])])])]),Object(E["createElementVNode"])("div",is,[Object(E["createElementVNode"])("div",null,[Object(E["createElementVNode"])("div",ns,[Object(E["createVNode"])(r,{uicontrol:"radio",name:"filter_type",title:e.translate("CoreHome_ReportType"),modelValue:e.reportType,"onUpdate:modelValue":t[5]||(t[5]=t=>e.reportType=t),"full-width":!0,options:e.availableReportTypes},null,8,["title","modelValue","options"])])]),Object(E["createElementVNode"])("div",as,[Object(E["withDirectives"])(Object(E["createElementVNode"])("div",rs,[Object(E["createVNode"])(r,{uicontrol:"radio",name:"filter_limit_all",title:e.translate("CoreHome_RowLimit"),modelValue:e.reportLimitAll,"onUpdate:modelValue":t[6]||(t[6]=t=>e.reportLimitAll=t),"full-width":!0,options:e.limitAllOptions},null,8,["title","modelValue","options"])],512),[[E["vShow"],!e.maxFilterLimit||e.maxFilterLimit<=0]]),"no"===e.reportLimitAll&&e.maxFilterLimit<=0?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ss,[Object(E["createVNode"])(r,{uicontrol:"number",name:"filter_limit",min:1,modelValue:e.reportLimit,"onUpdate:modelValue":t[7]||(t[7]=t=>e.reportLimit=t),"full-width":!0},null,8,["modelValue"])])):Object(E["createCommentVNode"])("",!0),"no"===e.reportLimitAll&&e.maxFilterLimit>0?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",ls,[Object(E["createVNode"])(r,{uicontrol:"number",name:"filter_limit",min:1,max:e.maxFilterLimit,modelValue:e.reportLimit,"onUpdate:modelValue":t[8]||(t[8]=t=>e.reportLimit=t),value:e.reportLimit,"full-width":!0,title:e.filterLimitTooltip},null,8,["max","modelValue","value","title"])])):Object(E["createCommentVNode"])("",!0)])]),Object(E["withDirectives"])(Object(E["createElementVNode"])("div",cs,[Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("textarea",{readonly:"",class:"exportFullUrl",value:e.exportLinkWithoutToken},[Object(E["createTextVNode"])("\n ")],8,ds)),[[s,{}]]),Object(E["createElementVNode"])("div",{class:"tooltip",innerHTML:e.$sanitize(e.translate("CoreHome_ExportTooltipWithLink","","","ENTER_YOUR_TOKEN_AUTH_HERE"))},null,8,us)],512),[[E["vShow"],e.showUrl]]),Object(E["createElementVNode"])("div",ms,[Object(E["createElementVNode"])("a",{class:"btn",href:e.exportLink,target:"_new",title:e.translate("CoreHome_ExportTooltip")},Object(E["toDisplayString"])(e.translate("General_Export")),9,ps),Object(E["createElementVNode"])("a",{href:"javascript:",onClick:t[9]||(t[9]=t=>e.showUrl=!e.showUrl),class:"toggle-export-url"},[Object(E["withDirectives"])(Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translate("CoreHome_ShowExportUrl")),513),[[E["vShow"],!e.showUrl]]),Object(E["withDirectives"])(Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translate("CoreHome_HideExportUrl")),513),[[E["vShow"],e.showUrl]])])]),e.additionalContent?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{key:0,class:"col l12 report-export-popover-footer",innerHTML:e.$sanitize(e.additionalContent)},null,8,hs)):Object(E["createCommentVNode"])("",!0)])}const bs=ve("CorePluginsAdmin","Field");var fs=Object(E["defineComponent"])({components:{Field:bs},directives:{SelectOnFocus:Tt},props:{hasSubtables:Boolean,availableReportTypes:Object,availableReportFormats:{type:Object,required:!0},maxFilterLimit:Number,limitAllOptions:Object,dataTable:{type:Object,required:!0},requestParams:[Object,String],apiMethod:{type:String,required:!0},initialReportType:{type:String,default:"default"},initialReportLimit:{type:[String,Number],default:100},initialReportLimitAll:{type:String,default:"yes"},initialOptionFlat:{type:Boolean,default:!1},initialOptionShowDimensions:{type:Boolean,default:!1},initialOptionExpanded:{type:Boolean,default:!0},initialOptionFormatMetrics:{type:Boolean,default:!1},initialReportFormat:{type:String,default:"XML"}},mounted(){const e={content:this.additionalContent,dataTable:this.dataTable};I.postEvent("ReportExportPopover.additionalContent",e),this.additionalContent=e.content},data(){return{showUrl:!1,reportFormat:this.initialReportFormat,optionFlat:this.initialOptionFlat,optionShowDimensions:this.initialOptionShowDimensions,optionExpanded:this.initialOptionExpanded,optionFormatMetrics:this.initialOptionFormatMetrics,reportType:this.initialReportType,reportLimitAll:this.initialReportLimitAll,reportLimit:"string"===typeof this.initialReportLimit?parseInt(this.initialReportLimit,10):this.initialReportLimit,additionalContent:""}},watch:{reportType(e){this.availableReportFormats[e][this.reportFormat]||(this.reportFormat="XML")},reportLimit(e,t){this.maxFilterLimit&&this.maxFilterLimit>0&&e>this.maxFilterLimit&&(this.reportLimit=t)}},computed:{hasMultipleDimensions(){var e,t;return"function"===typeof(null===(e=this.dataTable)||void 0===e?void 0:e.getReportMetadata)&&Object.keys((null===(t=this.dataTable)||void 0===t?void 0:t.getReportMetadata().dimensions)||{}).length>1},filterLimitTooltip(){const e=a("CoreHome_RowLimit"),t=this.maxFilterLimit?a("General_ComputedMetricMax",this.maxFilterLimit.toString()):"";return`${e} (${t})`},exportLink(){return this.getExportLink(!0)},exportLinkWithoutToken(){return this.getExportLink(!1)}},methods:{getExportLink(e=!0){const{reportFormat:t,apiMethod:o,reportType:i}=this,n=this.dataTable;if(!t)return;let a={};const r="yes"===this.reportLimitAll?-1:this.reportLimit;this.requestParams&&"string"===typeof this.requestParams?a=JSON.parse(this.requestParams):this.requestParams&&"object"===typeof this.requestParams&&(a=this.requestParams);const{segment:s,label:l,idGoal:c,idDimension:d,idSite:u}=n.param;let{date:m,period:p}=n.param;"RSS"===t&&(m="last10"),"undefined"!==typeof n.param.dateUsedInGraph&&(m=n.param.dateUsedInGraph);const h=I.config.datatable_export_range_as_day.toLowerCase();-1!==h.indexOf(t.toLowerCase())&&"range"===n.param.period&&(p="day"),"range"===n.param.period&&"graphEvolution"===n.param.viewDataTable&&(p="day");const g={module:"API",format:t,idSite:u,period:p,date:m};if("processed"===i?(g.method="API.getProcessedReport",[g.apiModule,g.apiAction]=o.split(".")):g.method=o,n.param.compareDates&&n.param.compareDates.length&&(g.compareDates=n.param.compareDates,g.compare="1"),n.param.comparePeriods&&n.param.comparePeriods.length&&(g.comparePeriods=n.param.comparePeriods,g.compare="1"),n.param.compareSegments&&n.param.compareSegments.length&&(g.compareSegments=n.param.compareSegments,g.compare="1"),"undefined"!==typeof n.param.filter_pattern&&(g.filter_pattern=n.param.filter_pattern),"undefined"!==typeof n.param.filter_pattern_recursive&&(g.filter_pattern_recursive=n.param.filter_pattern_recursive),window.$.isPlainObject(a)&&Object.entries(a).forEach(([e,t])=>{let o=t;!0===o?o=1:!1===o&&(o=0),g[e]=o}),this.optionFlat&&(g.flat=1,this.optionShowDimensions&&(g.show_dimensions=1),"undefined"!==typeof n.param.include_aggregate_rows&&"1"===n.param.include_aggregate_rows&&(g.include_aggregate_rows=1)),!this.optionFlat&&this.optionExpanded&&(g.expanded=1),this.optionFormatMetrics&&(g.format_metrics=1),n.param.pivotBy&&(g.pivotBy=n.param.pivotBy,g.pivotByColumnLimit=20,n.props.pivot_by_column&&(g.pivotByColumn=n.props.pivot_by_column)),"CSV"!==t&&"TSV"!==t&&"RSS"!==t||(g.translateColumnNames=1,g.language=I.language),"undefined"!==typeof s&&(g.segment=decodeURIComponent(s)),"undefined"!==typeof c&&"-1"!==c&&(g.idGoal=c),"undefined"!==typeof d&&"-1"!==d&&(g.idDimension=d),l){const e=l.split(",");e.length>1?g.label=e:[g.label]=e}g.showMetadata=0,g.token_auth="ENTER_YOUR_TOKEN_AUTH_HERE",!0===e&&(g.token_auth=I.token_auth,g.force_api_session=1),g.filter_limit=r;const b=window.location.href.split("?")[0];return`${b}?${H.stringify(g)}`}}});fs.render=gs;var vs=fs; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */const{$:Os}=window;var js={mounted(e,t){e.addEventListener("click",()=>{const o=H.hashParsed.value.popover,i=Os(e).closest("[data-report]").data("uiControlObject"),n=window.Piwik_Popover.showLoading("Export"),r=t.value.reportFormats;let s=i.param.filter_limit;t.value.maxFilterLimit>0&&(s=Math.min(s,t.value.maxFilterLimit));const l=!0===i.param.flat||1===i.param.flat||"1"===i.param.flat,c=!0===i.param.show_dimensions||1===i.param.show_dimensions||"1"===i.param.show_dimensions,d={initialReportType:"default",initialReportLimit:s>0?s:100,initialReportLimitAll:-1===s?"yes":"no",initialOptionFlat:l,initialOptionShowDimensions:c,initialOptionExpanded:!0,initialOptionFormatMetrics:!1,hasSubtables:l||i.numberOfSubtables>0,availableReportFormats:{default:r,processed:{XML:r.XML,JSON:r.JSON}},availableReportTypes:{default:a("CoreHome_StandardReport"),processed:a("CoreHome_ReportWithMetadata")},limitAllOptions:{yes:a("General_All"),no:a("CoreHome_CustomLimit")},maxFilterLimit:t.value.maxFilterLimit,dataTable:i,requestParams:t.value.requestParams,apiMethod:t.value.apiMethod},u=me({template:'\n ',data(){return{bind:d}}});u.component("popover",vs);const m=document.createElement("div");u.mount(m);const{reportTitle:p}=t.value;window.Piwik_Popover.setTitle(`${a("General_Export")} ${I.helper.htmlEntities(p)}`),window.Piwik_Popover.setContent(m),window.Piwik_Popover.onClose(()=>{u.unmount(),""!==o&&setTimeout(()=>{H.updateHash(Object.assign(Object.assign({},H.hashParsed.value),{},{popover:o})),t.value.onClose&&t.value.onClose()},100)}),setTimeout(()=>{n.dialog(),Os(".exportFullUrl, .btn",n).tooltip({track:!0,show:!1,hide:!1})},100)})}};const ys=["src","width","height"];function ws(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{class:"sparklineImg",loading:"lazy",alt:"",src:e.sparklineUrl,width:e.width,height:e.height},null,8,ys)}var Ss=Object(E["defineComponent"])({props:{seriesIndices:Array,params:[Object,String],width:Number,height:Number},data(){return{isWidget:!1}},mounted(){this.isWidget=!!this.$el.closest("[widgetId]")},computed:{sparklineUrl(){const{seriesIndices:e,params:t}=this,o=I.getSparklineColors();e&&(o.lineColor=o.lineColor.filter((t,o)=>-1!==e.indexOf(o)));const i=JSON.stringify(o),n={forceView:"1",viewDataTable:"sparkline",widget:this.isWidget?"1":"0",showtitle:"1",colors:i,random:Date.now(),date:this.defaultDate,segment:H.parsed.value.segment},a="object"===typeof t?t:H.parse(t.substring(t.indexOf("?")+1)),r=new G,s=r.mixinDefaultGetParams(Object.assign(Object.assign({},n),a)),l=H.parsed.value.token_auth;return l&&l.length&&I.shouldPropagateTokenAuth&&(s.token_auth=l),"?"+H.stringify(s)},defaultDate(){if("range"===I.period)return`${I.startDateString},${I.endDateString}`;const e=C.getLastNRange(I.period,30,I.currentDateString).getDateRange(),t=new Date(I.minDateYear,I.minDateMonth-1,I.minDateDay);e[0]100?100:this.progress<0?0:this.progress}}});Ts.render=Ps;var Vs=Ts,Ns={mounted(e){e.classList.add("piwik-content-intro")},updated(e){Object(E["nextTick"])(()=>{e.classList.add("piwik-content-intro")})}},xs={mounted(e,t){var o;null!==t&&void 0!==t&&null!==(o=t.value)&&void 0!==o&&o.off||e.classList.add("card","card-table","entityTable")},updated(e,t){var o;null!==t&&void 0!==t&&null!==(o=t.value)&&void 0!==o&&o.off||Object(E["nextTick"])(()=>{e.classList.add("card","card-table","entityTable")})}}; + */const{$:Os}=window;var js={mounted(e,t){e.addEventListener("click",()=>{const o=H.hashParsed.value.popover,i=Os(e).closest("[data-report]").data("uiControlObject"),n=window.Piwik_Popover.showLoading("Export"),r=t.value.reportFormats;let s=i.param.filter_limit;t.value.maxFilterLimit>0&&(s=Math.min(s,t.value.maxFilterLimit));const l=!0===i.param.flat||1===i.param.flat||"1"===i.param.flat,c=!0===i.param.show_dimensions||1===i.param.show_dimensions||"1"===i.param.show_dimensions,d={initialReportType:"default",initialReportLimit:s>0?s:100,initialReportLimitAll:-1===s?"yes":"no",initialOptionFlat:l,initialOptionShowDimensions:c,initialOptionExpanded:!0,initialOptionFormatMetrics:!1,hasSubtables:l||i.numberOfSubtables>0,availableReportFormats:{default:r,processed:{XML:r.XML,JSON:r.JSON}},availableReportTypes:{default:a("CoreHome_StandardReport"),processed:a("CoreHome_ReportWithMetadata")},limitAllOptions:{yes:a("General_All"),no:a("CoreHome_CustomLimit")},maxFilterLimit:t.value.maxFilterLimit,dataTable:i,requestParams:t.value.requestParams,apiMethod:t.value.apiMethod},u=me({template:'\n ',data(){return{bind:d}}});u.component("popover",vs);const m=document.createElement("div");u.mount(m);const{reportTitle:p}=t.value;window.Piwik_Popover.setTitle(`${a("General_Export")} ${I.helper.htmlEntities(p)}`),window.Piwik_Popover.setContent(m),window.Piwik_Popover.onClose(()=>{u.unmount(),""!==o&&setTimeout(()=>{H.updateHash(Object.assign(Object.assign({},H.hashParsed.value),{},{popover:o})),t.value.onClose&&t.value.onClose()},100)}),setTimeout(()=>{n.dialog(),Os(".exportFullUrl, .btn",n).tooltip({track:!0,show:!1,hide:!1})},100)})}};const ys=["src","width","height"];function ws(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{class:"sparklineImg",loading:"lazy",alt:"",src:e.sparklineUrl,width:e.width,height:e.height},null,8,ys)}var Ss=Object(E["defineComponent"])({props:{seriesIndices:Array,params:[Object,String],width:Number,height:Number},data(){return{isWidget:!1}},mounted(){this.isWidget=!!this.$el.closest("[widgetId]")},computed:{sparklineUrl(){const{seriesIndices:e,params:t}=this,o=I.getSparklineColors();e&&(o.lineColor=o.lineColor.filter((t,o)=>-1!==e.indexOf(o)));const i=JSON.stringify(o),n={forceView:"1",viewDataTable:"sparkline",widget:this.isWidget?"1":"0",showtitle:"1",colors:i,random:Date.now(),date:this.defaultDate,segment:H.parsed.value.segment},a="object"===typeof t?t:H.parse(t.substring(t.indexOf("?")+1)),r=new K,s=r.mixinDefaultGetParams(Object.assign(Object.assign({},n),a)),l=H.parsed.value.token_auth;return l&&l.length&&I.shouldPropagateTokenAuth&&(s.token_auth=l),"?"+H.stringify(s)},defaultDate(){if("range"===I.period)return`${I.startDateString},${I.endDateString}`;const e=C.getLastNRange(I.period,30,I.currentDateString).getDateRange(),t=new Date(I.minDateYear,I.minDateMonth-1,I.minDateDay);e[0]100?100:this.progress<0?0:this.progress}}});Ts.render=Ps;var Vs=Ts,Ns={mounted(e){e.classList.add("piwik-content-intro")},updated(e){Object(E["nextTick"])(()=>{e.classList.add("piwik-content-intro")})}},xs={mounted(e,t){var o;null!==t&&void 0!==t&&null!==(o=t.value)&&void 0!==o&&o.off||e.classList.add("card","card-table","entityTable")},updated(e,t){var o;null!==t&&void 0!==t&&null!==(o=t.value)&&void 0!==o&&o.off||Object(E["nextTick"])(()=>{e.classList.add("card","card-table","entityTable")})}}; /*! * Matomo - free/libre analytics platform * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */const Bs={ref:"root"};function Is(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Bs,[Object(E["renderSlot"])(e.$slots,"default",{formData:e.formData,submitApiMethod:e.submitApiMethod,sendJsonPayload:e.sendJsonPayload,noErrorNotification:e.noErrorNotification,noSuccessNotification:e.noSuccessNotification,submitForm:e.submitForm,isSubmitting:e.isSubmitting,successfulPostResponse:e.successfulPostResponse,errorPostResponse:e.errorPostResponse})],512)}const{$:Ms}=window;var Ls=Object(E["defineComponent"])({props:{formData:{type:Object,required:!0},submitApiMethod:{type:String,required:!0},sendJsonPayload:Boolean,noErrorNotification:Boolean,noSuccessNotification:Boolean},data(){return{isSubmitting:!1,successfulPostResponse:null,errorPostResponse:null}},emits:["update:modelValue"],mounted(){Ms(this.$refs.root).on("click","input[type=submit]",()=>{this.submitForm()})},methods:{submitForm(){this.successfulPostResponse=null,this.errorPostResponse=null;let e=this.formData;this.sendJsonPayload&&(e={data:JSON.stringify(this.formData)}),this.isSubmitting=!0,G.post({module:"API",method:this.submitApiMethod},e,{createErrorNotification:!this.noErrorNotification}).then(e=>{if(this.successfulPostResponse=e,!this.noSuccessNotification){const e=ki.show({message:a("General_YourChangesHaveBeenSaved"),context:"success",type:"toast",id:"ajaxHelper"});ki.scrollToNotification(e)}}).catch(e=>{this.errorPostResponse=e.message}).finally(()=>{this.isSubmitting=!1})}}});Ls.render=Is;var Fs=Ls;function As(e,t,o,i,n,a){return Object(E["renderSlot"])(e.$slots,"default")}var _s=Object(E["defineComponent"])({});_s.render=As;var Rs=_s;const Hs={key:0},$s=["data-target"],Us=Object(E["createElementVNode"])("span",{class:"icon-configure"},null,-1),qs=[Us],Ws=["data-target"],zs=["title"],Gs=["title","src"],Ys=["id"],Js=["data-footer-icon-id"],Ks=["title"],Qs=["title","src"],Xs={key:2},Zs=Object(E["createElementVNode"])("li",{class:"divider"},null,-1),el=Object(E["createElementVNode"])("li",{class:"divider"},null,-1),tl=["title"],ol=Object(E["createElementVNode"])("span",{class:"icon-export"},null,-1),il=[ol],nl=["title"],al=Object(E["createElementVNode"])("span",{class:"icon-image"},null,-1),rl=[al],sl=["title"],ll=Object(E["createElementVNode"])("span",{class:"icon-annotation"},null,-1),cl=[ll],dl=["title"],ul=Object(E["createElementVNode"])("span",{class:"icon-search",draggable:"false"},null,-1),ml=["title"],pl=["id","title"],hl=["title"],gl=["title","src"],bl=["id"],fl={key:0},vl=["innerHTML"],Ol={key:1},jl=["innerHTML"],yl={key:2},wl=["innerHTML"],Sl={key:3},kl=["innerHTML"],Cl={key:4},El=["innerHTML"],Dl={key:5},Pl=["innerHTML"],Tl=["title","data-target"],Vl=Object(E["createElementVNode"])("span",{class:"icon-calendar"},null,-1),Nl={class:"periodName"},xl=["id"],Bl=["data-period"];function Il(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Passthrough"),s=Object(E["resolveDirective"])("dropdown-button"),l=Object(E["resolveDirective"])("report-export");return e.showFooter&&e.showFooterIcons?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Hs,[e.hasConfigItems&&(e.isAnyConfigureIconHighlighted||e.isTableView)?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:0,class:Object(E["normalizeClass"])(["dropdown-button dropdownConfigureIcon dataTableAction",{highlighted:e.isAnyConfigureIconHighlighted}]),href:"",onClick:t[0]||(t[0]=Object(E["withModifiers"])(()=>{},["prevent"])),"data-target":"dropdownConfigure"+e.randomIdForDropdown,style:{"margin-right":"3.5px"}},qs,10,$s)),[[s]]):Object(E["createCommentVNode"])("",!0),e.hasFooterIconsToShow?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,class:"dropdown-button dataTableAction activateVisualizationSelection",href:"","data-target":"dropdownVisualizations"+e.randomIdForDropdown,style:{"margin-right":"3.5px"},onClick:t[1]||(t[1]=Object(E["withModifiers"])(()=>{},["prevent"]))},[/^icon-/.test(e.activeFooterIcon||"")?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,title:e.translate("CoreHome_ChangeVisualization"),class:Object(E["normalizeClass"])(e.activeFooterIcon)},null,10,zs)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{key:1,title:e.translate("CoreHome_ChangeVisualization"),width:"16",height:"16",src:e.activeFooterIcon},null,8,Gs))],8,Ws)),[[s]]):Object(E["createCommentVNode"])("",!0),e.showFooterIcons?(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",{key:2,id:"dropdownVisualizations"+e.randomIdForDropdown,class:"dropdown-content dataTableFooterIcons"},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.footerIcons,(t,o)=>(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:o},{default:Object(E["withCtx"])(()=>[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.buttons.filter(e=>!!e.icon),o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:o.id},[Object(E["createElementVNode"])("a",{class:Object(E["normalizeClass"])(`${t.class} tableIcon\n ${-1!==e.activeFooterIconIds.indexOf(o.id)?"activeIcon":""}`),"data-footer-icon-id":o.id},[/^icon-/.test(o.icon||"")?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,title:o.title,class:Object(E["normalizeClass"])(o.icon),style:{"margin-right":"5.5px"}},null,10,Ks)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{key:1,width:"16",height:"16",title:o.title,src:o.icon,style:{"margin-right":"5.5px"}},null,8,Qs)),o.title?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",Xs,Object(E["toDisplayString"])(o.title),1)):Object(E["createCommentVNode"])("",!0)],10,Js)]))),128)),Zs]),_:2},1024))),128)),el],8,Ys)):Object(E["createCommentVNode"])("",!0),e.showExport?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:3,class:"dataTableAction activateExportSelection",title:e.translate("General_ExportThisReport"),href:"",style:{"margin-right":"3.5px"},onClick:t[2]||(t[2]=Object(E["withModifiers"])(()=>{},["prevent"]))},il,8,tl)),[[l,{reportTitle:e.reportTitle,requestParams:e.requestParams,apiMethod:e.apiMethodToRequestDataTable,reportFormats:e.reportFormats,maxFilterLimit:e.maxFilterLimit}]]):Object(E["createCommentVNode"])("",!0),e.showExportAsImageIcon?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:4,class:"dataTableAction tableIcon",href:"",id:"dataTableFooterExportAsImageIcon",onClick:t[3]||(t[3]=Object(E["withModifiers"])(t=>e.showExportImage(t),["prevent"])),title:e.translate("General_ExportAsImage"),style:{"margin-right":"3.5px"}},rl,8,nl)):Object(E["createCommentVNode"])("",!0),e.showAnnotations?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:5,class:"dataTableAction annotationView",href:"",title:e.translate("Annotations_Annotations"),onClick:t[4]||(t[4]=Object(E["withModifiers"])(()=>{},["prevent"])),style:{"margin-right":"3.5px"}},cl,8,sl)):Object(E["createCommentVNode"])("",!0),e.showSearch?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:6,class:"dropdown-button dataTableAction searchAction",href:"",title:e.translate("General_Search"),style:{"margin-right":"3.5px"},draggable:"false",onClick:t[5]||(t[5]=Object(E["withModifiers"])(()=>{},["prevent"]))},[ul,Object(E["createElementVNode"])("span",{class:"icon-close",draggable:"false",title:e.translate("CoreHome_CloseSearch")},null,8,ml),Object(E["createElementVNode"])("input",{id:`widgetSearch_${e.reportId}_${e.placement}`,title:e.translate("CoreHome_DataTableHowToSearch"),type:"text",class:"dataTableSearchInput"},null,8,pl)],8,dl)):Object(E["createCommentVNode"])("",!0),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.dataTableActions,e=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:e.id,class:Object(E["normalizeClass"])("dataTableAction "+e.id),href:"",onClick:t[6]||(t[6]=Object(E["withModifiers"])(()=>{},["prevent"])),title:e.title,style:{"margin-right":"3.5px"}},[/^icon-/.test(e.icon||"")?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,class:Object(E["normalizeClass"])(e.icon)},null,2)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{key:1,width:"16",height:"16",title:e.title,src:e.icon},null,8,gl))],10,hl))),128)),Object(E["createElementVNode"])("ul",{id:"dropdownConfigure"+e.randomIdForDropdown,class:"dropdown-content tableConfiguration"},[e.showFlattenTable?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",fl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableFlatten",innerHTML:e.$sanitize(e.flattenItemText)},null,8,vl)])):Object(E["createCommentVNode"])("",!0),e.showDimensionsConfigItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Ol,[Object(E["createElementVNode"])("div",{class:"configItem dataTableShowDimensions",innerHTML:e.$sanitize(e.showDimensionsText)},null,8,jl)])):Object(E["createCommentVNode"])("",!0),e.showFlatConfigItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",yl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableIncludeAggregateRows",innerHTML:e.$sanitize(e.includeAggregateRowsText)},null,8,wl)])):Object(E["createCommentVNode"])("",!0),e.showTotalsConfigItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Sl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableShowTotalsRow",innerHTML:e.$sanitize(e.keepTotalsRowText)},null,8,kl)])):Object(E["createCommentVNode"])("",!0),e.showExcludeLowPopulation?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Cl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableExcludeLowPopulation",innerHTML:e.$sanitize(e.excludeLowPopText)},null,8,El)])):Object(E["createCommentVNode"])("",!0),e.showPivotBySubtable?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Dl,[Object(E["createElementVNode"])("div",{class:"configItem dataTablePivotBySubtable",innerHTML:e.$sanitize(e.pivotByText)},null,8,Pl)])):Object(E["createCommentVNode"])("",!0)],8,bl),e.showPeriods?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:7,class:"dropdown-button dataTableAction activatePeriodsSelection",href:"",onClick:t[7]||(t[7]=Object(E["withModifiers"])(()=>{},["prevent"])),title:e.translate("CoreHome_ChangePeriod"),"data-target":"dropdownPeriods"+e.randomIdForDropdown},[Object(E["createElementVNode"])("div",null,[Vl,Object(E["createElementVNode"])("span",Nl,Object(E["toDisplayString"])(e.translations[e.clientSideParameters.period]||e.clientSideParameters.period),1)])],8,Tl)),[[s]]):Object(E["createCommentVNode"])("",!0),e.showPeriods?(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",{key:8,id:"dropdownPeriods"+e.randomIdForDropdown,class:"dropdown-content dataTablePeriods"},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.selectablePeriods,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:t},[Object(E["createElementVNode"])("a",{"data-period":t,class:Object(E["normalizeClass"])("tableIcon "+(e.clientSideParameters.period===t?"activeIcon":""))},[Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translations[t]||t),1)],10,Bl)]))),128))],8,xl)):Object(E["createCommentVNode"])("",!0)])):Object(E["createCommentVNode"])("",!0)}const{$:Ml}=window;function Ll(e,t,o){if(/(%(.\$)?s+)/g.test(a(e))){const i=['
'];o&&i.push(o);let n=a(e,...i);return t&&(n+=` (${a("CoreHome_Default")})`),n+="",n}return a(e)}function Fl(e,t,o){return e?Ll(t,!0):Ll(o)}function Al(e){return!!e&&"0"!==e}var _l=Object(E["defineComponent"])({props:{showPeriods:Boolean,showFooter:Boolean,showFooterIcons:Boolean,showSearch:Boolean,showFlattenTable:Boolean,footerIcons:{type:Array,required:!0},viewDataTable:{type:String,required:!0},reportTitle:String,requestParams:{type:Object,required:!0},apiMethodToRequestDataTable:{type:String,required:!0},maxFilterLimit:{type:Number,required:!0},showExport:Boolean,showExportAsImageIcon:Boolean,showAnnotations:Boolean,reportId:{type:String,required:!0},dataTableActions:{type:Array,required:!0},clientSideParameters:{type:Object,required:!0},hasMultipleDimensions:Boolean,isDataTableEmpty:Boolean,showTotalsRow:Boolean,showExcludeLowPopulation:Boolean,showPivotBySubtable:Boolean,selectablePeriods:Array,translations:{type:Object,required:!0},pivotDimensionName:String,placement:{type:String,default:"footer"}},components:{Passthrough:Rs},directives:{DropdownButton:kt,ReportExport:js},methods:{showExportImage(e){Ml(e.target).closest(".dataTable").find("div.jqplot-target").trigger("piwikExportAsImage")}},computed:{randomIdForDropdown(){return Math.floor(999999*Math.random())},allFooterIcons(){return this.footerIcons.reduce((e,t)=>(e.push(...t.buttons),e),[])},activeFooterIcons(){const e=this.clientSideParameters,t=[this.viewDataTable];return 0===e.abandonedCarts||"0"===e.abandonedCarts?t.push("ecommerceOrder"):1!==e.abandonedCarts&&"1"!==e.abandonedCarts||t.push("ecommerceAbandonedCart"),t.map(e=>this.allFooterIcons.find(t=>t.id===e)).filter(e=>!!e)},activeFooterIcon(){var e;return null===(e=this.activeFooterIcons[0])||void 0===e?void 0:e.icon},activeFooterIconIds(){return this.activeFooterIcons.map(e=>e.id)},numIcons(){return this.allFooterIcons.length},hasFooterIconsToShow(){return!!this.activeFooterIcons.length&&this.numIcons>1},reportFormats(){const e={CSV:"CSV",TSV:"TSV (Excel)",XML:"XML",JSON:"Json",HTML:"HTML",RSS:"RSS"};return e},showDimensionsConfigItem(){return this.showFlattenTable&&""+this.clientSideParameters.flat==="1"&&this.hasMultipleDimensions},showFlatConfigItem(){return this.showFlattenTable&&""+this.clientSideParameters.flat==="1"},showTotalsConfigItem(){return!this.isDataTableEmpty&&this.showTotalsRow},hasConfigItems(){return this.showFlattenTable||this.showDimensionsConfigItem||this.showFlatConfigItem||this.showTotalsConfigItem||this.showExcludeLowPopulation||this.showPivotBySubtable},flattenItemText(){const e=this.clientSideParameters;return Fl(Al(e.flat),"CoreHome_UnFlattenDataTable","CoreHome_FlattenDataTable")},keepTotalsRowText(){const e=this.clientSideParameters;return Fl(Al(e.keep_totals_row),"CoreHome_RemoveTotalsRowDataTable","CoreHome_AddTotalsRowDataTable")},includeAggregateRowsText(){const e=this.clientSideParameters;return Fl(Al(e.include_aggregate_rows),"CoreHome_DataTableExcludeAggregateRows","CoreHome_DataTableIncludeAggregateRows")},showDimensionsText(){const e=this.clientSideParameters;return Fl(Al(e.show_dimensions),"CoreHome_DataTableCombineDimensions","CoreHome_DataTableShowDimensions")},pivotByText(){const e=this.clientSideParameters;return Al(e.pivotBy)?Ll("CoreHome_UndoPivotBySubtable",!0):Ll("CoreHome_PivotBySubtable",!1,this.pivotDimensionName)},excludeLowPopText(){const e=this.clientSideParameters;return Fl(Al(e.enable_filter_excludelowpop),"CoreHome_IncludeRowsWithLowPopulation","CoreHome_ExcludeRowsWithLowPopulation")},isAnyConfigureIconHighlighted(){const e=this.clientSideParameters;return Al(e.flat)||Al(e.keep_totals_row)||Al(e.include_aggregate_rows)||Al(e.show_dimensions)||Al(e.pivotBy)||Al(e.enable_filter_excludelowpop)},isTableView(){return"table"===this.viewDataTable||"tableAllColumns"===this.viewDataTable||"tableGoals"===this.viewDataTable}}});_l.render=Il;var Rl=_l;const Hl={key:0,class:"title",style:{cursor:"pointer"},ref:"expander"},$l=Object(E["createElementVNode"])("span",{class:"icon-warning"},null,-1),Ul={key:1,class:"title",href:"?module=CoreUpdater&action=newVersionAvailable",style:{cursor:"pointer"},ref:"expander"},ql=Object(E["createElementVNode"])("span",{class:"icon-warning"},null,-1),Wl=["innerHTML"],zl=["href"],Gl={id:"updateCheckLinkContainer"},Yl={class:"dropdown positionInViewport"},Jl=["innerHTML"],Kl=["innerHTML"];function Ql(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Passthrough"),s=Object(E["resolveDirective"])("expand-on-hover");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{id:"header_message",class:Object(E["normalizeClass"])(["piwikSelector",{header_info:!e.latestVersionAvailable||e.lastUpdateCheckFailed,update_available:e.latestVersionAvailable}])},[e.latestVersionAvailable?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0},{default:Object(E["withCtx"])(()=>[e.isMultiServerEnvironment?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",Hl,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_NewUpdatePiwikX",e.latestVersionAvailable))+" ",1),$l],512)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",Ul,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_NewUpdatePiwikX",e.latestVersionAvailable))+" ",1),ql],512))]),_:1})):e.isSuperUser&&(e.isAdminArea||e.lastUpdateCheckFailed)?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:1},{default:Object(E["withCtx"])(()=>[e.isInternetEnabled?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:0,class:"title",innerHTML:e.$sanitize(e.updateCheck)},null,8,Wl)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,class:"title",href:e.externalRawLink("https://matomo.org/changelog/"),target:"_blank",rel:"noreferrer noopener"},[Object(E["createElementVNode"])("span",Gl,Object(E["toDisplayString"])(e.translate("CoreHome_SeeAvailableVersions")),1)],8,zl))]),_:1})):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",Yl,[e.latestVersionAvailable&&e.isSuperUser?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,innerHTML:e.$sanitize(e.updateNowText)},null,8,Jl)):e.latestVersionAvailable&&e.hasSomeViewAccess&&!e.isAnonymous?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:1,innerHTML:e.$sanitize(e.updateAvailableText)},null,8,Kl)):Object(E["createCommentVNode"])("",!0),Object(E["createTextVNode"])(" "+Object(E["toDisplayString"])(e.translate("General_YouAreCurrentlyUsing",e.piwikVersion)),1)])],2)),[[s,{expander:"expander"}]])}var Xl=Object(E["defineComponent"])({props:{isMultiServerEnvironment:Boolean,lastUpdateCheckFailed:Boolean,latestVersionAvailable:String,isSuperUser:Boolean,isAdminArea:Boolean,isInternetEnabled:Boolean,updateCheck:String,isAnonymous:Boolean,hasSomeViewAccess:Boolean,contactEmail:String,piwikVersion:String},components:{Passthrough:Rs},directives:{ExpandOnHover:jt},computed:{updateNowText(){let e="";if(this.isMultiServerEnvironment){const t=ae(`https://builds.matomo.org/matomo-${this.latestVersionAvailable}.zip`);e=a("CoreHome_OneClickUpdateNotPossibleAsMultiServerEnvironment",`builds.matomo.org`)}else e=a("General_PiwikXIsAvailablePleaseUpdateNow",this.latestVersionAvailable||"",'
',"",re("https://matomo.org/changelog/"),"");return e+"
"},updateAvailableText(){const e=a("General_NewUpdatePiwikX",this.latestVersionAvailable||""),t=re("https://matomo.org/")+"Matomo",o=re("https://matomo.org/changelog/"),i=a("General_PiwikXIsAvailablePleaseNotifyPiwikAdmin",`${t} ${o}${this.latestVersionAvailable}`,``,"");return i+"
"}}});Xl.render=Ql;var Zl=Xl;const ec={id:"mobile-left-menu",class:"sidenav hide-on-large-only"},tc={class:"collapsible collapsible-accordion"},oc={class:"collapsible-header"},ic={class:"collapsible-body"},nc=["title","href"];function ac(e,t,o,i,n,a){const r=Object(E["resolveDirective"])("side-nav");return Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",ec,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menuWithSubmenuItems,(t,o)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:"no-padding",key:o},[Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",tc,[Object(E["createElementVNode"])("li",null,[Object(E["createElementVNode"])("a",oc,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translateOrDefault(o)),1),Object(E["createElementVNode"])("i",{class:Object(E["normalizeClass"])(t._icon||"icon-chevron-down")},null,2)]),Object(E["createElementVNode"])("div",ic,[Object(E["createElementVNode"])("ul",null,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(Object.entries(t).filter(([e])=>"_"!==e[0]),([t,o])=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:t},[Object(E["createElementVNode"])("a",{title:o._tooltip?e.translateIfNecessary(o._tooltip):"",target:"_self",href:e.getMenuUrl(o._url)},Object(E["toDisplayString"])(e.translateIfNecessary(t)),9,nc)]))),128))])])])])),[[r,{activator:e.activateLeftMenu}]])]))),128))])}const{$:rc}=window;var sc=Object(E["defineComponent"])({props:{menu:{type:Object,required:!0}},directives:{SideNav:Bt},methods:{getMenuUrl(e){return"?"+H.stringify(Object.assign(Object.assign({},H.urlParsed.value),e))},translateIfNecessary(e){return e.includes("_")?a(e):e}},computed:{menuWithSubmenuItems(){const e=this.menu||{};return Object.fromEntries(Object.entries(e).filter(([,e])=>{const t=Object.entries(e).filter(([e])=>"_"!==e[0]);return Object.keys(t).length}))},activateLeftMenu(){return rc("nav .activateLeftMenu")[0]}}});sc.render=ac;var lc=sc; + */const Bs={ref:"root"};function Is(e,t,o,i,n,a){return Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Bs,[Object(E["renderSlot"])(e.$slots,"default",{formData:e.formData,submitApiMethod:e.submitApiMethod,sendJsonPayload:e.sendJsonPayload,noErrorNotification:e.noErrorNotification,noSuccessNotification:e.noSuccessNotification,submitForm:e.submitForm,isSubmitting:e.isSubmitting,successfulPostResponse:e.successfulPostResponse,errorPostResponse:e.errorPostResponse})],512)}const{$:Ms}=window;var Ls=Object(E["defineComponent"])({props:{formData:{type:Object,required:!0},submitApiMethod:{type:String,required:!0},sendJsonPayload:Boolean,noErrorNotification:Boolean,noSuccessNotification:Boolean},data(){return{isSubmitting:!1,successfulPostResponse:null,errorPostResponse:null}},emits:["update:modelValue"],mounted(){Ms(this.$refs.root).on("click","input[type=submit]",()=>{this.submitForm()})},methods:{submitForm(){this.successfulPostResponse=null,this.errorPostResponse=null;let e=this.formData;this.sendJsonPayload&&(e={data:JSON.stringify(this.formData)}),this.isSubmitting=!0,K.post({module:"API",method:this.submitApiMethod},e,{createErrorNotification:!this.noErrorNotification}).then(e=>{if(this.successfulPostResponse=e,!this.noSuccessNotification){const e=ki.show({message:a("General_YourChangesHaveBeenSaved"),context:"success",type:"toast",id:"ajaxHelper"});ki.scrollToNotification(e)}}).catch(e=>{this.errorPostResponse=e.message}).finally(()=>{this.isSubmitting=!1})}}});Ls.render=Is;var Fs=Ls;function As(e,t,o,i,n,a){return Object(E["renderSlot"])(e.$slots,"default")}var _s=Object(E["defineComponent"])({});_s.render=As;var Rs=_s;const Hs={key:0},$s=["data-target"],Us=Object(E["createElementVNode"])("span",{class:"icon-configure"},null,-1),qs=[Us],Ws=["data-target"],zs=["title"],Gs=["title","src"],Ys=["id"],Js=["data-footer-icon-id"],Ks=["title"],Qs=["title","src"],Xs={key:2},Zs=Object(E["createElementVNode"])("li",{class:"divider"},null,-1),el=Object(E["createElementVNode"])("li",{class:"divider"},null,-1),tl=["title"],ol=Object(E["createElementVNode"])("span",{class:"icon-export"},null,-1),il=[ol],nl=["title"],al=Object(E["createElementVNode"])("span",{class:"icon-image"},null,-1),rl=[al],sl=["title"],ll=Object(E["createElementVNode"])("span",{class:"icon-annotation"},null,-1),cl=[ll],dl=["title"],ul=Object(E["createElementVNode"])("span",{class:"icon-search",draggable:"false"},null,-1),ml=["title"],pl=["id","title"],hl=["title"],gl=["title","src"],bl=["id"],fl={key:0},vl=["innerHTML"],Ol={key:1},jl=["innerHTML"],yl={key:2},wl=["innerHTML"],Sl={key:3},kl=["innerHTML"],Cl={key:4},El=["innerHTML"],Dl={key:5},Pl=["innerHTML"],Tl=["title","data-target"],Vl=Object(E["createElementVNode"])("span",{class:"icon-calendar"},null,-1),Nl={class:"periodName"},xl=["id"],Bl=["data-period"];function Il(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Passthrough"),s=Object(E["resolveDirective"])("dropdown-button"),l=Object(E["resolveDirective"])("report-export");return e.showFooter&&e.showFooterIcons?(Object(E["openBlock"])(),Object(E["createElementBlock"])("div",Hs,[e.hasConfigItems&&(e.isAnyConfigureIconHighlighted||e.isTableView)?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:0,class:Object(E["normalizeClass"])(["dropdown-button dropdownConfigureIcon dataTableAction",{highlighted:e.isAnyConfigureIconHighlighted}]),href:"",onClick:t[0]||(t[0]=Object(E["withModifiers"])(()=>{},["prevent"])),"data-target":"dropdownConfigure"+e.randomIdForDropdown,style:{"margin-right":"3.5px"}},qs,10,$s)),[[s]]):Object(E["createCommentVNode"])("",!0),e.hasFooterIconsToShow?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,class:"dropdown-button dataTableAction activateVisualizationSelection",href:"","data-target":"dropdownVisualizations"+e.randomIdForDropdown,style:{"margin-right":"3.5px"},onClick:t[1]||(t[1]=Object(E["withModifiers"])(()=>{},["prevent"]))},[/^icon-/.test(e.activeFooterIcon||"")?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,title:e.translate("CoreHome_ChangeVisualization"),class:Object(E["normalizeClass"])(e.activeFooterIcon)},null,10,zs)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{key:1,title:e.translate("CoreHome_ChangeVisualization"),width:"16",height:"16",src:e.activeFooterIcon},null,8,Gs))],8,Ws)),[[s]]):Object(E["createCommentVNode"])("",!0),e.showFooterIcons?(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",{key:2,id:"dropdownVisualizations"+e.randomIdForDropdown,class:"dropdown-content dataTableFooterIcons"},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.footerIcons,(t,o)=>(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:o},{default:Object(E["withCtx"])(()=>[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(t.buttons.filter(e=>!!e.icon),o=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:o.id},[Object(E["createElementVNode"])("a",{class:Object(E["normalizeClass"])(`${t.class} tableIcon\n ${-1!==e.activeFooterIconIds.indexOf(o.id)?"activeIcon":""}`),"data-footer-icon-id":o.id},[/^icon-/.test(o.icon||"")?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,title:o.title,class:Object(E["normalizeClass"])(o.icon),style:{"margin-right":"5.5px"}},null,10,Ks)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{key:1,width:"16",height:"16",title:o.title,src:o.icon,style:{"margin-right":"5.5px"}},null,8,Qs)),o.title?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",Xs,Object(E["toDisplayString"])(o.title),1)):Object(E["createCommentVNode"])("",!0)],10,Js)]))),128)),Zs]),_:2},1024))),128)),el],8,Ys)):Object(E["createCommentVNode"])("",!0),e.showExport?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:3,class:"dataTableAction activateExportSelection",title:e.translate("General_ExportThisReport"),href:"",style:{"margin-right":"3.5px"},onClick:t[2]||(t[2]=Object(E["withModifiers"])(()=>{},["prevent"]))},il,8,tl)),[[l,{reportTitle:e.reportTitle,requestParams:e.requestParams,apiMethod:e.apiMethodToRequestDataTable,reportFormats:e.reportFormats,maxFilterLimit:e.maxFilterLimit}]]):Object(E["createCommentVNode"])("",!0),e.showExportAsImageIcon?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:4,class:"dataTableAction tableIcon",href:"",id:"dataTableFooterExportAsImageIcon",onClick:t[3]||(t[3]=Object(E["withModifiers"])(t=>e.showExportImage(t),["prevent"])),title:e.translate("General_ExportAsImage"),style:{"margin-right":"3.5px"}},rl,8,nl)):Object(E["createCommentVNode"])("",!0),e.showAnnotations?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:5,class:"dataTableAction annotationView",href:"",title:e.translate("Annotations_Annotations"),onClick:t[4]||(t[4]=Object(E["withModifiers"])(()=>{},["prevent"])),style:{"margin-right":"3.5px"}},cl,8,sl)):Object(E["createCommentVNode"])("",!0),e.showSearch?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:6,class:"dropdown-button dataTableAction searchAction",href:"",title:e.translate("General_Search"),style:{"margin-right":"3.5px"},draggable:"false",onClick:t[5]||(t[5]=Object(E["withModifiers"])(()=>{},["prevent"]))},[ul,Object(E["createElementVNode"])("span",{class:"icon-close",draggable:"false",title:e.translate("CoreHome_CloseSearch")},null,8,ml),Object(E["createElementVNode"])("input",{id:`widgetSearch_${e.reportId}_${e.placement}`,title:e.translate("CoreHome_DataTableHowToSearch"),type:"text",class:"dataTableSearchInput"},null,8,pl)],8,dl)):Object(E["createCommentVNode"])("",!0),(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.dataTableActions,e=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:e.id,class:Object(E["normalizeClass"])("dataTableAction "+e.id),href:"",onClick:t[6]||(t[6]=Object(E["withModifiers"])(()=>{},["prevent"])),title:e.title,style:{"margin-right":"3.5px"}},[/^icon-/.test(e.icon||"")?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,class:Object(E["normalizeClass"])(e.icon)},null,2)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("img",{key:1,width:"16",height:"16",title:e.title,src:e.icon},null,8,gl))],10,hl))),128)),Object(E["createElementVNode"])("ul",{id:"dropdownConfigure"+e.randomIdForDropdown,class:"dropdown-content tableConfiguration"},[e.showFlattenTable?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",fl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableFlatten",innerHTML:e.$sanitize(e.flattenItemText)},null,8,vl)])):Object(E["createCommentVNode"])("",!0),e.showDimensionsConfigItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Ol,[Object(E["createElementVNode"])("div",{class:"configItem dataTableShowDimensions",innerHTML:e.$sanitize(e.showDimensionsText)},null,8,jl)])):Object(E["createCommentVNode"])("",!0),e.showFlatConfigItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",yl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableIncludeAggregateRows",innerHTML:e.$sanitize(e.includeAggregateRowsText)},null,8,wl)])):Object(E["createCommentVNode"])("",!0),e.showTotalsConfigItem?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Sl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableShowTotalsRow",innerHTML:e.$sanitize(e.keepTotalsRowText)},null,8,kl)])):Object(E["createCommentVNode"])("",!0),e.showExcludeLowPopulation?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Cl,[Object(E["createElementVNode"])("div",{class:"configItem dataTableExcludeLowPopulation",innerHTML:e.$sanitize(e.excludeLowPopText)},null,8,El)])):Object(E["createCommentVNode"])("",!0),e.showPivotBySubtable?(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",Dl,[Object(E["createElementVNode"])("div",{class:"configItem dataTablePivotBySubtable",innerHTML:e.$sanitize(e.pivotByText)},null,8,Pl)])):Object(E["createCommentVNode"])("",!0)],8,bl),e.showPeriods?Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:7,class:"dropdown-button dataTableAction activatePeriodsSelection",href:"",onClick:t[7]||(t[7]=Object(E["withModifiers"])(()=>{},["prevent"])),title:e.translate("CoreHome_ChangePeriod"),"data-target":"dropdownPeriods"+e.randomIdForDropdown},[Object(E["createElementVNode"])("div",null,[Vl,Object(E["createElementVNode"])("span",Nl,Object(E["toDisplayString"])(e.translations[e.clientSideParameters.period]||e.clientSideParameters.period),1)])],8,Tl)),[[s]]):Object(E["createCommentVNode"])("",!0),e.showPeriods?(Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",{key:8,id:"dropdownPeriods"+e.randomIdForDropdown,class:"dropdown-content dataTablePeriods"},[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.selectablePeriods,t=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:t},[Object(E["createElementVNode"])("a",{"data-period":t,class:Object(E["normalizeClass"])("tableIcon "+(e.clientSideParameters.period===t?"activeIcon":""))},[Object(E["createElementVNode"])("span",null,Object(E["toDisplayString"])(e.translations[t]||t),1)],10,Bl)]))),128))],8,xl)):Object(E["createCommentVNode"])("",!0)])):Object(E["createCommentVNode"])("",!0)}const{$:Ml}=window;function Ll(e,t,o){if(/(%(.\$)?s+)/g.test(a(e))){const i=['
'];o&&i.push(o);let n=a(e,...i);return t&&(n+=` (${a("CoreHome_Default")})`),n+="",n}return a(e)}function Fl(e,t,o){return e?Ll(t,!0):Ll(o)}function Al(e){return!!e&&"0"!==e}var _l=Object(E["defineComponent"])({props:{showPeriods:Boolean,showFooter:Boolean,showFooterIcons:Boolean,showSearch:Boolean,showFlattenTable:Boolean,footerIcons:{type:Array,required:!0},viewDataTable:{type:String,required:!0},reportTitle:String,requestParams:{type:Object,required:!0},apiMethodToRequestDataTable:{type:String,required:!0},maxFilterLimit:{type:Number,required:!0},showExport:Boolean,showExportAsImageIcon:Boolean,showAnnotations:Boolean,reportId:{type:String,required:!0},dataTableActions:{type:Array,required:!0},clientSideParameters:{type:Object,required:!0},hasMultipleDimensions:Boolean,isDataTableEmpty:Boolean,showTotalsRow:Boolean,showExcludeLowPopulation:Boolean,showPivotBySubtable:Boolean,selectablePeriods:Array,translations:{type:Object,required:!0},pivotDimensionName:String,placement:{type:String,default:"footer"}},components:{Passthrough:Rs},directives:{DropdownButton:kt,ReportExport:js},methods:{showExportImage(e){Ml(e.target).closest(".dataTable").find("div.jqplot-target").trigger("piwikExportAsImage")}},computed:{randomIdForDropdown(){return Math.floor(999999*Math.random())},allFooterIcons(){return this.footerIcons.reduce((e,t)=>(e.push(...t.buttons),e),[])},activeFooterIcons(){const e=this.clientSideParameters,t=[this.viewDataTable];return 0===e.abandonedCarts||"0"===e.abandonedCarts?t.push("ecommerceOrder"):1!==e.abandonedCarts&&"1"!==e.abandonedCarts||t.push("ecommerceAbandonedCart"),t.map(e=>this.allFooterIcons.find(t=>t.id===e)).filter(e=>!!e)},activeFooterIcon(){var e;return null===(e=this.activeFooterIcons[0])||void 0===e?void 0:e.icon},activeFooterIconIds(){return this.activeFooterIcons.map(e=>e.id)},numIcons(){return this.allFooterIcons.length},hasFooterIconsToShow(){return!!this.activeFooterIcons.length&&this.numIcons>1},reportFormats(){const e={CSV:"CSV",TSV:"TSV (Excel)",XML:"XML",JSON:"Json",HTML:"HTML",RSS:"RSS"};return e},showDimensionsConfigItem(){return this.showFlattenTable&&""+this.clientSideParameters.flat==="1"&&this.hasMultipleDimensions},showFlatConfigItem(){return this.showFlattenTable&&""+this.clientSideParameters.flat==="1"},showTotalsConfigItem(){return!this.isDataTableEmpty&&this.showTotalsRow},hasConfigItems(){return this.showFlattenTable||this.showDimensionsConfigItem||this.showFlatConfigItem||this.showTotalsConfigItem||this.showExcludeLowPopulation||this.showPivotBySubtable},flattenItemText(){const e=this.clientSideParameters;return Fl(Al(e.flat),"CoreHome_UnFlattenDataTable","CoreHome_FlattenDataTable")},keepTotalsRowText(){const e=this.clientSideParameters;return Fl(Al(e.keep_totals_row),"CoreHome_RemoveTotalsRowDataTable","CoreHome_AddTotalsRowDataTable")},includeAggregateRowsText(){const e=this.clientSideParameters;return Fl(Al(e.include_aggregate_rows),"CoreHome_DataTableExcludeAggregateRows","CoreHome_DataTableIncludeAggregateRows")},showDimensionsText(){const e=this.clientSideParameters;return Fl(Al(e.show_dimensions),"CoreHome_DataTableCombineDimensions","CoreHome_DataTableShowDimensions")},pivotByText(){const e=this.clientSideParameters;return Al(e.pivotBy)?Ll("CoreHome_UndoPivotBySubtable",!0):Ll("CoreHome_PivotBySubtable",!1,this.pivotDimensionName)},excludeLowPopText(){const e=this.clientSideParameters;return Fl(Al(e.enable_filter_excludelowpop),"CoreHome_IncludeRowsWithLowPopulation","CoreHome_ExcludeRowsWithLowPopulation")},isAnyConfigureIconHighlighted(){const e=this.clientSideParameters;return Al(e.flat)||Al(e.keep_totals_row)||Al(e.include_aggregate_rows)||Al(e.show_dimensions)||Al(e.pivotBy)||Al(e.enable_filter_excludelowpop)},isTableView(){return"table"===this.viewDataTable||"tableAllColumns"===this.viewDataTable||"tableGoals"===this.viewDataTable}}});_l.render=Il;var Rl=_l;const Hl={key:0,class:"title",style:{cursor:"pointer"},ref:"expander"},$l=Object(E["createElementVNode"])("span",{class:"icon-warning"},null,-1),Ul={key:1,class:"title",href:"?module=CoreUpdater&action=newVersionAvailable",style:{cursor:"pointer"},ref:"expander"},ql=Object(E["createElementVNode"])("span",{class:"icon-warning"},null,-1),Wl=["innerHTML"],zl=["href"],Gl={id:"updateCheckLinkContainer"},Yl={class:"dropdown positionInViewport"},Jl=["innerHTML"],Kl=["innerHTML"];function Ql(e,t,o,i,n,a){const r=Object(E["resolveComponent"])("Passthrough"),s=Object(E["resolveDirective"])("expand-on-hover");return Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("div",{id:"header_message",class:Object(E["normalizeClass"])(["piwikSelector",{header_info:!e.latestVersionAvailable||e.lastUpdateCheckFailed,update_available:e.latestVersionAvailable}])},[e.latestVersionAvailable?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:0},{default:Object(E["withCtx"])(()=>[e.isMultiServerEnvironment?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",Hl,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_NewUpdatePiwikX",e.latestVersionAvailable))+" ",1),$l],512)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",Ul,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translate("General_NewUpdatePiwikX",e.latestVersionAvailable))+" ",1),ql],512))]),_:1})):e.isSuperUser&&(e.isAdminArea||e.lastUpdateCheckFailed)?(Object(E["openBlock"])(),Object(E["createBlock"])(r,{key:1},{default:Object(E["withCtx"])(()=>[e.isInternetEnabled?(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:0,class:"title",innerHTML:e.$sanitize(e.updateCheck)},null,8,Wl)):(Object(E["openBlock"])(),Object(E["createElementBlock"])("a",{key:1,class:"title",href:e.externalRawLink("https://matomo.org/changelog/"),target:"_blank",rel:"noreferrer noopener"},[Object(E["createElementVNode"])("span",Gl,Object(E["toDisplayString"])(e.translate("CoreHome_SeeAvailableVersions")),1)],8,zl))]),_:1})):Object(E["createCommentVNode"])("",!0),Object(E["createElementVNode"])("div",Yl,[e.latestVersionAvailable&&e.isSuperUser?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:0,innerHTML:e.$sanitize(e.updateNowText)},null,8,Jl)):e.latestVersionAvailable&&e.hasSomeViewAccess&&!e.isAnonymous?(Object(E["openBlock"])(),Object(E["createElementBlock"])("span",{key:1,innerHTML:e.$sanitize(e.updateAvailableText)},null,8,Kl)):Object(E["createCommentVNode"])("",!0),Object(E["createTextVNode"])(" "+Object(E["toDisplayString"])(e.translate("General_YouAreCurrentlyUsing",e.piwikVersion)),1)])],2)),[[s,{expander:"expander"}]])}var Xl=Object(E["defineComponent"])({props:{isMultiServerEnvironment:Boolean,lastUpdateCheckFailed:Boolean,latestVersionAvailable:String,isSuperUser:Boolean,isAdminArea:Boolean,isInternetEnabled:Boolean,updateCheck:String,isAnonymous:Boolean,hasSomeViewAccess:Boolean,contactEmail:String,piwikVersion:String},components:{Passthrough:Rs},directives:{ExpandOnHover:jt},computed:{updateNowText(){let e="";if(this.isMultiServerEnvironment){const t=ae(`https://builds.matomo.org/matomo-${this.latestVersionAvailable}.zip`);e=a("CoreHome_OneClickUpdateNotPossibleAsMultiServerEnvironment",`builds.matomo.org`)}else e=a("General_PiwikXIsAvailablePleaseUpdateNow",this.latestVersionAvailable||"",'
',"",re("https://matomo.org/changelog/"),"");return e+"
"},updateAvailableText(){const e=a("General_NewUpdatePiwikX",this.latestVersionAvailable||""),t=re("https://matomo.org/")+"Matomo",o=re("https://matomo.org/changelog/"),i=a("General_PiwikXIsAvailablePleaseNotifyPiwikAdmin",`${t} ${o}${this.latestVersionAvailable}`,``,"");return i+"
"}}});Xl.render=Ql;var Zl=Xl;const ec={id:"mobile-left-menu",class:"sidenav hide-on-large-only"},tc={class:"collapsible collapsible-accordion"},oc={class:"collapsible-header"},ic={class:"collapsible-body"},nc=["title","href"];function ac(e,t,o,i,n,a){const r=Object(E["resolveDirective"])("side-nav");return Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",ec,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(e.menuWithSubmenuItems,(t,o)=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{class:"no-padding",key:o},[Object(E["withDirectives"])((Object(E["openBlock"])(),Object(E["createElementBlock"])("ul",tc,[Object(E["createElementVNode"])("li",null,[Object(E["createElementVNode"])("a",oc,[Object(E["createTextVNode"])(Object(E["toDisplayString"])(e.translateOrDefault(o)),1),Object(E["createElementVNode"])("i",{class:Object(E["normalizeClass"])(t._icon||"icon-chevron-down")},null,2)]),Object(E["createElementVNode"])("div",ic,[Object(E["createElementVNode"])("ul",null,[(Object(E["openBlock"])(!0),Object(E["createElementBlock"])(E["Fragment"],null,Object(E["renderList"])(Object.entries(t).filter(([e])=>"_"!==e[0]),([t,o])=>(Object(E["openBlock"])(),Object(E["createElementBlock"])("li",{key:t},[Object(E["createElementVNode"])("a",{title:o._tooltip?e.translateIfNecessary(o._tooltip):"",target:"_self",href:e.getMenuUrl(o._url)},Object(E["toDisplayString"])(e.translateIfNecessary(t)),9,nc)]))),128))])])])])),[[r,{activator:e.activateLeftMenu}]])]))),128))])}const{$:rc}=window;var sc=Object(E["defineComponent"])({props:{menu:{type:Object,required:!0}},directives:{SideNav:Bt},methods:{getMenuUrl(e){return"?"+H.stringify(Object.assign(Object.assign({},H.urlParsed.value),e))},translateIfNecessary(e){return e.includes("_")?a(e):e}},computed:{menuWithSubmenuItems(){const e=this.menu||{};return Object.fromEntries(Object.entries(e).filter(([,e])=>{const t=Object.entries(e).filter(([e])=>"_"!==e[0]);return Object.keys(t).length}))},activateLeftMenu(){return rc("nav .activateLeftMenu")[0]}}});sc.render=ac;var lc=sc; /*! * Matomo - free/libre analytics platform * @@ -332,7 +332,7 @@ function qe(e,t,o){const i=t.value.isMouseDown&&t.value.hasScrolled;t.value.isMo * * @link https://matomo.org * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later - */class Jc{constructor(e){Yc(this,"module",void 0),Yc(this,"method",void 0),Yc(this,"format",void 0),Yc(this,"requiredFields",void 0),this.module=e.module||"API",this.method=e.method,this.format=e.format||"json",this.requiredFields=e.requiredFields||["idSite","idDestinationSites"]}async validateFormFields(e){const t=[];return this.requiredFields.forEach(o=>{o in e&&e[o]||t.push(a("General_Required",o))}),new Promise(e=>e({errorMessages:t,isValid:0===t.length}))}prepareApiParams(e){return Object.assign({idSite:I.idSite||H.parsed.value.idSite,idDestinationSites:[e.idDestinationSite]},e)}async submitRequest(e){this.module=e.module||this.module,this.method=e.method||this.method,this.format=e.format||this.format;const t=e;if(!this.method||this.method.length<1)throw new Error("The POST method cannot be empty!");const o=new G;return o.useCallbackInCaseOfError(),o.setErrorCallback(null),o.removeDefaultParameter("date"),o.removeDefaultParameter("period"),o.removeDefaultParameter("segment"),o.addParams({module:this.module,method:this.method,format:this.format},"GET"),o.addParams(t,"POST"),o.setFormat(this.format),o.send()}onSuccess(e){let t=new Promise(e=>e());this.onSuccessCallback&&(t=this.onSuccessCallback(e)),t.then(()=>{setTimeout(()=>{const t=ki.show({message:e.message,context:e.success?"success":"error",type:"toast",id:"entityDuplicationResult"});ki.scrollToNotification(t)})})}}function Kc(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} + */class Jc{constructor(e){Yc(this,"module",void 0),Yc(this,"method",void 0),Yc(this,"format",void 0),Yc(this,"requiredFields",void 0),this.module=e.module||"API",this.method=e.method,this.format=e.format||"json",this.requiredFields=e.requiredFields||["idSite","idDestinationSites"]}async validateFormFields(e){const t=[];return this.requiredFields.forEach(o=>{o in e&&e[o]||t.push(a("General_Required",o))}),new Promise(e=>e({errorMessages:t,isValid:0===t.length}))}prepareApiParams(e){return Object.assign({idSite:I.idSite||H.parsed.value.idSite,idDestinationSites:[e.idDestinationSite]},e)}async submitRequest(e){this.module=e.module||this.module,this.method=e.method||this.method,this.format=e.format||this.format;const t=e;if(!this.method||this.method.length<1)throw new Error("The POST method cannot be empty!");const o=new K;return o.useCallbackInCaseOfError(),o.setErrorCallback(null),o.removeDefaultParameter("date"),o.removeDefaultParameter("period"),o.removeDefaultParameter("segment"),o.addParams({module:this.module,method:this.method,format:this.format},"GET"),o.addParams(t,"POST"),o.setFormat(this.format),o.send()}onSuccess(e){let t=new Promise(e=>e());this.onSuccessCallback&&(t=this.onSuccessCallback(e)),t.then(()=>{setTimeout(()=>{const t=ki.show({message:e.message,context:e.success?"success":"error",type:"toast",id:"entityDuplicationResult"});ki.scrollToNotification(t)})})}}function Kc(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e} /*! * Matomo - free/libre analytics platform * diff --git a/plugins/CoreHome/vue/src/AjaxHelper/AjaxHelper.ts b/plugins/CoreHome/vue/src/AjaxHelper/AjaxHelper.ts index fb380a11e02..bb1c1eaa3e5 100644 --- a/plugins/CoreHome/vue/src/AjaxHelper/AjaxHelper.ts +++ b/plugins/CoreHome/vue/src/AjaxHelper/AjaxHelper.ts @@ -10,6 +10,7 @@ import jqXHR = JQuery.jqXHR; import MatomoUrl from '../MatomoUrl/MatomoUrl'; import Matomo from '../Matomo/Matomo'; +import { setCookie } from '../CookieHelper/CookieHelper'; export interface AjaxOptions { withTokenInUrl?: boolean; @@ -544,8 +545,10 @@ export default class AjaxHelper { // eslint-disable-line } const isInApp = !document.querySelector('#login_form'); + const sessionTimedOut = xhr.getResponseHeader('X-Matomo-Session-Timed-Out') === '1'; - if (xhr.status === 401 && isInApp) { + if (sessionTimedOut && isInApp) { + setCookie('matomo_session_timed_out', '1', 60 * 1000); Matomo.helper.refreshAfter(0); return; } diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index 9213d317010..5dd4b4a9316 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -339,6 +339,7 @@ public function bruteForceLog() public function ajaxNoAccess($errorMessage) { http_response_code(401); + return sprintf( '

%s: %s

diff --git a/plugins/Login/tests/UI/SessionTimeoutRefresh_spec.js b/plugins/Login/tests/UI/SessionTimeoutRefresh_spec.js new file mode 100644 index 00000000000..a18bd884bb9 --- /dev/null +++ b/plugins/Login/tests/UI/SessionTimeoutRefresh_spec.js @@ -0,0 +1,55 @@ +/*! + * Matomo - free/libre analytics platform + * + * Session timeout refresh UI test. + * + * @link https://matomo.org + * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + */ + +describe('SessionTimeoutRefresh', function () { + this.fixture = 'Piwik\\Tests\\Fixtures\\OneVisitorTwoVisits'; + + const reportUrl = '?module=CoreHome&action=index&idSite=1&period=day&date=yesterday' + + '#?idSite=1&period=day&date=yesterday&category=General_Visitors&subcategory=UserId_UserReportTitle'; + + before(async function () { + testEnvironment.testUseMockAuth = 0; + testEnvironment.overrideConfig('General', 'login_session_not_remembered_idle_timeout', 2); + testEnvironment.save(); + }); + + after(async function () { + testEnvironment.testUseMockAuth = 1; + testEnvironment.save(); + }); + + it('should refresh to login when an ajax call happens after session timeout', async function () { + await page.clearCookies(); + await page.goto(reportUrl); + await page.waitForNetworkIdle(); + + await page.type('#login_form_login', superUserLogin); + await page.type('#login_form_password', superUserPassword); + await page.click('#login_form_submit'); + await page.waitForNetworkIdle(); + await page.waitForSelector('.reporting-page'); + + await page.waitForTimeout(3500); + + await page.click('div.reportingMenu ul.navbar li[data-category-id="General_Actions"]'); + await page.waitForTimeout(100); + await page.click('div.reportingMenu ul.navbar li[data-category-id="General_Actions"] ul li:nth-of-type(1)'); + + const loginPage = await page.waitForSelector('#loginPage', { visible: true }); + expect(loginPage).to.be.ok; + + const expectedText = 'Error: Your session has expired due to inactivity. Please log in to continue.'; + await page.waitForSelector('div.system.notification-error .notification-body'); + const notificationText = await page.$eval( + 'div.system.notification-error .notification-body', + (el) => el.textContent.trim() + ); + expect(notificationText).to.equal(expectedText); + }); +}); diff --git a/tests/PHPUnit/Integration/AccessTest.php b/tests/PHPUnit/Integration/AccessTest.php index aa88e77afaf..92ce2319f75 100644 --- a/tests/PHPUnit/Integration/AccessTest.php +++ b/tests/PHPUnit/Integration/AccessTest.php @@ -304,7 +304,7 @@ public function testCheckUserHasSomeWriteAccessWithSomeAccessDoesNotHaveAccess() public function testCheckUserHasViewAccessWithEmptyAccessNoSiteIdsGiven() { - $this->expectException(\Piwik\NoAccessException::class); + $this->expectException(\Piwik\Http\BadRequestException::class); $access = $this->getAccess(); $access->checkUserHasViewAccess(array()); } @@ -356,7 +356,7 @@ public function testCheckUserHasViewAccessWithSomeAccessFailure() public function testCheckUserHasWriteAccessWithEmptyAccessNoSiteIdsGiven() { - $this->expectException(\Piwik\NoAccessException::class); + $this->expectException(\Piwik\Http\BadRequestException::class); $access = $this->getAccess(); $access->checkUserHasWriteAccess(array()); } @@ -393,7 +393,7 @@ public function testCheckUserHasAdminAccessWithSuperUserAccess() public function testCheckUserHasAdminAccessWithEmptyAccessNoSiteIdsGiven() { - $this->expectException(\Piwik\NoAccessException::class); + $this->expectException(\Piwik\Http\BadRequestException::class); $access = $this->getAccess(); $access->checkUserHasViewAccess(array()); }