diff --git a/Dockerfile b/Dockerfile index df603e7..2ec3eb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM matomo:5.3.2 +FROM matomo:5.4.0 # checkov:skip=CKV_DOCKER_2:Skipping HEALTHCHECK configuration for now # checkov:skip=CKV_DOCKER_3:The container actually runs as www-data user @@ -17,6 +17,9 @@ COPY ./files/plugin-UsersFlow-5.0.5/ /var/www/html/plugins/UsersFlow # Add the SearchEngineKeywordsPerformance plugin COPY ./files/plugin-SearchEngineKeywordsPerformance-5.0.22/ /var/www/html/plugins/SearchEngineKeywordsPerformance +# Add the CustomReports plugin +COPY ./files/plugin-CustomReports-5.4.3/ /var/www/html/plugins/CustomReports + # Our custom configuration settings. COPY ./files/config.ini.php /var/www/html/config/config.ini.php diff --git a/docs/HowTos/HOWTO-premium-plugins.md b/docs/HowTos/HOWTO-premium-plugins.md index 5be77ac..5ea4d58 100644 --- a/docs/HowTos/HOWTO-premium-plugins.md +++ b/docs/HowTos/HOWTO-premium-plugins.md @@ -18,11 +18,11 @@ The `config.ini.php` file has two lists of plugins under two different headings. In the end, the premium plugin installation is a two-pass process. -## Process +## Process to Install New Premium Plugin ### High level overview -1. Install license key (via UI or CLI) so that it is in the database (this apparently only needs to be done once as all future premium plugins get linked to the same license key). +1. Install license key (via UI or CLI) so that it is in the database (this only needs to be done once as all future premium plugins get linked to the same license key). 2. Go through a dev -> stage -> prod deployment cycle of the container to install the plugin folder(s) into the container 3. Activate the new plugin(s) (via UI or CLI) so that any database changes are properly executed. 4. Go through a dev -> stage -> prod deployment cycle of the container to match the updated `config.ini.php` file on the server. @@ -41,8 +41,14 @@ According to the support team at Matomo, the premium license key can be installe This needs to be done once on each of the stage & prod instances of Matomo. +**Note**: It is possible to add the license key to the Dev1 instance of Matomo for a short period of time for testing a new premium plugin without breaking either the Stage or Prod instances of Matomo. This is useful for the initial test of a new premium plugin. + #### 2. Install the plugin files +First, download the plugin source files from shop.matomo.org (use the username/password in the "Matomo Plugins" secret in LastPass to log in). Once the .zip files are downloaded, expand them and save them in the `files/` folder in this repository. + +Second, update the [Dockerfile](../../Dockerfile) with a new `COPY` command to copy the the plugin files to the correct directory in the image. + In this phase, the files are installed in the container **but** no changes are made to the `config.ini.php` file. This will **not** activate the plugins, it will just make them visible in the UI. **Note**: It is possible to do this with the `/var/www/html/console` utility when logged in to the cli of the running conatiner. However, that method introduces potential file permission errors since the command is run as `root` and the content in the `/var/www/html` folder needs to be owned by `www-data`. @@ -62,3 +68,7 @@ It's also important to note that this `plugin:activate` command very likely make #### 4. Backfill this repo Update the `config.ini.php` file in this repo and go through another dev -> stage -> prod deployment to ensure that the repo code matches the container running in AWS. + +## Process to Upgrade Existing Premium Plugin + +See the [HOWTO-matomo-upgrade](./HOWTO-matomo-upgrade.md) documentation. Premium plug updates are the same as regular plugin updates. diff --git a/files/plugin-CustomReports-5.4.3/API.php b/files/plugin-CustomReports-5.4.3/API.php new file mode 100644 index 0000000..059fc2a --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/API.php @@ -0,0 +1,852 @@ +Custom Reports API lets you 1) create custom + * reports within Matomo and 2) view the created reports in the Matomo Reporting UI or consume them via the API. + *

+ * You can choose between different visualizations (eg table or evolution graph) and combine hundreds of dimensions + * and metrics to get the data you need. + * + * @method static \Piwik\Plugins\CustomReports\API getInstance() + */ +class API extends \Piwik\Plugin\API +{ + /** + * @var MetricsList + */ + private $metricsList; + + /** + * @var DimensionsProvider + */ + private $columnsProvider; + + /** + * @var CustomReportsModel + */ + private $model; + + /** + * @var Validator + */ + private $validator; + + /** + * @var LogTablesProvider + */ + private $logTablesProvider; + + /** + * @var Configuration + */ + private $configuration; + + /** + * @var ArchiveInvalidator + */ + private $archiveInvalidator; + + public function __construct( + CustomReportsModel $model, + Validator $validator, + DimensionsProvider $columnsProvider, + LogTablesProvider $logTablesProvider, + Configuration $configuration, + ArchiveInvalidator $archiveInvalidator + ) { + $this->metricsList = MetricsList::get(); + $this->columnsProvider = $columnsProvider; + $this->model = $model; + $this->validator = $validator; + $this->logTablesProvider = $logTablesProvider; + $this->configuration = $configuration; + $this->archiveInvalidator = $archiveInvalidator; + } + + /** + * Adds a new custom report + * @param int $idSite + * @param string $name The name of the report. + * @param string $reportType The type of report you want to create, for example 'table' or 'evolution'. + * For a list of available reports call 'CustomReports.getAvailableReportTypes' + * @param string[] $metricIds A list of metric IDs. For a list of available metrics call 'CustomReports.getAvailableMetrics' + * @param string $categoryId By default, the report will be put into a custom report category unless a specific + * categoryId is provided. For a list of available categories call 'CustomReports.getAvailableCategories'. + * @param string[] $dimensionIds A list of dimension IDs. For a list of available metrics call 'CustomReports.getAvailableDimensions' + * @param bool|string $subcategoryId By default, a new reporting page will be created for this report unless you + * specifiy a specific name or subcategoryID. For a list of available subcategories + * call 'CustomReports.getAvailableCategories'. + * @param string $description An optional description for the report, will be shown in the title help icon of the report. + * @param string $segmentFilter An optional segment to filter the report data. Needs to be sent urlencoded. + * @param string[] $multipleIdSites An optional list of idsites for which we need to execute the report + * @return int + */ + public function addCustomReport($idSite, $name, $reportType, $metricIds, $categoryId = false, $dimensionIds = array(), $subcategoryId = false, $description = '', $segmentFilter = '', $multipleIdSites = []) + { + if (!empty($multipleIdSites) && $idSite != 'all' && $idSite != '0') { + $multipleIdSites = array_unique($multipleIdSites); + foreach ($multipleIdSites as $multipleIdSite) { + $this->validator->checkWritePermission($multipleIdSite); + } + if (!in_array($idSite, $multipleIdSites)) { + throw new \Exception(Piwik::translate('CustomReports_ErrorInvalidMultipleIdSite', [$idSite])); + } + } else { + $this->validator->checkWritePermission($idSite); + // prevent creating reports for sites that do not yet exist but might in the future + $this->validator->checkSiteExists($idSite); + } + + if (empty($categoryId)) { + $categoryId = CustomReportsDao::DEFAULT_CATEGORY; + } + + $createdDate = Date::now()->getDatetime(); + if (!empty($segmentFilter)) { + $segmentFilter = Common::unsanitizeInputValue($segmentFilter); + $segmentFilter = urldecode($segmentFilter); + } + + // If there's a Product Revenue metric without a Product Quantity metric, throw an exception + if ( + (in_array('sum_product_revenue', $metricIds) || in_array('avg_product_revenue', $metricIds)) + && !in_array('sum_ecommerce_productquantity', $metricIds) + && !in_array('avg_ecommerce_productquantity', $metricIds) + ) { + throw new \Exception(Piwik::translate('CustomReports_ErrorProductRevenueMetricDependency')); + } + + $idReport = $this->model->createCustomReport($idSite, $name, $description, $reportType, $dimensionIds, $metricIds, $segmentFilter, $categoryId, $subcategoryId, $createdDate, $multipleIdSites); + $report = $this->model->getCustomReportById($idReport, $idSite); + + $config = StaticContainer::get(Configuration::class); + $startDate = null; + $subMonth = $config->getReArchiveReportsInPastLastNMonths(); + if (!empty($subMonth)) { + $startDate = Date::yesterday()->subMonth($subMonth)->setDay(1); + } + + $this->archiveInvalidator->scheduleReArchiving( + $idSite === 0 || $idSite === '0' || $idSite == 'all' ? 'all' : (!empty($multipleIdSites) ? $multipleIdSites : [$idSite]), + 'CustomReports', + Archiver::makeRecordName($idReport, $report['revision'] ?? '0'), + $startDate + ); + + $this->clearCache(); + return $idReport; + } + + private function clearCache() + { + // we need to delete possibly cached values. especially ReportsProvider + try { + Cache::getLazyCache()->flushAll(); + } catch (\Exception $e) { + } + // we need to delete possibly cached values. especially ReportsProvider + try { + Cache::getEagerCache()->flushAll(); + } catch (\Exception $e) { + } + // we need to delete possibly cached values. especially ReportsProvider + try { + Cache::getTransientCache()->flushAll(); + } catch (\Exception $e) { + } + } + + /** + * Updates an existing custom report. Be aware that if you change metrics, dimensions, the report type or the segment filter, + * previously processed/archived reports may become unavailable and would need to be re-processed. + * + * @param int $idSite + * @param int $idCustomReport + * @param string $name The name of the report. + * @param string $reportType The type of report you want to create, for example 'table' or 'evolution'. + * For a list of available reports call 'CustomReports.getAvailableReportTypes' + * @param string[] $metricIds A list of metric IDs. For a list of available metrics call 'CustomReports.getAvailableMetrics' + * @param string $categoryId By default, the report will be put into a custom report category unless a specific + * categoryId is provided. For a list of available categories call 'CustomReports.getAvailableCategories'. + * @param string[] $dimensionIds A list of dimension IDs. For a list of available metrics call 'CustomReports.getAvailableDimensions' + * @param bool|string $subcategoryId By default, a new reporting page will be created for this report unless you + * specifiy a specific name or subcategoryID. For a list of available subcategories + * call 'CustomReports.getAvailableCategories'. + * @param string $description An optional description for the report, will be shown in the title help icon of the report. + * @param string $segmentFilter An optional segment to filter the report data. Needs to be sent urlencoded. + * @param int[] $subCategoryReportIds List of sub report ids mapped to this report + * @param string[] $multipleIdSites An optional list of idsites for which we need to execute the report + */ + public function updateCustomReport( + $idSite, + $idCustomReport, + $name, + $reportType, + $metricIds, + $categoryId = false, + $dimensionIds = array(), + $subcategoryId = false, + $description = '', + $segmentFilter = '', + $subCategoryReportIds = [], + $multipleIdSites = [] + ) { + if (!empty($multipleIdSites) && $idSite != 'all' && $idSite != '0') { + $multipleIdSites = array_unique($multipleIdSites); + foreach ($multipleIdSites as $multipleIdSite) { + $this->validator->checkWritePermission($multipleIdSite); + } + if (!in_array($idSite, $multipleIdSites)) { + throw new \Exception(Piwik::translate('CustomReports_ErrorInvalidMultipleIdSite', [$idSite])); + } + } else { + $this->validator->checkWritePermission($idSite); + // prevent creating reports for sites that do not yet exist but might in the future + $this->validator->checkSiteExists($idSite); + } + + // we cannot get report by idSite, idCustomReport since the idSite may change! + $report = $this->model->getCustomReportById($idCustomReport, $idSite); + + if (empty($report)) { + throw new \Exception(Piwik::translate('CustomReports_ErrorReportDoesNotExist')); + } + + if ($report['idsite'] != $idSite && empty($multipleIdSites)) { + // if the site changes for a report, make sure the user write permission for the old and the new site + $this->validator->checkWritePermission($report['idsite']); + } + + if (empty($categoryId)) { + $categoryId = CustomReportsDao::DEFAULT_CATEGORY; + } + + if (!empty($segmentFilter)) { + $segmentFilter = Common::unsanitizeInputValue($segmentFilter); + $segmentFilter = urldecode($segmentFilter); + } + + $updatedDate = Date::now()->getDatetime(); + + $shouldReArchive = false; + if ( + ( + isset($report['report_type']) && + $report['report_type'] != $reportType + ) || + ( + isset($report['dimensions']) && + $report['dimensions'] != $dimensionIds + ) || + ( + isset($report['metrics']) && + $report['metrics'] != $metricIds + ) || + ( + isset($report['segment_filter']) && + $report['segment_filter'] != $segmentFilter + ) + ) { + $shouldReArchive = true; + } + + // If there's a Product Revenue metric without a Product Quantity metric, throw an exception + if ( + (in_array('sum_product_revenue', $metricIds) || in_array('avg_product_revenue', $metricIds)) + && !in_array('sum_ecommerce_productquantity', $metricIds) + && !in_array('avg_ecommerce_productquantity', $metricIds) + ) { + throw new \Exception(Piwik::translate('CustomReports_ErrorProductRevenueMetricDependency')); + } + + $this->model->updateCustomReport($idSite, $idCustomReport, $name, $description, $reportType, $dimensionIds, $metricIds, $segmentFilter, $categoryId, $subcategoryId, $updatedDate, $subCategoryReportIds, $multipleIdSites); + + if ($shouldReArchive) { + $updatedReport = $this->model->getCustomReportById($idCustomReport, $idSite); + $config = StaticContainer::get(Configuration::class); + $startDate = null; + $subMonth = $config->getReArchiveReportsInPastLastNMonths(); + if (!empty($subMonth)) { + $startDate = Date::yesterday()->subMonth($subMonth)->setDay(1); + } + + $this->archiveInvalidator->scheduleReArchiving( + $idSite === 0 || $idSite === '0' || $idSite == 'all' ? 'all' : (!empty($multipleIdSites) ? $multipleIdSites : [$idSite]), + 'CustomReports', + Archiver::makeRecordName($idCustomReport, $updatedReport['revision']), + $startDate + ); + } + + $this->clearCache(); + } + + /** + * Get all custom report configurations for a specific site. + * + * @param int $idSite + * @param bool $skipCategoryMetadata + * @return array + */ + public function getConfiguredReports($idSite, $skipCategoryMetadata = false) + { + $this->validator->checkReportViewPermission($idSite); + $this->validator->checkSiteExists($idSite); + + if ($idSite === 'all') { + $idSite = 0; + } + + $reports = $this->model->getAllCustomReportsForSite($idSite, $skipCategoryMetadata == '1'); + usort($reports, function ($a, $b) { + if ($a['idcustomreport'] > $b['idcustomreport']) { + return 1; // no need to check for === because two reports won't have same ID + } + return -1; + }); + + foreach ($reports as &$report) { + $this->addAllowedToEditStatus($report); + } + + return $reports; + } + + /** + * Get a specific custom report configuration. + * + * @param int $idSite + * @param int $idCustomReport + * @return array + */ + public function getConfiguredReport($idSite, $idCustomReport) + { + $this->validator->checkReportViewPermission($idSite); + $this->validator->checkSiteExists($idSite); + + if ($idSite === 'all') { + $idSite = 0; + } + + $this->model->checkReportExists($idSite, $idCustomReport); + + $report = $this->model->getCustomReport($idSite, $idCustomReport); + $this->addAllowedToEditStatus($report); + + return $report; + } + + /** + * Deletes the given custom report. + * + * When a custom report is deleted, its report will be no longer available in the API and tracked data for this + * report might be removed at some point by the system. + * + * @param int $idSite + * @param int $idForm + */ + public function deleteCustomReport($idSite, $idCustomReport) + { + $this->validator->checkWritePermission($idSite); + + if ($idSite === 'all') { + $idSite = 0; + } + + $report = $this->getCustomReportInfo($idSite, $idCustomReport, 'Delete'); + + $multipleIDSites = $report['multiple_idsites'] ? explode(',', $report['multiple_idsites']) : []; + if ($multipleIDSites) { + foreach ($multipleIDSites as $multipleIdSite) { + $this->validator->checkWritePermission($multipleIdSite); + } + } + $this->archiveInvalidator->removeInvalidationsSafely( + $multipleIDSites ? $multipleIDSites : [$idSite], + 'CustomReports', + Archiver::makeRecordName($idCustomReport, $report['revision']) + ); + + $this->model->deactivateReport($multipleIDSites ? -1 : $idSite, $idCustomReport, $report['name']); + Piwik::postEvent('CustomReports.deleteCustomReport.end', array($idSite, $idCustomReport)); + $this->clearCache(); + } + + /** + * Pauses the given custom report. + * + * When a custom report is paused, its report will be no longer be archived + * + * @param int $idSite + * @param int $idForm + */ + public function pauseCustomReport($idSite, $idCustomReport) + { + $this->validator->checkWritePermission($idSite); + + if ($idSite === 'all') { + $idSite = 0; + } + + $report = $this->getCustomReportInfo($idSite, $idCustomReport, 'Pause'); + + $multipleIDSites = $report['multiple_idsites'] ? explode(',', $report['multiple_idsites']) : []; + if ($multipleIDSites) { + foreach ($multipleIDSites as $multipleIdSite) { + $this->validator->checkWritePermission($multipleIdSite); + } + } + $this->archiveInvalidator->removeInvalidationsSafely( + $multipleIDSites ? $multipleIDSites : [$idSite], + 'CustomReports', + Archiver::makeRecordName($idCustomReport, $report['revision']) + ); + + $this->model->pauseReport($multipleIDSites ? -1 : $idSite, $idCustomReport, $report['name']); + $this->clearCache(); + } + + /** + * Resumes the given custom report. + * + * When a custom report is resumed, its report will start archiving again + * + * @param int $idSite + * @param int $idForm + */ + public function resumeCustomReport($idSite, $idCustomReport) + { + $this->validator->checkWritePermission($idSite); + + if ($idSite === 'all') { + $idSite = 0; + } + + $report = $this->getCustomReportInfo($idSite, $idCustomReport, 'Resume'); + + $multipleIDSites = $report['multiple_idsites'] ? explode(',', $report['multiple_idsites']) : []; + if ($multipleIDSites) { + foreach ($multipleIDSites as $multipleIdSite) { + $this->validator->checkWritePermission($multipleIdSite); + } + } + + $this->model->resumeReport($multipleIDSites ? -1 : $idSite, $idCustomReport, $report['name']); + $this->clearCache(); + } + + /** + * Get a list of available categories that can be used in custom reports. + * + * @param int $idSite + * @return array + */ + public function getAvailableCategories($idSite) + { + $this->validator->checkReportViewPermission($idSite); + + $reportPages = Request::processRequest('API.getReportPagesMetadata', array('idSite' => $idSite, 'filter_limit' => -1)); + + $categories = array(); + foreach ($reportPages as $reportPage) { + if (!empty($reportPage['category']['id'])) { + $categoryId = $reportPage['category']['id']; + + if ($categoryId === 'Dashboard_Dashboard') { + continue; + } + + $subcategoryId = $reportPage['subcategory']['id']; + if (strpos($subcategoryId, '_Manage') !== false) { + continue; // we do not want to be able to add reports to manage pages + } + + if (isset($categories[$categoryId])) { + $categories[$categoryId]['subcategories'][] = array( + 'uniqueId' => $reportPage['subcategory']['id'], + 'name' => $reportPage['subcategory']['name'] + ); + } else { + $categories[$categoryId] = array( + 'uniqueId' => $categoryId, + 'name' => $reportPage['category']['name'], + 'subcategories' => array( + array( + 'uniqueId' => $reportPage['subcategory']['id'], + 'name' => $reportPage['subcategory']['name'] + ) + ), + ); + } + } + } + + if (!isset($categories['CustomReports_CustomReports'])) { + $categories['CustomReports_CustomReports'] = array( + 'uniqueId' => 'CustomReports_CustomReports', + 'name' => Piwik::translate('CustomReports_CustomReports'), + 'subcategories' => array() + ); + } + + return array_values($categories); + } + + /** + * Get a list of available reporty types that can be used in custom reports. + * + * @param int $idSite + * @return array + */ + public function getAvailableReportTypes() + { + $this->validator->checkHasSomeWritePermission(); + + $rows = array(); + foreach (ReportType::getAll() as $reportType) { + $rows[] = array('key' => $reportType::ID, 'value' => $reportType->getName()); + } + + return $rows; + } + + private function isTableJoinable($tableName) + { + $logTable = $this->logTablesProvider->getLogTable($tableName); + if ($logTable && ($logTable->getColumnToJoinOnIdAction() || $logTable->getColumnToJoinOnIdVisit())) { + if ($logTable->getPrimaryKey()) { + // without primary key we would not group the data correctly + return true; + } + } elseif ($logTable && $logTable->getWaysToJoinToOtherLogTables()) { + $tables = new JoinTables($this->logTablesProvider, [$tableName]); + return $tables->isTableJoinableOnVisit($tableName) || $tables->isTableJoinableOnAction($tableName); + } + + return false; + } + + /** + * Get a list of available dimensions that can be used in custom reports. + * + * @param int $idSite + * @return array + */ + public function getAvailableDimensions($idSite) + { + Piwik::checkUserIsNotAnonymous(); + Piwik::checkUserHasSomeViewAccess(); + + $dimensions = $this->columnsProvider->getAllDimensions(); + + $rows = array(); + + $dimensionsToIgnore = array( + 'Actions.IdPageview', 'CoreHome.VisitId', + 'DevicesDetection.OsVersion', // only makes sense in combination with Os Family + 'CoreHome.LinkVisitActionId', 'CoreHome.LinkVisitActionIdPages', 'UserCountry.Provider' + ); + + $dimensionsToRename = [ + 'CoreHome.IdSite' => Piwik::translate('CustomReports_WebsiteName') + ]; + + $config = StaticContainer::get(Configuration::class); + foreach ($config->getDisabledDimensions() as $dimensionDisabled) { + $dimensionsToIgnore[] = $dimensionDisabled; + } + + /** + * Adds the possibility to other plugins to ignore more dimensions + */ + Piwik::postEvent('CustomReports.addDimensionsToIgnore', array(&$dimensionsToIgnore)); + + $categoryList = CategoryList::get(); + + foreach ($dimensions as $dimension) { + $categoryId = $dimension->getCategoryId(); + $dimensionName = $dimension->getName(); + $table = $dimension->getDbTableName(); + $dimensionId = $dimension->getId(); + + if (!$table) { + // without table we cannot join it + continue; + } + + if (!$this->isTableJoinable($table)) { + // archiving this dimension would not work + continue; + } + + if (in_array($dimensionId, $dimensionsToIgnore)) { + continue; + } + + if (key_exists($dimensionId, $dimensionsToRename)) { + $dimensionName = $dimensionsToRename[$dimensionId]; + } + + if ($dimension->getColumnName() && $dimensionName) { + if (!isset($rows[$categoryId])) { + $category = $categoryList->getCategory($categoryId); + $orderId = 999; + if (!empty($category)) { + $orderId = $category->getOrder(); + } + + $categoryName = Piwik::translate($categoryId); + if (!is_null($category) && method_exists($category, 'getDisplayName')) { + $categoryName = $category->getDisplayName(); + } + + $rows[$categoryId] = array( + 'category' => $categoryName, + 'dimensions' => array(), + 'orderId' => $orderId + ); + } + $rows[$categoryId]['dimensions'][] = array( + 'uniqueId' => $dimension->getId(), + 'name' => ucwords($dimensionName), + 'sqlSegment' => $dimension->getSqlSegment(), + ); + } + } + + usort($rows, function ($rowA, $rowB) { + if ((int)$rowA['orderId'] > (int)$rowB['orderId']) { + return 1; + } + if ((int)$rowA['orderId'] === (int)$rowB['orderId']) { + return 0; + } + return -1; + }); + + foreach ($rows as $categoryId => $row) { + $dimensions = $row['dimensions']; + usort($dimensions, function ($dimA, $dimB) { + return strcmp($dimA['name'], $dimB['name']); + }); + $rows[$categoryId]['dimensions'] = $dimensions; + } + + return array_values($rows); + } + + /** + * Get a list of available metrics that can be used in custom reports. + * + * @param int $idSite + * @return array + */ + public function getAvailableMetrics($idSite) + { + Piwik::checkUserIsNotAnonymous(); + Piwik::checkUserHasSomeViewAccess(); + + $metrics = MetricsList::get(); + $categoryList = CategoryList::get(); + + $rows = array(); + $period = Common::getRequestVar('period', '', 'string'); + foreach ($metrics->getMetrics() as $metric) { + if (!$metric) { + continue; + } + if ($metric instanceof ProcessedMetric && !$this->canGenerateMetricAutomatically($metric)) { + // we do not have all the dependent metrics to generate this processed metric automatically + continue; + } + + $categoryId = $metric->getCategoryId(); + $name = $metric->getName(); + $translatedName = $metric->getTranslatedName(); + + if (($metric instanceof ProcessedMetric || $metric instanceof ArchivedMetric) && $name && $translatedName) { + if (method_exists($metric, 'getQuery') && !$metric->getQuery()) { + // archiving this metric would not work! + continue; + } + + if (method_exists($metric, 'getDbTableName') && $metric->getDbTableName() && !$this->isTableJoinable($metric->getDbTableName())) { + // archiving this metric would not work! + continue; + } + + if (method_exists($metric, 'getDimension') && $metric->getDimension()) { + $dimension = $metric->getDimension(); + $dbDiscriminator = $dimension->getDbDiscriminator(); + if ($dbDiscriminator) { + $dbDiscriminatorValue = $dbDiscriminator->getValue(); + if (!isset($dbDiscriminatorValue) || !is_numeric($dbDiscriminatorValue)) { + continue; + } + } + } + + if (!isset($rows[$categoryId])) { + $category = $categoryList->getCategory($categoryId); + $orderId = 999; + if (!empty($category)) { + $orderId = $category->getOrder(); + } + + $categoryName = Piwik::translate($categoryId); + if (!is_null($category) && method_exists($category, 'getDisplayName')) { + $categoryName = $category->getDisplayName(); + } + + $rows[$categoryId] = array( + 'category' => $categoryName, + 'metrics' => array(), + 'orderId' => $orderId + ); + } + + $description = $metric->getDocumentation(); + if (stripos($translatedName, 'unique') === 0) { + $description = Piwik::translate('CustomReports_CommonUniqueMetricDescription', array($description, ucwords($translatedName), str_replace('Unique ', '', ucwords($translatedName)))); + } + + $rows[$categoryId]['metrics'][] = array( + 'uniqueId' => $name, 'name' => ucwords($translatedName), 'description' => $description + ); + } + } + + usort($rows, function ($rowA, $rowB) { + if ((int)$rowA['orderId'] > (int)$rowB['orderId']) { + return 1; + } + if ((int)$rowA['orderId'] === (int)$rowB['orderId']) { + return 0; + } + return -1; + }); + + foreach ($rows as $category => $row) { + $dimensions = $row['metrics']; + usort($dimensions, function ($dimA, $dimB) { + return strcasecmp($dimA['name'], $dimB['name']); + }); + $rows[$category]['metrics'] = $dimensions; + } + + return array_values($rows); + } + + private function canGenerateMetricAutomatically(ProcessedMetric $metric) + { + foreach ($metric->getDependentMetrics() as $dependentMetric) { + $depMetric = $this->metricsList->getMetric($dependentMetric); + if (!$depMetric) { + // we cannot generate this metric directly + return false; + } + + if ($depMetric instanceof ProcessedMetric && !$this->canGenerateMetricAutomatically($depMetric)) { + return false; + } + } + + return true; + } + + /** + * Get report data for a previously created custom report. + * + * @param int $idSite + * @param string $period + * @param string $date + * @param int $idCustomReport + * @param bool|string $segment + * @param bool $expanded + * @param bool $flat + * @param int|bool $idSubtable + * @param string|bool $columns + * @return DataTable\DataTableInterface + */ + public function getCustomReport($idSite, $period, $date, $idCustomReport, $segment = false, $expanded = false, $flat = false, $idSubtable = false, $columns = false) + { + $this->validator->checkReportViewPermission($idSite); + $this->validator->checkSiteExists($idSite); // lets not return any reports from eg deleted sites if for some reason report still exists + $this->model->checkReportExists($idSite, $idCustomReport); + + $report = $this->model->getCustomReport($idSite, $idCustomReport); + + $reportType = ReportType::factory($report['report_type']); + + $table = $reportType->fetchApi($idSite, $idCustomReport, $period, $date, $segment, $expanded, $flat, $idSubtable, $columns); + + return $table; + } + + private function addAllowedToEditStatus(&$report) + { + $idSite = $report['idsite']; + $multipleIdSites = $report['multiple_idsites'] ? explode(',', $report['multiple_idsites']) : array(); + if (Piwik::hasUserSuperUserAccess()) { + $allowedToEdit = true; + } elseif ($idSite == 'all' || $idSite == '0') { + $allowedToEdit = false; + } else { + $allowedToEdit = $multipleIdSites ? Piwik::isUserHasWriteAccess($multipleIdSites) : Piwik::isUserHasWriteAccess($idSite); + } + + $report['allowedToEdit'] = $allowedToEdit; + } + + private function getCustomReportInfo($idSite, $idCustomReport, $action) + { + $report = $this->model->getCustomReport($idSite, $idCustomReport); + + if (empty($report)) { + throw new \Exception(Piwik::translate('CustomReports_ErrorCustomReportDoesNotExist')); + } elseif ($report['idsite'] != $idSite) { + // prevent a possible hack that someone passes a different site than the report has and then we accidentally + // still delete the report because we match with `idsite = 0 or idsite = ?`. We don't do this here right now + // and wouldn't need this code but it is to prevent any possible future security bugs. + throw new \Exception(Piwik::translate('CustomReports_' . $action . 'ExceptionMessage')); + } + + return $report; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Activity/BaseActivity.php b/files/plugin-CustomReports-5.4.3/Activity/BaseActivity.php new file mode 100644 index 0000000..75a03a6 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Activity/BaseActivity.php @@ -0,0 +1,113 @@ + $this->getSiteData($idSite), + 'version' => 'v1', + 'report' => $this->getReportData($idSite, $idCustomReport), + ); + } + + private function getSiteData($idSite) + { + if ($idSite == 0) { + return array( + 'site_id' => 'all', + 'site_name' => 'all' + ); + } + + return array( + 'site_id' => $idSite, + 'site_name' => Site::getNameFor($idSite) + ); + } + + private function getReportData($idSite, $idCustomReport) + { + $report = $this->getDao()->getCustomReport($idSite, $idCustomReport); + + if (!empty($report['name'])) { + $reportName = $report['name']; + } else { + // report name might not be set when we are handling ReportDeleted activity + $reportName = 'ID: ' . (int) $idCustomReport; + } + + return array( + 'id' => $idCustomReport, + 'name' => $reportName + ); + } + + public function getPerformingUser($eventData = null) + { + $login = Piwik::getCurrentUserLogin(); + + if ($login === self::USER_ANONYMOUS || empty($login)) { + // anonymous cannot change a report, in this case the system changed it + return self::USER_SYSTEM; + } + + return $login; + } + + private function getDao() + { + return StaticContainer::get('Piwik\Plugins\CustomReports\Dao\CustomReportsDao'); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Activity/ReportAdded.php b/files/plugin-CustomReports-5.4.3/Activity/ReportAdded.php new file mode 100644 index 0000000..59db137 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Activity/ReportAdded.php @@ -0,0 +1,41 @@ +formatActivityData($idSite, $idCustomReport); + } + + public function getTranslatedDescription($activityData, $performingUser) + { + $siteName = $this->getSiteNameFromActivityData($activityData); + $reportName = $this->getReportNameFromActivityData($activityData); + + return Piwik::translate('CustomReports_ActivityReportAddedDescription', [$reportName, $siteName]); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Activity/ReportDeleted.php b/files/plugin-CustomReports-5.4.3/Activity/ReportDeleted.php new file mode 100644 index 0000000..3a145af --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Activity/ReportDeleted.php @@ -0,0 +1,44 @@ +formatActivityData($idSite, $idCustomReport); + } + + public function getTranslatedDescription($activityData, $performingUser) + { + $siteName = $this->getSiteNameFromActivityData($activityData); + $reportName = $this->getReportNameFromActivityData($activityData); + + return Piwik::translate('CustomReports_ActivityReportDeletedDescription', [$reportName, $siteName]); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Activity/ReportPaused.php b/files/plugin-CustomReports-5.4.3/Activity/ReportPaused.php new file mode 100644 index 0000000..3658592 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Activity/ReportPaused.php @@ -0,0 +1,42 @@ +formatActivityData($idSite, $idCustomReport); + } + + public function getTranslatedDescription($activityData, $performingUser) + { + $siteName = $this->getSiteNameFromActivityData($activityData); + $reportName = $this->getReportNameFromActivityData($activityData); + + return Piwik::translate('CustomReports_ActivityReportPausedDescription', [$reportName, $siteName]); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Activity/ReportResumed.php b/files/plugin-CustomReports-5.4.3/Activity/ReportResumed.php new file mode 100644 index 0000000..b883659 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Activity/ReportResumed.php @@ -0,0 +1,42 @@ +formatActivityData($idSite, $idCustomReport); + } + + public function getTranslatedDescription($activityData, $performingUser) + { + $siteName = $this->getSiteNameFromActivityData($activityData); + $reportName = $this->getReportNameFromActivityData($activityData); + + return Piwik::translate('CustomReports_ActivityReportResumedDescription', [$reportName, $siteName]); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Activity/ReportUpdated.php b/files/plugin-CustomReports-5.4.3/Activity/ReportUpdated.php new file mode 100644 index 0000000..77b6b8b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Activity/ReportUpdated.php @@ -0,0 +1,42 @@ +formatActivityData($idSite, $idCustomReport); + } + + public function getTranslatedDescription($activityData, $performingUser) + { + $siteName = $this->getSiteNameFromActivityData($activityData); + $reportName = $this->getReportNameFromActivityData($activityData); + + return Piwik::translate('CustomReports_ActivityReportUpdatedDescription', [$reportName, $siteName]); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Archiver.php b/files/plugin-CustomReports-5.4.3/Archiver.php new file mode 100644 index 0000000..1db375c --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Archiver.php @@ -0,0 +1,39 @@ +dimensions = array_values($dimensions); + $this->metrics = $metrics; + } + + /** + * @return Dimension[][][] + */ + public function getDimensionsPlan() + { + $numDimensions = count($this->dimensions); + + $plan = array(); + + for ($i = 0; $i < $numDimensions; $i++) { + $dimension = $this->dimensions[$i]; + + $currentTable = $dimension->getDbTableName(); + + $group = array('left' => array(), 'right' => array()); + + if ($i >= 1) { + for ($j = 0; $j < $i; $j++) { + $group['left'][] = $this->dimensions[$j]; + } + } + + $group['left'][] = $dimension; + + // No need for right join if there are 2 dimensions on left, as adding the right join can cause some data to be filtered out and there we be no data for second dimension, #PG-3138 + if (isset($this->dimensions[$i + 1]) && count($group['left']) !== 2) { + $group['right'][] = $this->dimensions[$i + 1]; + } + + $plan[] = $group; + } + + if (empty($plan)) { + // for evolution graph... we need to make sure to still iterate at least over one "fake group" + $plan[] = array('left' => array(), 'right' => array()); + } + + return $plan; + } + + /** + * @return ArchivedMetric[][] + */ + public function getMetricsPlanForGroup() + { + $metricsToResolve = $this->metrics; + + $plan = array(); + + foreach ($metricsToResolve as $index => $metric) { + if (!$metric->getDimension()) { + continue; + } + + $discriminator = $metric->getDimension()->getDbDiscriminator(); + // create a separate run for each metric that has a discriminator + if (!empty($discriminator)) { + $id = $metric->getDbTableName() . '_' . $discriminator->getTable() . '_' . $discriminator->getColumn() . '_' . $discriminator->getValue(); + if (!isset($plan[$id])) { + // improve performance by grouping metrics with the very same discriminator together!! + $plan[$id] = array(); + } + $plan[$id][] = $metric; + unset($metricsToResolve[$index]); + } else { + if (!isset($plan[$metric->getDbTableName()])) { + $plan[$metric->getDbTableName()] = array(); + } + + // we try to put all metrics that go on same table in one run + $plan[$metric->getDbTableName()][] = $metric; + } + } + + return $plan; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Archiver/NotJoinableException.php b/files/plugin-CustomReports-5.4.3/Archiver/NotJoinableException.php new file mode 100644 index 0000000..bbe7b9f --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Archiver/NotJoinableException.php @@ -0,0 +1,21 @@ +reportQuery = StaticContainer::getContainer()->make('Piwik\Plugins\CustomReports\Archiver\ReportQuery'); + $this->configuration = $configuration; + + $this->rankingQuery = new RankingQuery(50000); + if (version_compare(Version::VERSION, '3.12.0-b2', '<')) { + $this->rankingQuery->setOthersLabel(DataTable::LABEL_SUMMARY_ROW); + } + + $this->logTablesProvider = StaticContainer::get('Piwik\Plugin\LogTablesProvider'); + + $this->logAggregator = $logAggregator; + $this->parameters = $parameters; + Piwik::postEvent('Plugin.shouldLowerCampaignCase', [$pluginName = 'CustomReports', &$this->shouldLowerCampaignCase]); + } + + public function isValid() + { + $selects = $this->reportQuery->getSelect(); + return !empty($selects) && $this->hasMetric; + } + + public function addDimension($dimension, $useRightJoin = false) + { + if (!$dimension instanceof Dimension) { + return; + } + + $join = $dimension->getDbColumnJoin(); + $dbTable = $dimension->getDbTableName(); + $dbColumn = $dimension->getColumnName(); + + $dbDiscriminator = $dimension->getDbDiscriminator(); + + // if other ways to join the table are defined (and it's joinable to visit or action) + // ensure to add log_visit/log_action first, otherwise it might fail when a custom table is added first + $logTable = $this->logTablesProvider->getLogTable($dbTable); + $tables = new JoinTables($this->logTablesProvider, [$dbTable]); + + if ( + !$logTable->getColumnToJoinOnIdVisit() && !$logTable->getColumnToJoinOnIdAction() && + !$logTable->getLinkTableToBeAbleToJoinOnVisit() && $logTable->getWaysToJoinToOtherLogTables() + ) { + if ($tables->isTableJoinableOnVisit($dbTable)) { + $this->reportQuery->addFrom('log_visit'); + } + if ($tables->isTableJoinableOnAction($dbTable)) { + $this->reportQuery->addFrom('log_action'); + } + } + + // Special handling for ActionType dimension + if ($dimension instanceof ActionType) { + if (!$this->reportQuery->hasFrom('log_link_visit_action')) { + $this->reportQuery->addFrom('log_link_visit_action'); + } + if (!$this->reportQuery->hasFrom('log_visit')) { + $this->reportQuery->addFrom('log_visit'); + } + } + + if ($useRightJoin) { + $tableArray = [ + 'table' => $dbTable, + 'join' => 'RIGHT JOIN', + ]; + $this->reportQuery->addFrom($tableArray); + } else { + $this->rankingQuery->addLabelColumn($dimension->getId()); + $this->reportQuery->addFrom($dbTable); + } + + if ($dbTable && $dbColumn) { + if (!empty($join)) { + $tableAlias = $join->getTable() . '_' . $dbColumn; + + + $this->reportQuery->addFrom([ + 'table' => $join->getTable(), + 'tableAlias' => $tableAlias, + 'joinOn' => $dbTable . '.' . $dbColumn . ' = ' . $tableAlias . '.' . $join->getColumn() . + $this->addExtraJoinConditions($join, $tableAlias) + ]); + + if (!$useRightJoin) { + $tableColumn = $tableAlias . '.' . $join->getTargetColumn(); + $this->reportQuery->addSelect($tableColumn . " AS '" . $dimension->getId() . "'"); + $this->reportQuery->addGroupBy($tableColumn); + + // prevent "XYZ not defined" + // we cannot do something like " and $tableColumn != ''" as it could break dimension like visitor type + $this->reportQuery->addWhere($tableColumn . ' is not null'); + } + + if ($dbDiscriminator && $dbDiscriminator->isValid()) { + // we make sure discriminator is valid and has only allowed values to prevent injections + + $dbDiscriminatorTable = $dbDiscriminator->getTable(); + + // table might be joined under an alias + $actualTableName = $this->reportQuery->getFromAlias($dbDiscriminatorTable); + + if ($dbDiscriminatorTable === $join->getTable()) { + $actualTableName = $tableAlias; // we need to make sure to apply the where condition on this joined table + } elseif (empty($actualTableName)) { + // not joined yet + $actualTableName = $dbDiscriminatorTable; + $this->reportQuery->addFrom($dbDiscriminatorTable); + } + + // we support for now only numeric values because we cannot use bind here as it would not be possible to position bind correctly + $this->reportQuery->addWhere(($actualTableName === $join->getTable() ? $tableAlias : $actualTableName) . '.' . $dbDiscriminator->getColumn() . ' = "' . $dbDiscriminator->getValue() . '"'); + } + } else { + if (!$useRightJoin) { + if ($dimension->getSegmentName() === 'regionCode') { + $this->reportQuery->addSelect("CONCAT(log_visit.location_region, '|', log_visit.location_country) AS '" . $dimension->getId() . "'"); + $this->reportQuery->addGroupBy($dimension->getSqlSegment()); + $this->reportQuery->addGroupBy('log_visit.location_country'); + } else { + $select = $dimension->getSqlSegment(); + if ($this->shouldLowerCampaignCase && stripos($dimension->getSegmentName(), 'campaign') === 0) { + $select = 'LOWER(' . $select . ')'; + } + $this->reportQuery->addSelect($select . " AS '" . $dimension->getId() . "'"); + $this->reportQuery->addGroupBy($dimension->getSqlSegment()); + } + } + + if ($dbDiscriminator) { + $dbDiscriminatorTable = $dbDiscriminator->getTable(); + + if ($dbDiscriminator->isValid()) { + // we make sure discriminator is valid and has only allowed values to prevent injections + + // table might be joined under an alias + $actualTableName = $this->reportQuery->getFromAlias($dbDiscriminatorTable); + if (empty($actualTableName)) { + // not joined yet + $actualTableName = $dbDiscriminatorTable; + $this->reportQuery->addFrom($dbDiscriminatorTable); + } + + // we support for now only numeric values because we cannot use bind here as it would not be possible to position bind correctly + $where = $actualTableName . '.' . $dbDiscriminator->getColumn() . ' = "' . $dbDiscriminator->getValue() . '"'; + + $this->reportQuery->addWhere($where); + } + } + + if (!$useRightJoin) { + $tableColumn = $dimension->getDbTableName() . '.' . $dimension->getColumnName(); + if ($tableColumn === $dimension->getSqlSegment() && $dimension->getSegmentName() !== 'regionCode') { + // when the segment goes on the sql segment, we do not fetch any values with NULL otherwise we often see "XYZ is not defined" + // we cannot do something like " and $tableColumn != ''" as it could break dimension like visitor type + $this->reportQuery->addWhere($tableColumn . ' is not null'); + } + } + } + } + } + + private function addExtraJoinConditions(Join $join, $tableAlias) + { + if ($join->getTable() === 'goal') { + $idSites = $this->parameters->getIdSites(); + if (!empty($idSites)) { + $idSites = array_map('intval', $idSites); + $idSites = implode(',', $idSites); + return ' AND ' . $tableAlias . '.idsite IN (' . $idSites . ')'; + } + } + } + + public function addMetric($metric) + { + if (!$metric instanceof ArchivedMetric || !$metric->getDimension() || !$metric->getQuery()) { + return; + } + + $metricName = $metric->getName(); + $dimension = $metric->getDimension(); + + $tableName = $dimension->getDbTableName(); + $dbDiscriminator = $dimension->getDbDiscriminator(); + + $this->reportQuery->addFrom($tableName); + + if ($dbDiscriminator) { + // we need to add a join for this table to make sure to calc correct results when eg a goal metric or action metric is selected (to be able to measure different values for eg clicked urls vs page urls) + $join = $dimension->getDbColumnJoin(); + $dbDiscriminatorValue = $dbDiscriminator->getValue(); + $dbDiscriminatorTable = $dbDiscriminator->getTable(); + + if (!$dbDiscriminator->isValid()) { + // we make sure discriminator is valid and has only allowed values to prevent injections + Log::debug(sprintf('Ignored metric %s because dbDiscriminator does not valid value', $metricName)); + return; + } + + if ($join && $join->getTable() === $dbDiscriminatorTable) { + // we need to use that join only when a discriminator is actually on the joined table, otherwise ignore it as not needed + + $tableAlias = $join->getTable() . '_' . $metricName; + $dbColumn = $dimension->getColumnName(); + $this->reportQuery->addFrom([ + 'table' => $join->getTable(), + 'tableAlias' => $tableAlias, + 'joinOn' => $tableName . '.' . $dbColumn . ' = ' . $tableAlias . '.' . $join->getColumn() . $this->addExtraJoinConditions($join, $tableAlias) + ]); + + // we need to make sure that the query uses the newly joined table and the correct column... + $metricQuery = str_replace($dbColumn, $join->getTargetColumn(), $metric->getQuery()); + $select = str_replace($tableName . '.', $tableAlias . '.', $metricQuery) . " AS '" . $metricName . "'"; + $this->reportQuery->addSelect($select); + $where = $tableAlias . '.' . $dbDiscriminator->getColumn() . ' = "' . $dbDiscriminatorValue . '"'; + $this->reportQuery->addWhere($where); + } elseif ($tableName === $dbDiscriminatorTable || $this->reportQuery->hasFrom($dbDiscriminatorTable)) { + $actualTableName = $this->reportQuery->getFromAlias($dbDiscriminatorTable); + + // we support for now only numeric values because we cannot use bind here as it would not be possible to position bind correctly + $where = $actualTableName . '.' . $dbDiscriminator->getColumn() . ' = "' . $dbDiscriminatorValue . '"'; + $this->reportQuery->addWhere($where); + $this->reportQuery->addSelect($metric->getQuery() . " AS '" . $metricName . "'"); + } elseif ($this->reportQuery->isTableJoinable($dbDiscriminatorTable)) { + $actualTableName = $this->reportQuery->getFromAlias($dbDiscriminatorTable); + + if (empty($actualTableName)) { + $this->reportQuery->addFrom($dbDiscriminatorTable); + $actualTableName = $dbDiscriminatorTable; + } + + // we support for now only numeric values because we cannot use bind here as it would not be possible to position bind correctly + $where = $actualTableName . '.' . $dbDiscriminator->getColumn() . ' = "' . $dbDiscriminatorValue . '"'; + $this->reportQuery->addWhere($where); + $this->reportQuery->addSelect($metric->getQuery() . " AS '" . $metricName . "'"); + } else { + Log::debug(sprintf('Cannot select metric %s because not supported discriminator table?!?', $metricName)); + return; + } + } else { + $this->reportQuery->addSelect($metric->getQuery() . " AS '" . $metricName . "'"); + } + + $this->hasMetric = true; + $this->setMetricGroupBy($tableName, $tableName); + $this->rankingQuery->addColumn($metricName); + $this->reportQuery->setSortBy($metricName); + } + + private function setMetricGroupBy($tableName, $tableAlias) + { + if (empty($this->metricGroupBy)) { + $this->metricGroupBy = str_replace($tableName, $tableAlias, $this->reportQuery->getTableColumnId($tableName)); + } + } + + public function addSegmentFilter($segmentFilter, $idSite) + { + if (empty($segmentFilter)) { + return; + } + + $from = $this->reportQuery->getFrom(); + + $segment = new Segment($segmentFilter, [$idSite]); + $segmentExpression = $segment->getSegmentExpression(); + $segmentExpression->parseSubExpressionsIntoSqlExpressions($from); + $sql = $segmentExpression->getSql(); + + $this->reportQuery->setFrom($from); + $this->reportQuery->addExtraWhere($sql['where']); + $this->reportQuery->addExtraBind($sql['bind']); + } + + public function getOrderBy() + { + return $this->reportQuery->getSortBy(); + } + + public function getReportQuery() + { + return $this->reportQuery; + } + + private function getMaxExecutionTimeMySQLHint() + { + $maxExecutionTime = $this->configuration->getMaxExecutionTime(); + if (Piwik::getAction() == 'previewReport' && Piwik::getModule() == 'CustomReports') { + $maxExecutionTime = Config::getInstance()->General['live_query_max_execution_time']; + } + $maxExecutionTimeHint = ''; + if (is_numeric($maxExecutionTime) && $maxExecutionTime > 0) { + $timeInMs = $maxExecutionTime * 1000; + $timeInMs = (int) $timeInMs; + $maxExecutionTimeHint = ' /*+ MAX_EXECUTION_TIME(' . $timeInMs . ') */ '; + } + return $maxExecutionTimeHint; + } + + public function buildQuery() + { + // needed because we generate the where condition based on this + $this->reportQuery->addFrom('log_visit'); + $condition = $this->logAggregator->getWhereStatement('log_visit', 'visit_last_action_time'); + + // If joining other log tables then if possible add extra default binds to limit the query scope + // These may be removed by LogAggregator later on if deemed unnecessary + $joinConditions = []; + $joinBinds = 0; + $logTablesProvider = StaticContainer::get(LogTablesProvider::class); + foreach ($logTablesProvider->getAllLogTables() as $logTable) { + foreach ($this->reportQuery->getFrom() as $table) { + if (!is_array($table) || !array_key_exists('join', $table) || strtolower($table['join']) != 'right join') { + continue; + } + $tableName = (array_key_exists('tableAlias', $table) ? $table['tableAlias'] : $table['table']); + if ($tableName !== 'log_visit' && $tableName === $logTable->getName()) { + $dateTimeColumn = $logTable->getDateTimeColumn(); + if ($dateTimeColumn) { + $joinConditions[$tableName] = $this->logAggregator->getWhereStatement($tableName, $dateTimeColumn); + $joinBinds++; + } + } + } + } + + $select = $this->reportQuery->getSelect(); + $groupBy = $this->reportQuery->getGroupBy(); + $where = $this->reportQuery->getWhere(); + $from = $this->reportQuery->getFrom(); + $orderBy = $this->reportQuery->getSortBy(); + + foreach ($joinConditions as $joinCondition) { + $condition .= ' AND ' . $joinCondition; + } + + if (!empty($where)) { + $condition .= ' AND (' . $where . ') '; + } + + /** @var \Piwik\DataAccess\LogQueryBuilder $segmentQueryBuilder */ + $segmentQueryBuilder = StaticContainer::getContainer()->make('Piwik\DataAccess\LogQueryBuilder'); + + if ($this->metricGroupBy && !empty($groupBy)) { + // there is no groupBy eg for evolution reports + $segmentQueryBuilder->forceInnerGroupBySubselect($groupBy . ', ' . $this->metricGroupBy); + } + + $defaultBindCount = count($this->logAggregator->getGeneralQueryBindParams()); + + try { + $query = $this->logAggregator->generateQuery($select, $from, $condition, $groupBy, $orderBy); + } catch (\Exception $e) { + $segmentQueryBuilder->forceInnerGroupBySubselect(''); + throw $e; + } + + // Add extra default bind parameters for any right join conditions + $bindCount = $defaultBindCount; + $defaultBinds = $this->logAggregator->getGeneralQueryBindParams(); + for ($i = 0; $i < $joinBinds; $i++) { + $query['bind'] = array_merge($query['bind'], $defaultBinds); + $bindCount += $defaultBindCount; + } + + $segmentQueryBuilder->forceInnerGroupBySubselect(''); + + $select = 'SELECT'; + if (is_array($query) && 0 === strpos(trim($query['sql']), $select)) { + $query['sql'] = trim($query['sql']); + $query['sql'] = 'SELECT /* CustomReports */' . substr($query['sql'], strlen($select)); + } + + $bind = $this->reportQuery->getExtraBind(); + + if (!empty($bind)) { + // we need to add bind parameters from applied "report segment filter" at correct position right after the general + // query parameters but before any Matomo segment. + $newBind = $query['bind']; + array_splice($newBind, $bindCount, 0, $bind); + $bind = $newBind; + } else { + $bind = $query['bind']; + } + + if (!empty($this->rankingQuery->getLabelColumns())) { + // we only do this when there are dimensions, not for evolution graph queries + $query['sql'] = $this->rankingQuery->generateRankingQuery($query['sql']); + } + + $maxExecutionTimeHint = $this->getMaxExecutionTimeMySQLHint(); + if ($maxExecutionTimeHint) { + $query['sql'] = trim($query['sql']); + $pos = stripos($query['sql'], 'SELECT'); + if ($pos !== false) { + $query['sql'] = substr_replace($query['sql'], 'SELECT ' . $maxExecutionTimeHint, $pos, strlen('SELECT')); + } + } + + return [ + 'sql' => $query['sql'], + 'bind' => $bind + ]; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Archiver/ReportQuery.php b/files/plugin-CustomReports-5.4.3/Archiver/ReportQuery.php new file mode 100644 index 0000000..e9e48f1 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Archiver/ReportQuery.php @@ -0,0 +1,284 @@ +logTablesProvider = $logTablesProvider; + } + + public function addSelect($select) + { + $this->selects[] = $select; + } + + public function hasFrom($table) + { + $has = in_array($table, $this->from, $strict = true); + + if ($has) { + return true; + } + + foreach ($this->from as $from) { + if (is_array($from)) { + if (!isset($from['tableAlias']) && $from['table'] === $table) { + return true; + } elseif (isset($from['tableAlias']) && $from['tableAlias'] === $table) { + return true; + } + } + } + + if (is_array($table) && isset($table['table']) && !isset($table['tableAlias'])) { + return $this->hasFrom($table['table']); + } + + if (is_array($table) && isset($table['table']) && isset($table['tableAlias'])) { + return $this->hasFrom($table['tableAlias']); + } + + return false; + } + + public function getFromAlias($table) + { + if (is_array($table) && isset($table['table']) && !isset($table['tableAlias'])) { + // todo... we might only be able to re-use that table if there is no custom "joinOn"... to be tested at some point + return $this->getFromAlias($table['table']); + } + + if (is_array($table) && isset($table['table']) && isset($table['tableAlias'])) { + // todo... we might only be able to re-use that table if there is no custom "joinOn"... to be tested at some point + return $this->getFromAlias($table['tableAlias']); + } + + if (is_string($table) && in_array($table, $this->from, $strict = true)) { + return $table; + } + + foreach ($this->from as $from) { + if (is_array($from)) { + if (!isset($from['tableAlias']) && isset($from['table']) && $from['table'] === $table) { + return $table; + } elseif (isset($from['tableAlias']) && ($from['tableAlias'] === $table || ($from['table'] === $table && !isset($from['joinOn'])))) { + return $from['tableAlias']; + } + } + } + } + + public function addFrom($table) + { + if (!$this->hasFrom($table)) { + if (is_string($table) && !$this->isTableJoinable($table)) { + throw new NotJoinableException("Table $table cannot be joined"); + } + + if (is_array($table) && isset($table['table']) && !isset($table['tableAlias']) && !isset($table['joinOn']) && !$this->isTableJoinable($table['table'])) { + throw new NotJoinableException("Table " . $table['table'] . " cannot be joined"); + } + + // if this table is being *explicitly joined* (ie, is an array instead of just a string table name), core + // Matomo code will not automatically take into account dependent tables when determining join ordering. + // in this case we have to make sure that information is present ourselves. + if (is_array($table) && empty($table['joinOn'])) { + $tableName = $table['table']; + $logTable = $this->logTablesProvider->getLogTable($tableName); + + if ($logTable && !$logTable->getColumnToJoinOnIdVisit()) { + // if there is a preferred "link" table specified, use that one. otherwise we look for the + // first table that is joinable (directly or indirectly) to log_visit. + $preferTable = $logTable->getLinkTableToBeAbleToJoinOnVisit(); + + // if this is not directly joinable to log_visit, look for another way to join it to log_visit + $tables = new JoinTables($this->logTablesProvider, [$tableName]); + foreach ($logTable->getWaysToJoinToOtherLogTables() as $otherLogTable => $column) { + if ( + $preferTable == $otherLogTable + || (!$preferTable && $tables->isTableJoinableOnVisit($otherLogTable)) + ) { + $this->addFrom($otherLogTable); // make sure the other table is present in the from list + break; + } + } + } + } + + $this->from[] = $table; + } + } + + public function addWhere($where) + { + if (!in_array($where, $this->where, $strict = true)) { + // make sure we do not add it twice, happens eg if two metrics have same discriminator + $this->where[] = $where; + } + } + + public function addGroupBy($groupBy) + { + if (!in_array($groupBy, $this->groupBy)) { + $this->groupBy[] = $groupBy; + } + } + + public function setSortBy($sortBy) + { + if (empty($this->sortBy)) { + $this->sortBy = $sortBy; + } + } + + public function addExtraWhere($where) + { + if (empty($this->extraWhere)) { + $this->extraWhere = $where; + } else { + $this->extraWhere = sprintf("( %s ) AND (%s)", $this->extraWhere, $where); + } + } + + public function getExtraBind() + { + return $this->extraBind; + } + + public function addExtraBind($bind) + { + if (empty($this->extraBind)) { + $this->extraBind = $bind; + } else { + foreach ($bind as $val) { + $this->extraBind[] = $val; + } + } + } + + public function getTableColumnId($tableName) + { + $logTable = $this->logTablesProvider->getLogTable($tableName); + + $primaryKey = $logTable->getPrimaryKey(); + + if (count($primaryKey) === 1) { + return '`' . $tableName . '`.`' . array_shift($primaryKey) . '`'; + } + + $glue = "`, '_', `" . $tableName . '`.`'; + return sprintf("CONCAT(`%s`.`%s`)", $tableName, implode($glue, $primaryKey)); + } + + public function isTableJoinable($tableName) + { + try { + $logTable = $this->logTablesProvider->getLogTable($tableName); + $tables = new JoinTables($this->logTablesProvider, [$tableName]); + if ($logTable && ($tables->isTableJoinableOnAction($tableName) || $tables->isTableJoinableOnVisit($tableName))) { + if ($logTable->getPrimaryKey()) { + // without primary key we would not group the data correctly + return true; + } + } + } catch (\Exception $e) { + // intentionally left blank + } + + return false; + } + + public function getSelect() + { + return implode(', ', $this->selects); + } + + public function getFrom() + { + return $this->from; + } + + public function setFrom($from) + { + $this->from = $from; + } + + public function getGroupBy() + { + if (empty($this->groupBy)) { + return false; + } + + return implode(', ', $this->groupBy); + } + + public function getWhere() + { + $where = implode(' AND ', $this->where); + + if (!empty($this->extraWhere) && !empty($where)) { + $where = sprintf("( %s ) AND (%s)", $where, $this->extraWhere); + } elseif (!empty($this->extraWhere)) { + $where = $this->extraWhere; + } + + return $where; + } + + /** + * @return false|string + */ + public function getSortBy() + { + return $this->sortBy; + } +} diff --git a/files/plugin-CustomReports-5.4.3/CHANGELOG.md b/files/plugin-CustomReports-5.4.3/CHANGELOG.md new file mode 100644 index 0000000..c88875b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/CHANGELOG.md @@ -0,0 +1,315 @@ +## Changelog + +5.4.3 - 2025-07-21 +- Stopped filtering empty values for regionCode dimension + +5.4.2 - 2025-06-09 +- Added custom_reports_max_dimensions config setting if not present in config.ini.php + +5.4.1 - 2025-05-15 +- Fixed array reference error + +5.4.0 - 2025-05-12 +- Added the ability to use more than 3 dimensions +- No longer show Insights visualization option when it's not available + +5.3.4 - 2025-04-15 +- Made preview report timeframes as a config value + +5.3.3 - 2025-03-17 +- Improved preview report performance to limit by timeframe + +5.3.2 - 2025-03-03 +- Added new `getNthLevelTableDimension` method to support new Matomo core changes +- Added query validation check before add, update or preview of report + +5.3.1 - 2025-02-17 +- Improved paused state message + +5.3.0 - 2025-02-03 +- Added code to pause/resume a custom report + +5.2.3 - 2025-01-20 +- Fixes add and update report not working when rearchive_reports_in_past_last_n_months & custom_reports_rearchive_reports_in_past_last_n_months config is set as 0 + +5.2.2 - 2025-01-15 +- Lower campaign values based on a event to honor keep campaign parameter capitalisation setting + +5.2.1 - 2025-01-06 +- Added code to allow admins to add/edit multiple websites if access to all websites in a report + +5.2.0 - 2024-12-09 +- Added option to assign multiple idSites to a single report +- Added action type dimension +- Updated region dimension query to group by country and show region name instead of region code + +5.1.1 - 2024-12-02 +- Added region and action type dimension + +5.1.0 - 2024-11-18 +- Added an option to sort subcategory reports + +5.0.19 - 2024-11-05 +- Updated README.md + +5.0.18 - 2024-10-21 +- Added config for setting custom reports historical archiving period + +5.0.17 - 2024-09-26 +- Added some new metrics specifically for this plugin: + - Average Product Quantity + - Average Product Price + - Product Revenue (Total & avg) + - Total Click Outlinks (Clicked Outlinks) + - Content Impressions + - Content Interactions + - Content Interaction Rate + - Product Category (Dimension) + +5.0.16 - 2024-08-26 +- Pricing updated + +5.0.15 +- Improved validation for dimensions being added to look for allowed dimensions + +5.0.14 +- Added cover image for marketplace + +5.0.13 +- Fixed error when changing number of rows in evolution report + +5.0.12 +- Added a fix to show 2nd dimension when 3rd dimension has no data + +5.0.11 +- Added missing translations for glossary + +5.0.10 +- Improved performance for reports that use dimensions accessed by a visit action via right join + +5.0.9 +- Updated README.md + +5.0.8 +- Fixed evolution graph refresh issue after metric selection + +5.0.7 +- Fixed regression in archiving when a new report is created + +5.0.6 +- Changes to hide the delete button when user doesn't have permission to delete report + +5.0.5 +- Fix archiving error due to labels not defined +- Added code to allow creating report with same name. + +5.0.4 +- Fixed error when no metric to sort available in getMetricToSortMultiPeriod() + +5.0.3 +- Fixed warnings during archive process + +5.0.2 +- Fixed undefined key notice during previewReport + +5.0.1 +- Compatibility with Matomo 5.0.0-b4 + +5.0.0 +- Compatibility with Matomo 5 + +4.1.7 +- Fixes regression from previous version where Insights wouldn't load + +4.1.6 +- Fixes issue where report view preferences do not persist + +4.1.5 +- Fixes for PHP 8.1 + +4.1.4 +- Fix report links not maintaining the selected date and/or segment + +4.1.3 +- Fix possible XSS if segment definition contains valid angularjs syntax + +4.1.2 +- Fixed Unsupported operand error for preview report. + +4.1.1 +- Fixed Unsupported operand error due to wrong dimension selection for subtable, #PG-1329 + +4.1.0 +- Migrate AngularJS code to Vue. + +4.0.15 +- Added check to limit live queries for previewReport action if live_query_max_execution_time is set + +4.0.14 +- Fixed sub data table warning +- Fixed code to show maximum of 3 metrics when type evolution graph for email report + +4.0.13 +- Changed dimension name to UTC time for Server Time dimensions + +4.0.12 +- Started supporting 3 dimensions in preview report + +4.0.11 +- Fixed namespace when previewing a report + +4.0.10 +- Started re-archiving only when reportType/dimensionIds/metricIds/segmentFilter are changed +- Show empty datatable for no new rows found to avoid fatal error +- Disabled segmented visitor log got download dimension + +4.0.9 +- Fixed preview report to work even if not metrics provided by other plugins. + +4.0.8 +- Updated README.md to highlight benefit of custom reports and mentioned simpler reports + +4.0.7 +- Add config to aggregate unique metrics instead of raw data for periods specified in config + +4.0.6 +- Fix archiving of unique metrics in evolution graphs for week, month and year periods + +4.0.5 +- Add category help text + +4.0.4 +- Tweak message when editing a custom report and browser archiving is disabled + +4.0.3 +- Add back the archive reports command + +4.0.2 +- Ability to rearchive reports on custom report creation/update + +4.0.1 +- Compatibility with Matomo 4.X + +4.0.0 +- Compatibility with Matomo 4.X + +3.1.27 +- Improve archive command + +3.1.26 +- List dimension IDs in glossary + +3.1.25 +- Add new config setting `custom_reports_disabled_dimensions` to disable dimensions + +3.1.24 +- Ignore new region dimension as it won't work + +3.1.23 +- Fix view link in manage custom reports may not work when report is configured for all websites +- Fix goalId archiving + +3.1.22 +- Fix archiver + +3.1.21 +- Add possibility to set max execution time + +3.1.20 +- Better segment filter check + +3.1.19 +- Apply segment filter in segmented visitor log +- Better support for Matomo 3.12 + +3.1.18 +- Sort aggregated reports before generating the report (week, month, year, range) +- Compatibility with Matomo 3.12 + +3.1.17 +- Add more options to archive command + +3.1.16 +- Support new segmentation in Matomo 3.12 + +3.1.15 +- Compatibility with Matomo 3.12 + +3.1.14 +- Show search box for entities +- Support usage of a reader DB when configured + +3.1.13 +- Enable more dimensions (visitorId, geolocation) + +3.1.12 +- Add more translations +- Make sure a report can be moved to its own page after it was assigned to another page + +3.1.11 +- Add Turkish translation +- Enable Order ID dimension + +3.1.10 +- Improve report generation for some combination of dimensions + +3.1.9 +- Fix report preview unter circumstances doesn't show column names when no report is configured yet + +3.1.8 +- Add config setting to always show unique visitors in all periods + +3.1.7 +- Improve handling of unique visitors and users + +3.1.6 +- Use correct category names +- Calculate unique visitors and users from raw data for periods != day if enabled in config in evolution graphs when only these metrics are used + +3.1.5 +- Support more languages +- Added command to archive reports in past + +3.1.4 +- Support new languages +- Use new brand colors +- Ensure segment definition is shown correctly + +3.1.3 +- Fix possible combination with event name and event value may not return a result + +3.1.2 +- Add dimensions and metrics information to glossary +- Support new "Write" role + +3.1.1 +- Make sure pie and bar graphs show available columns + +3.1.0 +- Support [Roll-Up Reporting](https://plugins.matomo.org/RollUpReporting). Create custom reports across multiple sites. + +3.0.6 +- Prevent possible fatal error when opening manage screen for all websites +- New config setting `custom_reports_validate_report_content_all_websites` which, when enabled under the `[CustomReports]` section, allows the creation of Custom Reports on "All websites", even those that contain "Custom dimensions" or other entities which may not be present on all websites. This is useful when you have many (or all) websites with the exact same dimensions Ids and/or Goals Ids across all websites. + + +3.0.5 +- Renamed Piwik to Matomo + +3.0.4 +- Prevent possible error when putting a custom report to another custom report page + +3.0.3 +- Prevent possible problems with custom dimensions in custom reports when also using roll-ups. + +3.0.2 +- Added German translation +- When generating report data and data needs to be truncated, make sure to sort the data by the first column of the report +- Make number of rows within a datatable configurable +- Make sure aggregated reports are truncated if needed + +3.0.1 +- Make sure custom reports category can be always selected when creating a new custom report + +3.0.0 +- Custom Reports for Piwik 3 diff --git a/files/plugin-CustomReports-5.4.3/Categories/CustomReportsCategory.php b/files/plugin-CustomReports-5.4.3/Categories/CustomReportsCategory.php new file mode 100644 index 0000000..434fbd7 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Categories/CustomReportsCategory.php @@ -0,0 +1,27 @@ +' . Piwik::translate('CustomReports_ManageReportsSubcategoryHelp') . '

'; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Columns/CustomMetricHelper.php b/files/plugin-CustomReports-5.4.3/Columns/CustomMetricHelper.php new file mode 100644 index 0000000..df93df7 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Columns/CustomMetricHelper.php @@ -0,0 +1,112 @@ +addCustomMetricsToList($metrics); + + return $metrics; + } + + public function addCustomMetricsToList(MetricsList $metricsList) + { + if (Manager::getInstance()->isPluginActivated('Actions')) { + $dimensionMetricFactory = new DimensionMetricFactory(new \Piwik\Plugins\Actions\Columns\ClickedUrl()); + $metric1 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_COUNT); + $metricsList->addMetric($metric1); + } + + if (Manager::getInstance()->isPluginActivated('Contents')) { + $contentInteractionDimension = new \Piwik\Plugins\Contents\Columns\ContentInteraction(); + $dimensionMetricFactory = new DimensionMetricFactory($contentInteractionDimension); + $metric2 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_COUNT); + $metricsList->addMetric($metric2); + + // This is necessary to make sure that the result set isn't restricted to only rows with a value + // This also makes sure that the metric name is correct + $impressionDimension = new class () extends \Piwik\Plugins\Contents\Columns\ContentInteraction { + protected $nameSingular = 'Contents_ContentImpression'; + protected $namePlural = 'CustomReports_ContentImpressions'; + + public function getDbDiscriminator() + { + return null; + } + }; + $dimensionMetricFactory = new DimensionMetricFactory($impressionDimension); + $contentImporessionsTranslation = Piwik::translate('CustomReports_ContentImpressions'); + $metric3 = $dimensionMetricFactory->createCustomMetric('nb_content_impressions', $contentImporessionsTranslation, 'sum(case when %s IS NOT NULL then 0 else 1 end)'); + $metric3->setDocumentation(Piwik::translate('General_ComputedMetricCountDocumentation', $contentImporessionsTranslation)); + $metricsList->addMetric($metric3); + + $dimensionMetricFactory = new DimensionMetricFactory($contentInteractionDimension); + $metric4 = $dimensionMetricFactory->createComputedMetric($metric2->getName(), $metric3->getName(), ComputedMetric::AGGREGATION_RATE); + $metric4->setName($contentInteractionDimension->getMetricId() . '_' . ComputedMetric::AGGREGATION_RATE); + $metric4->setTranslatedName(Piwik::translate('General_ComputedMetricRate', $contentInteractionDimension->getName())); + $metricsList->addMetric($metric4); + } + + if (!Manager::getInstance()->isPluginActivated('Ecommerce')) { + return; + } + + $this->buildProductDimensionMetrics($metricsList, new \Piwik\Plugins\Ecommerce\Columns\ProductPrice(), 'General_Price'); + $this->buildProductDimensionMetrics($metricsList, new \Piwik\Plugins\Ecommerce\Columns\ProductQuantity(), 'General_Quantity'); + } + + protected function buildProductDimensionMetrics(MetricsList $metricsList, Dimension $dimension, string $baseProductSingular) + { + $dimensionMetricFactory = new DimensionMetricFactory($dimension); + + $metric1 = $dimensionMetricFactory->createMetric(ArchivedMetric::AGGREGATION_COUNT_WITH_NUMERIC_VALUE); + $metric1->setName('conversion_items_with_' . $dimension->getMetricId()); + $metric1->setTranslatedName(Piwik::translate('CustomReports_ProductsWithX', Piwik::translate($baseProductSingular))); + $metricsList->addMetric($metric1); + + $metric2 = $dimensionMetricFactory->createComputedMetric('sum_' . $dimension->getMetricId(), $metric1->getName(), ComputedMetric::AGGREGATION_AVG); + $metric2->setName(ComputedMetric::AGGREGATION_AVG . '_' . $dimension->getMetricId()); + $metric2->setTranslatedName(Piwik::translate('General_AverageX', $dimension->getName())); + $metricsList->addMetric($metric2); + + if ($dimension->getMetricId() === 'ecommerce_productprice') { + $productRevenueTranslation = Piwik::translate('General_ProductRevenue'); + $translatedName = Piwik::translate('General_ComputedMetricSum', $productRevenueTranslation); + $metric3 = $dimensionMetricFactory->createCustomMetric('sum_product_revenue', $translatedName, 'sum(case when %s > 0 then `price` * `quantity` else 0 end)'); + $metric3->setDocumentation(Piwik::translate('General_ComputedMetricSumDocumentation', $productRevenueTranslation)); + $metricsList->addMetric($metric3); + + $metric4 = $dimensionMetricFactory->createComputedMetric($metric3->getName(), 'conversion_items_with_ecommerce_productprice', ComputedMetric::AGGREGATION_AVG); + $metric4->setName('avg_product_revenue'); + $metric4->setTranslatedName(Piwik::translate('General_AverageX', $productRevenueTranslation)); + $productWithPriceTranslation = Piwik::translate('CustomReports_ProductsWithX', Piwik::translate('General_Price')); + $metric4->setDocumentation(Piwik::translate('General_ComputedMetricAverageDocumentation', [$productRevenueTranslation, $productWithPriceTranslation])); + $metricsList->addMetric($metric4); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Columns/ProductCategory.php b/files/plugin-CustomReports-5.4.3/Columns/ProductCategory.php new file mode 100644 index 0000000..3ced25e --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Columns/ProductCategory.php @@ -0,0 +1,33 @@ +setName('customreports:archive'); + $this->setDescription('Let\'s you trigger custom reports archiving for given site and date range'); + $this->addRequiredValueOption('idsites', null, 'The ids of the sites you want to archive custom reports for', 'all'); + $this->addRequiredValueOption('date', null, 'The date or date range you want to archive custom reports for'); + $this->addRequiredValueOption('idreport', null, 'If set, only a specific report will be archived'); + $this->addNoValueOption('disable-segments', null, 'Disables archiving of pre-archived segments'); + $this->addRequiredValueOption('periods', null, 'Specify which periods should be archived. A comma separated list will archive multiple periods', 'all'); + $this->addRequiredValueOption( + 'segment', + null, + 'List of segments to invalidate report data for. This can be the segment string itself, the segment name from the UI or the ID of the segment.' + . ' If specifying the segment definition, make sure it is encoded properly (it should be the same as the segment parameter in the URL.', + null + ); + } + + public function isEnabled() + { + // Archives can't be overwritten in Matomo before 3.0.3 + return version_compare(Version::VERSION, '3.0.3', '>='); + } + + /** + * @return int + */ + protected function doExecute(): int + { + $input = $this->getInput(); + $output = $this->getOutput(); + $idSites = Site::getIdSitesFromIdSitesString($input->getOption('idsites')); + $date = $input->getOption('date'); + $idReport = $input->getOption('idreport'); + $segmentOption = $input->getOption('segment'); + if (!is_array($segmentOption) && !empty($segmentOption)) { + $segmentOption = explode(',', $segmentOption); + } + $segmentOptionValues = !$segmentOption ? [] : array_map('trim', $segmentOption); + $segmentOptionValues = array_unique($segmentOptionValues); + + Period::checkDateFormat($date); + + if (Period::isMultiplePeriod($date, 'day')) { + $period = Period\Factory::build('range', $date); + $datesToComplete = $this->getDaysFromPeriod($period); + } else { + $datesToComplete = [$date]; + } + + $periods = $this->getPeriodsToArchive($datesToComplete, $input->getOption('periods')); + + foreach ($idSites as $idSite) { + $siteName = Site::getNameFor($idSite); + $output->writeln('Starting to archive custom reports for Site ' . $siteName); + + // Check if the report even exists for the site + $reports = StaticContainer::get(CustomReportsModel::class)->getAllCustomReportsForSite($idSite); + $reportIds = count($reports) ? array_column($reports, 'idcustomreport') : []; + if (!empty($idReport) && !in_array($idReport, $reportIds)) { + $output->writeln("Report {$idReport} not found for Site {$siteName}"); + continue; + } + + if ($input->getOption('disable-segments')) { + $segments = ['']; // Only archive data without segments + } elseif (count($segmentOptionValues)) { + $segments = $this->getSegmentsToProcess([$idSite], $segmentOptionValues); // Only archive the specified segments + } else { + $segments = ArchiveProcessor\Rules::getSegmentsToProcess([$idSite]); + array_unshift($segments, ''); // Archive data without segment as well as all segments + } + + foreach ($segments as $segment) { + if ('' !== $segment) { + $output->writeln('Archiving segment ' . $segment); + } + + // Check if the segment is valid before progressing any further + try { + StaticContainer::getContainer()->make(Segment::class, ['segmentCondition' => $segment, 'idSites' => [$idSite]]); + } catch (\Exception $e) { + $errorMsg = $e->getMessage(); + if (strpos($errorMsg, 'is not a supported segment') !== false || preg_match('/The segment condition \'.*\' is not valid\./', $errorMsg)) { + // eg a plugin was uninstalled etc + $output->writeln('The segment is not supported. The associated plugin was likely disabled.'); + continue; + } + throw $e; + } + + $this->initProgressBar(count($periods)); + + $periodsNotArchived = []; + foreach ($periods as $period) { + if (!$this->archiveCustomReports($idSite, $period, $reports, $segment, $idReport)) { + $periodsNotArchived[] = $period instanceof Day ? $period->toString() : $period->getRangeString(); + } + $this->advanceProgressBar(); + } + + $this->finishProgressBar(); + $output->writeln(''); + + if (!empty($periodsNotArchived)) { + $output->writeln('Archiving has been skipped for following periods, as a full archiving has not yet been done: "' . implode('", "', $periodsNotArchived) . '"'); + } + } + } + + return self::SUCCESS; + } + + /** + * @param Period $period + * @return array + */ + protected function getDaysFromPeriod(Period $period) + { + $dates = []; + + if ($period instanceof Day) { + return [$period->getDateStart()->toString()]; + } + + $subperiods = $period->getSubperiods(); + + foreach ($subperiods as $subperiod) { + if ($subperiod instanceof Day) { + if ($subperiod->getDateStart()->isLater(Date::today())) { + continue; // discard days in the future + } + $dates[] = $subperiod->getDateStart()->toString(); + } else { + $dates = array_merge($dates, $this->getDaysFromPeriod($subperiod)); + } + } + + return $dates; + } + + /** + * @param array $dates + * @return Period[] + */ + protected function getPeriodsToArchive($dates, $periods) + { + $days = $weeks = $months = $years = []; + + sort($dates); + + if (empty($periods) || $periods === 'all') { + $periods = array('day', 'week', 'month', 'year'); + } else { + $periods = Common::mb_strtolower($periods); + $periods = explode(',', $periods); + } + + foreach ($dates as $date) { + $date = Date::factory($date); + if (in_array('day', $periods)) { + $day = new Day($date); + $days[$day->toString()] = $day; + } + if (in_array('week', $periods)) { + $week = new Period\Week($date); + $weeks[$week->getRangeString()] = $week; + } + if (in_array('month', $periods)) { + $month = new Period\Month($date); + $months[$month->getRangeString()] = $month; + } + if (in_array('year', $periods)) { + $year = new Period\Year($date); + $years[$year->getRangeString()] = $year; + } + } + + return $days + $weeks + $months + $years; + } + + /** + * Runs the Archiving for CustomReports plugin if an archive for the given period already exists + * + * @param int $idSite + * @param \Piwik\Period $period + * @return bool + * @throws \Piwik\Exception\UnexpectedWebsiteFoundException + */ + protected function archiveCustomReports($idSite, $period, array $reports, $segmentCondition = '', $idReport = null) + { + $_GET['idSite'] = $idSite; + + $parameters = new Parameters(new Site($idSite), $period, new Segment($segmentCondition, [$idSite])); + $parameters->setRequestedPlugin('CustomReports'); + + $result = ArchiveSelector::getArchiveIdAndVisits($parameters, $period->getDateStart()->getDateStartUTC(), false); + $idArchive = $result ? array_shift($result) : null; + + if (empty($idArchive)) { + return false; // ignore periods if full archiving hadn't run before + } + + if (is_array($idArchive)) { + // there might now be multiple archives + $idArchive = array_shift($idArchive); + } + + $archiveWriter = new ArchiveWriter($parameters); + $archiveWriter->idArchive = $idArchive; + + $logAggregator = new LogAggregator($parameters); + if (method_exists($logAggregator, 'allowUsageSegmentCache')) { + $logAggregator->allowUsageSegmentCache(); + } + $archiveProcessor = new ArchiveProcessor($parameters, $archiveWriter, $logAggregator); + + $archiveProcessor->setNumberOfVisits(1, 1); + + foreach ($reports as $report) { + if ($idReport && isset($report['idcustomreport']) && $report['idcustomreport'] != $idReport) { + continue; + } + + $recordBuilder = StaticContainer::getContainer()->make(CustomReport::class, ['report' => $report]); + + if ($period instanceof Day) { + $recordBuilder->buildFromLogs($archiveProcessor); + } else { + $recordBuilder->buildForNonDayPeriod($archiveProcessor); + } + + $recordBuilder->finalize($archiveProcessor); + + DataTableManager::getInstance()->deleteAll(); + } + + return true; + } + + /** + * @param array $idSites + * @param array $segmentOptionValues + * + * @return array + */ + protected function getSegmentsToProcess(array $idSites, array $segmentOptionValues): array + { + $result = []; + + foreach ($segmentOptionValues as $segmentOptionValue) { + $segmentDefinition = $this->findSegment($segmentOptionValue, $idSites); + + if (empty($segmentDefinition)) { + continue; + } + + $result[] = $segmentDefinition; + } + + return $result; + } + + /** + * Find a segment based on ID, name, or definition. + * + * This method was copied from plugins/CoreAdminHome/Commands/InvalidateReportData.php + * + * @param array $idSites + */ + private function findSegment(string $segmentOptionValue, array $idSites) + { + $logger = StaticContainer::get(LoggerInterface::class); + $allSegments = $this->getAllSegments($idSites); + + foreach ($allSegments as $segment) { + if ( + !empty($segment['enable_only_idsite']) + && !in_array($segment['enable_only_idsite'], $idSites) + ) { + continue; + } + + if ($segmentOptionValue == $segment['idsegment']) { + $logger->debug("Matching '$segmentOptionValue' by idsegment with segment {segment}.", ['segment' => json_encode($segment)]); + return $segment['definition']; + } + + if (strtolower($segmentOptionValue) == strtolower($segment['name'])) { + $logger->debug("Matching '$segmentOptionValue' by name with segment {segment}.", ['segment' => json_encode($segment)]); + return $segment['definition']; + } + + if ( + $segment['definition'] == $segmentOptionValue + || $segment['definition'] == urldecode($segmentOptionValue) + ) { + $logger->debug("Matching '{value}' by definition with segment {segment}.", ['value' => $segmentOptionValue, 'segment' => json_encode($segment)]); + return $segment['definition']; + } + } + + $logger->warning("'$segmentOptionValue' did not match any stored segment, but invalidating it anyway."); + return $segmentOptionValue; + } + + /** + * Get all the segments applicable to a specific collection of sites. + * + * This method was copied from plugins/CoreAdminHome/Commands/InvalidateReportData.php + * + * @param array $idSites + * + * @return array + */ + private function getAllSegments(array $idSites): array + { + $segmentsByDefinition = []; + + if ([] === $idSites) { + $idSites = [false]; + } + + foreach ($idSites as $idSite) { + // Check if we've looked up the segments for this site before making the API call. + $siteSegments = $this->segmentsBySite[$idSite] ?? []; + if (empty($siteSegments)) { + $siteSegments = API::getInstance()->getAll($idSite); + $this->segmentsBySite[$idSite] = $siteSegments; + } + + $siteSegmentsByDefinition = array_combine( + array_column($siteSegments, 'definition'), + $siteSegments + ); + + $segmentsByDefinition = array_merge( + $segmentsByDefinition, + $siteSegmentsByDefinition + ); + } + + return array_values($segmentsByDefinition); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Commands/GenerateReports.php b/files/plugin-CustomReports-5.4.3/Commands/GenerateReports.php new file mode 100644 index 0000000..cc0c980 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Commands/GenerateReports.php @@ -0,0 +1,95 @@ +setName('customreports:generate-reports'); + $this->setDescription('GenerateReports'); + $this->addRequiredValueOption('idsite', null, 'The id of the site you want to add custom reports to', '1'); + } + + public function isEnabled() + { + return Development::isEnabled(); + } + + /** + * @return int + */ + protected function doExecute(): int + { + $input = $this->getInput(); + $idsite = $input->getOption('idsite'); + + if (empty($idsite) || !is_numeric($idsite)) { + throw new InvalidArgumentException('The idSite must be set and numeric'); + } + + $idsite = (int) $idsite; + + if (!$this->confirmChange($idsite)) { + $this->getOutput()->writeln('Not created any report'); + return self::FAILURE; + } + + $usedNames = []; + $dimensions = API::getInstance()->getAvailableDimensions(1); + foreach ($dimensions as $dimension) { + foreach ($dimension['dimensions'] as $dim) { + $name = $dim['name']; + if (in_array($name, $usedNames)) { + $name = $dimension['category'] . ' ' . $name; + } + $usedNames[] = $name; + + API::getInstance()->addCustomReport(1, $name, Table::ID, ['nb_uniq_visitors'], false, [$dim['uniqueId']]); + } + } + + $metrics = API::getInstance()->getAvailableMetrics(1); + $allMetr = array(); + foreach ($metrics as $metric) { + foreach ($metric['metrics'] as $met) { + $allMetr[] = $met['uniqueId']; + } + } + + API::getInstance()->addCustomReport(1, 'visit all metrics', Table::ID, $allMetr, false, ["DevicesDetection.BrowserName"]); + API::getInstance()->addCustomReport(1, 'action all metrics', Table::ID, $allMetr, false, ["Actions.PageUrl"]); + API::getInstance()->addCustomReport(1, 'media all metrics', Table::ID, $allMetr, false, ["MediaAnalytics.MediaLength"]); + API::getInstance()->addCustomReport(1, 'conversion all metrics', Table::ID, $allMetr, false, ["Goals.Revenue"]); + + return self::SUCCESS; + } + + private function confirmChange($idsite): bool + { + return $this->askForConfirmation( + 'Are you sure you want to generate lots of custom reports for idSite ' . $idsite . '? (y/N)', + false + ); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Configuration.php b/files/plugin-CustomReports-5.4.3/Configuration.php new file mode 100644 index 0000000..c659060 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Configuration.php @@ -0,0 +1,361 @@ +getConfig(); + + $reports = $config->CustomReports; + if (empty($reports)) { + $reports = array(); + } + + // we make sure to set a value only if none has been configured yet, eg in common config. + if (empty($reports[self::KEY_VALIDATE_REPORT_CONTENT_ALL_WEBSITES])) { + $reports[self::KEY_VALIDATE_REPORT_CONTENT_ALL_WEBSITES] = self::DEFAULT_VALIDATE_REPORT_CONTENT_ALL_WEBSITES; + } + if (empty($reports[self::KEY_ALWAYS_SHOW_UNIQUE_VISITORS])) { + $reports[self::KEY_ALWAYS_SHOW_UNIQUE_VISITORS] = self::DEFAULT_ALWAYS_SHOW_UNIQUE_VISITORS; + } + if (empty($reports[self::KEY_MAX_EXECUTION_TIME])) { + $reports[self::KEY_MAX_EXECUTION_TIME] = self::DEFAULT_MAX_EXECUTION_TIME; + } + if (empty($reports[self::KEY_DISABLED_DIMENSIONS])) { + $reports[self::KEY_DISABLED_DIMENSIONS] = self::DEFAULT_DISABLED_DIMENSIONS; + } + if (empty($reports[self::KEY_EVOLUTION_UNIQUE_FORCE_AGGREGATION])) { + $reports[self::KEY_EVOLUTION_UNIQUE_FORCE_AGGREGATION] = self::DEFAULT_EVOLUTION_UNIQUE_FORCE_AGGREGATION; + } + if (empty($reports[self::KEY_MAX_DIMENSIONS])) { + $reports[self::KEY_MAX_DIMENSIONS] = self::DEFAULT_MAX_DIMENSIONS; + } + if (empty($reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT])) { + $reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT] = self::DEFAULT_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT; + } + if (empty($reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT])) { + $reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT] = self::DEFAULT_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT; + } + for ($i = 1; $i <= $reports[self::KEY_MAX_DIMENSIONS]; $i++) { + if (empty($reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $i])) { + $reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $i] = $reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT]; + $reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . $i] = $reports[self::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT]; + } + } + if (empty($reports[self::KEY_PREVIEW_REPORT_ITERATIONS])) { + $reports[self::KEY_PREVIEW_REPORT_ITERATIONS] = self::DEFAULT_PREVIEW_REPORT_ITERATIONS; + } + if (empty($reports[self::KEY_PREVIEW_REPORT_MIN_ROWS_REQUIRED])) { + $reports[self::KEY_PREVIEW_REPORT_MIN_ROWS_REQUIRED] = self::DEFAULT_PREVIEW_REPORT_MIN_ROWS_REQUIRED; + } + + $config->CustomReports = $reports; + + $config->forceSave(); + } + + public function uninstall() + { + $config = $this->getConfig(); + $config->CustomReports = array(); + $config->forceSave(); + } + + /** + * @return array + */ + public function getDisabledDimensions() + { + $value = $this->getConfigValue(self::KEY_DISABLED_DIMENSIONS, self::KEY_DISABLED_DIMENSIONS); + if (is_string($value)) { + $value = trim($value); + } + + if (empty($value) || !is_string($value)) { + return array(); + } + $values = explode(',', $value); + $values = array_map('trim', $values); + + return $values; + } + + /** + * @return int + */ + public function getMaxExecutionTime() + { + $value = $this->getConfigValue(self::KEY_MAX_EXECUTION_TIME, self::DEFAULT_MAX_EXECUTION_TIME); + + if ($value === false || $value === '' || $value === null || !is_numeric($value)) { + $value = self::DEFAULT_MAX_EXECUTION_TIME; + } + + return (int) $value; + } + + /** + * For some periods we may want to rather aggregate unique metrics from reports rather than raw data as it can be quite + * resource intensive to aggregate the data from raw data. It's not used in GetCustomReport::supportsUniqueMetric() + * because then the metric might disappear in the report vs in this case if it is mentioned here we just want to + * change how it is calculated. Can reduce load on DB quite a bit. + * @param string $periodLabel + * @return bool + */ + public function forceAggregateUniqueMetricsFromReportsInsteadOfRawDataInEvolutionReport($periodLabel) + { + $value = $this->getConfigValue(self::KEY_EVOLUTION_UNIQUE_FORCE_AGGREGATION, self::DEFAULT_EVOLUTION_UNIQUE_FORCE_AGGREGATION); + + if (empty($value)) { + return false; + } + + $periodsToSkip = explode(',', $value); + $periodsToSkip = array_map('trim', $periodsToSkip); + $periodsToSkip = array_map('strtolower', $periodsToSkip); + $periodLabel = strtolower($periodLabel); + + return in_array($periodLabel, $periodsToSkip); + } + + /** + * @param int $noOfDimensions + * @return int + */ + public function getArchiveMaxRowsInMainTable(?int $noOfDimensions = 3): int + { + $defaultValue = $this->getArchiveMaxRowsDefault(); + $value = $this->getConfigValue(self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $noOfDimensions, $defaultValue); + + if ($value === false || $value === '' || $value === null) { + $value = $defaultValue; + } + + return (int) $value; + } + + /** + * @param int $noOfDimensions + * @return int + */ + public function getArchiveMaxRowsInSubTable(?int $noOfDimensions = 3): int + { + $defaultValue = $this->getArchiveMaxRowsSubTableDefault(); + $value = $this->getConfigValue(self::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . $noOfDimensions, $defaultValue); + + if ($value === false || $value === '' || $value === null) { + $value = $defaultValue; + } + + return (int) $value; + } + + /** + * @return int + */ + public function getArchiveMaxRowsDefault() + { + $value = $this->getConfigValue(self::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT, self::DEFAULT_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT); + + if ($value === false || $value === '' || $value === null) { + $value = self::DEFAULT_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT; + } + + return (int) $value; + } + + /** + * @return int + */ + public function getArchiveMaxRowsSubTableDefault() + { + $value = $this->getConfigValue(self::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT, self::DEFAULT_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT); + + if ($value === false || $value === '' || $value === null) { + $value = self::DEFAULT_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT; + } + + return (int) $value; + } + + /** + * @return int + */ + public function shouldAlwaysShowUniqueVisitors() + { + $value = $this->getConfigValue(self::KEY_ALWAYS_SHOW_UNIQUE_VISITORS, self::DEFAULT_ALWAYS_SHOW_UNIQUE_VISITORS); + + if ($value === false || $value === '' || $value === null) { + $value = self::DEFAULT_ALWAYS_SHOW_UNIQUE_VISITORS; + } + + return !empty($value); + } + + /** + * @return int + */ + public function shouldValidateReportContentWhenAllSites() + { + $value = $this->getConfigValue(self::KEY_VALIDATE_REPORT_CONTENT_ALL_WEBSITES, self::DEFAULT_VALIDATE_REPORT_CONTENT_ALL_WEBSITES); + + if ($value === false || $value === '' || $value === null) { + $value = self::DEFAULT_VALIDATE_REPORT_CONTENT_ALL_WEBSITES; + } + + return (bool) $value; + } + + /** + * @return int|string|null + */ + public function getReArchiveReportsInPastLastNMonths() + { + $config = $this->getConfig(); + $reArchiveLastN = null; + if (isset($config->CustomReports[self::KEY_REARCHIVE_REPORTS_IN_PAST_LAST_N_MONTHS])) { + $reArchiveLastN = $config->CustomReports[self::KEY_REARCHIVE_REPORTS_IN_PAST_LAST_N_MONTHS]; + } elseif (isset($config->General['rearchive_reports_in_past_last_n_months'])) { + $reArchiveLastN = $config->General['rearchive_reports_in_past_last_n_months']; + } + + if (!is_null($reArchiveLastN) && !is_numeric($reArchiveLastN)) { + $reArchiveLastN = (int)str_replace('last', '', $reArchiveLastN); + } + + if ($reArchiveLastN < 0) { + $reArchiveLastN = null; + } + + return $reArchiveLastN; + } + + /** + * @return array + */ + public function getPreviewReportIterations() + { + $config = $this->getConfig(); + $iterations = !empty($config->CustomReports[self::KEY_PREVIEW_REPORT_ITERATIONS]) ? $config->CustomReports[self::KEY_PREVIEW_REPORT_ITERATIONS] : self::DEFAULT_PREVIEW_REPORT_ITERATIONS; + $minimumRowsRequired = $this->getPreviewReportMinRowsRequired(); + $iterationValues = explode(',', $iterations); + $allowedIterations = []; + $count = count($iterationValues); + $maxDateAllowed = new \DateTime('-1 day'); + + foreach ($iterationValues as $iterationKey => $iterationValue) { + $iterationValue = trim($iterationValue); + if ($count === ($iterationKey + 1)) { + $minimumRowsRequired = 0; + } + $dateTimeObject = new \DateTime($iterationValue); + + if (empty($iterationValue) || (stripos($iterationValue, 'second') === false && stripos($iterationValue, 'hour') === false && stripos($iterationValue, 'minute') === false && stripos($iterationValue, 'day') === false)) { + throw new \Exception(Piwik::translate('CustomReports_PreviewReportInvalidTimeFrameValues')); + } elseif ($dateTimeObject->getTimestamp() < $maxDateAllowed->getTimestamp()) { + throw new \Exception(Piwik::translate('CustomReports_PreviewReportExceedsMaximumTimeFrameValueAllowed')); + } + + $allowedIterations[] = ['startDate' => $iterationValue, 'minRowsRequired' => $minimumRowsRequired]; + } + + return $allowedIterations; + } + + /** + * @return int + */ + public function getPreviewReportMinRowsRequired() + { + $config = $this->getConfig(); + $minRows = !empty($config->CustomReports[self::KEY_PREVIEW_REPORT_MIN_ROWS_REQUIRED]) ? $config->CustomReports[self::KEY_PREVIEW_REPORT_MIN_ROWS_REQUIRED] : self::DEFAULT_PREVIEW_REPORT_MIN_ROWS_REQUIRED; + + if (empty($minRows) || !is_numeric($minRows) || $minRows < 1) { + $minRows = self::DEFAULT_PREVIEW_REPORT_MIN_ROWS_REQUIRED; + } + + return ((int) $minRows); + } + + /** + * If a valid int value is configured, that will be returned. If not, the setting default will be returned. + * + * @return int + */ + public function getMaxDimensions(): int + { + $config = $this->getConfig(); + if (!isset($config->CustomReports[self::KEY_MAX_DIMENSIONS])) { + return self::DEFAULT_MAX_DIMENSIONS; + } + + $maxDimensions = $config->CustomReports[self::KEY_MAX_DIMENSIONS]; + if ( + empty($maxDimensions) || intval($maxDimensions) < 1 + || (is_string($maxDimensions) && !ctype_digit($maxDimensions)) + ) { + return self::DEFAULT_MAX_DIMENSIONS; + } + + return intval($maxDimensions); + } + + private function getConfig() + { + return Config::getInstance(); + } + + private function getConfigValue($name, $default) + { + $config = $this->getConfig(); + $attribution = $config->CustomReports; + if (isset($attribution[$name])) { + return $attribution[$name]; + } + return $default; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Controller.php b/files/plugin-CustomReports-5.4.3/Controller.php new file mode 100644 index 0000000..954b517 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Controller.php @@ -0,0 +1,366 @@ +validator = $validator; + + parent::__construct(); + } + + /** + * Manage custom reports in the admin area. + * @return string + */ + public function manage() + { + $idSite = Common::getRequestVar('idSite'); + + if (strtolower($idSite) === 'all') { + // prevent fatal error... redirect to a specific site as it is not possible to manage for all sites + $this->validator->checkHasSomeWritePermission(); + $this->redirectToIndex('CustomReports', 'manage'); + exit; + } + + $this->checkSitePermission(); + $this->validator->checkWritePermission($this->idSite); + + $configuration = StaticContainer::get(Configuration::class); + + return $this->renderTemplate('manage', [ + 'browserArchivingDisabled' => !ArchiveProcessor\Rules::isBrowserTriggerEnabled(), + 'reArchiveLastN' => $configuration->getReArchiveReportsInPastLastNMonths(), + 'maxDimensions' => $configuration->getMaxDimensions(), + 'isCloud' => \Piwik\Plugin\Manager::getInstance()->isPluginLoaded('Cloud'), + ]); + } + + /** + * Preview a custom reports report. Only supports table visualization so far. + * @return string + * @throws \Exception + */ + public function previewReport() + { + $this->checkSitePermission(); + $this->validator->checkWritePermission($this->idSite); + + $report = null; + Piwik::postEvent('CustomReports.buildPreviewReport', array(&$report)); + + $date = Common::getRequestVar('date', null, 'string'); + $period = defined('PIWIK_TEST_MODE') && PIWIK_TEST_MODE ? 'day' : 'range'; + $configuration = StaticContainer::get(Configuration::class); + try { + $iterations = $configuration->getPreviewReportIterations(); + } catch (\Exception $e) { + $message = $e->getMessage(); + $view = Factory::build(); + $view->setDataTable(new DataTable()); + $view->config->show_header_message = '
' . $message . '
'; + $view->config->no_data_message = ' '; + return $view->render(); + } + + try { + // only for UI tests + if (StaticContainer::get('test.vars.previewDate')) { + $date = StaticContainer::get('test.vars.previewDate'); + $period = 'day'; + } + } catch (\Exception $e) { + // ignore any possible error + } + // for now we only support day period as weekly or monthly doesn't really work and would take way too long + // so it can also not be misused to fetch not yet archived reports + + $site = new Site($this->idSite); + if ($period === 'day') { + $iterations = [ + ['startDate' => '-1 day', 'minRowsRequired' => 0], + ]; + } + + $startDateObj = null; + $endDateObj = null; + $timezone = $site->getTimezone(); + + foreach ($iterations as $iteration) { + $periodObject = null; + if ($period === 'range') { + // hack for PeriodFactory::build('range'); to work, as it throws an error for same day, our archives are date based i.e 2024-02-01, sending 2 same dates will create an issue + // Since we are sending $startDateObj and $endDateObj, start and end date will be overwritten with the help of CustomLogAggregator for range period + $date = date('Y-m-d', strtotime('-1 day')) . ',' . date('Y-m-d'); + $startDateObj = new \DateTime($iteration['startDate'], new \DateTimeZone($timezone)); + $endDateObj = new \DateTime('now', new \DateTimeZone($timezone)); + } + try { + $dataTable = $this->getReportDataTable($report, $date, $site, $period, $periodObject, $startDateObj, $endDateObj); + } catch (\Exception $e) { + $message = $e->getMessage(); + if (stripos($message, 'be joined for segmentation') !== false) { + $faqLink = Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/custom-reports/how-to-resolve-errors-when-using-different-dimension-combinations-in-matomo/'); + $message = Piwik::translate('CustomReports_NoSegmentationJoinExceptionMessage', ['', '']); + $type = ReportType::factory($report['report_type']); + $view = Factory::build($type->getDefaultViewDataTable(), 'CustomReports.getCustomReport', 'CustomReports.previewReport', true); + $view->setDataTable(new DataTable()); + $view->config->show_header_message = '
' . $message . '
'; + $view->config->no_data_message = ' '; + return $view->render(); + } + + throw $e; + } + + $count = $dataTable->getRowsCount(); + if ($count >= $iteration['minRowsRequired']) { + break; + } + } + + $idSubTable = Request::fromRequest()->getIntegerParameter('idSubtable', 0); + if (!empty($idSubTable)) { + $row = $dataTable->getRowFromIdSubDataTable($idSubTable); + if ($row !== false) { + $dataTable = $row->getSubTable(); + } else { + $searchResult = $this->searchDescendentsForSubtable($dataTable, $idSubTable); + if ($searchResult !== null) { + $dataTable = $searchResult; + } + } + } + + $showFooterMessage = true; + + if ($report['report_type'] === Table::ID) { + $factory = StaticContainer::get('Piwik\Columns\DimensionsProvider'); + if (empty($idSubTable)) { + $dimension = $factory->factory(reset($report['dimensions'])); + } else { + $showFooterMessage = false; // do not show message again for subtables + $firstRow = $dataTable ? $dataTable->getFirstRow() : false; + $level = $firstRow ? $firstRow->getColumn('level') : 0; + if (!empty($level) && !empty($report['dimensions'][$level - 1])) { + $dimension = $factory->factory($report['dimensions'][$level - 1]); + } + } + if (!empty($dimension)) { + $dataTable->filter('Piwik\Plugins\CustomReports\DataTable\Filter\ReportTypeTableFilter', [$this->idSite, $dimension, array()]); + } + } + + $type = ReportType::factory($report['report_type']); + $view = Factory::build($type->getDefaultViewDataTable(), 'CustomReports.getCustomReport', 'CustomReports.previewReport', true); + $view->setDataTable($dataTable); + + $reportInstance = ReportsProvider::factory('CustomReports', 'getCustomReport'); + if (!$reportInstance) { + // user has not configured any custom reports yet, we need to configure manually otherwise it won't work + // because reports are cached + $reportInstance = new GetCustomReport(); + $reportInstance->initCustomReport($report); + + $subtable = $reportInstance->getActionToLoadSubTables(); + if (!empty($subtable)) { + $view->config->subtable_controller_action = $subtable; + } + + $metrics = $reportInstance->getMetrics(); + if (!empty($metrics)) { + $view->config->addTranslations($metrics); + } + + $processedMetrics = $reportInstance->getProcessedMetrics(); + if (!empty($processedMetrics)) { + $view->config->addTranslations($processedMetrics); + } + + $view->config->title = $reportInstance->getName(); + $reportInstance->configureView($view); + } + + // make sure any action will be correctly forwarded + if (property_exists($view->config, 'disable_row_evolution')) { + $view->config->disable_row_evolution = true; + } + $view->config->custom_parameters['module'] = 'CustomReports'; + $view->config->custom_parameters['action'] = 'previewReport'; + $view->config->subtable_controller_action = 'previewReport'; + + if ($showFooterMessage) { + $dateString = $periodObject->getLocalizedLongString(); + if (!empty($startDateObj) && !empty($endDateObj) && $period === 'range') { + $dateString = $startDateObj->format('M d Y h:i:s A T') . ' - ' . $endDateObj->format('M d Y h:i:s A T'); + } + $view->config->show_footer_message = Piwik::translate('CustomReports_PreviewDate', $dateString); + } + + $view->config->show_flatten_table = false; + $view->config->show_pivot_by_subtable = false; + $view->config->show_insights = false; + $view->config->show_pie_chart = false; + $view->config->show_bar_chart = false; + $view->config->show_tag_cloud = false; + $view->config->show_all_views_icons = false; + $view->config->show_search = false; + $view->config->show_title = false; + $view->config->show_limit_control = false; + $view->config->show_export_as_image_icon = false; + $view->config->show_export_as_rss_feed = false; + $view->config->show_export = false; + $view->config->show_pagination_control = false; + $view->config->show_offset_information = false; + $view->requestConfig->filter_limit = 10; + $view->requestConfig->request_parameters_to_modify['report_type'] = $report['report_type']; + $view->requestConfig->request_parameters_to_modify['metrics'] = $report['metrics']; + $view->requestConfig->request_parameters_to_modify['totals'] = 0; + if (!empty($report['dimensions'])) { + $view->requestConfig->request_parameters_to_modify['dimensions'] = $report['dimensions']; + } + + return $view->render(); + } + + private function getReportDataTable(?array $report, string $date, Site $site, string $period, ?string &$periodObject, ?\DateTime $startDateObj, ?\DateTime $endDateObj): DataTable + { + if ($period === 'range') { + $periodObject = PeriodFactory::build('range', $date, $site->getTimezone()); + } else { + $periodObject = PeriodFactory::makePeriodFromQueryParams($site->getTimezone(), $period, $date); + } + $parameters = new ArchiveProcessor\Parameters($site, $periodObject, new Segment('', [$this->idSite])); + $archiveWriter = new ArchiveWriter($parameters); + $logAggregator = new CustomLogAggregator($parameters); + if ($startDateObj && $endDateObj && $period === 'range') { + $logAggregator->setDateStart(Date::factory($startDateObj->getTimestamp())); + $logAggregator->setDateEnd(Date::factory($endDateObj->getTimestamp())); + } + + $processor = new ArchiveProcessor($parameters, $archiveWriter, $logAggregator); + + $dataTable = null; + if (!empty($report)) { + $recordBuilder = new CustomReport($report, StaticContainer::get(DimensionsProvider::class), StaticContainer::get(Configuration::class)); + $dataTables = $recordBuilder->aggregate($processor); + $dataTable = reset($dataTables); + } + + if (!$dataTable) { + throw new \Exception('Invalid report information'); + } + + return $dataTable; + } + + private function searchDescendentsForSubtable(DataTable $dataTable, int $idSubtable): ?DataTable + { + foreach ($dataTable->getRows() as $row) { + $subTable = $row->getSubtable(); + if ($subTable) { + $row = $subTable->getRowFromIdSubDataTable($idSubtable); + if ($row) { + return $row->getSubtable(); + } + + // Recursively search further descendents + $searchResult = $this->searchDescendentsForSubtable($subTable, $idSubtable); + if ($searchResult !== null) { + return $searchResult; + } + } + } + + return null; + } + + /** + * Renders an evolution graph visualization. + * @return string|void + */ + public function getEvolutionGraph() + { + $this->checkSitePermission(); + $this->validator->checkReportViewPermission($this->idSite); + + if (empty($columns)) { + $columns = Common::getRequestVar('columns', false); + if (false !== $columns) { + $columns = Piwik::getArrayFromApiParameter($columns); + } + } + + $report = new GetCustomReport(); + $documentation = $report->getDocumentation(); + + $selectableColumns = array_keys($report->getMetrics()); + + if (empty($columns) && !empty($selectableColumns) && count($selectableColumns) <= 4) { + // pre-select all columns when there are only 4 columns + $columns = $selectableColumns; + } elseif (empty($columns) && !empty($selectableColumns)) { + // pre-select only first column when there are more than 5 columns + $columns = array(reset($selectableColumns)); + } + + // Use getCustomReport as the controller action so that the apiMethod and currentControllerAction match + // This is important so that the stored viewDataTableParameters values for the report are used + $view = $this->getLastUnitGraphAcrossPlugins( + $this->pluginName, + 'getCustomReport', + $columns, + $selectableColumns, + $documentation, + 'CustomReports.getCustomReport' + ); + + if (empty($view->config->columns_to_display) && $report->getDefaultSortColumn()) { + $view->config->columns_to_display = array($report->getDefaultSortColumn()); + } + + return $this->renderView($view); + } +} diff --git a/files/plugin-CustomReports-5.4.3/CustomLogAggregator.php b/files/plugin-CustomReports-5.4.3/CustomLogAggregator.php new file mode 100644 index 0000000..4d06495 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/CustomLogAggregator.php @@ -0,0 +1,32 @@ +dateStart = $dateStart; + } + + public function setDateEnd($dateEnd) + { + $this->dateEnd = $dateEnd; + } +} diff --git a/files/plugin-CustomReports-5.4.3/CustomReports.php b/files/plugin-CustomReports-5.4.3/CustomReports.php new file mode 100644 index 0000000..84aa45d --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/CustomReports.php @@ -0,0 +1,425 @@ + 'getStylesheetFiles', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'Report.addReports' => 'addCustomReports', + 'SitesManager.deleteSite.end' => 'onDeleteSite', + 'System.addSystemSummaryItems' => 'addSystemSummaryItems', + 'Category.addSubcategories' => 'addSubcategories', + 'CustomReports.buildPreviewReport' => 'buildPreviewReport', + 'API.addGlossaryItems' => 'addGlossaryItems', + 'API.getPagesComparisonsDisabledFor' => 'getPagesComparisonsDisabledFor', + 'Db.getTablesInstalled' => 'getTablesInstalled', + 'ScheduledReports.processReports' => 'processReports', + 'Archiver.addRecordBuilders' => 'addRecordBuilders', + 'Metric.addMetrics' => 'addMetrics', + ); + } + + public function addMetrics(MetricsList $metricsList) + { + StaticContainer::get(CustomMetricHelper::class)->addCustomMetricsToList($metricsList); + } + + public function addRecordBuilders(array &$recordBuilders): void + { + $idSite = \Piwik\Request::fromRequest()->getIntegerParameter('idSite', 0); + if (!$idSite) { + return; + } + + $reports = StaticContainer::get(CustomReportsModel::class)->getAllCustomReportsForSite($idSite); + foreach ($reports as $report) { + if ($report['status'] === CustomReportsModel::STATUS_ACTIVE) { + $recordBuilders[] = StaticContainer::getContainer()->make(CustomReport::class, ['report' => $report]); + } + } + } + + /** + * Register the new tables, so Matomo knows about them. + * + * @param array $allTablesInstalled + */ + public function getTablesInstalled(&$allTablesInstalled) + { + $allTablesInstalled[] = Common::prefixTable('custom_reports'); + } + + public function getPagesComparisonsDisabledFor(&$pages) + { + $pages[] = 'CustomReports_CustomReports.CustomReports_ManageReports'; + } + + public function buildPreviewReport(&$report) + { + $dimensions = Common::getRequestVar('dimensions', '', 'string'); + $metrics = Common::getRequestVar('metrics', '', 'string'); + $idSite = Common::getRequestVar('idSite', 0, 'string'); + if (empty($metrics)) { + // not for this plugin + return; + } + + if (!empty($dimensions)) { + $dimensions = array_unique(explode(',', $dimensions)); + $dimensionsCheck = new Dimensions($dimensions, $idSite); + $dimensionsCheck->check(); + } else { + $dimensions = array(); + } + + $metrics = array_unique(explode(',', $metrics)); + $metricsCheck = new Metrics($metrics, $idSite); + $metricsCheck->check(); + + $reportType = Common::getRequestVar('report_type', null, 'string'); + $segment = Request::getRawSegmentFromRequest(); + + $type = new ReportType($reportType); + $type->check(); + + $report = array( + 'idcustomreport' => 0, + 'report_type' => $reportType, + 'dimensions' => $dimensions, + 'metrics' => $metrics, + 'segment_filter' => $segment, + 'category' => array('id' => CustomReportsDao::DEFAULT_CATEGORY, + 'name' => Piwik::translate(CustomReportsDao::DEFAULT_CATEGORY), + 'order' => 999, + 'icon' => ''), + 'subcategory' => null, + 'name' => Piwik::translate('CustomReports_Preview'), + 'description' => null, + 'created_date' => Date::now()->getDatetime(), + 'updated_date' => Date::now()->getDatetime(), + 'revision' => 0, + ); + } + + public function addSystemSummaryItems(&$systemSummary) + { + $dao = $this->getDao(); + $numForms = $dao->getNumReportsTotal(); + + $systemSummary[] = new SystemSummary\Item($key = 'customreports', Piwik::translate('CustomReports_NCustomReports', $numForms), $value = null, array('module' => 'CustomReports', 'action' => 'manage'), self::MENU_ICON, $order = 8); + } + + public function install() + { + $dao = new CustomReportsDao(); + $dao->install(); + + $config = new Configuration(); + $config->install(); + } + + public function uninstall() + { + $dao = new CustomReportsDao(); + $dao->uninstall(); + + $config = new Configuration(); + $config->uninstall(); + } + + private function getModel() + { + return StaticContainer::get('Piwik\Plugins\CustomReports\Model\CustomReportsModel'); + } + + private function getDao() + { + return StaticContainer::get('Piwik\Plugins\CustomReports\Dao\CustomReportsDao'); + } + + public function onDeleteSite($idSite) + { + $model = $this->getModel(); + $model->deactivateReportsForSite($idSite); + } + + public function addCustomReports(&$instances) + { + $idSite = Common::getRequestVar('idSite', 0, 'int'); + + if (empty($idSite) || $idSite < 1) { + // fallback for eg API.getReportMetadata which uses idSites + $idSite = Common::getRequestVar('idSites', 0, 'int'); + + if (empty($idSite) || $idSite < 1) { + return; + } + } + + $reports = $this->getConfiguredReports($idSite); + + foreach ($reports as $report) { + $instance = new GetCustomReport(); + $instance->initCustomReport($report); + $instances[] = $instance; + } + } + + public function addSubcategories(&$subcategories) + { + $idSite = Common::getRequestVar('idSite', 0, 'int'); + + if (empty($idSite)) { + // fallback for eg API.getReportMetadata which uses idSites + $idSite = Common::getRequestVar('idSites', 0, 'int'); + + if (empty($idSite)) { + return; + } + } + + $reports = $this->getConfiguredReports($idSite, $skipCategoryMetadata = true); // skipping metadata since it will lead to infinite recursion + usort($reports, function ($a, $b) { + return strcasecmp($a['name'], $b['name']); + }); + + $addedNames = array(); + $addedCategories = array(); + + $order = 100; + + foreach ($reports as $report) { + if (!empty($report['category']) && $report['category'] === CustomReportsDao::DEFAULT_CATEGORY) { + // we presume this subcategory is added by different plugin. + if (!empty($report['subcategory']) && $report['idcustomreport'] != $report['subcategory']) { + // will be added with another custom report entry. Happens when assigning a custom report to another custom report page + continue; + } + + $subcategoryName = $report['name']; + $subcategoryId = $report['idcustomreport']; + $lowerName = strtolower($subcategoryName); + + if (in_array($lowerName, $addedNames)) { + continue; // this may happen when two custom reports exist where one has eg name "My report" and the other + // custom report chooses the same subcategory "My report" + } + + if (in_array($subcategoryId, $addedCategories)) { + continue; // this may happen when two custom reports exist where one has eg name "My report" and the other + // custom report chooses the same subcategory "My report" + } + + $addedNames[] = $lowerName; + $addedCategories[] = $subcategoryId; + + $subcategory = new Subcategory(); + $subcategory->setName($subcategoryName); + $subcategory->setCategoryId($report['category']); + $subcategory->setId($subcategoryId); + $subcategory->setOrder($order++); + $subcategories[] = $subcategory; + } + } + } + + public function getStylesheetFiles(&$stylesheets) + { + $stylesheets[] = "plugins/CustomReports/vue/src/Reports/Edit.less"; + $stylesheets[] = "plugins/CustomReports/vue/src/Reports/List.less"; + } + + public function getClientSideTranslationKeys(&$result) + { + $result[] = 'General_Actions'; + $result[] = 'General_Name'; + $result[] = 'General_Id'; + $result[] = 'General_Yes'; + $result[] = 'General_No'; + $result[] = 'General_LoadingData'; + $result[] = 'General_Description'; + $result[] = 'General_Cancel'; + $result[] = 'General_Website'; + $result[] = 'General_Metrics'; + $result[] = 'General_Metric'; + $result[] = 'General_Search'; + $result[] = 'CoreUpdater_UpdateTitle'; + $result[] = 'CustomReports_AddMetric'; + $result[] = 'CustomReports_Type'; + $result[] = 'CustomReports_Category'; + $result[] = 'CustomReports_AddDimension'; + $result[] = 'CustomReports_ReportPage'; + $result[] = 'CustomReports_ReportCategory'; + $result[] = 'CustomReports_ReportCategoryHelp'; + $result[] = 'CustomReports_ReportSubcategory'; + $result[] = 'CustomReports_ReportSubcategoryHelp'; + $result[] = 'CustomReports_ReportType'; + $result[] = 'CustomReports_Dimensions'; + $result[] = 'CustomReports_PreviewReport'; + $result[] = 'CustomReports_Preview'; + $result[] = 'CustomReports_Filter'; + $result[] = 'CustomReports_WarningRequiresUnlock'; + $result[] = 'CustomReports_Unlock'; + $result[] = 'CustomReports_ConfirmUnlockReport'; + $result[] = 'CustomReports_WarningOnUpdateReportMightGetLost'; + $result[] = 'CustomReports_InfoReportIsLocked'; + $result[] = 'CustomReports_ReportContent'; + $result[] = 'CustomReports_AvailableAllWebsites'; + $result[] = 'CustomReports_ErrorMissingMetric'; + $result[] = 'CustomReports_ErrorMissingDimension'; + $result[] = 'CustomReports_ReportEditNotAllowedAllWebsitesUpdated'; + $result[] = 'CustomReports_RemoveMetric'; + $result[] = 'CustomReports_RemoveDimension'; + $result[] = 'CustomReports_ReportAvailableToAllWebsites'; + $result[] = 'CustomReports_ApplyTo'; + $result[] = 'CustomReports_ViewReportInfo'; + $result[] = 'CustomReports_CustomReportIntroduction'; + $result[] = 'CustomReports_NoCustomReportsFound'; + $result[] = 'CustomReports_ManageReports'; + $result[] = 'CustomReports_EditReport'; + $result[] = 'CustomReports_DeleteReportConfirm'; + $result[] = 'CustomReports_DeleteReportInfo'; + $result[] = 'CustomReports_CreateNewReport'; + $result[] = 'CustomReports_ErrorXNotProvided'; + $result[] = 'CustomReports_ReportCreated'; + $result[] = 'CustomReports_ReportUpdated'; + $result[] = 'CustomReports_UpdatingData'; + $result[] = 'CustomReports_FieldNamePlaceholder'; + $result[] = 'CustomReports_FieldDescriptionPlaceholder'; + $result[] = 'CustomReports_ReportNameHelp'; + $result[] = 'CustomReports_ReportDescriptionHelp'; + $result[] = 'CustomReports_ReportAllWebsitesHelp'; + $result[] = 'CustomReports_ReportDimensionsHelpNew'; + $result[] = 'CustomReports_ReportMetricsHelp'; + $result[] = 'CustomReports_ReportSegmentHelp'; + $result[] = 'CustomReports_WarningOnUpdateReportMightGetLostBrowserArchivingDisabled'; + $result[] = 'CustomReports_ConfirmUnlockReportBrowserArchivingDisabled'; + $result[] = 'CustomReports_WarningRequiresUnlockBrowserArchivingDisabled'; + $result[] = 'CustomReports_InfoReportIsLockedBrowserArchivingDisabled'; + $result[] = 'CustomReports_Dimension'; + $result[] = 'CustomReports_WarningProductRevenueMetricDependency'; + $result[] = 'CustomReports_OrderSubCategoryReports'; + $result[] = 'CustomReports_OrderSubCategoryReportsDescription'; + $result[] = 'CustomReports_WarningRegionDimensionDependency'; + $result[] = 'CustomReports_SelectMeasurablesMatchingSearch'; + $result[] = 'CustomReports_FindMeasurables'; + $result[] = 'CustomReports_ReportEditNotAllowedMultipleWebsitesAccessIssue'; + $result[] = 'CustomReports_ReportAvailableToMultipleWebsites'; + $result[] = 'CustomReports_NoMeasurableAssignedYet'; + $result[] = 'CustomReports_MatchingSearchNotFound'; + $result[] = 'CustomReports_MatchingSearchConfirmTitle'; + $result[] = 'CustomReports_MatchingSearchConfirmTitleAlreadyAdded'; + $result[] = 'CustomReports_MatchingSearchMatchedAdd'; + $result[] = 'CustomReports_MatchingSearchMatchedAlreadyAdded'; + $result[] = 'CustomReports_ReportAllWebsitesNonSuperUserHelp'; + $result[] = 'CustomReports_PauseReportInfo'; + $result[] = 'CustomReports_ResumeReportInfo'; + $result[] = 'CustomReports_PauseReportConfirm'; + $result[] = 'CustomReports_ResumeReportConfirm'; + $result[] = 'CustomReports_ResumedReport'; + $result[] = 'CustomReports_PausedReport'; + $result[] = 'CustomReports_ReportInPausedStateAdmin'; + $result[] = 'CustomReports_NoDataMessagePausedStateNonAdminUser'; + $result[] = 'CustomReports_ReportDimensionsHelpExtended'; + } + + public function addGlossaryItems(&$glossaryItems) + { + /** @var Glossary $glossary */ + $glossary = StaticContainer::get(Glossary::class); + $glossaryItems['CustomReports'] = [ + 'title' => Piwik::translate('CustomReports_CustomReports'), + 'entries' => $glossary->getMetricsAndDimensions(), + ]; + } + + private function getConfiguredReports($idSite, $skipCategoryMetadata = false) + { + return Request::processRequest('CustomReports.getConfiguredReports', [ + 'idSite' => $idSite, + 'skipCategoryMetadata' => $skipCategoryMetadata ? '1' : '0', + 'filter_limit' => '-1', + ], $default = []); + } + + public function processReports(&$processedReports, $reportType, $outputType, $report) + { + foreach ($processedReports as &$processedReport) { + $metadata = &$processedReport['metadata']; + if ( + !empty($metadata['module']) && + $metadata['module'] === 'CustomReports' && + !empty($metadata['metrics']) && + count($metadata['metrics']) > 1 + ) { + //we limit the columns to show only first 3 metrics as too many metrics will break the graph + $columns = implode(',', array_slice(array_keys($metadata['metrics']), 0, 3)); + $metadata['imageGraphUrl'] .= '&columns=' . $columns; + $metadata['imageGraphEvolutionUrl'] .= '&columns=' . $columns; + } + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Dao/CustomReportsDao.php b/files/plugin-CustomReports-5.4.3/Dao/CustomReportsDao.php new file mode 100644 index 0000000..0cb683b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Dao/CustomReportsDao.php @@ -0,0 +1,388 @@ +tablePrefixed = Common::prefixTable($this->table); + } + + private function getDb() + { + return Db::get(); + } + + public function install() + { + // revision is there to indirectly "invalidate" an existing archive for that custom report. + // revision is appended to the archive record name and when revision changes, it will notice that no archive + // exists yet and need to re-archive reports for it + DbHelper::createTable($this->table, " + `idcustomreport` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `idsite` int(11) NOT NULL, + `revision` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0, + `report_type` VARCHAR(10) NOT NULL DEFAULT '" . Table::ID . "', + `name` VARCHAR(" . Name::MAX_LENGTH . ") NOT NULL, + `description` VARCHAR(" . Description::MAX_LENGTH . ") NOT NULL DEFAULT '', + `category` VARCHAR(" . Category::MAX_LENGTH . ") NOT NULL DEFAULT '" . self::DEFAULT_CATEGORY . "', + `subcategory` VARCHAR(" . Subcategory::MAX_LENGTH . ") NOT NULL DEFAULT '', + `subcategory_order` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 9999999, + `dimensions` TEXT NOT NULL, + `metrics` TEXT NOT NULL, + `segment_filter` TEXT NOT NULL DEFAULT '', + `created_date` DATETIME NOT NULL, + `updated_date` DATETIME NOT NULL, + `status` VARCHAR(10) NOT NULL DEFAULT '" . CustomReportsModel::STATUS_ACTIVE . "', + `multiple_idsites` VARCHAR(2000), + PRIMARY KEY (`idcustomreport`), + UNIQUE unique_site_name (`idsite`, `name`)"); + } + + public function uninstall() + { + Db::query(sprintf('DROP TABLE IF EXISTS `%s`', $this->tablePrefixed)); + } + + public function addCustomReport($idSite, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, $status, $createdDate, $multipleIdSites) + { + $columns = array( + 'idsite' => $idSite, + 'name' => $name, + 'description' => $description, + 'report_type' => $reportType, + 'dimensions' => $dimensions, + 'metrics' => $metrics, + 'segment_filter' => $segmentFilter, + 'subcategory' => $subcategoryId, + 'category' => $categoryId, + 'status' => $status, + 'created_date' => $createdDate, + 'updated_date' => $createdDate, + 'multiple_idsites' => '' + ); + + if ($multipleIdSites) { + $columns['idsite'] = -1; + $columns['multiple_idsites'] = implode(',', $multipleIdSites); + } + + $columns = $this->encodeFieldsWhereNeeded($columns); + + $bind = array_values($columns); + $placeholder = Common::getSqlStringFieldsArray($columns); + + $sql = sprintf( + 'INSERT INTO %s (`%s`) VALUES(%s)', + $this->tablePrefixed, + implode('`,`', array_keys($columns)), + $placeholder + ); + + $db = $this->getDb(); + + try { + $db->query($sql, $bind); + } catch (Exception $e) { + if ( + $e->getCode() == 23000 + || strpos($e->getMessage(), 'Duplicate entry') !== false + || strpos($e->getMessage(), ' 1062 ') !== false + ) { + throw new Exception(Piwik::translate('CustomReports_ErrorReportNameDuplicate')); + } + throw $e; + } + + $idCustomReport = $db->lastInsertId(); + + return (int) $idCustomReport; + } + + public function updateColumns($idSite, $idCustomReport, $columns) + { + $columns = $this->encodeFieldsWhereNeeded($columns); + + if (!empty($columns)) { + if (!isset($columns['updated_date'])) { + $columns['updated_date'] = $this->getCurrentTime(); + } + + $fields = array(); + $bind = array(); + foreach ($columns as $key => $value) { + $fields[] = ' ' . $key . ' = ?'; + $bind[] = $value; + } + $fields = implode(',', $fields); + + $query = sprintf('UPDATE %s SET %s WHERE idcustomreport = ? AND (idsite = ? or idsite = -1)', $this->tablePrefixed, $fields); + $bind[] = (int) $idCustomReport; + $bind[] = (int) $idSite; + + // we do not use $db->update() here as this method is as well used in Tracker mode and the tracker DB does not + // support "->update()". Therefore we use the query method where we know it works with tracker and regular DB + $this->getDb()->query($query, $bind); + } + } + + /** + * @return int + */ + public function getNumReportsTotal() + { + $sql = sprintf("SELECT COUNT(*) as numreports FROM %s WHERE `status` = ? or `status` = ?", $this->tablePrefixed); + return $this->getDb()->fetchOne($sql, array(CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED)); + } + + /** + * @param int $idSite + * @param int $idCustomReport + */ + public function deleteCustomReport($idSite, $idCustomReport) + { + $query = sprintf('DELETE FROM %s WHERE (idsite = ? or idsite = 0) and idcustomreport = ?', $this->tablePrefixed); + $db = $this->getDb(); + $db->query($query, array($idSite, $idCustomReport)); + } + + /** + * @param int $idSite + */ + public function deleteCustomReports($idSite) + { + $query = sprintf('DELETE FROM %s WHERE (idsite = ? or idsite = 0) and (status = ? or `status` = ?)', $this->tablePrefixed); + $db = $this->getDb(); + $db->query($query, array($idSite, CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED)); + } + + /** + * @param int $idSite + * @return array + */ + public function getCustomReports($idSite) + { + $query = sprintf('SELECT * FROM %s WHERE (idsite = ? or idsite = 0 or idsite = -1) and (status = ? or status = ?)', $this->tablePrefixed); + $db = $this->getDb(); + $rows = $db->fetchAll($query, array($idSite, CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED)); + + return $this->enrichRecords($rows, $idSite); + } + + /** + * @return array + */ + public function getAllReports() + { + $table = $this->tablePrefixed; + $reports = $this->getDb()->fetchAll("SELECT * FROM $table"); + return $this->enrichRecords($reports, 'all'); + } + + /** + * @param int $idSite + * @param int $idCustomReport + * @return array|bool + */ + public function getCustomReport($idSite, $idCustomReport) + { + $query = sprintf('SELECT * FROM %s WHERE (idsite = ? or idsite = 0 or idsite = -1) and idcustomreport = ? and (status = ? or status = ?) LIMIT 1', $this->tablePrefixed); + $db = $this->getDb(); + $row = $db->fetchRow($query, array($idSite, $idCustomReport, CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED)); + + return $this->enrichRecord($row, $idSite); + } + + public function getChildReports(int $idSite, int $idCustomReport): array + { + $query = sprintf('SELECT idcustomreport, name, subcategory_order FROM %s WHERE (idsite = ? or idsite = 0) and subcategory = ? and (status = ? or status = ?) order by subcategory_order ASC', $this->tablePrefixed); + $db = $this->getDb(); + + return $db->fetchAll($query, array($idSite, $idCustomReport, CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED)); + } + + /** + * @param int $idCustomReport + * @return array|bool + */ + public function getCustomReportById($idCustomReport, $idSite) + { + $query = sprintf('SELECT * FROM %s WHERE idcustomreport = ? and (status = ? or status = ?) LIMIT 1', $this->tablePrefixed); + $db = $this->getDb(); + $row = $db->fetchRow($query, array($idCustomReport, CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED)); + + return $this->enrichRecord($row, $idSite); + } + + public function updateReportOrder($idCustomReport, $subCategoryOrder, $idSite) + { + $bind = []; + $query = sprintf('UPDATE %s SET subcategory_order = ? WHERE idcustomreport = ? AND idsite = ?', $this->tablePrefixed); + $bind[] = (int) $subCategoryOrder; + $bind[] = (int) $idCustomReport; + $bind[] = (int) $idSite; + + // we do not use $db->update() here as this method is as well used in Tracker mode and the tracker DB does not + // support "->update()". Therefore we use the query method where we know it works with tracker and regular DB + $this->getDb()->query($query, $bind); + } + + public function getReportIds(array $idCustomReports): array + { + $idCustomReportsFilteredValues = $this->filterNonNumericValues($idCustomReports); + if (empty($idCustomReportsFilteredValues)) { + return []; + } + $query = sprintf('SELECT idcustomreport FROM %s WHERE idcustomreport in(' . implode(',', $idCustomReportsFilteredValues) . ') and (status = ? or status = ?)', $this->tablePrefixed); + + return $this->getDb()->fetchAll( + $query, + array(CustomReportsModel::STATUS_ACTIVE, CustomReportsModel::STATUS_PAUSED) + ); + } + + private function enrichRecords($records, $idSite) + { + if (empty($records)) { + return $records; + } + + $data = array(); + + foreach ($records as $record) { + if ($idSite === 'all' && !empty($record['multiple_idsites'])) { + $multipleIdSites = $record['multiple_idsites'] ? explode(',', $record['multiple_idsites']) : []; + foreach ($multipleIdSites as $multipleIdSite) { + $record['idsite'] = $multipleIdSite; + $data[] = $this->enrichRecord($record, $multipleIdSite); + } + } elseif ($record['idsite'] == -1) { + $multipleIdSites = $record['multiple_idsites'] ? explode(',', $record['multiple_idsites']) : []; + if (!in_array($idSite, $multipleIdSites)) { + continue; + } + $record['idsite'] = $idSite; + $data[] = $this->enrichRecord($record, $idSite); + } else { + $data[] = $this->enrichRecord($record, $record['idsite']); + } + } + + return $data; + } + + private function enrichRecord($record, $idSite) + { + if (empty($record)) { + return $record; + } + if ($record['idsite'] == -1) { + $multipleIdSites = $record['multiple_idsites'] ? explode(',', $record['multiple_idsites']) : []; + if ($idSite != -1 && !in_array($idSite, $multipleIdSites) && $idSite !== 'all' && $idSite != '0') { + return []; + } + $record['idsite'] = $idSite; + } + + $record['idcustomreport'] = (int) $record['idcustomreport']; + $record['idsite'] = (int) $record['idsite']; + $record['revision'] = (int) $record['revision']; + $record['dimensions'] = $this->decodeField($record['dimensions']); + $record['metrics'] = $this->decodeField($record['metrics']); + $record['multiple_idsites'] = $record['multiple_idsites']; + + if (!empty($record['created_date']) && strpos($record['created_date'], '0000') !== false) { + $record['created_date'] = null; + } + + if (!empty($record['updated_date']) && strpos($record['updated_date'], '0000') !== false) { + $record['updated_date'] = null; + } + + if (empty($record['category'])) { + $record['category'] = self::DEFAULT_CATEGORY; + } + + return $record; + } + + private function encodeFieldsWhereNeeded($columns) + { + foreach ($columns as $column => $value) { + if (in_array($column, array('dimensions', 'metrics'))) { + $columns[$column] = $this->encodeField($value); + } + } + + return $columns; + } + + private function encodeField($field) + { + if (empty($field) || !is_array($field)) { + $field = array(); + } + + return json_encode($field); + } + + private function decodeField($field) + { + if (!empty($field)) { + $field = @json_decode($field, true); + } + + if (empty($field) || !is_array($field)) { + $field = array(); + } + + return $field; + } + + protected function getCurrentTime() + { + return Date::now()->getDatetime(); + } + + private function filterNonNumericValues(array $values): array + { + // allow only int values + return array_filter($values, function ($value) { + + return (is_int($value) || (is_string($value) && ctype_digit($value))); + }); + } +} diff --git a/files/plugin-CustomReports-5.4.3/DataTable/Filter/ReportTypeTableFilter.php b/files/plugin-CustomReports-5.4.3/DataTable/Filter/ReportTypeTableFilter.php new file mode 100644 index 0000000..17e117c --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/DataTable/Filter/ReportTypeTableFilter.php @@ -0,0 +1,106 @@ +dimension = $dimension; + $this->dimensions = $nestedDimensions; + $this->idSite = $idSite; + $this->isFlat = $flat; + } + + /** + * @param DataTable $table + */ + public function filter($table) + { + $this->renameRowDimension($table, $this->dimension, $this->dimensions); + $table->setLabelsHaveChanged(); + } + + /** + * @param DataTable $table + * @param Dimension $dimension + * @param Dimension[] $dimension + */ + private function renameRowDimension($table, $dimension, $dimensions) + { + if (!$dimension) { + return; + } + + $formatter = new Formatter(); + + $nextDimension = null; + if (!empty($dimensions)) { + $nextDimension = array_shift($dimensions); + } + + foreach ($table->getRowsWithoutSummaryRow() as $row) { + $label = $row->getColumn('label'); + if ($label === Archiver::LABEL_NOT_DEFINED) { + $label = Piwik::translate('General_NotDefined', $dimension->getName()); + if ($dimension->getSegmentName() === 'regionCode') { + $label = $dimension->getName() . ' ' . Piwik::translate('General_Unknown'); + } + } elseif ($dimension->getSegmentName() === 'regionCode') { + $label = !empty($label) ? $label : Piwik::translate('General_Unknown'); + $explodedValues = explode('|', $label); + if (count($explodedValues) == 2) { + $regionCode = $explodedValues[0]; + $countryCode = $explodedValues[1]; + $label = $regionCode . ', ' . $countryCode; + if (\Piwik\Plugin\Manager::getInstance()->isPluginActivated('UserCountry')) { + $label = \Piwik\Plugins\UserCountry\getRegionNameFromCodes($countryCode, $regionCode) . ', ' . \Piwik\Plugins\UserCountry\countryTranslate($countryCode); + $logo = \Piwik\Plugins\UserCountry\getFlagFromCode($countryCode); + if ($logo && !$this->isFlat) { + $row->setMetadata('logo', $logo); + } + } + } + } else { + $label = $dimension->formatValue($label, $this->idSite, $formatter); + } + + $row->setColumn('label', $label); + + $subtable = $row->getSubtable(); + if ($subtable) { + $this->renameRowDimension($subtable, $nextDimension, $dimensions); + } + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/GetCustomReport.php b/files/plugin-CustomReports-5.4.3/GetCustomReport.php new file mode 100644 index 0000000..89f17b2 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/GetCustomReport.php @@ -0,0 +1,522 @@ +module = 'CustomReports'; + $this->action = 'getCustomReport'; + $this->order = 99; + + $this->actionToLoadSubTables = $this->action; + $request = Request::fromRequest(); + + $idSite = $request->getIntegerParameter('idSite', 0); + $idCustomReport = $request->getIntegerParameter('idCustomReport', 0); + $this->isFlat = $request->getIntegerParameter('flat', 0); + + if ( + !empty($idSite) + && ( Common::getRequestVar('actionToWidgetize', '', 'string') === 'previewReport' + || Common::getRequestVar('action', '', 'string') === 'previewReport') + && ( Common::getRequestVar('moduleToWidgetize', '', 'string') === 'CustomReports' + || Common::getRequestVar('module', '', 'string') === 'CustomReports') + ) { + $report = null; + Piwik::postEvent('CustomReports.buildPreviewReport', array(&$report)); + + $this->initCustomReport($report); + $this->doNotInitTwice = true; + } elseif (!empty($idCustomReport) && !empty($idSite)) { + // needed when this report is being rendered because viewDataTable would not find correct report. + $model = StaticContainer::get('Piwik\Plugins\CustomReports\Model\CustomReportsModel'); + $report = $model->getCustomReport($idSite, $idCustomReport); + if (!empty($report)) { + $this->initCustomReport($report); + } + } + } + + public function isEnabled() + { + if (!empty($this->dimension) && !$this->dimension->isAnonymousAllowed() && Piwik::isUserIsAnonymous()) { + return false; + } + return parent::isEnabled(); + } + + public function render() + { + if (!empty($this->dimension) && !$this->dimension->isAnonymousAllowed()) { + Piwik::checkUserIsNotAnonymous(); + } + return parent::render(); + } + + public function initCustomReport($report, DataTable\DataTableInterface $table = null) + { + if ($this->doNotInitTwice) { + return; + } + + $this->customReport = $report; + + $this->reportType = ReportType::factory($report['report_type']); + + $this->categoryId = $report['category']['id']; + $this->name = $report['name']; + $this->documentation = $report['description']; + $this->metrics = $report['metrics']; + $this->metricSemanticTypes = []; + $this->processedMetrics = array(); + + // TODO we may need to adjust defaultSortColumn if it was ignored by report builder eg if metric is actually + // not joinable anymore or does not exist anymore + $this->defaultSortColumn = reset($report['metrics']); + $this->order = 0; + + if (!empty($report['subcategory']['id'])) { + $this->subcategoryId = $report['subcategory']['id']; + if ($report['subcategory_order'] != 9999999) { + $this->order = $report['subcategory_order']; + } + } elseif (!empty($report['category']['id']) && $report['category']['id'] === CustomReportsDao::DEFAULT_CATEGORY) { + $this->subcategoryId = $report['idcustomreport']; + } else { + // when the category is not specified and does not go into the custom reports category, we use the report name + // as the category ID. Otherwise we may add eg for a reportId 19 a subcategory to Goals with the ID 19. + // when there a goal exists with ID 19 as well, we would accidentally put the report on the page of the goal. + $this->subcategoryId = $report['name']; + } + + $idSubtable = $this->getSelectedSubtableId(); + + $this->dimension = null; + if (empty($idSubtable) && !empty($report['dimensions'][0])) { + $this->dimension = $this->getDimensionInstance($report['dimensions'][0]); + } elseif (!empty($idSubtable)) { + $this->tryToSetDimensionBasedOnTable($table); + + if (empty($this->dimension) && isset($report['dimensions'][1])) { + // we assume second dimension + $this->dimension = $this->getDimensionInstance($report['dimensions'][1]); + } + } + + $factory = MetricsList::get(); + + $this->metricTranslations = array(); + $period = Common::getRequestVar('period', '', 'string'); + foreach ($report['metrics'] as $metric) { + $metricInstance = $factory->getMetric($metric); + if ( + !empty($metricInstance) && + ($metricInstance instanceof ProcessedMetric || $metricInstance instanceof ArchivedMetric) + ) { + if ($period != 'day' && stripos($metricInstance->getTranslatedName(), 'unique') === 0) { + $metricInstance->setDocumentation(Piwik::translate( + 'CustomReports_CommonUniqueMetricDescription', + array($metricInstance->getDocumentation(), ucwords($metricInstance->getTranslatedName()), str_ireplace('Unique ', '', ucwords($metricInstance->getTranslatedName()))) + )); + $metricInstance->setTranslatedName(Piwik::translate('CustomReports_CommonUniqueMetric', array($metricInstance->getTranslatedName()))); + } + $this->processedMetrics[] = $metricInstance; + $this->metricTranslations[$metric] = $metricInstance->getTranslatedName(); + } + + if ($metricInstance instanceof Plugin\Metric && method_exists($metricInstance, 'getSemanticType')) { + $this->metricSemanticTypes[$metric] = $metricInstance->getSemanticType(); + } else { + $this->metricSemanticTypes[$metric] = null; + } + } + if (!empty($report['idcustomreport'])) { + $this->parameters = array('idCustomReport' => $report['idcustomreport']); + } else { + $this->parameters = array(); + } + } + + private function getSelectedSubtableId() + { + return Common::getRequestVar('idSubtable', 0, 'int'); + } + + public function getMetrics() + { + return $this->metricTranslations; + } + + private function tryToSetDimensionBasedOnTable(DataTable\DataTableInterface $table = null) + { + if (!empty($table)) { + $level = $this->detectSubtableLevelOnTable($table); + if (!empty($level) && isset($this->customReport['dimensions'][$level - 1])) { + $this->dimension = $this->getDimensionInstance($this->customReport['dimensions'][$level - 1]); + } + } + } + + private function detectSubtableLevelOnTable(DataTable\DataTableInterface $table) + { + $row = $table->getFirstRow(); + + if ($row && $row instanceof DataTable\DataTableInterface) { + $row = $row->getFirstRow(); + } + + if ($row && $row instanceof DataTable\Row) { + $level = $row->getColumn('level'); + if (!empty($level)) { + return $level; + } + } + } + + public function getDimensionInstance($dimensionName) + { + $factory = StaticContainer::get('Piwik\Columns\DimensionsProvider'); + return $factory->factory($dimensionName); + } + + public function getDefaultTypeViewDataTable() + { + if ($this->reportType) { + return $this->reportType->getDefaultViewDataTable(); + } + + return parent::getDefaultTypeViewDataTable(); + } + + public function alwaysUseDefaultViewDataTable() + { + if ($this->reportType) { + return $this->reportType->alwaysUseDefaultViewDataTable(); + } + + return parent::alwaysUseDefaultViewDataTable(); + } + + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + if ($this->categoryId && $this->subcategoryId && $this->reportType) { + $widget = $factory->createWidget(); + $widget->setAction($this->reportType->getRenderAction()); + $widgetsList->addWidgetConfig($widget); + } + } + + public function configureView(ViewDataTable $view) + { + $dimensionName = 'Label'; + + if (!empty($this->dimension)) { + $dimensionName = $this->dimension->getName(); + $view->config->addTranslations(array('label' => $dimensionName)); + } + + // The insights API is currently hardcoded to use 'nb_visits', and doesn't work + // if we don't have 'nb_visits' included. + if (!in_array('nb_visits', $this->metrics, true)) { + $view->config->show_insights = false; + } + + $view->config->show_flatten_table = true; + + $subdimension = $this->getSubtableDimension(); + if (!empty($subdimension)) { + $view->config->show_pivot_by_subtable = true; + $view->config->pivot_by_dimension = $subdimension->getId(); + $view->config->pivot_by_column = $this->metrics[0]; + } else { + $view->config->show_pivot_by_subtable = false; + } + + $metricsList = MetricsList::get(); + + foreach ($this->metrics as $metric) { + $metricInstance = $metricsList->getMetric($metric); + if (!empty($metricInstance) && $metricInstance->getDocumentation()) { + $view->config->metrics_documentation[$metricInstance->getName()] = $metricInstance->getDocumentation(); + } + if (!empty($metricInstance) && $metricInstance->getTranslatedName()) { + $view->config->addTranslation($metricInstance->getName(), $metricInstance->getTranslatedName()); + } + } + + $self = $this; + $report = $this->customReport; + $request = Request::fromRequest(); + $idSite = $request->getIntegerParameter('idSite', 0); + $view->config->filters[] = function (DataTable $table) use ($self, $view, $report, $metricsList, $idSite) { + // we fix the dimension based on the data table content. + $self->tryToSetDimensionBasedOnTable($table); + + $dimension = $self->getDimension(); + + if (!empty($dimension)) { + $view->config->addTranslations(array('label' => $dimension->getName())); + } + + // make urls clickable... + if ($dimension && $dimension->getType() === Dimension::TYPE_URL && (!$this->isFlat || (count($self->customReport['dimensions']) === 1))) { + $table->filter('ColumnCallbackAddMetadata', array('label', 'url', function ($label) { + if ($label === Archiver::LABEL_NOT_DEFINED) { + return false; + } + return $label; + })); + } + + if ($table->getRowsCount() === 0 && $table->getMetadata('period')) { + $period = $table->getMetadata('period'); + if (!empty($period) && $period instanceof Period) { + /** @var Period $period */ + $reportStartDate = $period->getDateStart()->getTimestampUTC(); + + if ( + (!empty($report['created_date']) && $reportStartDate < Date::factory($report['created_date'])->getTimestamp()) + || (!empty($report['updated_date']) && $reportStartDate < Date::factory($report['updated_date'])->getTimestamp()) + ) { + $view->config->no_data_message = Piwik::translate('CoreHome_ThereIsNoDataForThisReport') . ' ' . Piwik::translate('CustomReports_NoDataNotArchivedYet'); + + if (!Plugin\Manager::getInstance()->isPluginActivated('Cloud')) { + $view->config->no_data_message .= ' ' . Piwik::translate( + 'CustomReports_NoDataNotArchivedYetReprocess', + ['', ''] + ); + } + } + } + } else { + $periodLabel = Common::getRequestVar('period', '', 'string'); + $isEvolution = $view->isViewDataTableId(Evolution::ID); + + if (!self::supportsUniqueMetric($periodLabel, $isEvolution)) { + $removed = array_intersect(self::$RAW_DATA_UNIQUE_METRICS, $view->config->columns_to_display); + $removed2 = array_intersect(self::$RAW_DATA_UNIQUE_METRICS, (property_exists($view->config, 'selectable_columns') && is_array($view->config->selectable_columns)) ? $view->config->selectable_columns : array()); + if (!empty($removed) || !empty($removed2)) { + $view->config->columns_to_display = array_diff($view->config->columns_to_display, self::$RAW_DATA_UNIQUE_METRICS); + + if ($isEvolution || $view->isViewDataTableId(Bar::ID) || $view->isViewDataTableId(Pie::ID)) { + $period = Common::getRequestVar('period', '', 'string'); + if (!GetCustomReport::supportsUniqueMetric($period, true)) { + /** @var Evolution $view */ + if (is_array($view->config->selectable_columns)) { + $view->config->selectable_columns = array_diff($view->config->selectable_columns, GetCustomReport::$RAW_DATA_UNIQUE_METRICS); + } + } + } + + $removedHumanReadable = array(); + foreach ($removed as $metricName) { + $foundMetric = $metricsList->getMetric($metricName); + if ($foundMetric) { + $removedHumanReadable[] = $foundMetric->getTranslatedName(); + } elseif (is_string($metricName)) { + $removedHumanReadable[] = $metricName; + } + } + + if (empty($view->config->columns_to_display)) { + $view->config->show_header_message = Piwik::translate('CustomReports_NoDataRemovedMetrics', implode(', ', $removedHumanReadable)); + } elseif ($view->config->columns_to_display == array('label')) { + $view->config->show_header_message = Piwik::translate('CustomReports_NoDataRemovedMetrics', implode(', ', $removedHumanReadable)); + $view->config->columns_to_display = array(); + $view->config->show_pagination_control = false; + $view->config->show_offset_information = false; + } else { + if (empty($view->config->show_footer_message)) { + $view->config->show_footer_message = ''; + } else { + $view->config->show_footer_message .= ' '; + } + $view->config->show_footer_message .= Piwik::translate('CustomReports_RemovedMetrics', implode(', ', $removedHumanReadable)); + } + } + } + } + if (!empty($report['status']) && $report['status'] === CustomReportsModel::STATUS_PAUSED) { + $url = Url::getCurrentQueryStringWithParametersModified(array( + 'module' => 'CustomReports', + 'action' => 'manage' + )); + $view->config->no_data_message = Piwik::translate('CustomReports_NoDataMessagePausedStateAdminUser', ['', '']); + $idSitesToCheck = !empty($report['multiple_idsites']) ? explode(',', $report['multiple_idsites']) : array($idSite); + foreach ($idSitesToCheck as $idSite) { + if (!$this->getValidator()->canWrite($idSite)) { + $view->config->no_data_message = Piwik::translate('CustomReports_NoDataMessagePausedStateNonAdminUser'); + break; + } + } + } + }; + + $idCustomReport = Common::getRequestVar('idCustomReport', 0, 'int'); + $idSubtable = $this->getSelectedSubtableId(); + + if (!empty($this->customReport['segment_filter']) && empty($idSubtable)) { + // we do not show it in subtable gain... + $segmentFormatter = StaticContainer::get('Piwik\Plugins\SegmentEditor\SegmentFormatter'); + + try { + $segmentDefinition = $segmentFormatter->getHumanReadable($this->customReport['segment_filter'], $idSite); + $view->config->show_footer_message = Piwik::translate('CustomReports_ReportHasFilterApplied', Common::sanitizeInputValue($segmentDefinition)); + } catch (\Exception $e) { + // may fail when a configured segment is no longer available + } + } + + $view->config->filters[] = function (DataTable $table) { + $table->filter('ReplaceSummaryRowLabel'); + $table->setLabelsHaveChanged(); + }; + + $view->config->show_table_all_columns = false; + $view->config->show_exclude_low_population = false; + + $pivotBy = Common::getRequestVar('pivotBy', false); + if (empty($pivotBy)) { + if ( + $view->isViewDataTableId(Pie::ID) + || $view->isViewDataTableId(Bar::ID) + ) { + /** @var Pie $view */ + $selectableColumns = array_values($this->metrics); + $view->config->selectable_columns = $selectableColumns; + $view->config->columns_to_display = array(reset($selectableColumns)); + } else { + $view->config->columns_to_display = array_merge(array('label'), $this->metrics); + } + } + + if (!empty($idCustomReport)) { + $view->config->report_id = 'CustomReports.getCustomReport_idCustomReport--' . $idCustomReport; + $view->requestConfig->request_parameters_to_modify['idCustomReport'] = $idCustomReport; + $view->requestConfig->request_parameters_to_modify['reportUniqueId'] = 'CustomReports_getCustomReport_idCustomReport--' . $idCustomReport; + + if ($this->getValidator()->canWrite($idSite)) { + $view->config->title_edit_entity_url = 'index.php' . Url::getCurrentQueryStringWithParametersModified(array( + 'module' => 'CustomReports', + 'action' => 'manage' + )) . '#?idCustomReport=' . (int)$idCustomReport; + } + } + + // Is this an evolution graph. If it is, we need to override the controller action so the right API call is made + if ($view->isViewDataTableId(Evolution::ID) && !in_array(Common::getRequestVar('action', '', 'string'), ['getMultiRowEvolutionPopover', 'getRowEvolutionPopover', 'getRowEvolutionGraph'])) { + $view->config->controllerAction = 'getEvolutionGraph'; + } + + if (!$this->isFlat && !empty($this->customReport['dimensions']) && is_array($this->customReport['dimensions']) && count($this->customReport['dimensions']) > 3) { + // add a css class to update the width of table for hierarchical, when dimensions are > 3 to resolve scrolling issue + $view->config->datatable_css_class = 'customReportsHigherDimensions'; + } + } + + public static function supportsUniqueMetric($period, $isEvolutionGraph) + { + $config = StaticContainer::get(Configuration::class); + if ($config->shouldAlwaysShowUniqueVisitors()) { + return true; + } + + if ($isEvolutionGraph) { + return SettingsPiwik::isUniqueVisitorsEnabled($period); + } + + return $period === 'day'; + } + + public function getSubtableDimension() + { + return $this->getSecondLeveltableDimension(); + } + + public function getSecondLeveltableDimension() + { + if (isset($this->customReport['dimensions'][1])) { + return $this->getDimensionInstance($this->customReport['dimensions'][1]); + } + } + + public function getThirdLeveltableDimension() + { + if (isset($this->customReport['dimensions'][2])) { + return $this->getDimensionInstance($this->customReport['dimensions'][2]); + } + } + + public function getNthLevelTableDimension(int $level): ?Dimension + { + if (isset($this->customReport['dimensions'][$level])) { + return $this->getDimensionInstance($this->customReport['dimensions'][$level]); + } + + return null; + } + + private function getValidator() + { + return StaticContainer::get('Piwik\Plugins\CustomReports\Input\Validator'); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Glossary.php b/files/plugin-CustomReports-5.4.3/Glossary.php new file mode 100644 index 0000000..d92794e --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Glossary.php @@ -0,0 +1,76 @@ +api = $api; + } + + public function getMetricsAndDimensions() + { + $result = []; + + $allDimensions = Request::processRequest('CustomReports.getAvailableDimensions'); + foreach ($allDimensions as $categoryId => $category) { + foreach ($category['dimensions'] as $dimension) { + $result[] = [ + 'name' => $dimension['name'], + 'subtitle' => 'CustomReports_Dimension', + 'documentation' => '', + 'id' => $dimension['uniqueId'], + ]; + } + } + + $allMetrics = Request::processRequest('CustomReports.getAvailableMetrics'); + foreach ($allMetrics as $categoryId => $category) { + foreach ($category['metrics'] as $metric) { + $result[] = [ + 'name' => $metric['name'], + 'subtitle' => 'General_Metric', + 'documentation' => Common::sanitizeInputValue($metric['description']), // uses |raw in twig template + 'id' => $metric['uniqueId'], + 'is_metric' => true, + ]; + } + } + + usort($result, function ($a, $b) { + return strcmp($this->cleanName($a['name']), $this->cleanName($b['name'])); + }); + + return $result; + } + + private function cleanName($name) + { + $name = preg_replace('/[\'"]/', '', $name); + $name = strtolower($name); + return $name; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Category.php b/files/plugin-CustomReports-5.4.3/Input/Category.php new file mode 100644 index 0000000..5ff0053 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Category.php @@ -0,0 +1,51 @@ +category = $categoryId; + } + + public function check() + { + $title = 'CustomReports_ReportCategory'; + + if (empty($this->category)) { + $title = Piwik::translate($title); + throw new Exception(Piwik::translate('CustomReports_ErrorXNotProvided', $title)); + } + + if (Common::mb_strlen($this->category) > static::MAX_LENGTH) { + $title = Piwik::translate($title); + throw new Exception(Piwik::translate('CustomReports_ErrorXTooLong', array($title, static::MAX_LENGTH))); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Description.php b/files/plugin-CustomReports-5.4.3/Input/Description.php new file mode 100644 index 0000000..bcf3043 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Description.php @@ -0,0 +1,49 @@ +description = $description; + } + + public function check() + { + if (empty($this->description)) { + // no description is valid + return; + } + + if (Common::mb_strlen($this->description) > self::MAX_LENGTH) { + $title = Piwik::translate('General_Description'); + throw new Exception(Piwik::translate('CustomReports_ErrorXTooLong', array($title, static::MAX_LENGTH))); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Dimensions.php b/files/plugin-CustomReports-5.4.3/Input/Dimensions.php new file mode 100644 index 0000000..9648fa8 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Dimensions.php @@ -0,0 +1,99 @@ +dimensions = $dimensions; + $this->idSite = $idSite; + } + + public function check() + { + if (empty($this->dimensions)) { + return; // it may be empty + } + + $title = Piwik::translate('CustomReports_Dimensions'); + + if (!is_array($this->dimensions)) { + throw new Exception(Piwik::translate('CustomReports_ErrorNotAnArray', $title)); + } + + $validateDimensionsExist = true; + if (empty($this->idSite) || $this->idSite === 'all') { + $configuration = StaticContainer::get('Piwik\Plugins\CustomReports\Configuration'); + $validateDimensionsExist = $configuration->shouldValidateReportContentWhenAllSites(); + } + + $dimensionProvider = StaticContainer::get('Piwik\Columns\DimensionsProvider'); + $availableDimensions = $this->getAvailableDimensionsList(); + foreach ($this->dimensions as $index => $dimension) { + if (empty($dimension)) { + throw new Exception(Piwik::translate('CustomReports_ErrorArrayMissingItem', array($title, $index))); + } + + if ($validateDimensionsExist && !$dimensionProvider->factory($dimension)) { + throw new Exception(Piwik::translate('CustomReports_ErrorInvalidValueInArray', array($title, $index))); + } + + if ($validateDimensionsExist && !isset($availableDimensions[$dimension])) { + throw new Exception(Piwik::translate('CustomReports_ErrorInvalidDimension', array($dimension))); + } + } + + if (count($this->dimensions) !== count(array_unique($this->dimensions))) { + $title = Piwik::translate('CustomReports_Dimension'); + throw new Exception(Piwik::translate('CustomReports_ErrorDuplicateItem', $title)); + } + } + + private function getAvailableDimensionsList() + { + $dimensions = API::getInstance()->getAvailableDimensions($this->idSite); + $list = []; + + if (!empty($dimensions)) { + foreach ($dimensions as $values) { + if (!empty($values['dimensions'])) { + foreach ($values['dimensions'] as $dimension) { + $list[$dimension['uniqueId']] = $dimension['name']; + } + } + } + } + + return $list; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Metrics.php b/files/plugin-CustomReports-5.4.3/Input/Metrics.php new file mode 100644 index 0000000..12306f7 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Metrics.php @@ -0,0 +1,76 @@ +metrics = $metrics; + $this->idSite = $idSite; + } + + public function check() + { + if (empty($this->metrics)) { + return; // it may be empty + } + + $title = Piwik::translate('General_Metrics'); + + if (!is_array($this->metrics)) { + throw new Exception(Piwik::translate('CustomReports_ErrorNotAnArray', $title)); + } + + $validateMetricsExist = true; + if (empty($this->idSite) || $this->idSite === 'all') { + $configuration = StaticContainer::get('Piwik\Plugins\CustomReports\Configuration'); + $validateMetricsExist = $configuration->shouldValidateReportContentWhenAllSites(); + } + + $metricsList = MetricsList::get(); + + foreach ($this->metrics as $index => $metric) { + if (empty($metric)) { + throw new Exception(Piwik::translate('CustomReports_ErrorArrayMissingItem', array($title, $index))); + } + if ($validateMetricsExist && !$metricsList->getMetric($metric)) { + throw new Exception(Piwik::translate('CustomReports_ErrorInvalidValueInArray', array($title, $index))); + } + } + + if (count($this->metrics) !== count(array_unique($this->metrics))) { + $title = Piwik::translate('General_Metric'); + throw new Exception(Piwik::translate('CustomReports_ErrorDuplicateItem', $title)); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Name.php b/files/plugin-CustomReports-5.4.3/Input/Name.php new file mode 100644 index 0000000..0aa2e91 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Name.php @@ -0,0 +1,51 @@ +name = $name; + } + + public function check() + { + $title = 'CustomReports_ReportName'; + + if (empty($this->name)) { + $title = Piwik::translate($title); + throw new Exception(Piwik::translate('CustomReports_ErrorXNotProvided', $title)); + } + + if (Common::mb_strlen($this->name) > static::MAX_LENGTH) { + $title = Piwik::translate($title); + throw new Exception(Piwik::translate('CustomReports_ErrorXTooLong', array($title, static::MAX_LENGTH))); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/ReportType.php b/files/plugin-CustomReports-5.4.3/Input/ReportType.php new file mode 100644 index 0000000..52656a1 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/ReportType.php @@ -0,0 +1,45 @@ +reportType = $reportType; + } + + public function check() + { + $title = 'CustomReports_ReportType'; + + if (empty($this->reportType)) { + $title = Piwik::translate($title); + throw new Exception(Piwik::translate('CustomReports_ErrorXNotProvided', $title)); + } + + \Piwik\Plugins\CustomReports\ReportType\ReportType::factory($this->reportType); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/SegmentFilter.php b/files/plugin-CustomReports-5.4.3/Input/SegmentFilter.php new file mode 100644 index 0000000..ac96418 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/SegmentFilter.php @@ -0,0 +1,47 @@ +segment = $segmentFilter; + $this->idSites = $idSites; + } + + public function check() + { + if (empty($this->segment)) { + return; // it may be empty + } + + new Segment($this->segment, $this->idSites); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Subcategory.php b/files/plugin-CustomReports-5.4.3/Input/Subcategory.php new file mode 100644 index 0000000..29c66dd --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Subcategory.php @@ -0,0 +1,49 @@ +subcategory = $subcategoryId; + } + + public function check() + { + if (empty($this->subcategory)) { + return; // may be empty + } + $title = 'CustomReports_ReportSubcategory'; + + if (!empty($this->subcategory) && Common::mb_strlen($this->subcategory) > static::MAX_LENGTH) { + $title = Piwik::translate($title); + throw new Exception(Piwik::translate('CustomReports_ErrorXTooLong', array($title, static::MAX_LENGTH))); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Input/Validator.php b/files/plugin-CustomReports-5.4.3/Input/Validator.php new file mode 100644 index 0000000..e27b18c --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Input/Validator.php @@ -0,0 +1,99 @@ +supportsMethod('checkUserHasSomeWriteAccess')) { + // since Matomo 3.6.0 + Piwik::checkUserHasSomeWriteAccess(); + return; + } + + Piwik::checkUserHasSomeAdminAccess(); + } + + public function checkWritePermission($idSite) + { + if (self::isAllWebsitesRequest($idSite)) { + Piwik::checkUserHasSuperUserAccess(); + } else { + $this->checkSiteExists($idSite); + + if ($this->supportsMethod('checkUserHasWriteAccess')) { + // since Matomo 3.6.0 + Piwik::checkUserHasWriteAccess($idSite); + return; + } + + Piwik::checkUserHasAdminAccess($idSite); + } + } + + public static function isAllWebsitesRequest($idSite) + { + return $idSite === 0 || $idSite === '0' || $idSite === 'all' || $idSite === false; + } + + public function checkReportViewPermission($idSite) + { + $this->checkSiteExists($idSite); + Piwik::checkUserHasViewAccess($idSite); + } + + public function checkSiteExists($idSite) + { + if (self::isAllWebsitesRequest($idSite)) { + return; + } + + new Site($idSite); + } + + public function canViewReport($idSite) + { + if (empty($idSite)) { + return false; + } + + return Piwik::isUserHasViewAccess($idSite); + } + + public function canWrite($idSite) + { + if (empty($idSite)) { + return false; + } + + if ($this->supportsMethod('isUserHasWriteAccess')) { + // since Matomo 3.6.0 + return Piwik::isUserHasWriteAccess($idSite); + } + + return Piwik::isUserHasAdminAccess($idSite); + } +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/LICENSE b/files/plugin-CustomReports-5.4.3/LICENSE similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/LICENSE rename to files/plugin-CustomReports-5.4.3/LICENSE diff --git a/files/plugin-CustomReports-5.4.3/Menu.php b/files/plugin-CustomReports-5.4.3/Menu.php new file mode 100644 index 0000000..3052ef5 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Menu.php @@ -0,0 +1,45 @@ +validator = $validator; + + parent::__construct(); + } + + public function configureAdminMenu(MenuAdmin $menu) + { + $idSite = Common::getRequestVar('idSite', 0, 'int'); + + if ($this->validator->canWrite($idSite)) { + $menu->addMeasurableItem('CustomReports_CustomReports', $this->urlForAction('manage'), $orderId = 42); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Model/CustomReportsModel.php b/files/plugin-CustomReports-5.4.3/Model/CustomReportsModel.php new file mode 100644 index 0000000..2b12c39 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Model/CustomReportsModel.php @@ -0,0 +1,491 @@ +dao = $dao; + } + + public function createCustomReport($idSite, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, $createdDate, $multipleIdSites) + { + if ($reportType === Evolution::ID) { + $dimensions = array(); + } + + $this->validateReportValues($idSite, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, [], $multipleIdSites); + + $status = self::STATUS_ACTIVE; + + $idCustomReport = $this->dao->addCustomReport($idSite, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, $status, $createdDate, $multipleIdSites); + + return $idCustomReport; + } + + private function areMetricsEqual($metricNew, $metricOld) + { + if (!is_array($metricNew) || !is_array($metricOld)) { + return false; + } + + if (count($metricNew) > count($metricOld)) { + // there are now more metrics in the new version... + return false; + } + + if (array_diff($metricNew, $metricOld) === array_diff($metricOld, $metricNew)) { + return true; // they are still the same metrics + } + + if (array_diff($metricNew, $metricOld) === array()) { + return true; // the new metric contains still all of the old metrics so we do not need to invalidate reports with a new revision + } + + return false; + } + + public function updateCustomReport($idSite, $idCustomReport, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, $updatedDate, $subCategoryReportIds, $multipleIdSites) + { + if ($reportType === Evolution::ID) { + $dimensions = array(); + } + + $this->validateReportValues($idSite, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, $subCategoryReportIds, $multipleIdSites); + + $report = $this->getCustomReportById($idCustomReport, $idSite); + + $revision = $report['revision']; + + if ( + $report['dimensions'] !== $dimensions + || $reportType !== $report['report_type'] + || $segmentFilter !== $report['segment_filter'] + || !$this->areMetricsEqual($metrics, $report['metrics']) + ) { + // we do not need to create a new revision if metrics only has a different order as we would still have all the data + $revision++; + } + + $columns = array( + 'idsite' => $idSite, + 'name' => $name, + 'description' => $description, + 'report_type' => $reportType, + 'dimensions' => $dimensions, + 'metrics' => $metrics, + 'segment_filter' => $segmentFilter, + 'subcategory' => $subcategoryId, + 'category' => $categoryId, + 'updated_date' => $updatedDate, + 'revision' => $revision, + 'multiple_idsites' => '', + ); + if (!empty($multipleIdSites)) { + $columns['idsite'] = -1; + $columns['multiple_idsites'] = implode(',', $multipleIdSites); + } + // idsite might change when configuring a report so we cannot use $idSite but need to use the currently stored + // idsite in order to update the report! + + $this->updateReportColumns($report['idsite'], $idCustomReport, $columns); + + if (!empty($subCategoryReportIds)) { + $this->updateSubCategoryReportsOrder($subCategoryReportIds, $idSite); + } + } + + /** + * @param $idSite + * @param $idCustomReport + * @return array|false + * @throws \Exception + */ + public function getCustomReport($idSite, $idCustomReport) + { + $report = $this->dao->getCustomReport($idSite, $idCustomReport); + return $this->enrichReport($report, false, true); + } + + /** + * @param $idCustomReport + * @param $idSite + * @return array|false + * @throws \Exception + */ + public function getCustomReportById($idCustomReport, $idSite) + { + $report = $this->dao->getCustomReportById($idCustomReport, $idSite); + return $this->enrichReport($report, false, true); + } + + /** + * @return array + */ + public function getAllCustomReportsForSite($idSite, $skipCategoryMetadata = false) + { + $reports = $this->dao->getCustomReports($idSite); + return $this->enrichReports($reports, $skipCategoryMetadata); + } + + private function enrichReports($reports, $skipCategoryMetadata = false) + { + if (empty($reports)) { + return array(); + } + + foreach ($reports as $index => $report) { + $reports[$index] = $this->enrichReport($report, $skipCategoryMetadata); + } + + return $reports; + } + + private function enrichReport($report, $skipCategoryMetadata = false, $addChildReports = false) + { + if (empty($report)) { + return $report; + } + + if (empty($report['idsite'])) { + $report['site'] = array('id' => $report['idsite'], 'name' => Piwik::translate('General_MultiSitesSummary')); + } else { + $report['site'] = array('id' => $report['idsite'], 'name' => Site::getNameFor($report['idsite'])); + } + + if (!$skipCategoryMetadata) { + $category = $report['category']; + $report['category'] = $this->buildCategoryMetadata($category); + $report['subcategory'] = $this->buildSubcategoryMetadata($category, $report['subcategory']); + } + + if ($addChildReports) { + $report['child_reports'] = $this->dao->getChildReports($report['idsite'], $report['idcustomreport']); + + // Since child reports are added for single reports so add multiple_sites info for single reports only + $report['multipleIdSites'] = $report['multiple_idsites'] ? $this->getMultipleIdSitesInfo(explode(',', $report['multiple_idsites'])) : []; + } + + return $report; + } + + private function getCategoryList() + { + if (!$this->categoryList) { + $this->categoryList = CategoryList::get(); + } + return $this->categoryList; + } + + /** + * Consist API return with API.getWidgetMetadata and API.getReportingPages... + * @param string $categoryId + * @return array + */ + private function buildCategoryMetadata($categoryId) + { + if (empty($categoryId)) { + return array( + 'id' => CustomReportsDao::DEFAULT_CATEGORY, + 'name' => Piwik::translate(CustomReportsDao::DEFAULT_CATEGORY), + 'order' => 999, + 'icon' => '', + ); + } + + $category = $this->getCategoryList()->getCategory($categoryId); + + if (!empty($category)) { + $name = method_exists($category, 'getDisplayName') ? $category->getDisplayName() : Piwik::translate($category->getId()); + + return array( + 'id' => (string) $category->getId(), + 'name' => $name, + 'order' => $category->getOrder(), + 'icon' => $category->getIcon(), + ); + } + + return array( + 'id' => (string) $categoryId, + 'name' => Piwik::translate($categoryId), + 'order' => 999, + 'icon' => '', + ); + } + + /** + * Consist API return with API.getWidgetMetadata and API.getReportingPages... + * @param Subcategory|null $subcategory + * @return array + */ + private function buildSubcategoryMetadata($categoryId, $subcategoryId) + { + if (empty($subcategoryId)) { + return null; + } + + if (!empty($categoryId)) { + $category = $this->getCategoryList()->getCategory($categoryId); + } else { + $category = null; + } + + if (!empty($category)) { + $subcategory = $category->getSubcategory($subcategoryId); + + if (!empty($subcategory)) { + return array( + 'id' => (string) $subcategory->getId(), + 'name' => Piwik::translate($subcategory->getName()), + 'order' => $subcategory->getOrder(), + ); + } + } + + return array( + 'id' => (string) $subcategoryId, + 'name' => Piwik::translate((string) $subcategoryId), + 'order' => 999, + ); + } + + public function checkReportExists($idSite, $idCustomReport) + { + $report = $this->dao->getCustomReport($idSite, $idCustomReport); + + if (empty($report)) { + throw new Exception(Piwik::translate('CustomReports_ErrorReportDoesNotExist')); + } + } + + public function deactivateReport($idSite, $idCustomReport, $customReportName = '') + { + $columns = array('status' => self::STATUS_DELETED); + if (!empty($customReportName)) { + //Since the unique index is created using combination of idsite+name, just soft deleting will not allow to create a new form with deleted form name, so we just update the name too when marking the status as deleted + $columns['name'] = 'deleted-' . $idCustomReport . '-' . $customReportName; + } + $this->updateReportColumns($idSite, $idCustomReport, $columns); + } + + public function pauseReport($idSite, $idCustomReport, $customReportName = '') + { + $columns = array('status' => self::STATUS_PAUSED); + $this->updateReportColumns($idSite, $idCustomReport, $columns); + } + + public function resumeReport($idSite, $idCustomReport, $customReportName = '') + { + $columns = array('status' => self::STATUS_ACTIVE); + $this->updateReportColumns($idSite, $idCustomReport, $columns); + } + + protected function getCurrentDateTime() + { + return Date::now()->getDatetime(); + } + + private function validateReportValues($idSite, $name, $description, $reportType, $dimensions, $metrics, $segmentFilter, $categoryId, $subcategoryId, $subCategoryReportIds = [], $multipleIdSites = []) + { + $nameObj = new Name($name); + $nameObj->check(); + + $descriptionObj = new Description($description); + $descriptionObj->check(); + + $typeObj = new ReportType($reportType); + $typeObj->check(); + + $categoryObj = new Category($categoryId); + $categoryObj->check(); + + $subcategoryObj = new Subcategory($subcategoryId); + $subcategoryObj->check(); + + if (!empty($multipleIdSites)) { + foreach ($multipleIdSites as $multipleIdSite) { + $dimensionsObj = new Dimensions($dimensions, $multipleIdSite); + $dimensionsObj->check(); + + $metricsObj = new Metrics($metrics, $multipleIdSite); + $metricsObj->check(); + } + } else { + $dimensionsObj = new Dimensions($dimensions, $idSite); + $dimensionsObj->check(); + + $metricsObj = new Metrics($metrics, $idSite); + $metricsObj->check(); + } + + if (!empty($multipleIdSites)) { + $idSite = $multipleIdSites; + } elseif ($idSite === '0' || $idSite === 0 || $idSite === 'all') { + // just fetching some sites as we have to pass them to the segment selector + $idSite = Request::processRequest('SitesManager.getSitesIdWithAtLeastViewAccess'); + } elseif (!empty($idSite)) { + $idSite = array($idSite); + } + + $segment = new SegmentFilter($segmentFilter, $idSite); + $segment->check(); + + $type = \Piwik\Plugins\CustomReports\ReportType\ReportType::factory($reportType); + + if ($type->needsDimensions() && empty($dimensions)) { + throw new Exception(Piwik::translate('CustomReports_ErrorMissingDimension')); + } + + $maxDimensions = StaticContainer::get(Configuration::class)->getMaxDimensions(); + if (!empty($dimensions) && is_array($dimensions) && count($dimensions) > $maxDimensions) { + throw new Exception(Piwik::translate('CustomReports_ErrorTooManyDimension', $maxDimensions)); + } + + if (!empty($subCategoryReportIds) && count($subCategoryReportIds) != count($this->dao->getReportIds($subCategoryReportIds))) { + throw new Exception(Piwik::translate('CustomReports_ErrorInvalidSubCategoryReport')); + } + + $this->validateQuery($idSite, $dimensions, $metrics, $segmentFilter, $reportType); + } + + public function deactivateReportsForSite($idSite) + { + foreach ($this->dao->getCustomReports($idSite) as $report) { + // getCustomReports also returns sites for "all websites"... we need to make sure to not delete those. + if (!empty($report['idsite']) && $report['idsite'] == $idSite) { + $this->deactivateReport($idSite, $report['idcustomreport'], $report['name']); + } + } + } + + private function updateReportColumns($idSite, $idCustomReport, $columns) + { + if (!isset($columns['updated_date'])) { + $columns['updated_date'] = $this->getCurrentDateTime(); + } + $this->dao->updateColumns($idSite, $idCustomReport, $columns); + } + + private function updateSubCategoryReportsOrder($subCategoryReportIds, $idSite) + { + if (!empty($subCategoryReportIds)) { + foreach ($subCategoryReportIds as $subCategoryReportIdIndex => $subCategoryReportId) { + $this->dao->updateReportOrder($subCategoryReportId, $subCategoryReportIdIndex, $idSite); + } + } + } + + private function getMultipleIdSitesInfo($idSites) + { + $sitesInfo = []; + + if (!empty($idSites)) { + foreach ($idSites as $idSite) { + if (empty($idSite)) { + $sitesInfo[] = array('idsite' => $idSite, 'name' => Piwik::translate('General_MultiSitesSummary')); + } else { + // If we don't do this, it will fail for admin users who can just view the edit-report, but has no access to all the sites + \Piwik\Access::doAsSuperUser(function () use ($idSite, &$sitesInfo) { + $sitesInfo[] = array('idsite' => $idSite, 'name' => Site::getNameFor($idSite)); + }); + } + } + } + + return $sitesInfo; + } + + private function validateQuery($idSites, $dimensions, $metrics, $segmentFilter, $reportType) + { + $idSite = $idSites[0]; + $report = [ + 'idsite' => $idSite, + 'dimensions' => $dimensions, + 'metrics' => $metrics, + 'segment_filter' => $segmentFilter, + 'report_type' => $reportType, + ]; + $recordBuilder = StaticContainer::getContainer()->make(\Piwik\Plugins\CustomReports\RecordBuilders\CustomReport::class, ['report' => $report]); + try { + $recordBuilder->aggregateReport($this->makeArchiveProcessor($idSite), $idSite, [], $isDryRun = true); + } catch (\Exception $exception) { + $message = $exception->getMessage(); + if (stripos($message, 'be joined for segmentation') !== false) { + $faqLink = Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/custom-reports/how-to-resolve-errors-when-using-different-dimension-combinations-in-matomo/', null, null, 'App.CustomReports.validateQuery'); + $message = Piwik::translate('CustomReports_NoSegmentationJoinExceptionMessage', ['', '']); + } + throw new \Exception($message); + } + } + + private function makeArchiveProcessor($idSite, $date = 'today', $period = 'day', $archiveOnlyReport = []): ArchiveProcessor + { + $period = Period\Factory::build($period, $date); + $segment = new Segment('', array($idSite)); + + $params = new ArchiveProcessor\Parameters(new Site($idSite), $period, $segment); + if (!empty($archiveOnlyReport)) { + $params->setArchiveOnlyReport($archiveOnlyReport); + } + $writer = new ArchiveWriter($params); + $logAggregator = new LogAggregator($params); + $processor = new ArchiveProcessor($params, $writer, $logAggregator); + + return $processor; + } +} diff --git a/files/plugin-CustomReports-5.4.3/README.md b/files/plugin-CustomReports-5.4.3/README.md new file mode 100644 index 0000000..a60d911 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/README.md @@ -0,0 +1,102 @@ +# Matomo CustomReports Plugin + +## Description + +Create unique reports that adapt to your unique goals and projects. Choose from over 250 metrics and dimensions and analyse your data for unparalleled visitor insights. + +Standard reports like the ones you can see in your Matomo dashboard sometimes aren't enough to understand how people experience your site. If you need to quickly uncover hidden insights and provide actionable recommendations, you need reports customised to your needs. + +With the Custom Reports plugin, you can tailor your reports to get the right information anytime. Gain actionable new insights that weren't possible before, and start making faster decisions that make a difference in your business. + +### How Custom Reports Works + +#### 250+ Metrics and Dimensions at Your Fingertips + +
+
+

Create custom reports from 163 metrics that span the entire visitor experience, from your pages to your forms, checkout, and content consumption.

+

Slice your metrics with 94 dimensions to make your analysis as in-depth and granular as you wish.

+
+
+250+ Metrics and Dimensions at Your Fingertips +
+
+ +#### Automate and Export Your Custom Reports for Faster Insights + +
+
+

Send email and SMS notifications to your colleagues or clients so they can access your custom reports. Schedule your reports daily, weekly, or monthly for regular updates on your campaign’s or site's performance.

+

Leverage the HTTP API to manage, fetch, and export your custom reports. You can even access the raw data via MySQL.

+
+
+Automate and Export Your Custom Reports for Faster Insights +
+
+ +#### Filters Your Reports to Enhance Your Analysis + +
+
+

Narrow your report's scope and learn how a subset of your audience performs for any given metric and dimension.

+

Study how different segments behave so you can uncover unique insights into what moves them to convert.

+
+
+Filters Your Reports to Enhance Your Analysis +
+
+ +#### Analyse Anything that Happens on Your Site with Events Tracking + +
+
+

Take your analytics to new heights by using events to study every action on your site. Drill down your reports by any dimension and learn the most popular video content, the most highly visited product pages, or the form elements that make them bounce.

+
+
+Analyse Anything that Happens on Your Site with Events Tracking +
+
+ +#### Enjoy a Seamless Integration with Matomo + +
+
+

The Custom Reports plugin gives you access to features not supported by most standard Matomo reports.

+

Whether you want to detect trends with pivots, view the historical evolution of any dimension value, or study individual visits with visit logs, the Custom Reports plugin has you covered.

+
+
+Enjoy a Seamless Integration with Matomo +
+
+ +### Try Custom Reports Today + +Create unlimited custom reports without data limits. With the Custom Reports plugin, your data will be ready to analyse anytime you need it, hassle-free. + +Start your 30-day free trial today. + +### Managing features +* Create compelling custom reports tailored to your needs without any developer knowledge in just seconds +* Choose from over 200 dimensions and metrics +* Supports several visualizations including evolution over time graphs, data tables, bar graph, pie chart, cloud chart, and others +* Combine up to 3 dimensions and unlimited metrics +* Define a report filter which is applied on the raw data to show the data only for a subset of your visitors and users +* Put your custom report on any existing reporting page or on its own reporting page +* Super Users can make reports available for all websites + +### Integrates with Matomo Analytics platform +* Enjoy features that are not supported by most standard Matomo reports such as pivoting. +* Drill down deeper and filter custom reports [with Segments](https://matomo.org/docs/segmentation/). +* View the evolution over time of any dimension value with [Row Evolution](https://matomo.org/docs/row-evolution/). +* View the segmented [Visitor Log](https://matomo.org/docs/real-time/#visitor-log) with just one click. +* Supports other typical Matomo features like flatten, search, and more. +* View your custom reports on the go with the [Matomo Mobile App](https://matomo.org/mobile/). +* Create unlimited number of reports [No data limit](https://matomo.org/docs/data-limits/). +* Supports other premium features like [Media Analytics](https://plugins.matomo.org/MediaAnalytics), [Form Analytics](https://plugins.matomo.org/FormAnalytics) and [Activity Log](https://plugins.matomo.org/ActivityLog). + +### Export and API features +* Get automatic [email and sms reports](https://matomo.org/docs/email-reports/) for your custom reports, or send them to your colleagues or customers +* [Embed](https://matomo.org/docs/embed-piwik-report/) the custom report widgets directly in your app, dashboard, or even TV screen! +* HTTP API to manage your custom reports +* HTTP API to fetch and export all [Custom Reports](https://developer.matomo.org/api-reference/reporting-api#CustomReports) +* Get access to all the raw data via MySQL for 100% data ownership \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/RecordBuilders/CustomReport.php b/files/plugin-CustomReports-5.4.3/RecordBuilders/CustomReport.php new file mode 100644 index 0000000..1ce71e2 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/RecordBuilders/CustomReport.php @@ -0,0 +1,599 @@ +report = $report; + $this->dimension = $dimension; + $this->metricsList = MetricsList::get(); + $this->configuration = $configuration; + + $noOfDimensions = (!empty($this->report['dimensions']) ? count($this->report['dimensions']) : 0); + $this->maxRowsInTable = $this->configuration->getArchiveMaxRowsInMainTable($noOfDimensions); + $this->maxRowsInSubtable = $this->configuration->getArchiveMaxRowsInSubTable($noOfDimensions); + + $metrics = $this->getArchivableMetricsInReport(); + + $orderBy = null; + if (!empty($metrics)) { + $metricOrderBy = reset($metrics); + if (!empty($metricOrderBy) && is_object($metricOrderBy)) { + $orderBy = $metricOrderBy->getName(); + } + } + + $this->columnToSortByBeforeTruncation = $orderBy; + + $this->columnAggregationOps = $this->getMetricAggregations(); + } + + public function getRecordMetadata(ArchiveProcessor $archiveProcessor): array + { + $report = $this->report; + + $periodLabel = $archiveProcessor->getParams()->getPeriod()->getLabel(); + $isMultiPeriod = $periodLabel != 'day'; + + $metricToSort = $this->columnToSortByBeforeTruncation; + if ($isMultiPeriod) { + $metricToSort = $this->getMetricToSortMultiPeriod(); + } + + $records = []; + + $record = Record::make(Record::TYPE_BLOB, Archiver::makeRecordName($report['idcustomreport'], $report['revision'])); + if ($metricToSort) { + $record->setColumnToSortByBeforeTruncation($metricToSort); + } + $records[] = $record; + + if ($report['report_type'] == Evolution::ID) { + $metrics = $this->getArchivableMetricsInReport(); + foreach ($metrics as $metric) { + if ($isMultiPeriod && $this->shouldAggregateRawDataForMultiPeriodMetric($metric, $periodLabel)) { + continue; // these are aggregated in buildMultiplePeriod() manually + } + + $recordName = Archiver::makeEvolutionRecordName($report['idcustomreport'], $report['revision'], $metric->getName()); + $records[] = Record::make(Record::TYPE_NUMERIC, $recordName); + } + } + + return $records; + } + + // public for use in CustomReports\Controller.php + public function aggregate(ArchiveProcessor $archiveProcessor): array + { + $idSite = $archiveProcessor->getParams()->getSite()->getId(); + if (empty($idSite)) { + return []; + } + + $this->doneLevel = 0; + + $records = $this->aggregateReport($archiveProcessor, $idSite); + return $records; + } + + public function buildForNonDayPeriod(ArchiveProcessor $archiveProcessor): void + { + parent::buildForNonDayPeriod($archiveProcessor); + + if ($this->report['report_type'] != Evolution::ID) { + return; + } + + // handle metrics that must be aggregated from raw data for multiple periods (ie unique metrics) + $idSite = $archiveProcessor->getParams()->getSite()->getId(); + if (empty($idSite)) { + return; + } + + $periodLabel = $archiveProcessor->getParams()->getPeriod()->getLabel(); + $metrics = $this->getArchivableMetricsInReport(); + + $rawDataMetricNames = []; + foreach ($metrics as $metric) { + if ($this->shouldAggregateRawDataForMultiPeriodMetric($metric, $periodLabel)) { + $rawDataMetricNames[] = $metric->getName(); + } + } + + if (!empty($rawDataMetricNames)) { + $aggregatedRecords = $this->aggregateReport($archiveProcessor, $idSite, $rawDataMetricNames); + foreach ($aggregatedRecords as $name => $value) { + if ($value instanceof DataTable) { + Common::destroy($value); // not needed + $aggregatedRecords[$name] = null; + } + } + + $aggregatedRecords = array_filter($aggregatedRecords); + $archiveProcessor->insertNumericRecords($aggregatedRecords); + } + } + + public function aggregateReport(ArchiveProcessor $archiveProcessor, int $idSite, $onlyMetrics = array(), bool $isDryRun = false): array + { + $report = $this->report; + + /** @var DataTable[] $records */ + $records = []; + + /** @var Dimension[] $allDimensions */ + $allDimensions = array(); + + if (!empty($report['dimensions'])) { + foreach ($report['dimensions'] as $dimension) { + $columnInstance = $this->dimension->factory($dimension); + if (!empty($columnInstance)) { + $allDimensions[] = $columnInstance; + } else { + $columnInstance = $this->findNotFoundCustomDimensionManually($dimension, $idSite); + + if (!empty($columnInstance)) { + $allDimensions[] = $columnInstance; + } + } + } + } + + $metrics = $this->getArchivableMetricsInReport(); + + if (empty($metrics)) { + return $records; + } + + if ($report['report_type'] === Table::ID && empty($allDimensions)) { + // none of the orignally assigned dimensions exist anymore. no need to do anything + return $records; + } + + if (!empty($onlyMetrics)) { + foreach ($metrics as $index => $metric) { + if (!in_array($metric->getName(), $onlyMetrics)) { + unset($metrics[$index]); + } + } + $metrics = array_values($metrics); + } + + if (empty($metrics)) { + return $records; + } + + $record = new DataTable(); + + $executionPlan = new ExecutionPlan($allDimensions, $metrics); + $dimensionsPlan = $executionPlan->getDimensionsPlan(); + + foreach ($dimensionsPlan as $dimensionsGroup) { + $metricsPlan = $executionPlan->getMetricsPlanForGroup(); + + // for each group of dimensions, we need to resolve all the metrics in several queries + foreach ($metricsPlan as $metricsToFetch) { + $queryBuilder = new QueryBuilder($archiveProcessor->getLogAggregator(), $this->configuration, $archiveProcessor->getParams()); + + foreach ($dimensionsGroup['left'] as $index => $dimension) { + try { + /** @var Dimension $dimension */ + $queryBuilder->addDimension($dimension, false); + } catch (NotJoinableException $e) { + Log::info(sprintf('Ignored dimension %s in report %d as it is not joinable', $dimension->getId(), $report['idcustomreport'])); + } + } + + foreach ($dimensionsGroup['right'] as $index => $dimension) { + try { + /** @var Dimension $dimension */ + $queryBuilder->addDimension($dimension, true); + } catch (NotJoinableException $e) { + Log::info(sprintf('Ignored dimension %s in report %d as it is not joinable', $dimension->getId(), $report['idcustomreport'])); + } + } + + foreach ($metricsToFetch as $metric) { + try { + /** @var ArchivedMetric $metric */ + $queryBuilder->addMetric($metric); + } catch (NotJoinableException $e) { + Log::info(sprintf('Ignored metric %s in report %d as it is not joinable', $metric->getName(), $report['idcustomreport'])); + } + } + + if (!$queryBuilder->isValid()) { + continue; + } + + if (!empty($report['segment_filter'])) { + try { + $queryBuilder->addSegmentFilter($report['segment_filter'], $idSite); + } catch (\Exception $e) { + if (strpos($e->getMessage(), 'is not a supported segment') !== false) { + // eg a plugin was uninstalled etc + continue; + } + throw $e; + } + } + + $query = $queryBuilder->buildQuery(); + if ($isDryRun) { + continue; + } + + try { + $db = $archiveProcessor->getLogAggregator()->getDb(); + $cursor = $db->query($query['sql'], $query['bind']); + } catch (\Exception $e) { + // we also need to check for the 'maximum statement execution time exceeded' text as the query might be + // aborted at different stages and we can't really know all the possible codes at which it may be aborted etc + if ($this->configuration->getMaxExecutionTime()) { + // handling this in the IF in here as it requires newer version of Matomo as those constants weren't defined before + // Matomo 3.12 or so + $isMaxExecutionTimeError = strpos($e->getMessage(), 'maximum statement execution time exceeded') !== false + || $db->isErrNo($e, DbMigration::ERROR_CODE_MAX_EXECUTION_TIME_EXCEEDED_QUERY_INTERRUPTED) + || $db->isErrNo($e, DbMigration::ERROR_CODE_MAX_EXECUTION_TIME_EXCEEDED_SORT_ABORTED); + if ($isMaxExecutionTimeError) { + $params = array( + 'sql' => $query['sql'], + 'bind' => $query['bind'], + 'segment' => $archiveProcessor->getParams()->getSegment()->getString(), + 'dateStart' => $archiveProcessor->getParams()->getDateStart()->getDatetime(), + 'dateEnd' => $archiveProcessor->getParams()->getDateEnd()->getDatetime(), + 'report' => $report, + ); + + /** + * @ignore + * @internal + */ + Piwik::postEvent('Live.queryMaxExecutionTimeExceeded', array($params)); + + throw new \Exception('Max execution time exceeded: The custom report ' . $report['idcustomreport'] . ' took too long to execute.', 1, $e); + } + } + // var_export($queryBuilder->getReportQuery()->getFrom()); + // var_export($queryBuilder->getReportQuery()->getSelect()); + // var_export($queryBuilder->getReportQuery()->getWhere()); + // echo $query['sql']; + throw $e; + } + + // we need to bring them in correct order again in case they were reversed + $this->makeRegularReport($record, $records, $dimensionsGroup['left'], $cursor, $idSite); + } + + $this->doneLevel = count($dimensionsGroup['left']); + } + + if ($isDryRun) { + return $records; + } + + $recordName = Archiver::makeRecordName($report['idcustomreport'], $report['revision']); + $records[$recordName] = $record; + return $records; + } + + private function findNotFoundCustomDimensionManually(string $dimensionId, int $idSite): ?CustomDimension + { + $manager = Plugin\Manager::getInstance(); + + if ( + strpos($dimensionId, 'CustomDimension.') === 0 + && $manager->isPluginActivated('CustomDimensions') + ) { + try { + $configuration = StaticContainer::get('Piwik\Plugins\CustomDimensions\Dao\Configuration'); + } catch (\Exception $e) { + // plugin does not have the class + return null; + } + + if (!$configuration || !method_exists($configuration, 'getCustomDimensionsForSite')) { + return null; + } + + $dimensions = $configuration->getCustomDimensionsForSite($idSite); + foreach ($dimensions as $dimension) { + if (!$dimension['active']) { + continue; + } + + $custom = new CustomDimension(); + $custom->initCustomDimension($dimension); + + if ($custom->getId() === $dimensionId) { + return $custom; + } + } + } + + return null; + } + + /** + * @return ArchivedMetric[] + */ + public function getArchivableMetricsInReport(): array + { + $metrics = array(); + + $report = $this->report; + if (!empty($report['metrics'])) { + foreach ($report['metrics'] as $metric) { + $metrics = $this->getMetrics($metrics, $metric); + } + } + + return $metrics; + } + + private function getMetrics(array $metricInstances, string $metricName): array + { + $metricInstance = $this->metricsList->getMetric($metricName); + + if ($metricInstance && $metricInstance instanceof ArchivedMetric) { + if (!in_array($metricInstance, $metricInstances, $strict = true)) { + $metricInstances[] = $metricInstance; + } + } elseif ($metricInstance && $metricInstance instanceof ProcessedMetric) { + $depMetrics = $metricInstance->getDependentMetrics(); + foreach ($depMetrics as $depMetric) { + $metricInstances = $this->getMetrics($metricInstances, $depMetric); + } + } + + return $metricInstances; + } + + private function usesSqlFunction(string $function, string $select): bool + { + return preg_match('/(' . $function . ')\s*\(/', $select); + } + + + /** + * @param Dimension[] $dimensionsInThisRun + * @param \Zend_Db_Statement $cursor + * @param int $idSite + */ + private function makeRegularReport(DataTable $mainRecord, array &$records, array $dimensionsInThisRun, $cursor, int $idSite): void + { + $report = $this->report; + + switch ($report['report_type']) { + case Evolution::ID: + $row = $cursor->fetch(); + + if (!empty($row)) { + foreach ($row as $metric => $value) { + $records[Archiver::makeEvolutionRecordName($report['idcustomreport'], $report['revision'], $metric)] = $value; + } + } + return; // TODO: is the main report archived in this case? double check + } + + $isDimBinaryMap = $dimColumnMap = []; + foreach ($dimensionsInThisRun as $index => $dimension) { + $isDimBinaryMap[$index] = $dimension->getType() === Dimension::TYPE_BINARY; + $dimColumnMap[$index] = $dimension->getId() ?: null; + } + + while ($row = $cursor->fetch()) { + $columns = []; + $dimensionLabelMap = []; + foreach ($dimensionsInThisRun as $index => $dimension) { + if ($isDimBinaryMap[$index]) { + $row[$dimension->getId()] = bin2hex($row[$dimension->getId()]); + } + + if (isset($row[$dimension->getId()])) { + $row[$dimension->getId()] = $dimension->groupValue($row[$dimension->getId()], $idSite); + } + + $dimensionLabel = Archiver::LABEL_NOT_DEFINED; + $dimensionColumn = $dimColumnMap[$index]; + if (isset($dimensionColumn) && isset($row[$dimensionColumn])) { + $dimensionLabel = $row[$dimensionColumn]; + unset($row[$dimensionColumn]); + + if ($this->isEmptyLabel($dimensionLabel)) { + $dimensionLabel = Archiver::LABEL_NOT_DEFINED; + } + } + $dimensionLabelMap[$index] = $dimensionLabel; + + foreach ($this->columnAggregationOps as $metricName => $ignore) { + $columns[$metricName] = (float)($row[$metricName] ?? 0); + } + + $this->sumRowsForIndex($mainRecord, $columns, $dimensionLabelMap, $index + 1); + } + } + + $cursor->closeCursor(); + } + + private function sumRowsForIndex(DataTable $mainRecord, array &$columns, array $dimensionLabelMap, int $level): void + { + // If this level has already been done, skip + if ($this->doneLevel >= $level) { + return; + } + + $columns['level'] = $level; + // If this is level 1, simply sum the row and return + if ($level === 1) { + $mainRecord->sumRowWithLabel($dimensionLabelMap[0], $columns, $this->columnAggregationOps); + + return; + } + + $rowList = []; + // Build the top level row + $rowList[] = $mainRecord->sumRowWithLabel($dimensionLabelMap[0], []); + // Build all the subtables above the current subtable + for ($i = 1; $i < $level - 1; $i++) { + $rowList[] = $rowList[$i - 1]->sumRowWithLabelToSubtable($dimensionLabelMap[$i], []); + } + + // Sum the current subtable + $rowList[$level - 2]->sumRowWithLabelToSubtable($dimensionLabelMap[$level - 1], $columns, $this->columnAggregationOps); + } + + /** + * public wrapper for finalizing an archive + */ + public function finalize(ArchiveProcessor $archiveProcessor): void + { + $archiveProcessor->getArchiveWriter()->flushSpools(); + } + + public function getMetricAggregations(): array + { + $metrics = $this->getArchivableMetricsInReport(); // TODO: cache result of this method, it's used a lot + + $allMetricNames = array(); + foreach ($metrics as $metric) { + $query = $metric->getQuery(); + $metricName = $metric->getName(); + + $columnsAggregationOperation = 'sum'; + if ($this->usesSqlFunction('sum', $query)) { + $columnsAggregationOperation = 'sum'; // we check for sum again in case there is like sum(min(0,1)) + } elseif ($this->usesSqlFunction('min', $query)) { + $columnsAggregationOperation = 'min'; + } elseif ($this->usesSqlFunction('max', $query)) { + $columnsAggregationOperation = 'max'; + } + // TODO add possibility for metric to add custom callback aggregation method and / or operation keyword + + $allMetricNames[$metricName] = $columnsAggregationOperation; + } + + $allMetricNames['level'] = function ($thisColumnValue, $columnToSumValue) { + // we do not want to sum the level or so. always keep either value + if (!empty($thisColumnValue)) { + return $thisColumnValue; + } + if (!empty($columnToSumValue)) { + return $columnToSumValue; + } + }; + + return $allMetricNames; + } + + private function getMetricToSortMultiPeriod(): ?string + { + $metrics = $this->getArchivableMetricsInReport(); + + $metricsAvailableForSort = []; + foreach ($metrics as $metric) { + $metricName = $metric->getName(); + if ($metricName !== 'nb_uniq_visitors' && $metricName !== 'nb_users' && $metricName !== 'nb_uniq_corehome_userid') { + // we don't want to sort by any unique metric as they are not available in aggregated reports + $metricsAvailableForSort[] = $metricName; + } + } + + $metricToSort = $this->columnToSortByBeforeTruncation; + foreach (array('nb_visits', 'sum_actions', 'hits', 'pageviews') as $preferredSortMetric) { + if (in_array($preferredSortMetric, $metricsAvailableForSort, true)) { + $metricToSort = $preferredSortMetric; + break; + } + } + + if (!$metricToSort && !empty($metricsAvailableForSort)) { + // we prefer to sort by nb_visits if it is present + $metricToSort = array_shift($metricsAvailableForSort); + } + + return $metricToSort; + } + + private function shouldAggregateRawDataForMultiPeriodMetric(ArchivedMetric $metric, string $periodLabel): bool + { + return in_array($metric->getName(), GetCustomReport::$RAW_DATA_UNIQUE_METRICS) + && GetCustomReport::supportsUniqueMetric($periodLabel, true) + && !$this->configuration->forceAggregateUniqueMetricsFromReportsInsteadOfRawDataInEvolutionReport($periodLabel); + } + + protected function isEmptyLabel(string $label): bool + { + return !isset($label) || $label === '' || $label === false; + } +} diff --git a/files/plugin-CustomReports-5.4.3/ReportType/Evolution.php b/files/plugin-CustomReports-5.4.3/ReportType/Evolution.php new file mode 100644 index 0000000..39f85e8 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/ReportType/Evolution.php @@ -0,0 +1,100 @@ +getMetricsRequiredForReport(null, $requestedColumns); + + $customReport = StaticContainer::get('\Piwik\Plugins\CustomReports\Model\CustomReportsModel'); + $reportData = $customReport->getCustomReport($idSite, $idCustomReport); + + $recordNamePrefix = Archiver::makeEvolutionRecordNamePrefix($idCustomReport, $reportData['revision']); + + $recordNames = array_map(function ($metricName) use ($idCustomReport, $reportData) { + return Archiver::makeEvolutionRecordName($idCustomReport, $reportData['revision'], $metricName); + }, $columns); + + $dataTable = $archive->getDataTableFromNumeric($recordNames); + $dataTable->filter(function (DataTable $table) use ($recordNamePrefix) { + foreach ($table->getRows() as $row) { + $columns = $row->getColumns(); + foreach ($columns as $column => $value) { + if (strpos($column, $recordNamePrefix) === 0) { + $row->setColumn(substr($column, strlen($recordNamePrefix)), $value); + $row->deleteColumn($column); + } + } + } + }); + + if (!GetCustomReport::supportsUniqueMetric($period, $isEvolution = true)) { + $hasUniqueMetrics = array_intersect(GetCustomReport::$RAW_DATA_UNIQUE_METRICS, array_keys($report->getMetrics())); + if (!empty($hasUniqueMetrics)) { + $dataTable->queueFilter('ColumnDelete', array(GetCustomReport::$RAW_DATA_UNIQUE_METRICS)); + } + } + + if (!empty($requestedColumns)) { + $dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $requestedColumns)); + } + + return $dataTable; + } +} diff --git a/files/plugin-CustomReports-5.4.3/ReportType/ReportType.php b/files/plugin-CustomReports-5.4.3/ReportType/ReportType.php new file mode 100644 index 0000000..642d670 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/ReportType/ReportType.php @@ -0,0 +1,62 @@ +getCustomReport($idSite, $idCustomReport); + + $recordName = Archiver::makeRecordName($idCustomReport, $reportData['revision']); + + $table = Archive::createDataTableFromArchive($recordName, $idSite, $period, $date, $segment, $expanded, $flat, $idSubtable); + $table->disableFilter('AddColumnsProcessedMetrics'); + + $recordBuilder = StaticContainer::getContainer()->make(CustomReport::class, ['report' => $reportData]); + $aggregations = $recordBuilder->getMetricAggregations(); + $table->filter(function (DataTable $t) use ($aggregations) { + $t->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $aggregations); + }); + + $report = new GetCustomReport(); + $report->initCustomReport($reportData, $table); + $dimension = $report->getDimension(); + $dimensions = $reportData['dimensions']; + $nestedDimensions = []; + if (!empty($dimensions) && count($dimensions) > 1) { + foreach ($dimensions as $index => $dimensionName) { + if ($index === 0) { + continue; + } + $dimensionToAdd = $report->getDimensionInstance($dimensionName); + if ($dimensionToAdd && $dimension !== $dimensionToAdd) { + $nestedDimensions[] = $dimensionToAdd; + } + } + } + + if (!empty($dimension) && $dimension->getSegmentName() && !$flat && !$idSubtable) { + if ($dimension instanceof DownloadUrl) { + // skip see DEV-2635, for now disabling as the segment won't work properly + } elseif (!empty($reportData['segment_filter'])) { + // we do not add segmented label to table when requesting a subtable since we would need to combine the segment + // with the root table or all root tables above this table. We do not have this information though + $segmentFilter = $reportData['segment_filter']; + $segmentNameDimension = $dimension->getSegmentName(); + $table->filter(function (DataTable $table) use ($segmentFilter, $segmentNameDimension) { + foreach ($table->getRowsWithoutSummaryRow() as $row) { + $firstPart = $segmentNameDimension . '==' . urlencode($row->getColumn('label')); + $row->setMetadata('segment', $firstPart . ';' . $segmentFilter); + } + }); + } else { + $table->filter('AddSegmentByLabel', array($dimension->getSegmentName())); + } + } + + if (!empty($dimension)) { + // we cannot really queue since the sorting by label wouldn't work correctly when it would sort eg + // a translation key or an enum value like "EU" or "MAC" + $table->filter('Piwik\Plugins\CustomReports\DataTable\Filter\ReportTypeTableFilter', [$idSite, $dimension, $nestedDimensions, $flat]); + } + + if (!GetCustomReport::supportsUniqueMetric($period, $isEvolution = false)) { + $hasUniqueMetrics = array_intersect(GetCustomReport::$RAW_DATA_UNIQUE_METRICS, array_keys($report->getMetrics())); + if (!empty($hasUniqueMetrics)) { + $table->queueFilter('ColumnDelete', array(GetCustomReport::$RAW_DATA_UNIQUE_METRICS)); + } + } + + // we cannot delete level column otherwise GetCustomReport won't be able to detect currently active dimension anymore + // $table->filter('ColumnDelete', array('level')); + + return $table; + } +} diff --git a/files/plugin-CustomReports-5.4.3/Updates/5.0.18.php b/files/plugin-CustomReports-5.4.3/Updates/5.0.18.php new file mode 100644 index 0000000..a827ec9 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Updates/5.0.18.php @@ -0,0 +1,68 @@ +migration = $factory; + } + + /** + * Return database migrations to be executed in this update. + * + * Database migrations should be defined here, instead of in `doUpdate()`, since this method is used + * in the `core:update` command when displaying the queries an update will run. If you execute + * migrations directly in `doUpdate()`, they won't be displayed to the user. Migrations will be executed in the + * order as positioned in the returned array. + * + * @param Updater $updater + * @return Migration\Db[] + */ + public function getMigrations(Updater $updater) + { + $tableName = Common::prefixTable('custom_reports'); + $updateQuery = "UPDATE $tableName SET `metrics` = CONCAT(SUBSTR(`metrics`, 1, CHAR_LENGTH(`metrics`) - 1), ',\"sum_ecommerce_productquantity\"]')"; + $updateQuery .= " WHERE `status` = 'active' AND `metrics` LIKE '%product_revenue%' AND `metrics` NOT LIKE '%ecommerce_productquantity%';"; + $migration = $this->migration->db->sql($updateQuery); + + return [ + $migration + ]; + } + + /** + * Perform the incremental version update. + * + * This method should perform all updating logic. If you define queries in the `getMigrations()` method, + * you must call {@link Updater::executeMigrations()} here. + * + * @param Updater $updater + */ + public function doUpdate(Updater $updater) + { + $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Updates/5.1.0.php b/files/plugin-CustomReports-5.4.3/Updates/5.1.0.php new file mode 100644 index 0000000..b7cba2c --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Updates/5.1.0.php @@ -0,0 +1,62 @@ +migration = $factory; + } + + /** + * Return database migrations to be executed in this update. + * + * Database migrations should be defined here, instead of in `doUpdate()`, since this method is used + * in the `core:update` command when displaying the queries an update will run. If you execute + * migrations directly in `doUpdate()`, they won't be displayed to the user. Migrations will be executed in the + * order as positioned in the returned array. + * + * @param Updater $updater + * @return Migration\Db[] + */ + public function getMigrations(Updater $updater) + { + return [ + $this->migration->db->addColumn('custom_reports', 'subcategory_order', 'MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 9999999', 'subcategory') + ]; + } + + /** + * Perform the incremental version update. + * + * This method should perform all updating logic. If you define queries in the `getMigrations()` method, + * you must call {@link Updater::executeMigrations()} here. + * + * @param Updater $updater + */ + public function doUpdate(Updater $updater) + { + $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Updates/5.2.0.php b/files/plugin-CustomReports-5.4.3/Updates/5.2.0.php new file mode 100644 index 0000000..ef0d2bd --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Updates/5.2.0.php @@ -0,0 +1,63 @@ +migration = $factory; + } + + /** + * Return database migrations to be executed in this update. + * + * Database migrations should be defined here, instead of in `doUpdate()`, since this method is used + * in the `core:update` command when displaying the queries an update will run. If you execute + * migrations directly in `doUpdate()`, they won't be displayed to the user. Migrations will be executed in the + * order as positioned in the returned array. + * + * @param Updater $updater + * @return Migration\Db[] + */ + public function getMigrations(Updater $updater) + { + return [ + $this->migration->db->changeColumn('custom_reports', 'idsite', 'idsite', 'INT NOT NULL'), + $this->migration->db->addColumn('custom_reports', 'multiple_idsites', 'VARCHAR(2000) NULL', 'status') + ]; + } + + /** + * Perform the incremental version update. + * + * This method should perform all updating logic. If you define queries in the `getMigrations()` method, + * you must call {@link Updater::executeMigrations()} here. + * + * @param Updater $updater + */ + public function doUpdate(Updater $updater) + { + $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Updates/5.4.0.php b/files/plugin-CustomReports-5.4.3/Updates/5.4.0.php new file mode 100644 index 0000000..898074e --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Updates/5.4.0.php @@ -0,0 +1,77 @@ +CustomReports; + $maxRows = (!empty($customReportsConfig['datatable_archiving_maximum_rows_custom_reports']) ? $customReportsConfig['datatable_archiving_maximum_rows_custom_reports'] : Configuration::DEFAULT_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT); + $maxSubTableRows = ( + !empty($customReportsConfig['datatable_archiving_maximum_rows_subtable_custom_reports']) ? + $customReportsConfig['datatable_archiving_maximum_rows_subtable_custom_reports'] + : Configuration::DEFAULT_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT + ); + for ($i = 1; $i <= 3; $i++) { + if (empty($customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $i])) { + $customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $i] = $maxRows; + } + + // To avoid customer confusion, don't create a subtable entry for first dimension as there are no subtables + if ($i > 1 && empty($customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . $i])) { + $customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . $i] = $maxSubTableRows; + } + } + + if (empty($customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . 4])) { + $customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . 4] = 125; + } + if (empty($customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . 4])) { + $customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . 4] = 100; + } + + for ($i = 5; $i <= 6; $i++) { + if (empty($customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $i])) { + $customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS . $i] = Configuration::DEFAULT_ARCHIVE_MAXIMUM_ROWS_CUSTOM_DIMENSIONS_DEFAULT; + } + + if (empty($customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . $i])) { + $customReportsConfig[Configuration::KEY_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS . $i] = Configuration::DEFAULT_ARCHIVE_MAXIMUM_ROWS_SUB_TABLE_CUSTOM_DIMENSIONS_DEFAULT; + } + } + + if (isset($customReportsConfig['datatable_archiving_maximum_rows_custom_reports'])) { + unset($customReportsConfig['datatable_archiving_maximum_rows_custom_reports']); + } + if (isset($customReportsConfig['datatable_archiving_maximum_rows_subtable_custom_reports'])) { + unset($customReportsConfig['datatable_archiving_maximum_rows_subtable_custom_reports']); + } + + $config->CustomReports = $customReportsConfig; + $config->forceSave(); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Updates/5.4.2.php b/files/plugin-CustomReports-5.4.3/Updates/5.4.2.php new file mode 100644 index 0000000..35ad22e --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Updates/5.4.2.php @@ -0,0 +1,42 @@ +CustomReports; + + if (!isset($customReportsConfig[Configuration::KEY_MAX_DIMENSIONS])) { + $configuration = StaticContainer::get(Configuration::class); + $customReportsConfig[Configuration::KEY_MAX_DIMENSIONS] = $configuration->getMaxDimensions(); + $config->CustomReports = $customReportsConfig; + $config->forceSave(); + } + } +} diff --git a/files/plugin-CustomReports-5.4.3/Widgets/BaseWidget.php b/files/plugin-CustomReports-5.4.3/Widgets/BaseWidget.php new file mode 100644 index 0000000..e1fe146 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Widgets/BaseWidget.php @@ -0,0 +1,36 @@ +setOrder(99); + $config->setCategoryId(CustomReportsDao::DEFAULT_CATEGORY); + } + + protected static function getIdSite() + { + return Common::getRequestVar('idSite', false, 'int'); + } +} diff --git a/files/plugin-CustomReports-5.4.3/Widgets/GetManageReports.php b/files/plugin-CustomReports-5.4.3/Widgets/GetManageReports.php new file mode 100644 index 0000000..ec998ba --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/Widgets/GetManageReports.php @@ -0,0 +1,74 @@ +setCategoryId(CustomReportsDao::DEFAULT_CATEGORY); + $config->setSubcategoryId('CustomReports_ManageReports'); + $config->setName('CustomReports_ManageReports'); + $config->setParameters(array('showtitle' => 0)); + $config->setOrder(99); + $config->setIsNotWidgetizable(); + + $idSite = Common::getRequestVar('idSite', 0, 'int'); + if (self::getAccessValidator()->canWrite($idSite)) { + $config->enable(); + } else { + $config->disable(); + } + } + + private static function getAccessValidator() + { + return StaticContainer::get('Piwik\Plugins\CustomReports\Input\Validator'); + } + + public function render() + { + $idSite = Common::getRequestVar('idSite', null, 'int'); + self::getAccessValidator()->checkWritePermission($idSite); + + $browserArchivingDisabled = !Rules::isBrowserTriggerEnabled(); + $browserArchivingDisabled = json_encode($browserArchivingDisabled); + + $configuration = StaticContainer::get(Configuration::class); + $reArchiveLastN = $configuration->getReArchiveReportsInPastLastNMonths(); + $reArchiveLastN = json_encode($reArchiveLastN); + $maxDimensions = $configuration->getMaxDimensions(); + $maxDimensions = json_encode($maxDimensions); + $isCloud = \Piwik\Plugin\Manager::getInstance()->isPluginLoaded('Cloud'); + $isCloud = json_encode($isCloud); + + return "
"; + } +} diff --git a/files/plugin-CustomReports-5.4.3/config/config.php b/files/plugin-CustomReports-5.4.3/config/config.php new file mode 100644 index 0000000..fc9f8c7 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/config/config.php @@ -0,0 +1,5 @@ + Piwik\DI::add(array('idCustomReport')), +); diff --git a/files/plugin-CustomReports-5.4.3/docs/index.md b/files/plugin-CustomReports-5.4.3/docs/index.md new file mode 100644 index 0000000..a962837 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/docs/index.md @@ -0,0 +1,3 @@ +## Documentation + +The [Custom Reports User Guide](https://matomo.org/docs/custom-reports/) and the [Custom Reports FAQ](https://matomo.org/faq/custom-reports/) cover how to get the most out of this plugin. \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/lang/bg.json b/files/plugin-CustomReports-5.4.3/lang/bg.json new file mode 100644 index 0000000..27e625b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/bg.json @@ -0,0 +1,7 @@ +{ + "CustomReports": { + "CustomReport": "Персонализиран отчет", + "CustomReports": "Персонализирани отчети", + "ManageReports": "Управление на отчети" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/cs.json b/files/plugin-CustomReports-5.4.3/lang/cs.json new file mode 100644 index 0000000..5538cd4 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/cs.json @@ -0,0 +1,12 @@ +{ + "CustomReports": { + "ErrorNotAnArray": "\"%1$s\" musí být pole.", + "ErrorXNotProvided": "Zadejte prosím hodnotu pro \"%1$s\".", + "ErrorXNotWhitelisted": "Hodnota pro \"%1$s\" není povolena, použijte jednu z: %2$s.", + "ErrorXTooLong": "\"%1$s\" je příliš dlouhé, max %2$s znaků je povoleno.", + "Filter": "Filtr", + "Unlock": "Odemknout", + "UpdatingData": "Aktualizuji data…", + "ViewReportInfo": "Zobrazit report" + } +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/da.json b/files/plugin-CustomReports-5.4.3/lang/da.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/da.json rename to files/plugin-CustomReports-5.4.3/lang/da.json diff --git a/files/plugin-CustomReports-5.4.3/lang/de.json b/files/plugin-CustomReports-5.4.3/lang/de.json new file mode 100644 index 0000000..7d7dcfb --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/de.json @@ -0,0 +1,79 @@ +{ + "CustomReports": { + "AddDimension": "Dimension hinzufügen", + "AddMetric": "Metrik hinzufügen", + "ApplyTo": "Anwenden auf", + "AvailableAllWebsites": "Verfügbar in allen Websites", + "Category": "Hauptkategorie", + "CommonUniqueMetric": "Summe von %1$s", + "CommonUniqueMetricDescription": "%1$s. Wenn Sie einen Zeitraum betrachten, der kein Tag ist, wird diese Metrik zu \"Summe von %2$s\". Wenn in einem solchen Fall dieselbe %3$s an 2 oder mehr Tagen innerhalb des ausgewählten Zeitraums erscheint, wird sie als 2 oder die Gesamtzahl der Tage gezählt, an denen sie erschienen ist, und nicht als 1.", + "ConfirmUnlockReport": "Wollen Sie wirklich diesen Bericht entsperren? Wenn Sie diesen Bericht aktualisieren, werden Berichte aus der Vergangenheit für diesen benutzerdefinierten Bericht nicht mehr erreichbar sein.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Sind Sie sicher, dass Sie diesen Bericht entsperren möchten? Wenn Sie den Inhalt dieses Berichts aktualisieren, werden zuvor erstellte Berichte für diesen benutzerdefinierten Bericht nicht mehr verfügbar sein und Berichte für die letzten %1$s Monate werden neu erstellt.", + "CreateNewReport": "Neuen Bericht erstellen", + "CustomReport": "Benutzerdefinierter Bericht", + "CustomReportIntroduction": "Mit benutzerdefinierte Berichte (Custom Reports) können Sie maßgeschneiderte Berichte erstellen, um neue Einblicke zu erhalten, die mit Standardberichten nicht möglich sind. Sie wählen die Dimensionen (z.B. \"Gerätetyp\" und \"Browser\") und Metriken (z.B. \"Anzahl der Besucher\" und \"Absprungrate\") sowie wie Art und Weise wie diese angezeigt werden sollen, um die Daten zu erhalten, die Sie benötigen.", + "CustomReports": "Benutzerdefinierte Berichte", + "DeleteReportConfirm": "Wollen Sie wirklich diesen Bericht löschen? Bereits generierte Berichte für diesen benutzerdefinierten Bericht werden danach nicht mehr erreichbar sein.", + "DeleteReportInfo": "Wenn Sie diesen Bericht löschen, werden die zuvor generierten Berichte für diesen benutzerdefinierten Bericht nicht mehr erreichbar sein und es ist nicht möglich diesen Schritt rückgängig zu machen.", + "Dimension": "Dimension", + "Dimensions": "Dimensionen", + "EditReport": "Editiere Bericht", + "ErrorArrayMissingItem": "Fehlender Wert in \"%1$s\" array an der Position \"%2$s\".", + "ErrorDuplicateItem": "Es ist nicht erlaubt den gleichen %s mehrfach zu verwenden.", + "ErrorInvalidValueInArray": "Der Wert \"%1$s\" an der Position \"%2$s\" existiert nicht.", + "ErrorMissingDimension": "Mindestens eine Dimension muss ausgewählt werden.", + "ErrorMissingMetric": "Mindestens eine Metrik muss ausgewählt werden.", + "ErrorNotAnArray": "\"%1$s\" muss ein array sein.", + "ErrorReportDoesNotExist": "Der angefragte Benutzerdefinierte Bericht existiert für diese Webseite nicht. Stellen Sie sicher, dass die Seite korrekt ist.", + "ErrorReportNameDuplicate": "Der Name des Berichts wird bereits in einem anderen Bericht verwendet.", + "ErrorTooManyDimension": "Zu viele Dimensionen ausgewählt. Maximal %s Dimensionen können ausgewählt werden.", + "ErrorXNotProvided": "Bitte geben Sie einen Wert für \"%1$s\" an.", + "ErrorXNotWhitelisted": "Der Wert für \"%1$s\" ist nicht erlaubt, verwenden Sie einen von diesen: %2$s.", + "ErrorXTooLong": "\"%1$s\" ist zu lang, maximal %2$s Zeichen sind erlaubt.", + "FieldDescriptionPlaceholder": "z.B. 'Die Anzahl der Besucher pro Land'", + "FieldNamePlaceholder": "z.B. 'Besucher pro Land'", + "Filter": "Filter", + "InfoReportIsLocked": "Dieser Bericht ist derzeit gesperrt. Klicken Sie auf \"entsperren\" um diesen Bericht bearbeiten zu können. Wenn Sie diesen Bericht aktualisieren, werden Berichte aus der Vergangenheit für diesen benutzerdefinierten Bericht nicht mehr erreichbar sein.", + "InfoReportIsLockedBrowserArchivingDisabled": "Dieser Bericht ist derzeit gesperrt und Sie müssen bestätigen, dass Sie diesen Bericht \"entsperren\" möchten. Wenn Sie Änderungen am Inhalt dieses Berichts vornehmen und ihn anschließend aktualisieren, werden neue Berichtsdaten für die letzten %1$s Monate neu generiert und zuvor erstellte Berichte für diesen benutzerdefinierten Bericht sind nicht mehr verfügbar.", + "ManageReports": "Benutzerdefinierte Berichte verwalten", + "ManageReportsSubcategoryHelp": "Mit benutzerdefinierten Berichten können Sie neue Berichte erstellen, um neue Erkenntnisse zu gewinnen, die mit Standardberichten nicht möglich sind. In diesem Abschnitt können Sie benutzerdefinierte Berichte für Ihre Website erstellen und verwalten.", + "NCustomReports": "%s benutzerdefinierte Berichte", + "NoCustomReportsFound": "Keine benutzerdefinierte Berichte gefunden", + "NoDataNotArchivedYet": "Da der Bericht erst kürzlich erstellt oder bearbeitet wurde, kann es einige Stunden dauern bis die Berichtsdaten verfügbar werden, falls Sie sich die heutigen Berichte ansehen. Die Berichts-Daten für Daten vor der Erstellung des Berichts werden nicht verfügbar sein.", + "NoDataNotArchivedYetReprocess": "Ein Systemadministrator kann Matomo jedoch veranlassen die Berichte dennoch %1$serneut zu verarbeiten%2$s damit die Berichte verfügbar werden.", + "NoDataRemovedMetrics": "Es werden keine Daten angezeigt, da der Bericht nur Metriken enthält, die für den gewählten Zeitraum nicht unterstützt werden (%s).", + "Preview": "Vorschau", + "PreviewDate": "Die Vorschau basiert auf den Daten von %s.", + "PreviewReport": "Berichtvorschau", + "PreviewSupportsDimension": "Die Vorschau unterstützt derzeit nur bis zu %s Dimensionen.", + "RemoveDimension": "Dimension entfernen", + "RemoveMetric": "Metrik entfernen", + "RemovedMetrics": "Diese Metriken wurden entfernt, da sie für die gewählte Zeitraum nicht korrekt berechnet werden können: %s.", + "ReportAllWebsitesHelp": "Wählen Sie, in welcher Website dieser Bericht verfügbar sein soll. Sie können \"Alle Websites\" auswählen um den Bericht in allen Websites verfügbar zu machen (der Bericht wird auch in Websites verfügbar sein, die in der Zukunft erstellt werden).", + "ReportAvailableToAllWebsites": "Dieser Bericht ist verfügbar in allen Websites.", + "ReportCategory": "Bericht Kategorie", + "ReportCategoryHelp": "Wählen Sie die Hauptkategorie, unter welcher dieser Bericht im Berichts-Menü verfügbar sein soll.", + "ReportContent": "Bericht Inhalt", + "ReportCreated": "Der Bericht wurde erfolgreich erstellt.", + "ReportDescriptionHelp": "Eine optionale Beschreibung für diesen Bericht. Diese wird angezeigt, wenn Sie auf das Hilfesymbol neben dem Berichtstitel klicken. Zum Beispiel können Sie hier den Zweck dieses Berichts erwähnen.", + "ReportHasFilterApplied": "Dieser Report hat den folgenden Filter angewendet: %s.", + "ReportMetricsHelp": "Metriken sind quantitative Messungen. Wenn Sie beispielsweise die Besucherzahl auf Ihrer Website erhöhen möchten, fügen Sie \"Besucher\" hinzu. Wollen Sie zum Beispiel die Leistung Ihrer Website verbessern, fügen Sie \"Durchschnittliche Generierungszeit\" hinzu.", + "ReportName": "Bericht Name", + "ReportNameHelp": "Definiert den Namen unter welchen dieser Bericht verfügbar sein wird.", + "ReportPage": "Seite des Berichts", + "ReportSegmentHelp": "Mit einem Filter (Segment) können Sie einen Bericht basierend auf einer Teilmenge Ihrer Besucher erstellen. Zum Beispiel können Sie die Benutzer die in diesem Bericht berücksichtigt werden auf mobile Geräte beschränken. Das heißt, der Bericht enthält lediglich Daten für die Benutzer, die Ihre Website mit einem mobilen Gerät besucht haben.", + "ReportSubcategory": "Bericht Unterkategorie", + "ReportSubcategoryHelp": "Optional kann dieser Bericht auf eine bereits existierte Berichts-Seite hinzugefügt werden. Wenn keine Unterkategorie ausgewählt ist, wird eine neue Seite für diesen Bericht unterhalb der ausgewählten Hauptkategorie erstellt.", + "ReportType": "Bericht Art", + "ReportUpdated": "Der Bericht wurde erfolgreich aktualisiert.", + "Type": "Art", + "Unlock": "Entsperren", + "UpdatingData": "Aktualisiere Daten…", + "ViewReportInfo": "Bericht ansehen", + "WarningOnUpdateReportMightGetLost": "Wenn Sie diesen Bericht aktualisieren, werden bereits generierte Berichte aus der Vergangenheit für diesen benutzerdefinierten Bericht nicht mehr zur Verfügung stehen.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "Wenn Sie diesen benutzerdefinierten Bericht aktualisieren, sind die zuvor erstellten Berichte nicht mehr verfügbar, und die Berichte für die letzten %1$s Monate werden neu erstellt.", + "WarningRequiresUnlock": "Um Änderungen an diesem Bericht vorzunehmen, muss der Bericht \"entsperrt\" werden. Damit Sie Änderungen vornehmen können, müssen Sie den Funnel \"entsperren\". Wenn Sie Änderungen an diesem Bericht vornehmen, werden bereits generierte Berichte aus der Vergangenheit nicht mehr zur Verfügung stehen.", + "WarningRequiresUnlockBrowserArchivingDisabled": "Um Änderungen am Inhalt dieses Berichts vorzunehmen, müssen Sie diesen Bericht \"entsperren\". Wenn Sie Änderungen and der Konfiguration des Berichts vornehmen und diesen Bericht aktualisieren, werden neue Berichtsdaten für die letzten %1$s Monate neu generiert und zuvor erstellte Berichte für diesen Bericht sind nicht mehr verfügbar.", + "WebsiteName": "Webseitenname" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/en.json b/files/plugin-CustomReports-5.4.3/lang/en.json new file mode 100644 index 0000000..431c2a4 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/en.json @@ -0,0 +1,123 @@ +{ + "CustomReports": { + "ManageReports": "Manage Reports", + "CustomReports": "Custom Reports", + "CustomReport": "Custom Report", + "NCustomReports": "%s custom reports", + "CustomReportIntroduction": "Custom Reports lets you create new reports to draw new insights that aren't possible with standard reports. You choose the dimensions (such as \"Device Type\" and \"Browser\") and metrics (such as \"Number of Visitors\" and \"Bounce Rate\") and how they should be displayed to get the unique actionable and useful data you need.", + "NoCustomReportsFound": "No custom reports found", + "EditReport": "Edit report", + "Preview": "Preview", + "PreviewReport": "Preview report", + "ViewReportInfo": "View report", + "CreateNewReport": "Create new report", + "Unlock": "Unlock", + "ApplyTo": "Apply to", + "ReportEditNotAllowedAllWebsitesUpdated": "Because this report is available for all websites, only a user with superuser access can change this report.", + "ReportEditNotAllowedMultipleWebsitesAccessIssue": "Because this report is available for multiple websites, only a superuser or an admin with access to all websites included in the report can modify it.", + "ReportAvailableToAllWebsites": "This report is available for all websites.", + "ReportAvailableToMultipleWebsites": "This report is available for multiple websites.", + "AvailableAllWebsites": "Available in all websites", + "WarningRequiresUnlock": "In order to make changes to this report content, you need to \"unlock\" this report. When you make changes to the report configuration and update this report, new reporting data needs to be generated and previously generated reports for this report won't be available anymore.", + "WarningOnUpdateReportMightGetLost": "When you update this custom report, previously generated reports for this custom report will become unavailable.", + "ConfirmUnlockReport": "Are you sure you want to unlock this report? When you update the report content of this report, previously generated reports for this custom report will become unavailable.", + "InfoReportIsLocked": "This report is currently locked and you need to confirm to \"unlock\" this report. When you make changes to this report content and update it afterwards, new reporting data needs to be generated and previously generated reports for this custom report won't be available anymore.", + "DeleteReportConfirm": "Are you sure you want to delete this custom report? Previously generated reports will no longer be available in the reporting UI.", + "DeleteReportInfo": "When you delete this report, its reports will no longer be available and you cannot undo this action.", + "ErrorXNotProvided": "Please provide a value for \"%1$s\".", + "ErrorXTooLong": "\"%1$s\" is too long, max %2$s characters are allowed.", + "ErrorNotAnArray": "\"%1$s\" has to be an array.", + "ErrorArrayMissingItem": "Missing value in \"%1$s\" array at position \"%2$s\".", + "ErrorDuplicateItem": "It is not allowed to use the same %s multiple times.", + "ErrorInvalidValueInArray": "The given \"%1$s\" at position \"%2$s\" does not exist.", + "ErrorReportDoesNotExist": "The requested custom report does not exist for this website. Please ensure the site is correct.", + "ErrorXNotWhitelisted": "The value for \"%1$s\" is not allowed, use one of: %2$s.", + "ErrorMissingDimension": "At least one dimension needs to be selected.", + "ErrorMissingMetric": "At least one metric needs to be selected.", + "ErrorTooManyDimension": "Too many dimensions selected. Max %s dimensions can be used.", + "ErrorInvalidDimension": "Dimension %1$s is not supported in Custom Reports.", + "PreviewSupportsDimension": "The preview currently only supports up to %s dimensions.", + "PreviewDate": "This preview is based on the data of %s.", + "RemovedMetrics": "These metrics were removed because they cannot be calculated correctly for this period: %s.", + "NoDataRemovedMetrics": "No data is shown because this report only contains metrics that are not supported by the selected period (%s).", + "Filter": "Filter", + "ReportHasFilterApplied": "This report has the following filter applied: %s.", + "Dimensions": "Dimensions", + "Dimension": "Dimension", + "RemoveDimension": "Remove dimension", + "RemoveMetric": "Remove metric", + "AddMetric": "Add metric", + "AddDimension": "Add dimension", + "ReportType": "Report type", + "Type": "Type", + "ReportContent": "Report content", + "ReportName": "Report name", + "ReportPage": "Report page", + "ReportCategory": "Report category", + "Category": "Category", + "ReportCategoryHelp": "Select the main reporting category under which this report will be available in the reporting menu.", + "ReportAllWebsitesHelp": "Select the website this report should be available for. You can also choose \"All websites\" to make this report available for all your sites (also sites that will be created in the future).", + "ReportAllWebsitesNonSuperUserHelp": "Select the website this report should be available for.", + "ReportDimensionsHelpNew": "A dimension typically describes characteristics and is shown in the first column of a report. You can select multiple dimensions (e.g., Browser, Country, City). At least one dimension must be selected.", + "ReportDimensionsHelpExtended": "If you require additional dimensions, you can increase the limit. %1$sLearn more%2$s.", + "ReportMetricsHelp": "Metrics are quantitative measurements. For example, if you want to increase the traffic on your website, include \"Visits\", if you are improving the performance of your website, include \"Avg. Generation Time\".", + "ReportSegmentHelp": "A filter lets you see this report only for a subset of your visitors. For example, you can filter this report down by mobile device users only.", + "ReportSubcategory": "Report subcategory", + "ReportSubcategoryHelp": "You can optionally add this report to any existing reporting page. If you don't choose a subcategory, a new reporting page under the selected category will be created using the report name.", + "ReportCreated": "The report has been successfully created.", + "ReportUpdated": "The report has been successfully updated.", + "ErrorReportNameDuplicate": "The report name is already in use by another report.", + "NoDataNotArchivedYet": "As the report was created or updated only recently, it may take a few hours for the data to become available when you are viewing today's reports. The report data for dates before this report was created won't become available.", + "NoDataNotArchivedYetReprocess": "However, a system administrator can force Matomo to %1$sreprocess the reports%2$s to make the data available.", + "UpdatingData": "Updating data…", + "FieldNamePlaceholder": "eg 'Visitors per Country'", + "FieldDescriptionPlaceholder": "eg 'The number of visitors per country'", + "ReportNameHelp": "Defines the name under which this report will be available.", + "ReportDescriptionHelp": "An optional description for your report which will be shown when you click on the help icon next to the report title. For example, you could mention the purpose of this report.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "When you update this custom report, previously generated reports will become unavailable and reports for the last %1$s months will be regenerated.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Are you sure you want to unlock this report? When you update the report content of this report, previously generated reports for this custom report will become unavailable and reports for the last %1$s months will be regenerated.", + "WarningRequiresUnlockBrowserArchivingDisabled": "In order to make changes to this report content, you need to \"unlock\" this report. When you make changes to the report configuration and update this report, new reporting data for the last %1$s months will be regenerated and previously generated reports for this report won't be available anymore.", + "InfoReportIsLockedBrowserArchivingDisabled": "This report is currently locked and you need to confirm to \"unlock\" this report. When you make changes to this report content and update it afterwards, new reporting data for the last %1$s months will be regenerated and previously generated reports for this custom report won't be available anymore.", + "ManageReportsSubcategoryHelp": "Custom Reports lets you create new reports to draw new insights that aren't possible with standard reports. This section enables you to create and manage Custom Reports for your site.", + "WebsiteName": "Website name", + "CommonUniqueMetric": "Sum of %1$s", + "CommonUniqueMetricDescription": "%1$s. When viewing a period that is not day, then this metric will become \"Sum of %2$s\". In such case, if the same %3$s appear in 2 or more days within the selected period, then it will be counted as 2 or the total number of days it has appeared and not 1.", + "ProductsWithX": "Products with %s", + "ContentImpressions": "Content Impressions", + "ErrorProductRevenueMetricDependency": "Product Revenue metrics need an accompanying Product Quantity metric in the same report.", + "WarningProductRevenueMetricDependency": "Product Revenue metrics need an accompanying Product Quantity metric in the same report. The accompanying metric has been added automatically. %1$sLearn more%2$s.", + "OrderSubCategoryReports": "Order Subcategory reports", + "OrderSubCategoryReportsDescription": "Optional: Adjust the order in which subcategories will be shown while viewing this custom report.", + "ErrorInvalidSubCategoryReport": "Invalid subcategory report ids.", + "SelectMeasurablesMatchingSearch": "or add all measureables that contain the following search term", + "FindMeasurables": "Find measurables", + "NoMeasurableAssignedYet": "No measurable has been assigned yet, please select a measurable from the selector above.", + "MatchingSearchNotFound": "There is no measurable matching the search term %s.", + "MatchingSearchConfirmTitle": "Are you sure you want to add %s matching measurables?", + "MatchingSearchConfirmTitleAlreadyAdded": "%s matching measurables are already added", + "MatchingSearchMatchedAdd": "These %1$s measurables matched %2$s and will be added to this custom report", + "MatchingSearchMatchedAlreadyAdded": "These %1$s measurables matched %2$s but are already added to this custom report", + "ErrorInvalidMultipleIdSite": "For multiple idsites, idsite:%1$s should be included in the list.", + "PauseReportInfo": "Pausing this report stops its archiving until you resume the report.", + "ResumeReportInfo": "When you resume this report, archiving will restart from today.", + "PauseReportConfirm": "Pausing this report stops its archiving until you resume the report. Are you sure you want to pause this report?", + "ResumeReportConfirm": "When you resume this report, archiving will restart from today. Are you sure you want to resume this custom report?", + "PausedReport": "The report has been paused successfully.", + "ResumedReport": "The report has been resumed successfully.", + "DeleteExceptionMessage": "Cannot delete report, site does not match", + "PauseExceptionMessage": "Cannot pause report, site does not match", + "ResumeExceptionMessage": "Cannot resume report, site does not match", + "ActivityReportAddedDescription": "added a custom report \"%1$s\" for site \"%2$s\"", + "ActivityReportUpdatedDescription": "updated the report \"%1$s\" for site \"%2$s\"", + "ActivityReportDeletedDescription": "deleted the report \"%1$s\" for site \"%2$s\"", + "ActivityReportPausedDescription": "paused the report \"%1$s\" for site \"%2$s\"", + "ActivityReportResumedDescription": "resumed the report \"%1$s\" for site \"%2$s\"", + "ErrorCustomReportDoesNotExist": "The requested custom report does not exist", + "ReportInPausedStateAdmin": "This report is paused. No archiving will occur until the report is resumed. To resume the report, go to %1$sManage Reports%2$s and click Play for the selected report.", + "NoDataMessagePausedStateNonAdminUser": "This report is paused, no new data will be available until the report is resumed. If you need access to the report, please contact your Matomo superuser.", + "NoDataMessagePausedStateAdminUser": "This report is paused, no new data will be available until the report is resumed. To resume the report, go to %1$sManage Reports%2$s and click Play for the selected report.", + "NoSegmentationJoinExceptionMessage": "The current order or combination of dimensions is not compatible. %1$sLearn more%2$s.", + "PreviewReportInvalidTimeFrameValues": "Invalid timeframe values set for preview report, allowed values are seconds, minutes, hours and days.", + "PreviewReportExceedsMaximumTimeFrameValueAllowed": "The maximum time frame for preview report cannot be > 24 hours." + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/es.json b/files/plugin-CustomReports-5.4.3/lang/es.json new file mode 100644 index 0000000..f510a6e --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/es.json @@ -0,0 +1,68 @@ +{ + "CustomReports": { + "AddDimension": "Agregar dimensión", + "AddMetric": "Agregar métrica", + "ApplyTo": "Usar en", + "AvailableAllWebsites": "Disponible en todos los sitios de internet", + "Category": "Categoría", + "ConfirmUnlockReport": "¿Está seguro de que quieres desbloquear este informe? Cuando actualice el contenido de este informe, los informes generados previamente para este informe personalizado no estarán disponibles.", + "CreateNewReport": "Crear nuevo informe", + "CustomReport": "Informe personalizado", + "CustomReportIntroduction": "Los informes personalizados le permiten crear nuevos informes para extraer nuevas perspectivas que no son posibles con los informes estándar. Elija las dimensiones (como \"Tipo de dispositivo\" y \"Navegador\") y las métricas (como \"Número de visitantes\" y \"Tasa de rebote\") y cómo deben mostrarse para obtener los datos únicos y útiles que necesita.", + "CustomReports": "Informes personalizados", + "DeleteReportConfirm": "¿Está seguro que desea eliminar este informe personalizado? Aquellos informes previamente generados ya no estarán disponibles en la interfaz de usuario Informes.", + "DeleteReportInfo": "Cuando elimine este informe, el mismo no estará disponible, y no podrá deshacer esta acción.", + "Dimension": "Dimensión", + "Dimensions": "Dimensiones", + "EditReport": "Modificar informe", + "ErrorArrayMissingItem": "Falta el valor en la matriz \"%1$s\" en la posición \"%2$s\".", + "ErrorDuplicateItem": "No está permitido usar el mismo %s varias veces.", + "ErrorInvalidValueInArray": "\"%1$s\" en la posición \"%2$s\" no existe.", + "ErrorMissingDimension": "Al menos una dimensión debe ser seleccionada.", + "ErrorMissingMetric": "Al menos una métrica debe ser seleccionada.", + "ErrorNotAnArray": "\"%1$s\" tiene que ser una matriz.", + "ErrorReportNameDuplicate": "El nombre del informe ya está en uso por otro informe.", + "ErrorTooManyDimension": "Demasiadas dimensiones seleccionadas. Un máximo de %s pueden ser usadas.", + "ErrorXNotProvided": "Por favor suministre un valor para \"%1$s\".", + "ErrorXNotWhitelisted": "El valor para \"%1$s\" no está permitido, use uno de: %2$s.", + "ErrorXTooLong": "\"%1$s\" es muy largo, un máximo de %2$s caracteres es permitido.", + "FieldDescriptionPlaceholder": "ej 'El número de visitantes por país'", + "FieldNamePlaceholder": "ej 'Visitantes por país'", + "Filter": "Filtro", + "InfoReportIsLocked": "Este informe está actualmente bloqueado y debe confirmar que desea \"desbloquearlo\". Cuando realice cambios en el contenido de este informe y lo actualice, es necesario generar nuevos datos de informes y los informes generados previamente para este informe personalizado ya no estarán disponibles.", + "ManageReports": "Administrar Informes", + "NCustomReports": "%s informes personalizados", + "NoCustomReportsFound": "No se encuentran informes personalizados", + "NoDataNotArchivedYet": "Debido a que el informe se creó o actualizó recientemente, puede tardar algunas horas para que los datos estén disponibles cuando esté viendo los informes de hoy. Los datos del informe para las fechas anteriores a la creación de este informe no estarán disponibles.", + "NoDataNotArchivedYetReprocess": "Sin embargo, un administrador de sistema puede forzar a Matomo a %1$sreprocesar los informes%2$s para hacer que los datos estén disponibles.", + "Preview": "Previsualización", + "PreviewDate": "La vista previa está basada en los datos de %s.", + "PreviewReport": "Previsualizar informe", + "PreviewSupportsDimension": "La vista previa actualmente es hasta %s dimensiones.", + "RemoveDimension": "Quitar dimensión", + "RemoveMetric": "Quitar métrica", + "ReportAllWebsitesHelp": "Seleccione el sitio web para el que debe estar disponible este informe. También puede elegir \"Todos los sitios web\" para que este informe esté disponible para todos sus sitios (y también aquellos sitios que se crearán en el futuro).", + "ReportAvailableToAllWebsites": "Este informe está disponible para todos los sitios web.", + "ReportCategory": "Categoría de informe", + "ReportCategoryHelp": "Seleccione la categoría de informe principal bajo la cual este informe estará disponible en el menú de informes.", + "ReportContent": "Contenido del informe", + "ReportCreated": "El informe se ha creado exitosamente.", + "ReportDescriptionHelp": "Una descripción opcional para su informe que se mostrará cuando haga clic en el icono de ayuda junto al título del informe. Por ejemplo, podría mencionar el propósito de este informe.", + "ReportHasFilterApplied": "Este informe tiene aplicado el siguiente filtro: %s.", + "ReportMetricsHelp": "Las métricas son medidas cuantitativas. Por ejemplo, si desea aumentar el tráfico en su sitio web, incluya \"Visitas\", si está mejorando el rendimiento de su sitio web, incluya \"Tiempo promedio de generación\".", + "ReportName": "Nombre del informe", + "ReportNameHelp": "Define el nombre bajo el cual este informe estará disponible.", + "ReportPage": "Página de informe", + "ReportSegmentHelp": "Un filtro le permite ver este informe solo para un subconjunto de sus visitantes. Por ejemplo, puede filtrar este informe solo por usuarios de dispositivos móviles.", + "ReportSubcategory": "Subcategoría de informe", + "ReportSubcategoryHelp": "Opcionalmente, puede agregar este informe a cualquier página de informe existente. Si no elige una subcategoría, se creará una nueva página de informes bajo la categoría seleccionada usando el nombre del informe.", + "ReportType": "Tipo de informe", + "ReportUpdated": "El informe se ha actualizado exitosamente.", + "Type": "Tipo", + "Unlock": "Desbloquear", + "UpdatingData": "Actualizando datos…", + "ViewReportInfo": "Ver informe", + "WarningOnUpdateReportMightGetLost": "Cuando actualice este informe personalizado, los informes generados previamente para este informe personalizado no estarán disponibles.", + "WarningRequiresUnlock": "Para realizar cambios en el contenido de este informe, debe \"desbloquearlo\". Cuando realice cambios en la configuración del informe y actualice este informe, es necesario generar nuevos datos de informes y los informes generados anteriormente para el mismo ya no estarán disponibles." + } +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/fi.json b/files/plugin-CustomReports-5.4.3/lang/fi.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/fi.json rename to files/plugin-CustomReports-5.4.3/lang/fi.json diff --git a/files/plugin-CustomReports-5.4.3/lang/fr.json b/files/plugin-CustomReports-5.4.3/lang/fr.json new file mode 100644 index 0000000..99fe58a --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/fr.json @@ -0,0 +1,123 @@ +{ + "CustomReports": { + "ActivityReportAddedDescription": "a ajouté un rapport personnalisé \"%1$s\"» pour le site \"%2$s\"", + "ActivityReportDeletedDescription": "a supprimé le rapport \"%1$s\" pour le site \"%2$s\"", + "ActivityReportPausedDescription": "a mis en pause le rapport \"%1$s\" pour le site \"%2$s\"", + "ActivityReportResumedDescription": "a repris le rapport \"%1$s\" pour le site \"%2$s\"", + "ActivityReportUpdatedDescription": "a mis à jour le rapport \"%1$s\" pour le site \"%2$s\"", + "AddDimension": "Ajouter une dimension", + "AddMetric": "Ajouter un élément mesurable", + "ApplyTo": "Appliquer à", + "AvailableAllWebsites": "Disponible pour tous les sites", + "Category": "Catégorie", + "CommonUniqueMetric": "Total de %1$s", + "CommonUniqueMetricDescription": "%1$s. Lorsque vous visualisez une période qui n'est pas un jour, cette mesure devient \"Somme de %2$s\". Dans ce cas, si le même %3$s apparaît dans 2 ou plusieurs jours de la période sélectionnée, il sera compté comme 2 ou le nombre total de jours où il est apparu et non 1.", + "ConfirmUnlockReport": "Êtes vous sûr de vouloir débloquer ce rapport ? Lorsque vous mettez à jour le contenu de ce rapport, les rapports précédemment générés pour ce rapport personnalisé ne seront plus disponibles.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Êtes-vous sûr de vouloir déverrouiller ce rapport ? Lorsque vous mettez à jour le contenu de ce rapport, les rapports précédemment générés pour ce rapport personnalisé deviennent indisponibles et les rapports des derniers %1$s mois sont régénérés.", + "ContentImpressions": "Impressions de contenu", + "CreateNewReport": "Créer un nouveau rapport", + "CustomReport": "Rapport personnalisé", + "CustomReportIntroduction": "Les rapports personnalisés vous permettent de créer de nouveaux rapports pour dessiner de nouvelles vues impossibles à obtenir avec les rapports standards. Vous choisissez les dimensions (tel que \"Type de périphérique\" et \"Navigateur\") ainsi que les métriques (tel que \"Nombre de visiteurs\" et \"Taux de rebond\") et comment ils doivent être affichés pour avoir les données uniques, exploitables et utiles dont vous avez besoin.", + "CustomReports": "Rapports personnalisés", + "DeleteExceptionMessage": "Impossible de supprimer le rapport, le site ne correspond pas", + "DeleteReportConfirm": "Êtes-vous sûr de vouloir supprimer ce rapport personnalisé ? Les rapports générés précédemment ne seront plus disponibles dans l'interface de rapport.", + "DeleteReportInfo": "Lorsque vous supprimez ce rapport, ses rapports ne sont plus disponibles et vous ne pouvez pas annuler cette action.", + "Dimension": "Dimension", + "Dimensions": "Dimensions", + "EditReport": "Éditer le rapport", + "ErrorArrayMissingItem": "Valeur manquante dans le tableau \"%1$s\" à la position \"%2$s\".", + "ErrorCustomReportDoesNotExist": "Le rapport personnalisé demandé n’existe pas", + "ErrorDuplicateItem": "Il n'est pas autorisé d'utiliser le même %s plusieurs fois.", + "ErrorInvalidDimension": "La dimension %1$s n’est pas prise en charge dans les Rapports personnalisés.", + "ErrorInvalidMultipleIdSite": "Pour plusieurs idsites, idsite :%1$s doit être inclus dans la liste.", + "ErrorInvalidSubCategoryReport": "Identifiants de rapports de sous-catégorie invalides.", + "ErrorInvalidValueInArray": "\"%1$s\" indiqué à la position \"%2$s\" n'existe pas.", + "ErrorMissingDimension": "Une dimension au moins doit être sélectionnée.", + "ErrorMissingMetric": "Un élément mesurable au moins doit être sélectionné.", + "ErrorNotAnArray": "\"%1$s\" doit être un tableau.", + "ErrorProductRevenueMetricDependency": "Les métriques de chiffre d'affaires produit nécessitent la présence d'une métrique de quantité de produit dans le même rapport.", + "ErrorReportDoesNotExist": "Le rapport personnalisé demandé n'existe pas pour ce site web. Veuillez vous assurer que le site est correct.", + "ErrorReportNameDuplicate": "Ce nom est déjà utilisé pour un autre rapport.", + "ErrorTooManyDimension": "Trop de dimensions sélectionnées. %s dimensions peuvent être utilisées au maximum.", + "ErrorXNotProvided": "Veuillez indiquer une valeur pour \"%1$s\".", + "ErrorXNotWhitelisted": "La valeur pour \"%1$s\" n'est pas autorisée, utilisez une de celles-ci : %2$s.", + "ErrorXTooLong": "\"%1$s\" est trop long, %2$s caractères maximum sont autorisés.", + "FieldDescriptionPlaceholder": "ex. 'Le nombre de visiteurs par pays'", + "FieldNamePlaceholder": "ex. 'Visiteurs par pays'", + "Filter": "Filtre", + "FindMeasurables": "Trouver des éléments mesurables", + "InfoReportIsLocked": "Ce rapport est actuellement verrouillé et vous devez confirmer pour \"déverrouiller\" ce rapport. Lorsque vous effectuez des changements sur le contenu du rapport et que vous le mettez à jour par la suite, de nouvelles données de rapport doivent être générées et les rapports précédemment générés pour ce rapport personnalisé ne seront plus disponibles.", + "InfoReportIsLockedBrowserArchivingDisabled": "Ce rapport est actuellement verrouillé et vous devez confirmer pour \"déverrouiller\" ce rapport. Lorsque vous apportez des modifications au contenu de ce rapport et que vous le mettez à jour par la suite, les nouvelles données de rapport pour les derniers %1$s mois seront régénérées et les rapports précédemment générés pour ce rapport personnalisé ne seront plus disponibles.", + "ManageReports": "Gestion des rapports", + "ManageReportsSubcategoryHelp": "Les rapports personnalisés vous permettent de créer de nouveaux rapports pour obtenir de nouvelles informations qui ne sont pas possibles avec les rapports standard. Cette section vous permet de créer et de gérer des rapports personnalisés pour votre site.", + "MatchingSearchConfirmTitle": "Êtes-vous sûr de vouloir ajouter des %s correspondant à ces élements mesurables ?", + "MatchingSearchConfirmTitleAlreadyAdded": "%s éléments mesurables correspondants sont déjà ajoutés", + "MatchingSearchMatchedAdd": "Ces %1$s éléments mesurables correspondent à %2$s et seront ajoutées à ce rapport personnalisé", + "MatchingSearchMatchedAlreadyAdded": "Ces %1$s éléments mesurables correspondent à %2$s mais sont déjà ajoutées à ce rapport personnalisé", + "MatchingSearchNotFound": "Il n'y a pas d'éléments mesurables correspondant au terme de recherche %s.", + "NCustomReports": "%s rapports personnalisés", + "NoCustomReportsFound": "Aucun rapport personnalisé trouvé", + "NoDataMessagePausedStateAdminUser": "Ce rapport est en pause, aucune nouvelle donnée ne sera disponible jusqu’à ce que le rapport soit repris. Pour reprendre le rapport, accédez à %1$sGérer les rapports%2$s et cliquez sur Lecture pour le rapport sélectionné.", + "NoDataMessagePausedStateNonAdminUser": "Ce rapport est en pause, aucune nouvelle donnée ne sera disponible jusqu’à ce que le rapport soit repris. Si vous avez besoin d’accéder au rapport, veuillez contacter votre super utilisateur Matomo.", + "NoDataNotArchivedYet": "Comme ce rapport a été créé ou mis à jour récemment, cela peut prendre quelques heures avant que les données soient disponibles quand vous consultez les rapports du jour. Les données concernant les dates antérieures à la création de ce rapport ne seront plus disponibles.", + "NoDataNotArchivedYetReprocess": "Cependant, un administrateur peut forcer Matomo à %1$s recalculer les rapports %2$s pour rendre les données disponibles.", + "NoDataRemovedMetrics": "Aucune donnée n'est affichée car ce rapport ne contient que des éléments mesurables non disponibles pour la période sélectionnée (%s).", + "NoMeasurableAssignedYet": "Aucun élément mesurable n'a encore été attribué, veuillez sélectionner un élément mesurable dans le sélecteur ci-dessus.", + "NoSegmentationJoinExceptionMessage": "L’ordre ou la combinaison actuelle des dimensions n’est pas compatible. %1$sEn savoir plus%2$s.", + "OrderSubCategoryReports": "Rapports de sous-catégorie de commande", + "OrderSubCategoryReportsDescription": "Optionnel : Ajustez l’ordre dans lequel les sous-catégories seront affichées lors de la consultation de ce rapport personnalisé.", + "PauseExceptionMessage": "Impossible de mettre le rapport en pause, le site ne correspond pas", + "PauseReportConfirm": "La mise en pause de ce rapport arrête son archivage jusqu'à ce que vous repreniez le rapport. Êtes-vous sûr de vouloir mettre ce rapport en pause ?", + "PauseReportInfo": "La mise en pause de ce rapport arrête son archivage jusqu'à ce que vous repreniez le rapport.", + "PausedReport": "Le rapport a été mis en pause avec succès.", + "Preview": "Prévisualiser", + "PreviewDate": "Cette prévisualisation se base sur les données de %s.", + "PreviewReport": "Prévisualiser le rapport", + "PreviewReportExceedsMaximumTimeFrameValueAllowed": "La période maximale pour l’aperçu du rapport ne peut pas dépasser 24 heures.", + "PreviewReportInvalidTimeFrameValues": "Valeurs de période non valides définies pour l’aperçu du rapport. Les valeurs autorisées sont : secondes, minutes, heures et jours.", + "PreviewSupportsDimension": "La prévisualisation supporte seulement %s dimensions pour le moment.", + "ProductsWithX": "Produits avec %s", + "RemoveDimension": "Retirer une dimension", + "RemoveMetric": "Retirer un élément mesurable", + "RemovedMetrics": "Ces éléments mesurables ont été retirés car ils ne peuvent pas être calculés correctement sur la période : %s.", + "ReportAllWebsitesHelp": "Sélectionnez le site pour lequel ce rapport sera disponible. Vous pouvez choisir \"Tous les sites\" pour rendre ce rapport disponible pour tous les sites (y compris ceux créés à l'avenir).", + "ReportAllWebsitesNonSuperUserHelp": "Sélectionnez le site web pour lequel ce rapport doit être disponible.", + "ReportAvailableToAllWebsites": "Ce rapport est disponible pour tous les sites.", + "ReportAvailableToMultipleWebsites": "Ce rapport est disponible pour plusieurs sites web.", + "ReportCategory": "Catégorie du rapport", + "ReportCategoryHelp": "Sélectionnez la catégorie principale dans laquelle le rapport sera disponible via le menu.", + "ReportContent": "Contenu du rapport", + "ReportCreated": "Le rapport a été créé avec succès.", + "ReportDescriptionHelp": "Une description facultative de votre rapport qui s'affichera lorsque vous cliquerez sur l'icône d'aide à côté du titre du rapport. Par exemple, vous pourriez mentionner le but de ce rapport.", + "ReportDimensionsHelpExtended": "Si vous avez besoin de dimensions supplémentaires, vous pouvez augmenter la limite. %1$sEn savoir plus%2$s.", + "ReportDimensionsHelpNew": "Une dimension décrit généralement des caractéristiques et apparaît dans la première colonne d’un rapport. Vous pouvez sélectionner plusieurs dimensions (par exemple : navigateur, pays, ville). Au moins une dimension doit être sélectionnée.", + "ReportEditNotAllowedAllWebsitesUpdated": "Parce que ce rapport est disponible pour tous les sites web, seul un utilisateur avec un accès super utilisateur peut modifier ce rapport.", + "ReportEditNotAllowedMultipleWebsitesAccessIssue": "Parce que ce rapport est disponible pour plusieurs sites web, seul un super utilisateur ou un administrateur ayant accès à tous les sites web inclus dans le rapport peut le modifier.", + "ReportHasFilterApplied": "Ce rapport a le filtre suivant : %s.", + "ReportInPausedStateAdmin": "Ce rapport est en pause. Aucun archivage n’aura lieu jusqu’à ce que le rapport soit repris. Pour reprendre le rapport, accédez à %1$sGérer les rapports%2$s et cliquez sur Lecture pour le rapport sélectionné.", + "ReportMetricsHelp": "Les éléments mesurables sont des mesures quantitatives. Par exemple, si vous souhaitez augmenter le trafic de votre site web, incluez \"Visites\", si vous recherchez la performance de votre site web, incluez \"Moyenne du temps de génération\".", + "ReportName": "Nom du rapport", + "ReportNameHelp": "Définissez le nom sous lequel ce rapport sera disponible.", + "ReportPage": "Page du rapport", + "ReportSegmentHelp": "Un filtre vous permet de voir ce rapport uniquement pour un sous-ensemble de vos visiteurs. Par exemple, vous pouvez filtrer ce rapport en fonction des utilisateurs d'appareils mobiles uniquement.", + "ReportSubcategory": "Sous-catégorie du rapport", + "ReportSubcategoryHelp": "Vous pouvez en option ajouter ce rapport dans n'importe quelle page existante. Si vous ne choisissez pas de sous-catégorie, une nouvelle page dans la catégorie sélectionnée sera créée en utilisant le nom du rapport.", + "ReportType": "Type de rapport", + "ReportUpdated": "Le rapport a bien été mis à jour.", + "ResumeExceptionMessage": "Impossible de reprendre le rapport, le site ne correspond pas", + "ResumeReportConfirm": "Lorsque vous reprendrez ce rapport, l'archivage redémarrera à partir d'aujourd'hui. Êtes-vous sûr de vouloir reprendre ce rapport personnalisé ?", + "ResumeReportInfo": "Lorsque vous reprendrez ce rapport, l'archivage redémarrera à partir d'aujourd'hui.", + "ResumedReport": "Le rapport a été repris avec succès.", + "SelectMeasurablesMatchingSearch": "ou ajouter toutes les entités mesurables contenant le terme de recherche suivant", + "Type": "Type", + "Unlock": "Déverrouiller", + "UpdatingData": "Mise à jour des données…", + "ViewReportInfo": "Voir le rapport", + "WarningOnUpdateReportMightGetLost": "Lorsque vous mettez à jour ce rapport personnalisé, les rapports précédemment générées pour ce rapport personnalisé ne seront plus disponibles.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "Lorsque vous mettez à jour ce rapport personnalisé, les rapports précédemment générés deviennent indisponibles et les rapports des derniers %1$s mois sont régénérés.", + "WarningProductRevenueMetricDependency": "Les métriques de chiffre d'affaires produit nécessitent la présence d'une métrique de quantité de produit dans le même rapport. La métrique correspondante a été ajoutée automatiquement. %1$sEn savoir plus%2$s.", + "WarningRequiresUnlock": "Pour faire des changements sur le contenu de ce rapport, vous devez \"déverrouiller\" ce rapport. Lorsque vous faites des changements dans la configuration du rapport et qu'il est mis à jour, les nouvelles données de reporting doivent être générées et les études générées précédemment pour ce rapport ne seront plus disponibles.", + "WarningRequiresUnlockBrowserArchivingDisabled": "Pour pouvoir apporter des modifications au contenu de ce rapport, vous devez le \"déverrouiller\". Lorsque vous apportez des modifications à la configuration du rapport et que vous mettez à jour ce rapport, les nouvelles données de rapport pour les derniers %1$s mois seront régénérées et les rapports précédemment générés pour ce rapport ne seront plus disponibles.", + "WebsiteName": "Nom du site web" + } +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/hi.json b/files/plugin-CustomReports-5.4.3/lang/hi.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/hi.json rename to files/plugin-CustomReports-5.4.3/lang/hi.json diff --git a/files/plugin-CustomReports-5.4.3/lang/it.json b/files/plugin-CustomReports-5.4.3/lang/it.json new file mode 100644 index 0000000..b1290c8 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/it.json @@ -0,0 +1,76 @@ +{ + "CustomReports": { + "AddDimension": "Aggiungi dimensione", + "AddMetric": "Aggiungi metrica", + "ApplyTo": "Applica a", + "AvailableAllWebsites": "Disponibile in tutti i siti web", + "Category": "Categoria", + "ConfirmUnlockReport": "Sei sicuro di voler sbloccare questo report? Quando si aggiorna il suo contenuto, i report generati in precedenza per questo report personalizzato non saranno più disponibili.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Sei sicuro di voler sbloccare questo report? Quando aggiorni il contenuto di questo report, quelli generati in precedenza per questo report personalizzato non saranno disponibili e quelli per gli ultimi %1$s mesi verranno rigenerati.", + "CreateNewReport": "Crea nuovo report", + "CustomReport": "Report Personalizzato", + "CustomReportIntroduction": "I report personalizzati ti consentono di creare nuovi report per ricavare nuovi approfondimenti che non sono possibili con i quelli standard. Scegli le dimensioni (come \"Tipo di Dispositivo\" e \"Browser\") e le metriche (come \"Numero di Visitatori\" e \"Frequenza dei Rimbalzi\") e come dovrebbero essere visualizzate per ottenere i dati unici, utilizzabili e utili, di cui hai bisogno.", + "CustomReports": "Report Personalizzati", + "DeleteReportConfirm": "Sei sicuro di voler cancellare questo report personalizzato? I report generati in precedenza non saranno più disponibili nell'Interfaccia Utente dei report.", + "DeleteReportInfo": "Quando elimini questo report, i suoi risultati non saranno più disponibili e non potrai annullare questa azione.", + "Dimension": "Dimensione", + "Dimensions": "Dimensioni", + "EditReport": "Modifica report", + "ErrorArrayMissingItem": "Valore mancante nell'array \"%1$s\" alla posizione \"%2$s\".", + "ErrorDuplicateItem": "Non è possibile usare più volte lo stesso %s", + "ErrorInvalidValueInArray": "\"%1$s\" alla posizione \"%2$s\" non esiste.", + "ErrorMissingDimension": "Deve essere selezionata almeno una dimensione.", + "ErrorMissingMetric": "Deve essere selezionata almeno una metrica.", + "ErrorNotAnArray": "\"%1$s\" deve essere un array.", + "ErrorReportDoesNotExist": "Il report personalizzato richiesto non esiste per questo sito web. Assicurati che il sito sia quello giusto.", + "ErrorReportNameDuplicate": "Il nome del report è già utilizzato da un altro report.", + "ErrorTooManyDimension": "Sono state selezionate troppe dimensioni. Ne possono essere utilizzate max. %s.", + "ErrorXNotProvided": "Si prega di assegnare un valore per \"%1$s\".", + "ErrorXNotWhitelisted": "Il valore per \"%1$s\" non è consentito, usane uno tra: %2$s.", + "ErrorXTooLong": "\"%1$s\" è troppo lungo, è permesso un massimo di %2$s caratteri.", + "FieldDescriptionPlaceholder": "es. 'Numero di visitatori per nazione'", + "FieldNamePlaceholder": "es. 'Visitatori per Nazione'", + "Filter": "Filtra", + "InfoReportIsLocked": "Questo report è attualmente bloccato ed è necessario confermare per \"sbloccarlo\". Quando si apportano modifiche a questo contenuto del report e lo si aggiorna successivamente, è necessario generare nuovi dati di report, e quelli generati in precedenza per questo report personalizzato non saranno più disponibili.", + "InfoReportIsLockedBrowserArchivingDisabled": "Questo report è attualmente bloccato e devi confermare per \"sbloccarlo\". Quando apporti modifiche al contenuto di questo report e lo aggiorni in seguito, i nuovi dati dei report per gli ultimi %1$s mesi verranno rigenerati e i report generati in precedenza per questo report personalizzato non saranno più disponibili.", + "ManageReports": "Gestisci Reports", + "ManageReportsSubcategoryHelp": "I report personalizzati ti consentono di creare nuovi rapporti per trarre nuove informazioni che non sono possibili con quelli standard. Questa sezione ti consente di creare e gestire report personalizzati per il tuo sito.", + "NCustomReports": "%sreport personalizzati", + "NoCustomReportsFound": "Non sono stati trovati report personalizzati", + "NoDataNotArchivedYet": "Poiché il report è stato creato o aggiornato solo di recente, potrebbero essere necessarie alcune ore prima che i dati siano disponibili, quando si visualizzano i report di oggi. I dati del report per i periodi precedenti alla sua creazione non saranno disponibili.", + "NoDataNotArchivedYetReprocess": "Tuttavia, un amministratore di sistema può forzare Matomo a %1$srielaborare i report%2$s per rendere disponibili i dati.", + "NoDataRemovedMetrics": "Non vengono mostrati dati in quanto questo report contiene solamente metriche che non sono supportate dal periodo selezionato (%s).", + "Preview": "Anteprima", + "PreviewDate": "Questa anteprima è basata sui dati di %s.", + "PreviewReport": "Anteprima report", + "PreviewSupportsDimension": "L'anteprima supporta al momento fino a %s dimensioni.", + "RemoveDimension": "Rimuovi dimensione", + "RemoveMetric": "Rimuovi metrica", + "RemovedMetrics": "Queste metriche sono state rimosse in quanto esse non possono essere calcolate correttamente per questo periodo: %s.", + "ReportAllWebsitesHelp": "Seleziona il sito web per cui questo report deve essere disponibile. Puoi anche scegliere \"Tutti i siti web\" per rendere questo report disponibile per tutti i tuoi siti (anche i siti che verranno creati in futuro).", + "ReportAvailableToAllWebsites": "Questo report è disponibile per tutti i siti web.", + "ReportCategory": "Categoria report", + "ReportCategoryHelp": "Seleziona la categoria principale in base alla quale questo report sarà disponibile nel relativo menù.", + "ReportContent": "Contenuto report", + "ReportCreated": "Il report è stato creato con successo.", + "ReportDescriptionHelp": "Una descrizione facoltativa del tuo report che verrà visualizzata quando clicchi sull'icona della guida accanto al titolo del report stesso. Ad esempio, potresti citare lo scopo di questo report.", + "ReportHasFilterApplied": "Questo report ha applicati i seguenti files: %s.", + "ReportMetricsHelp": "Le metriche sono misure quantitative. Ad esempio, se desideri aumentare il traffico sul tuo sito web, includi \"Visite\", se stai migliorando le prestazioni del tuo sito web, includi \"Tempo Medio di Generazione\".", + "ReportName": "Nome report", + "ReportNameHelp": "Definisce il nome sotto cui questo report sarà disponibile.", + "ReportPage": "Pagina report", + "ReportSegmentHelp": "Un filtro ti consente di visualizzare questo report solo per un sottoinsieme di visitatori. Ad esempio, puoi filtrare questo report solo per gli utenti di dispositivi mobili.", + "ReportSubcategory": "Sottocategoria report", + "ReportSubcategoryHelp": "È possibile aggiungere facoltativamente questo report a qualsiasi pagina di report esistente. Se non si sceglie una sottocategoria, verrà creata una nuova pagina di report sotto la categoria selezionata utilizzando il nome del report stesso.", + "ReportType": "Tipo di report", + "ReportUpdated": "Il report è stato aggiornato con successo.", + "Type": "Tipo", + "Unlock": "Sblocca", + "UpdatingData": "Aggiornamento dati…", + "ViewReportInfo": "Vedi report", + "WarningOnUpdateReportMightGetLost": "Quando aggiorni questo report personalizzato, i report generati in precedenza non saranno più disponibili per questo report personalizzato.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "Quando aggiorni questo report personalizzato, i report generati in precedenza non saranno disponibili e i report per gli ultimi %1$s mesi verranno rigenerati.", + "WarningRequiresUnlock": "Per apportare modifiche a questo contenuto del report, è necessario \"sbloccarlo\". Quando si apportano modifiche alla configurazione del report e lo si aggiorna, è necessario generare dei nuovi dati di report, e quelli generati in precedenza per questo report personalizzato non saranno più disponibili.", + "WarningRequiresUnlockBrowserArchivingDisabled": "Per apportare modifiche al contenuto di questo report, è necessario \"sbloccarlo\". Quando apporti modifiche alla configurazione del report e lo aggiorni, i nuovi dati dei report per gli ultimi %1$s mesi verranno rigenerati e i report generati in precedenza per questo report non saranno più disponibili." + } +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/ja.json b/files/plugin-CustomReports-5.4.3/lang/ja.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/ja.json rename to files/plugin-CustomReports-5.4.3/lang/ja.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/ru.json b/files/plugin-CustomReports-5.4.3/lang/nb.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/ru.json rename to files/plugin-CustomReports-5.4.3/lang/nb.json diff --git a/files/plugin-CustomReports-5.4.3/lang/nl.json b/files/plugin-CustomReports-5.4.3/lang/nl.json new file mode 100644 index 0000000..8b8d002 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/nl.json @@ -0,0 +1,70 @@ +{ + "CustomReports": { + "AddDimension": "Voeg dimensie toe", + "AddMetric": "Voeg statistiek toe", + "ApplyTo": "Van toepassing op", + "AvailableAllWebsites": "Beschikbaar in alle websites.", + "Category": "Categorie", + "ConfirmUnlockReport": "Weet je zeker dat je dit rapport wilt openen? Wanneer je de inhoud van het rapport update, eerder gegenereerde rapporten van dit maatwerk rapport worden dan onbeschikbaar.", + "CreateNewReport": "Maak een nieuw rapport", + "CustomReport": "Maatwerk rapport", + "CustomReportIntroduction": "Maatwerk rapporten laten je nieuwe rapporten maken waarmee je nieuwe inzichten krijgt die niet beschikbaar zijn in de standaard rapporten. Je kiest een dimensie (zoals \"Apparaat type\" en \"Browser\") en statistieken (zoals \"Aantal bezoekers\" en \"Bounce rate\") en hoe dit getoond dient te worden om de unieke actiegerichte en nuttige data te krijgen die je zoekt.", + "CustomReports": "Maatwerk rapporten", + "DeleteReportConfirm": "Weet je zeker dat je dit maatwerk rapport wilt verwijderen? Eerder gegenereerde rapportages zijn dan niet meer beschikbaar in de UI.", + "DeleteReportInfo": "Wanneer je het rapport verwijderd, wordt het rapport niet meer beschikbaar. Deze actie kan je niet meer ongedaan maken.", + "Dimension": "Dimensies", + "Dimensions": "Dimensies", + "EditReport": "Bewerk rapport", + "ErrorArrayMissingItem": "Missende waarde in \"%1$s\" reeks op positie \"%2$s\".", + "ErrorDuplicateItem": "Het is niet toegestaan om dezelfde %s meerdere keren te gebruiken.", + "ErrorInvalidValueInArray": "Het gegeven \"%1$s\" op positie \"%2$s\" bestaat niet.", + "ErrorMissingDimension": "Minstens één dimensie dient geselecteerd te worden.", + "ErrorMissingMetric": "Minstens één statistiek dient geselecteerd te worden.", + "ErrorNotAnArray": "\"%1$s\" dient een reeks te zijn.", + "ErrorReportNameDuplicate": "De rapport naam is al in gebruik door een ander rapport.", + "ErrorTooManyDimension": "Teveel dimensies zijn geselecteerd. Maximaal %s dimensies kunnen worden gebruikt.", + "ErrorXNotProvided": "Geef een waarde voor \"%1$s\".", + "ErrorXNotWhitelisted": "De waarde voor \"%1$s\" is niet toegestaan. Gebruik één van de: %2$s", + "ErrorXTooLong": "\"%1$s\" is te lang, maximaal %2$skarakters zijn toegestaan.", + "FieldDescriptionPlaceholder": "bv 'het aantal bezoekers per land'", + "FieldNamePlaceholder": "bv 'Bezoekers per land'", + "Filter": "Filter", + "InfoReportIsLocked": "Dit rapport is op dit moment gesloten en je dient eerst te bevestigen om dit rapport te ontgrendelen. Wanneer je wijzigingen aan dit rapport maakt en het daarna bijwerkt, nieuwe rapportage data dient dan gegenereerd te worden en eerder gegenereerde rapportages voor dit maatwerk rapport zijn dan niet meer beschikbaar.", + "ManageReports": "Beheer rapporten", + "NCustomReports": "%s maatwerk rapporten", + "NoCustomReportsFound": "Geen maatwerk rapport gevonden", + "NoDataNotArchivedYet": "Wanneer het rapport onlangs is gemaakt of bijgewerkt, dan kan het enkele uren duren voordat de data van vandaag beschikbaar wordt. De data van rapporten van voordat het rapport gecreëerd is komt niet beschikbaar.", + "NoDataNotArchivedYetReprocess": "Echter, een systeem administrator kan Matomo forceren om %1$s de rapporten %2$s opnieuw te verwerken om de data beschikbaar te maken.", + "NoDataRemovedMetrics": "Er wordt geen data getoond omdat dit rapport alleen metrics bevat die niet worden ondersteund voor de geselecteerde periode (%s).", + "Preview": "Preview", + "PreviewDate": "Deze preview is gebaseerd op data van %s.", + "PreviewReport": "Preview rapport", + "PreviewSupportsDimension": "De huidige preview ondersteund tot %s dimensies.", + "RemoveDimension": "Verwijder dimensie", + "RemoveMetric": "Verwijder statistiek", + "RemovedMetrics": "Deze metrics zijn verwijderd omdat deze niet correct berekend kunnen worden over deze periode: %s.", + "ReportAllWebsitesHelp": "Selecteer de website waar deze rapportage voor beschikbaar moet zijn. Je kan ook \"Alle websites\" selecteren om deze rapportage voor alle websites beschikbaar te maken (dit is ook voor websites die in de toekomst aangemaakt worden.)", + "ReportAvailableToAllWebsites": "Dit rapport is beschikbaar voor alle websites.", + "ReportCategory": "Rapport categorie", + "ReportCategoryHelp": "Selecteer de hoofdcategorie waaronder dit rapport beschikbaar komt in het rapport menu.", + "ReportContent": "Rapport inhoud", + "ReportCreated": "Het rapport is met succes aangemaakt.", + "ReportDescriptionHelp": "Een optionele omschrijving voor je rapport, welke wordt getoond wanneer je op help icoon klikt naast de rapport titel klikt. Je kan bijvoorbeeld het doel benoemen van het rapport.", + "ReportHasFilterApplied": "Dit rapport heeft de volgende filters: 1%s", + "ReportMetricsHelp": "Statistieken zijn kwantitatieve metingen. Bijvoorbeeld, wanneer je het verkeer op je website wilt verhogen, voeg \"Bezoeken\" toe. Wanneer je de prestatie van je website wilt verbeteren, voeg dan \"Gemiddelde generatietijd \"toe.", + "ReportName": "Rapport naam", + "ReportNameHelp": "Bepaalt onder welke naam dit rapport beschikbaar wordt.", + "ReportPage": "Rapport pagina", + "ReportSegmentHelp": "Een filter laat alleen een deelverzameling van het rapport van je bezoekers zien. Bijvoorbeeld, je kan het rapport filteren op alleen smartphone bezoekers.", + "ReportSubcategory": "Rapport subcategorie", + "ReportSubcategoryHelp": "Optioneel kan je dit rapport toevoegen aan een bestaande rapportage pagina. Wanneer je geen subcategorie selecteert, wordt er een nieuwe rapportage pagina, met als titel de rapportnaam, aangemaakt onder de geselecteerde categorie.", + "ReportType": "Rapport type", + "ReportUpdated": "Het rapport is succesvol bijgewerkt.", + "Type": "Type", + "Unlock": "Ontgrendel", + "UpdatingData": "Bijwerken gegevens…", + "ViewReportInfo": "Bekijk rapport", + "WarningOnUpdateReportMightGetLost": "Wanneer je dit maatwerk rapport bijwerkt, worden eerder gegenereerde rapporten van dit aangepaste rapport niet meer beschikbaar.", + "WarningRequiresUnlock": "Om aan dit rapport wijzigingen te maken, dient dit als eerst ontgrendeld te worden. Wanneer je wijzigingen maakt aan aan de inrichting van het rapport en deze update, zal nieuwe rapport data gegenereerd worden en eerdere gemaakte rapporten van dit rapport zijn dan niet meer beschikbaar." + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/pl.json b/files/plugin-CustomReports-5.4.3/lang/pl.json new file mode 100644 index 0000000..bace865 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/pl.json @@ -0,0 +1,44 @@ +{ + "CustomReports": { + "AddDimension": "Dodaj wymiar", + "AddMetric": "Dodaj metrykę", + "ApplyTo": "Zastosuj do", + "AvailableAllWebsites": "Dostępny we wszystkich serwisach", + "Category": "Kategoria", + "CreateNewReport": "Utwórz nowy raport", + "CustomReport": "Niestandardowy Raport", + "CustomReports": "Niestandardowe Raporty", + "Dimension": "Wymiar", + "Dimensions": "Wymiary", + "EditReport": "Edycja raportu", + "ErrorNotAnArray": "\"%1$s\" musi być tabelą.", + "ErrorReportNameDuplicate": "Wybrana nazwa jest już wykorzystywana przez inny raport.", + "ErrorXNotProvided": "Proszę podać wartość dla \"%1$s\".", + "ErrorXNotWhitelisted": "Niedozwolona wartość pola \"%1$s\", spróbuj jednej z: %2$s.", + "ErrorXTooLong": "Ciąg \"%1$s\" jest za długi. Dopuszczone są ciągi o długości do %2$s znaków.", + "FieldDescriptionPlaceholder": "np. 'Liczba odwiedzających na kraj'", + "FieldNamePlaceholder": "np. 'Odwiedzający na Kraj'", + "Filter": "Filtruj", + "ManageReports": "Zarządzaj Raportami", + "NCustomReports": "%s niestandardowe raporty", + "NoCustomReportsFound": "Brak raportów niestandardowych", + "Preview": "Podgląd", + "PreviewReport": "Podgląd raportu", + "RemoveDimension": "Usuń wymiar", + "RemoveMetric": "Usuń metrykę", + "ReportAvailableToAllWebsites": "Ten raport dostępny jest dla wszystkich serwisów.", + "ReportCategory": "Kategoria raportu", + "ReportContent": "Zawartość raportu", + "ReportCreated": "Pomyślnie utworzono raport.", + "ReportName": "Nazwa raportu", + "ReportNameHelp": "Określa nazwę, która będzie reprezentowała raport.", + "ReportPage": "Strona raportu", + "ReportSubcategory": "Podkategoria raportu", + "ReportType": "Typ raportu", + "ReportUpdated": "Pomyślnie zaktualizowano raport.", + "Type": "Typ", + "Unlock": "Odblokuj", + "UpdatingData": "Aktualizacja danych…", + "ViewReportInfo": "Raport wyświetleń" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/pt.json b/files/plugin-CustomReports-5.4.3/lang/pt.json new file mode 100644 index 0000000..e1fa11c --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/pt.json @@ -0,0 +1,70 @@ +{ + "CustomReports": { + "AddDimension": "Adicionar dimensão", + "AddMetric": "Adicionar métrica", + "ApplyTo": "Aplicar a", + "AvailableAllWebsites": "Disponível em todos os sites", + "Category": "Categoria", + "ConfirmUnlockReport": "Tem a certeza que pretende desbloquear este relatório? Quando atualiza o conteúdo deste relatório, os relatórios gerados anteriormente para este relatório personalizado ficarão indisponíveis.", + "CreateNewReport": "Criar novo relatório", + "CustomReport": "Relatório personalizado", + "CustomReportIntroduction": "Os Relatórios personalizados permitem criar novos relatórios para obter novas perspetivas que não são possíveis com os relatórios predefinidos. Pode escolher as dimensões (tais como \"Tipo de dispositivo\" e \"Navegador\") e as métricas (como o \"Número de visitantes\" e \"Taxa de ressalto\") e como devem ser apresentados para obter os dados únicos e úteis que pretende.", + "CustomReports": "Relatórios personalizados", + "DeleteReportConfirm": "Tem a certeza que pretende eliminar este relatório personalizado? Os relatórios gerados anteriormente deixarão de estar disponíveis a partir do interface dos relatórios.", + "DeleteReportInfo": "Quando eliminar este relatório os respetivos relatórios deixarão de estar disponíveis e não poderá anular esta ação.", + "Dimension": "Dimensão", + "Dimensions": "Dimensões", + "EditReport": "Editar relatório", + "ErrorArrayMissingItem": "Valor em falta no vetor \"%1$s\" na posição \"%2$s\".", + "ErrorDuplicateItem": "Não é permitida a utilização do mesmo %s múltiplas vezes.", + "ErrorInvalidValueInArray": "O \"%1$s\" fornecido na posição \"%2$s\" não existe.", + "ErrorMissingDimension": "Tem de ser selecionada pelo menos uma dimensão.", + "ErrorMissingMetric": "Pelo menos uma métrica tem de ser selecionada.", + "ErrorNotAnArray": "\"%1$s\" tem de ser um array.", + "ErrorReportNameDuplicate": "O nome do relatório já está a ser utilizado por outro relatório.", + "ErrorTooManyDimension": "Demasiadas dimensões selecionadas. Podem ser utilizadas um máximo de %s dimensões.", + "ErrorXNotProvided": "Por favor, forneça um valor para \"%1$s\".", + "ErrorXNotWhitelisted": "O valor para \"%1$s\" não é permitido; utilize um de: %2$s.", + "ErrorXTooLong": "\"%1$s\" é demasiado longo; pode utilizar um máximo de %2$s carateres.", + "FieldDescriptionPlaceholder": "Por exemplo, 'O número de visitantes por país'", + "FieldNamePlaceholder": "Por exemplo, 'Visitantes por país'", + "Filter": "Filtro", + "InfoReportIsLocked": "Este relatório está bloqueado e necessita de confirmar para \"desbloquear\" este relatório. Quando faz alterações ao conteúdo deste relatório e o atualiza posteriormente, terão de ser gerados novos resultados e os relatórios anteriores para este relatório personalizado deixarão de estar disponíveis.", + "ManageReports": "Gerir relatórios", + "NCustomReports": "%s relatórios personalizados", + "NoCustomReportsFound": "Não foram encontrados relatórios personalizados", + "NoDataNotArchivedYet": "Dado que o relatório foi criado ou atualizado recentemente, pode demorar algumas horas até que os dados sejam disponibilizados quando está a visualizar os relatórios do dia atual. Os resultados para datas anteriores à data de criação deste relatório não serão disponibilizados.", + "NoDataNotArchivedYetReprocess": "No entanto, um administrador de sistema pode forçar o Matomo a %1$sreprocessar os relatórios%2$s para disponibilizar estes resultados.", + "NoDataRemovedMetrics": "Não são apresentados dados porque este relatório apenas contém métricas que não são suportadas pelo período selecionado (%s).", + "Preview": "Pré-visualização", + "PreviewDate": "Esta pré-visualização é baseada nos dados de %s.", + "PreviewReport": "Pré-visualizar relatório", + "PreviewSupportsDimension": "A pré-visualização apenas suporta até %s dimensões.", + "RemoveDimension": "Remover dimensão", + "RemoveMetric": "Remover métrica", + "RemovedMetrics": "Estas métricas foram removidas porque não podem ser corretamente calculadas para este período: %s.", + "ReportAllWebsitesHelp": "Selecione o site no qual este relatório ficará disponível. Também pode escolher \"Todos os sites\" para disponibilizar este relatório para todos os sites (incluindo sites que venham a ser criados no futuro).", + "ReportAvailableToAllWebsites": "Este relatório está disponível para todos os sites.", + "ReportCategory": "Categoria do relatório", + "ReportCategoryHelp": "Selecione a categoria principal sob a qual este relatório ficará disponível no menu dos relatórios.", + "ReportContent": "Conteúdo do relatório", + "ReportCreated": "O relatório foi criado com sucesso.", + "ReportDescriptionHelp": "Uma descrição opcional para o seu relatório que será apresentada quando clica no ícone de ajuda junto ao nome do relatório. Por exemplo, poderia indicar o propósito deste relatório.", + "ReportHasFilterApplied": "Este relatório tem o seguinte filtro aplicado: %s.", + "ReportMetricsHelp": "As métricas são medidas quantitativas. Por exemplo, se quiser aumentar o tráfego no seu site, inclua \"Visitas\"; se pretende melhorar o desempenho, inclua \"Tempo médio de processamento\".", + "ReportName": "Nome do relatório", + "ReportNameHelp": "Define o nome sob o qual este relatório ficará disponível.", + "ReportPage": "Página do relatório", + "ReportSegmentHelp": "Um filtro permite-lhe ver este relatório apenas para um subconjunto dos seus visitantes. Por exemplo, pode filtrar este relatório para apenas utilizadores de dispositivos móveis.", + "ReportSubcategory": "Subcategoria do relatório", + "ReportSubcategoryHelp": "Opcionalmente, pode adicionar este relatório a qualquer página existente. Se não escolher uma subcategoria, será criada uma nova página sob a categoria selecionada utilizando o nome do relatório.", + "ReportType": "Tipo de relatório", + "ReportUpdated": "O relatório foi atualizado com sucesso.", + "Type": "Tipo", + "Unlock": "Desbloquear", + "UpdatingData": "A atualizar dados…", + "ViewReportInfo": "Ver relatório", + "WarningOnUpdateReportMightGetLost": "Quando atualiza este relatório personalizado, os resultados gerados anteriormente para o mesmo deixarão de estar disponíveis.", + "WarningRequiresUnlock": "Para fazer alterações ao conteúdo deste relatório, necessita de \"desbloquear\" este relatório. Quando faz alterações à configuração e atualiza o relatório, têm de ser gerados novos dados e os resultados de relatórios anteriores deixarão de estar disponíveis." + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/ro.json b/files/plugin-CustomReports-5.4.3/lang/ro.json new file mode 100644 index 0000000..d79cb1b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/ro.json @@ -0,0 +1,5 @@ +{ + "CustomReports": { + "CustomReports": "Rapoarte particularizate" + } +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/zh-cn.json b/files/plugin-CustomReports-5.4.3/lang/ru.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/zh-cn.json rename to files/plugin-CustomReports-5.4.3/lang/ru.json diff --git a/files/plugin-CustomReports-5.4.3/lang/sq.json b/files/plugin-CustomReports-5.4.3/lang/sq.json new file mode 100644 index 0000000..aa65248 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/sq.json @@ -0,0 +1,123 @@ +{ + "CustomReports": { + "ActivityReportAddedDescription": "u shtua një raport vetjak “%1$s“ për sajtin “%2$s”", + "ActivityReportDeletedDescription": "u fshi raporti “%1$s” për sajtin “%2$s”", + "ActivityReportPausedDescription": "u ndal raporti “%1$s” për sajtin “%2$s”", + "ActivityReportResumedDescription": "u rinis raporti “%1$s” për sajtin “%2$s”", + "ActivityReportUpdatedDescription": "u përditësua raporti “%1$s” për sajtin “%2$s”", + "AddDimension": "Shtoni përmasë", + "AddMetric": "Shtoni matje", + "ApplyTo": "Zbatoje mbi", + "AvailableAllWebsites": "Mund të kihet për krejt sajtet", + "Category": "Kategori", + "CommonUniqueMetric": "Shumë e %1$s", + "CommonUniqueMetricDescription": "%1$s. Kur shihet një periudhë që s’është ditë, kjo vlerë do të bëhet “Shumë e %2$s”. Në rast të tillë, nëse e njëjta %3$s shfaqet në 2 ose më tepër ditë brenda periudhës së përzgjedhur, do të numërohet si 2, ose si numri gjithsej i ditëve ku është shfaqur dhe jo si 1.", + "ConfirmUnlockReport": "Jeni i sigurt se doni të shkyçet ky raport? Kur përditësoni lëndën për këtë raport vetjak, të dhënat e prodhuara më herët për të s’do të mund të kihen më.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Jeni i sigurt se doni të shkyçet ky raport? Kur përditësoni lëndën e raportit për këtë raport, raporte të prodhuar më parë për këtë raport vetjak do të bëhen të papërdorshëm dhe të dhënat për %1$s muajt e fundit do të riprodhohen.", + "ContentImpressions": "Përshtypje Nga Lënda", + "CreateNewReport": "Krijoni raport të ri", + "CustomReport": "Raport Vetjak", + "CustomReportIntroduction": "Raportet Vetjakë ju lejojnë të krijoni raporte të rinj për të ndjekur prirje të reja që s’janë të mundshme me raportet standarde. Përmasat (të tilla si, “Lloj Pajisjeje” dhe “Shfletues”), matjet (të tilla si, “Numër Vizitorësh” dhe “Nivel Kthimesh”) dhe se si duhet të shfaqen për të pasur të dhënat unike të përdorshme dhe të dobishme që ju nevojiten, i zgjidhni ju.", + "CustomReports": "Raporte Vetjakë", + "DeleteExceptionMessage": "S’fshihet dot raporti, sajti s’përputhet", + "DeleteReportConfirm": "Jeni i sigurt se doni të fshihet ky raport vetjak? Raportet e prodhuar më herët s’do të mund të kihen më përmes UI-t të raporteve.", + "DeleteReportInfo": "Kur e fshini këtë raport, raportet e tij s’do të mund të kihen më dhe këtë veprim s’mund ta zhbëni.", + "Dimension": "Përmasë", + "Dimensions": "Përmasa", + "EditReport": "Përpunoni raport", + "ErrorArrayMissingItem": "Te matrica “%1$s” mungon vlerë në pozicionin “%2$s”.", + "ErrorCustomReportDoesNotExist": "Raporti vetjak i kërkuar s’ekziston", + "ErrorDuplicateItem": "Nuk lejohet të përdoret shumë herë i njëjti %s.", + "ErrorInvalidDimension": "Përmasa %1$s nuk mbulohet në Raporte të Përshtatur.", + "ErrorInvalidMultipleIdSite": "Për ID sajtesh të shumtë, duhet përfshirë në listë idsite:%1$s.", + "ErrorInvalidSubCategoryReport": "ID të pavlefshme raportesh nënkategorish.", + "ErrorInvalidValueInArray": "“%1$s” e dhënë në pozicionin “%2$s” s’ekziston.", + "ErrorMissingDimension": "Duhet përzgjedhur të paktën një përmasë.", + "ErrorMissingMetric": "Duhet përzgjedhur të paktën një matje.", + "ErrorNotAnArray": "“%1$s” duhet të jetë një matricë.", + "ErrorProductRevenueMetricDependency": "Vlerat për “Të Ardhura Produktesh” lypin në të njëjtin raport një vlerë shoqëruese “Sasi Produkti”.", + "ErrorReportDoesNotExist": "Raporti vetjak i kërkuar s’ekziston për këtë sajt. Ju lutemi, sigurohuni se sajti është i saktë.", + "ErrorReportNameDuplicate": "Emri i raportit është tashmë në përdorim nga një raport tjetër.", + "ErrorTooManyDimension": "Janë përzgjedhur shumë përmasa. Mund të përdoren e shumta %s përmasa.", + "ErrorXNotProvided": "Ju lutemi, jepni një vlerë për “%1$s”.", + "ErrorXNotWhitelisted": "Vlera për “%1$s” nuk lejohet, përdorni një nga: %2$s.", + "ErrorXTooLong": "“%1$s” është shumë e gjatë, lejohen e shumta %2$s shenja.", + "FieldDescriptionPlaceholder": "p.sh., “Numër vizitorësh për vend”", + "FieldNamePlaceholder": "p.sh., “Vizitorë sipas Vendesh”", + "Filter": "Filtër", + "FindMeasurables": "Gjeni të matshëm", + "InfoReportIsLocked": "Ky raport është i kyçur dhe lypset të ripohoni “shkyçjen” e tij. Kur bëni ndryshime te lënda e këtij raporti dhe në vijim e përditësoni, lypset të prodhohen të dhëna të reja dhe të dhënat e prodhuara më herët për këtë raport vetjak s’do të mund të kihen më.", + "InfoReportIsLockedBrowserArchivingDisabled": "Ky raport është i kyçur dhe lypset të ripohoni “shkyçjen” e tij. Kur bëni ndryshime te lënda e këtij raporti dhe në vijim e përditësoni, do të prodhohen të dhëna të reja për %1$s muajt e fundit dhe të dhënat e prodhuara më herët për këtë raport vetjak s’do të mund të kihen më.", + "ManageReports": "Administroni Raporte", + "ManageReportsSubcategoryHelp": "Raporte Vetjake ju lejojnë të krijoni raporte të reja për të analizuar prirje të reja, çka s’është e mundshme me raportet standarde. Kjo ndarje ju jep mundësinë të krijoni dhe administroni Raporte Vetjake për sajtin tuaj.", + "MatchingSearchConfirmTitle": "Jeni i sigurt se doni të shtohen të matshme që përkojnë me %s?", + "MatchingSearchConfirmTitleAlreadyAdded": "Janë shtuar tashmë %s të matshme me përkim", + "MatchingSearchMatchedAdd": "Këto %1$s të matshme përkojnë me %2$s dhe do të shtohen te ky raport vetjak", + "MatchingSearchMatchedAlreadyAdded": "Këto %1$s të matshme përkojnë me %2$s, por gjenden tashmë te ky raport vetjak", + "MatchingSearchNotFound": "S’ka të matshme që përkon me termin e kërkimit %s.", + "NCustomReports": "%s raporte vetjakë", + "NoCustomReportsFound": "S’u gjetën raporte vetjakë", + "NoDataMessagePausedStateAdminUser": "Ky raport është ndalur, s’do të ketë të dhëna të reja, para se raporti të riniset. Që të rinisni raportin, kaloni te %1$sAdministroni Raporte%2$s dhe klikoni Luaje për raportin e përzgjedhur.", + "NoDataMessagePausedStateNonAdminUser": "Ky raport është ndalur, s’do të ketë të dhëna të reja, para se raporti të riniset . Nëse ju duhet hyrje te raporti, ju lutemi, lidhuni me superpërdoruesin e Matomo-s tuaj.", + "NoDataNotArchivedYet": "Meqë raporti u krijua apo përditësua vetëm tani afër, mund të duhen disa orë që të ketë të dhëna të përdorshme për të parë raporte për sot. S’do të ketë të përdorshme të dhëna raporti për data më herët se të krijohej ky raport.", + "NoDataNotArchivedYetReprocess": "Sidoqoftë, një përgjegjës sistemi mund ta detyrojë Matomo-n t’i %1$sripërpilojë raportet%2$s për t’i pasur këto të dhëna.", + "NoDataRemovedMetrics": "S’janë shfaqur të dhëna, ngaqë ky raport përmban vetëm vlera që s’mbulohen nga periudha e përzgjedhur (%s).", + "NoMeasurableAssignedYet": "Ende pa caktim të matshmesh, ju lutemi, përzgjidhni një të matshme që nga përzgjedhësi më sipër.", + "NoSegmentationJoinExceptionMessage": "Renditja, ose ndërthurja e tanishme e përmasave s’është e përputhshme. %1$sMësoni më tepër%2$s.", + "OrderSubCategoryReports": "Renditni raporte Nënkategorish", + "OrderSubCategoryReportsDescription": "Opsional: Përimtoni rendin në të cilin do të shfaqen nënkategoritë, kur shihet ky raport i përshtatur.", + "PauseExceptionMessage": "S’ndalet dot raporti, sajti s’përputhet", + "PauseReportConfirm": "Ndalja e këtij raporti ndal arkivimin e tij deri kur të rinisni raportin. Jeni i sigurt se doni të ndalet ky raport?", + "PauseReportInfo": "Ndalja e këtij raporti ndal arkivimin e tij deri kur të riniset raportimi.", + "PausedReport": "Raporti është ndalur me sukses.", + "Preview": "Paraparje", + "PreviewDate": "Kjo paraparje bazohet në të dhënat e %s.", + "PreviewReport": "Paraparje raporti", + "PreviewReportExceedsMaximumTimeFrameValueAllowed": "Intervali kohor maksimum për paraparje raporti s’mund të jetë > 24 orë.", + "PreviewReportInvalidTimeFrameValues": "Për paraparje raporti janë vënë vlera të pavlefshme intervalesh kohorë, vlerat e lejuara janë sekonda, minuta, orë dhe ditë.", + "PreviewSupportsDimension": "Hëpërhë paraparja mbulon deri në %s përmasa.", + "ProductsWithX": "Produkte me %s", + "RemoveDimension": "Hiqe përmasën", + "RemoveMetric": "Hiqe matjen", + "RemovedMetrics": "Këto vlera u hoqën, ngaqë s’mund të përllogariten saktë për këtë periudhë: %s.", + "ReportAllWebsitesHelp": "Përzgjidhni sajtin për të cilin duhet të jepet ky raport. Mund të shtoni edhe “Krejt sajtet”, për ta bërë këtë raport të përdorshëm në krejt sajtet tuaj (dhe në sajte që do të krijohen në të ardhmen).", + "ReportAllWebsitesNonSuperUserHelp": "Përzgjidhni sajtin për të cilin duhet të prodhohet ky raport.", + "ReportAvailableToAllWebsites": "Ky raport mund të kihet për krejt sajtet.", + "ReportAvailableToMultipleWebsites": "Ky raport është i passhëm për shumë sajte.", + "ReportCategory": "Kategori raporti", + "ReportCategoryHelp": "Përzgjidhni kategorinë kryesore të raporteve nën të cilën do të ofrohet ky raport te menuja e raportimeve.", + "ReportContent": "Lëndë raporti", + "ReportCreated": "Raporti u krijua me sukses.", + "ReportDescriptionHelp": "Një përshkrim opsional për raportin tuaj, që do të shfaqet kur klikoni mbi tekstin e ikonës, në krah të titullit të raportit. Për shembull, mund të donit të shfaqej qëllimi i këtij raporti.", + "ReportDimensionsHelpExtended": "Nëse ju duhen përmasa shtesë, mund të rritni kufirin. %1$sMësoni më tepër%2$s.", + "ReportDimensionsHelpNew": "Një përmasë zakonisht përshkruan karakteristika dhe shfaqet zakonisht në shtyllën e parë të një raporti. Mund të përzgjidhni përmasa të shumta (p.sh., Shfletues, Vend, Qytet). Duhet përzgjedhur të paktën një përmasë.", + "ReportEditNotAllowedAllWebsitesUpdated": "Ngaqë ky raport mund të kihet për krejt sajtet, vetëm një përdorues me leje superpërdoruesi mund ta ndryshojë këtë raport.", + "ReportEditNotAllowedMultipleWebsitesAccessIssue": "Ngaqë ky raport mund të kihet për sajte të shumtë, vetëm një superpërdorues, ose një përgjegjës me leje mbi krejt sajtet e përfshirë në raport mund ta ndryshojë.", + "ReportHasFilterApplied": "Mbi këtë raport është aplikuar filtri vijues: %s.", + "ReportInPausedStateAdmin": "Ky raport është ndalur. S’do të kryhet arkivim, para se raporti të jetë rinisur. Që të rinisni raportin, kaloni te %1$sAdministroni Raporte%2$s dhe klikoni Luaje, për raportin e përzgjedhur.", + "ReportMetricsHelp": "Matjet janë matje sasiore. Për shembull, nëse doni të shtoni trafikun në sajtin tuaj, përfshini “Vizita”, nëse po merreni me funksionimin e sajtit tuaj, përfshini “Kohë Mesatare Prodhimi”.", + "ReportName": "Emër raporti", + "ReportNameHelp": "Përcakton emrin me të cilin do të jepet ky raport.", + "ReportPage": "Faqe raporti", + "ReportSegmentHelp": "Një filtër ju lejon ta shihni këtë raport vetëm për një nëngrup vizitorësh. Për shembull, mund ta filtroni këtë raport vetëm për përdorues me pajisje celulare.", + "ReportSubcategory": "Nënkategori raportesh", + "ReportSubcategoryHelp": "Në daçi, mund ta shtoni këtë raport te cilado faqe ekzistuese raportimi. Nëse nuk zgjidhni një nënkategori, do të krijohet një faqe e re raportimi nën kategorinë e përzgjedhur, duke përdorur emrin e raportit.", + "ReportType": "Lloj raporti", + "ReportUpdated": "Raporti u përditësua me sukses.", + "ResumeExceptionMessage": "S’riniset dot raporti, sajti s’përputhet", + "ResumeReportConfirm": "Kur rinisni këtë raport, arkivimi do të rinisë nga sot. Jeni i sigurt se doni të riniset ky raport vetjak?", + "ResumeReportInfo": "Kur rinisni këtë raport, arkivimi do të rifillojë nga sot.", + "ResumedReport": "Raporti u rinis me sukses.", + "SelectMeasurablesMatchingSearch": "ose shtoni krejt gjërat e matshme që përmbajnë termin vijues të kërkimit", + "Type": "Lloj", + "Unlock": "Shkyçe", + "UpdatingData": "Po përditësohen të dhëna…", + "ViewReportInfo": "Shiheni raportin", + "WarningOnUpdateReportMightGetLost": "Kur e përditësoni këtë raport vetjak, raportet e prodhuar më herët për këtë raport vetjak s’do të mund të kihen më.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "Kur përditësoni këtë raport vetjak, raporte të prodhuar më parë do të jenë të papërdorshëm dhe të dhënat për %1$s muajt e fundit do të riprodhohen.", + "WarningProductRevenueMetricDependency": "Vlerat për “Të Ardhura Produkti” lypin në të njëjtin raport një vlerë shoqëruese “Sasi Produkti”. Vlera shoqëruese është shtuar automatikisht. %1$sMësoni më tepër%2$s.", + "WarningRequiresUnlock": "Që të mund të bëni ndryshime te lënda e këtij raporti, lypset ta “shkyçni” këtë raport. Kur bëni ndryshime te formësimi i raportit dhe e përditësoni këtë raport, lypset të riprodhohen të dhëna të reja raporti dhe të dhënat e prodhuara më herët për këtë raport s’do të mund të kihen më.", + "WarningRequiresUnlockBrowserArchivingDisabled": "Që të mund të bëni ndryshime te lënda e këtij raporti, duhet ta “shkyçni” këtë raport. Kur bëni ndryshime te formësimi i raporteve dhe përditësoni këtë raport, të dhëna të reja raportimi për %1$s muajt e fundit do të riprodhohen dhe të dhënat e prodhuara më herët për këtë raport s’do të mund kihen më.", + "WebsiteName": "Emër sajti" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/sv.json b/files/plugin-CustomReports-5.4.3/lang/sv.json new file mode 100644 index 0000000..499bc19 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/sv.json @@ -0,0 +1,100 @@ +{ + "CustomReports": { + "AddDimension": "Lägg till dimension", + "AddMetric": "Lägg till mätvärde", + "ApplyTo": "Tillämpa på", + "AvailableAllWebsites": "Tillgänglig för alla webbplatser", + "Category": "Kategori", + "CommonUniqueMetric": "Summan av %1$s", + "CommonUniqueMetricDescription": "%1$s. När du tittar på en period som inte är en dag kommer det här mätvärdet att bli \"Summan av %2$s\". I de fallen, om samma %3$s finns för 2 eller fler dagar inom den valda perioden kommer det räknas som 2 eller det totala antalet dagar det fanns, och inte som 1.", + "ConfirmUnlockReport": "Är du säker på att du vill låsa upp denna rapport? När du uppdaterar rapportens innehåll kommer tidigare skapat data för rapporten att bli oåtkomliga.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Är du säker på att vill låsa upp rapporten? När du uppdaterar denna rapport kommer tidigare genererade rapporter för denna anpassade rapport att bli oåtkomliga och rapporter för de senaste %1$s månaderna kommer återskapas.", + "ContentImpressions": "Innehållsexponeringar", + "CreateNewReport": "Skapa ny rapport", + "CustomReport": "Anpassas rapport", + "CustomReportIntroduction": "Anpassade rapporter låter dig skapa nya rapporter för att dra nya insikter som inte är möjliga med standardrapporterna. Du väljer dimensioner (som \"Typ av enhet\" och \"Webbläsare\") och mätetal (som \"Antal besökare\" och \"Avvisningsfrekvens\") och hur de ska visas för att ge den unikt agerbara och meningsfulla data du behöver.", + "CustomReports": "Anpassade rapporter", + "DeleteReportConfirm": "Är du säker på att du vill radera denna anpassade rapport? Tidigare genererade rapporter kommer inte längre vara åtkomliga via användargränssnittet för rapporter.", + "DeleteReportInfo": "När du raderar rapporten kommer dess rapportdata bli oåtkomligt och du kan inte ångra denna åtgärd i efterhand.", + "Dimension": "Dimension", + "Dimensions": "Dimensioner", + "EditReport": "Redigera rapport", + "ErrorArrayMissingItem": "Saknar ett värde i \"%1$s\" i array, vid position \"%2$s\".", + "ErrorDuplicateItem": "Det går inte att använda samma %s mer än en gång.", + "ErrorInvalidDimension": "Dimensionen %1$s stöds inte i anpassade rapporter.", + "ErrorInvalidMultipleIdSite": "För multipla site-id, site-id:%1$s bör läggas till listan.", + "ErrorInvalidSubCategoryReport": "Felaktigt rapport-id för underkategori.", + "ErrorInvalidValueInArray": "Angivna \"%1$s\" vid position \"%2$s\" existerar inte.", + "ErrorMissingDimension": "Åtminstone en dimension behöver väljas.", + "ErrorMissingMetric": "Åtminstone ett mätvärde måste väljas.", + "ErrorNotAnArray": "\"%1$s\" behöver vara en array.", + "ErrorProductRevenueMetricDependency": "Produktens mätetal för inkomst behöver i samma rapport också ha ett kvantitativt mätetal.", + "ErrorReportDoesNotExist": "Den anpassade rapporten finns inte för denna webbplats. Vänligen kontrollerade att webbplatsen är korrekt.", + "ErrorReportNameDuplicate": "Rapportnamnet används redan av en annan rapport.", + "ErrorTooManyDimension": "För många dimensioner är valda. Maximalt %s dimensioner kan användas.", + "ErrorXNotProvided": "Vänligen ange att värde för \"%1$s\".", + "ErrorXNotWhitelisted": "Värdet för \"%1$s\" är inte tillåtet, använd en av: %2$s.", + "ErrorXTooLong": "\"%1$s\" är för långt, maximalt %2$s tecken tillåts.", + "FieldDescriptionPlaceholder": "'Antalet besökare per land'", + "FieldNamePlaceholder": "'Besökare per land'", + "Filter": "Filter", + "FindMeasurables": "Hitta uppgifter", + "InfoReportIsLocked": "Rapporten är för närvarande låst och du behöver bekräfta genom att \"låsa upp\" rapporten. När du gör ändringar till rapporten och uppdaterar den kommer nya rapportdata att behöva genereras och tidigare genererade rapporter för den här anpassade rapporten blir oåtkomliga.", + "InfoReportIsLockedBrowserArchivingDisabled": "Rapporten är för närvarande låst och du behöver bekräfta genom att \"låsa upp\" rapporten. När du gör ändringar i denna rapport och uppdaterar den kommer ny rapportdata genereras för de senaste %1$s månaderna och tidigare skapade rapporter för denna anpassade rapport kommer bli oåtkomliga.", + "ManageReports": "Hantera rapporter", + "ManageReportsSubcategoryHelp": "Anpassade rapporter låter dig skapa nya rapporter för att dra insikter som inte är möjliga med standardrapporterna. Den här sektionen låter di skapa och hantera Anpassade Rapporter för din webbplats.", + "MatchingSearchConfirmTitle": "Är du säker på att du vill lägga till %s som matchar uppgifterna?", + "MatchingSearchConfirmTitleAlreadyAdded": "%s matchande uppgifter har redan lagts till", + "MatchingSearchMatchedAdd": "Dessa %1$s uppgifter matchade %2$s och kommer läggas till denna anpassade rapport", + "MatchingSearchMatchedAlreadyAdded": "Dessa %1$s uppgifter matchade %2$s men var redan tillagda i denna anpassade rapport", + "MatchingSearchNotFound": "Det finns ingen uppgift som matchar sökfrasen %s.", + "NCustomReports": "%s anpassade rapporter", + "NoCustomReportsFound": "Ingen anpassad rapport hittad", + "NoDataNotArchivedYet": "Då rapporten skapades eller uppdaterades nyligen kan det ta några timmar för data att synas för innevarande dags rapport. Rapportdata för datum före rapportens skapande kommer inte att bli åtkomliga.", + "NoDataNotArchivedYetReprocess": "Dock kan en systemadministratör tvinga Matomo att %1$såterbearbeta rapporter%2$s för att göra historiska data åtkomliga.", + "NoDataRemovedMetrics": "Inga data visas då denna rapport endast innehåller mätvärden som inte stöds av den valda perioden (%s).", + "NoMeasurableAssignedYet": "Inga uppgifter har tilldelats ännu, vänligen välj en uppgift från ovanstående alternativ.", + "OrderSubCategoryReports": "Ordningen av underkategorirapporter", + "OrderSubCategoryReportsDescription": "Valfritt: Justera ordningen för underkategorier som visas för denna anpassade rapport.", + "Preview": "Förhandsgranska", + "PreviewDate": "Förhandsgranskningen är baserad på data från %s.", + "PreviewReport": "Förhandsgranska rapport", + "PreviewSupportsDimension": "Förhandsgranskningen stöder upp till %s dimensioner.", + "ProductsWithX": "Produkter med %s", + "RemoveDimension": "Ta bort dimension", + "RemoveMetric": "Ta bort mätvärde", + "RemovedMetrics": "Dessa mätvärden togs bort för att de inte kan beräknas korrekt för perioden: %s.", + "ReportAllWebsitesHelp": "Välj webbplats denna rapport ska vara tillgänglig för. Du kan också välja \"Alla webbplatser\" för att göra rapporten tillgänglig för alla webbplatser (inklusive de som skapas i framtiden).", + "ReportAllWebsitesNonSuperUserHelp": "Välj vilken webbplats rapporten ska vara åtkomlig för.", + "ReportAvailableToAllWebsites": "Rapporten är tillgänglig för alla webbplatser.", + "ReportAvailableToMultipleWebsites": "Rapport är åtkomlig för flera webbplatser.", + "ReportCategory": "Raportkategori", + "ReportCategoryHelp": "Välj huvudsaklig kategori där denna rapport ska visas i rapportmenyn.", + "ReportContent": "Rapportinnehåll", + "ReportCreated": "Rapporten skapades lyckosamt.", + "ReportDescriptionHelp": "En valfri beskrivning för din rapport, vilket visas upp om du klickar på hjälpikonen bredvid rapportens titel. Exempelvis kan du ange syftet med denna rapport.", + "ReportEditNotAllowedAllWebsitesUpdated": "Eftersom denna rapport är åtkomlig för alla webbplatser kan endast en använder med superuser-åtkomst redigera rapporten.", + "ReportEditNotAllowedMultipleWebsitesAccessIssue": "Eftersom denna rapport är åtkomlig för ett flertal webbplatser kan endast en använder med superuser-åtkomst redigera rapporten.", + "ReportHasFilterApplied": "Denna rapport har följande filtreringar: %s.", + "ReportMetricsHelp": "Mätvärden är kvantitativa mått. Exempelvis, om du vill öka trafiken på din webbplats lägger du till \"Besök\", om du förbättrar hastigheten på webbplatsen lägger du till \"Genomsnittlig servertid\".", + "ReportName": "Rapportnamn", + "ReportNameHelp": "Anger namnet där denna rapport kommer visas.", + "ReportPage": "Rapportsida", + "ReportSegmentHelp": "Ett filter låter dig se rapporten för en delmängd av dina besökare. Exempelvis kan du filtrera denna rapport enbart mobilanvändare.", + "ReportSubcategory": "Rapportens underkategori", + "ReportSubcategoryHelp": "Valfritt: Du kan lägga denna rapport till en befintlig rapportsida. Ifall du inte väljer underkategori kommer en ny rapportsida att skapas under rapportkategorin med rapportens namn.", + "ReportType": "Typ av rapport", + "ReportUpdated": "Rapporten har blivit uppdaterad.", + "SelectMeasurablesMatchingSearch": "eller lägg till alla uppgifter som innehåller följande sökfras", + "Type": "Typ", + "Unlock": "Lås upp", + "UpdatingData": "Uppdaterar data…", + "ViewReportInfo": "Se rapport", + "WarningOnUpdateReportMightGetLost": "När du uppdaterar denna anpassade rapport kommer tidigare data i rapporten att bli oåtkomlig.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "När du uppdaterar denna anpassade rapport kommer tidigare genererade rapporter att bli oåtkomliga och rapporter för de senaste %1$s månaderna kommer att återskapas.", + "WarningProductRevenueMetricDependency": "Produktens mätetal för inkomst behöver i samma rapport också ha ett kvantitativt mätetal. Ett sådant mätetal lades till automatiskt. %1$sLär dig mer%2$s.", + "WarningRequiresUnlock": "För att göra ändringar till rapportens innehåll behöver rapporten \"låsas upp\". När du gör ändringar i rapportens konfiguration och uppdaterar den behöver nya rapportdata genereras och tidigare rapportdata kommer inte längre vara tillgängligt.", + "WarningRequiresUnlockBrowserArchivingDisabled": "För att göra ändringar i denna rapport behöver du \"låsa upp\" den. När du ändrar rapportens konfiguration och uppdaterar rapporten kommer nya rapportdata för de senaste %1$s månaderna att återskapas och tidigare genererade rapporter för denna anpassade rapport kommer inte längre vara åtkomliga.", + "WebsiteName": "Webbplatsnamn" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/tr.json b/files/plugin-CustomReports-5.4.3/lang/tr.json new file mode 100644 index 0000000..bd40f4b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/tr.json @@ -0,0 +1,123 @@ +{ + "CustomReports": { + "ActivityReportAddedDescription": "\"%2$s\" sitesi için \"%1$s\" özel raporunu ekledi", + "ActivityReportDeletedDescription": "\"%2$s\" sitesi için \"%1$s\" raporunu sildi", + "ActivityReportPausedDescription": "\"%2$s\" sitesi için \"%1$s\" raporunu duraklattı", + "ActivityReportResumedDescription": "\"%2$s\" sitesi için \"%1$s\" raporunu sürdürdü", + "ActivityReportUpdatedDescription": "\"%2$s\" sitesi için \"%1$s\" raporunu güncelledi", + "AddDimension": "Boyut ekle", + "AddMetric": "Ölçüm ekle", + "ApplyTo": "Şuna uygula", + "AvailableAllWebsites": "Tüm siteler için kullanılabilir", + "Category": "Kategori", + "CommonUniqueMetric": "%1$s toplamı", + "CommonUniqueMetricDescription": "%1$s. Gün olmayan bir dönem görüntülenirken, bu ölçüm \"%2$s toplamı\" şeklinde olur. Böyle bir durumda, aynı %3$s, seçilmiş süre içinde 2 veya daha fazla günde görüntüleniyorsa, 1 değil, 2 veya göründüğü toplam gün sayısı olarak sayılır.", + "ConfirmUnlockReport": "Bu raporun kilidini açmak istediğinize emin misiniz? Bu özel raporu güncellediğinizde, bu özel rapor için daha önce üretilmiş raporlar kullanılamayacak.", + "ConfirmUnlockReportBrowserArchivingDisabled": "Bu raporun kilidini açmak istediğinize emin misiniz? Bu özel raporun içeriğini güncellediğinizde, daha önce üretilmiş raporlar kullanılamayacak ve son %1$s ayın raporları yeniden üretilecek.", + "ContentImpressions": "İçerik gösterimleri", + "CreateNewReport": "Yeni rapor ekle", + "CustomReport": "Özel rapor", + "CustomReportIntroduction": "Özel raporlar, standart raporlarda bulunmayan yeni bakış açıları oluşturmanızı sağlar. Boyutları (\"Aygıt türü\" ve \"Tarayıcı\" gibi) ve ölçümleri (\"Ziyaretçi sayısı\" ve \"Geri dönüş oranı\" gibi) ve nasıl görüneceğini seçerek eşsiz ve işinize yarayacak veriler elde edebilirsiniz.", + "CustomReports": "Özel raporlar", + "DeleteExceptionMessage": "Rapor silinemedi. Site eşleşmiyor", + "DeleteReportConfirm": "Bu özel raporu silmek istediğinize emin misiniz? Daha önce üretilmiş raporlar kullanıcı arayüzündeki raporlar bölümünde görüntülenmeyecek.", + "DeleteReportInfo": "Bu raporu sildiğinizde ilgili raporlar artık kullanılamayacak ve bu işlem geri alınamayacak.", + "Dimension": "Boyut", + "Dimensions": "Boyutlar", + "EditReport": "Raporu düzenle", + "ErrorArrayMissingItem": "\"%1$s\" dizisinde \"%2$s\" konumundaki değer eksik.", + "ErrorCustomReportDoesNotExist": "İstenilen özel rapor bulunamadı", + "ErrorDuplicateItem": "Aynı %s birden çok kez kullanılamaz.", + "ErrorInvalidDimension": "Özel Raporlar içinde %1$s boyutu desteklenmiyor.", + "ErrorInvalidMultipleIdSite": "Birden fazla site kimliği için, listeye idsite:%1$s eklenmelidir.", + "ErrorInvalidSubCategoryReport": "Alt kategori rapor kimlikleri geçersiz.", + "ErrorInvalidValueInArray": "\"%2$s\" konumunda belirtilen \"%1$s\" bulunamadı.", + "ErrorMissingDimension": "En az bir boyut seçilmelidir.", + "ErrorMissingMetric": "En az bir ölçüm seçilmelidir.", + "ErrorNotAnArray": "\"%1$s\" bir dizi olmalıdır.", + "ErrorProductRevenueMetricDependency": "Ürün geliri ölçümleri için aynı raporda eşlik edecek bir ürün adeti ölçümü gereklidir.", + "ErrorReportDoesNotExist": "Bu site için istenilen özel rapor bulunamadı. Lütfen sitenin doğru olduğundan emin olun.", + "ErrorReportNameDuplicate": "Aynı adı kullanan başka bir rapor zaten var.", + "ErrorTooManyDimension": "Çok fazla boyut seçilmiş. En fazla %s boyut kullanılabilir.", + "ErrorXNotProvided": "Lütfen \"%1$s\" için bir değer yazın.", + "ErrorXNotWhitelisted": "\"%1$s\" değeri kullanılamaz. Şunlardan birini kullanın: %2$s.", + "ErrorXTooLong": "\"%1$s\" çok uzun. İzin verilen en fazla karakter sayısı %2$s.", + "FieldDescriptionPlaceholder": "Örnek: 'Ülkelere göre ziyaretçi sayıları'", + "FieldNamePlaceholder": "Örnek: 'Ülkelere göre ziyaretçiler'", + "Filter": "Süzgeç", + "FindMeasurables": "Ölçülebilir arama", + "InfoReportIsLocked": "Bu rapor şu anda kilitli ve \"kilidini açmayı\" onaylamanız gerekiyor. Rapor yapılandırmasını değiştirip güncelledikten sonra, yeni rapor verilerinin üretilmesi gerekir ve daha önce üretilmiş raporlar artık kullanılamaz.", + "InfoReportIsLockedBrowserArchivingDisabled": "Bu rapor şu anda kilitli ve \"kilidini açmayı\" onaylamanız gerekiyor. Rapor yapılandırmasını değiştirip güncelledikten sonra, son %1$s ayın yeni rapor verileri yeniden üretilecek ve daha önce üretilmiş raporlar artık kullanılamayacak.", + "ManageReports": "Rapor yönetimi", + "ManageReportsSubcategoryHelp": "Özel raporlar, standart raporların sunmadığı yeni bakış açılarının elde edilmesini sağlar. Site için özel raporlar bu bölümden eklenip yönetilebilir.", + "MatchingSearchConfirmTitle": "Eşleşen %s ölçülebiliri eklemek istediğinize emin misiniz?", + "MatchingSearchConfirmTitleAlreadyAdded": "%s eşleşen ölçülebilir zaten eklenmiş", + "MatchingSearchMatchedAdd": "Bu %1$s ölçülebilir %2$s ile eşleşti ve bu özel rapora eklenecek", + "MatchingSearchMatchedAlreadyAdded": "Bu %1$s ölçülebilir %2$s ile eşleşti ancak zaten bu özel rapora eklenmiş", + "MatchingSearchNotFound": "%s ifadesine uyan bir ölçülebilir yok.", + "NCustomReports": "%s özel rapor", + "NoCustomReportsFound": "Herhangi bir özel rapor bulunamadı", + "NoDataMessagePausedStateAdminUser": "Bu rapor duraklatılmış. Rapor sürdürülene kadar yeni veriler bulunmayacak. Raporu sürdürmek için, %1$sRapor yönetimi%2$s bölümüne gidin ve seçilmiş rapor için Oynat üzerine tıklayın.", + "NoDataMessagePausedStateNonAdminUser": "Bu rapor duraklatılmış. Rapor sürdürülene kadar yeni veriler bulunmayacak. Rapor için izinlere gerek duyuyorsanız, lütfen Matomo süper kullanıcınızla görüşün.", + "NoDataNotArchivedYet": "Rapor yakın zamanda eklenmiş ya da güncellenmiş ise verilerin günlük raporlar bölümünde görülebilmesi için bir kaç saat geçmesi gerekebilir. Raporun eklenme tarihinden önceki tarihlere ait veriler kullanılamaz.", + "NoDataNotArchivedYetReprocess": "Bununla birlikte bir sistem yöneticisi Matomo üzerinde %1$sraporları yeniden işleyerek%2$s bu verilerin kullanılabilmesini sağlayabilir.", + "NoDataRemovedMetrics": "Bu rapor, yalnızca seçilmiş aralık (%s) tarafından desteklenmeyen ölçümleri içerdiğinden herhangi bir veri görüntülenemiyor.", + "NoMeasurableAssignedYet": "Henüz bir ölçülebilir atanmamış, lütfen yukarıdaki seçiciden bir ölçülebilir seçin.", + "NoSegmentationJoinExceptionMessage": "Geçerli boyut sıralaması veya kombinasyonu uyumlu değil. %1$sAyrıntılı bilgi alın%2$s.", + "OrderSubCategoryReports": "Alt kategori raporları sıralaması", + "OrderSubCategoryReportsDescription": "İsteğe bağlı: Bu özel rapor görüntülenirken alt kategorilerin görüntülenme sıralamasını ayarlayın.", + "PauseExceptionMessage": "Rapor duraklatılamadı. Site eşleşmiyor", + "PauseReportConfirm": "Bu raporu duraklatmak, raporun arşivlenmesini siz yeniden raporu başlatana kadar durdurur. Bu raporu duraklatmak istediğinize emin misiniz?", + "PauseReportInfo": "Bu raporu duraklatmak, siz yeniden başlatana kadar raporun arşivlenmesini durdurur.", + "PausedReport": "Rapor duraklatıldı.", + "Preview": "Ön izleme", + "PreviewDate": "Bu ön izleme %s verilerine göre hazırlanmıştır.", + "PreviewReport": "Rapor ön izlemesi", + "PreviewReportExceedsMaximumTimeFrameValueAllowed": "Rapor ön izlemesi için en fazla zaman aralığı 24 saatten büyük olamaz.", + "PreviewReportInvalidTimeFrameValues": "Rapor ön izlemesi için ayarlanmış zaman aralığı değerleri geçersiz. Saniye, dakika, saat ve gün değerlerine izin verilir.", + "PreviewSupportsDimension": "Ön izlemede en çok %s boyut görüntülenebilir.", + "ProductsWithX": "%s ile ürünler", + "RemoveDimension": "Boyutu kaldır", + "RemoveMetric": "Ölçümü kaldır", + "RemovedMetrics": "%s aralığı için doğru hesaplanamadığından bu ölçümler çıkarıldı.", + "ReportAllWebsitesHelp": "Bu raporun hangi siteler için kullanılacağını belirtin. Bu raporun tüm sitelerde kullanılabilmesi için \"Tüm siteler\" olarak da seçebilirsiniz (gelecekte eklenecek siteler dahil).", + "ReportAllWebsitesNonSuperUserHelp": "Bu raporun kullanılabileceği siteyi seçin.", + "ReportAvailableToAllWebsites": "Bu rapor tüm siteler için kullanılabilir.", + "ReportAvailableToMultipleWebsites": "Bu rapor, birden çok site için kullanılabilir.", + "ReportCategory": "Rapor kategorisi", + "ReportCategoryHelp": "Bu raporun, rapor menüsünde hangi ana kategori altında bulunacağını belirtin.", + "ReportContent": "Rapor içeriği", + "ReportCreated": "Rapor eklendi.", + "ReportDescriptionHelp": "Rapor başlığının yanındaki yardım simgesine tıklandığında görüntülenecek isteğe bağlı açıklama. Raporun amacını açıklayan bilgiler yazılabilir.", + "ReportDimensionsHelpExtended": "Ek boyutlara gerek duyuyorsanız, sınırı artırabilirsiniz. %1$sAyrıntılı bilgi alın%2$s.", + "ReportDimensionsHelpNew": "Bir boyut genellikle özellikleri tanımlar ve bir raporun ilk sütununda görüntülenir. Birden fazla boyut seçebilirsiniz (Tarayıcı, Ülke, İl gibi). En az bir boyut seçilmelidir.", + "ReportEditNotAllowedAllWebsitesUpdated": "Bu rapor tüm siteler için kullanılabileceğinden, yalnızca süper kullanıcı izinlerine sahip bir kullanıcı bu raporu düzenleyebilir.", + "ReportEditNotAllowedMultipleWebsitesAccessIssue": "Bu rapor birden çok site için kullanılabileceğinden, yalnızca tüm sitelere erişimi olan bir süper kullanıcı veya yönetici onu değiştirebilir.", + "ReportHasFilterApplied": "Bu rapora şu süzgeç uygulandı: %s.", + "ReportInPausedStateAdmin": "Bu rapor duraklatılmış. Rapor sürdürülene kadar arşivleme yapılmayacak. Raporu sürdürmek için, %1$sRapor yönetimi%2$s bölümüne gidin ve seçilmiş rapor için Oynat üzerine tıklayın.", + "ReportMetricsHelp": "Ölçümler, işlemlerin sayısal değerlerini belirtir. Örneğin sitenin trafiğini arttırmak istiyorsanız, \"Ziyaretler\" ölçümünü, sitesinin hızını arttırmak istiyorsanız \"Ortalama üretilme süresi\" ölçümünü eklemelisiniz.", + "ReportName": "Rapor adı", + "ReportNameHelp": "Bu raporun hangi ad altında bulunacağını belirler.", + "ReportPage": "Rapor sayfası", + "ReportSegmentHelp": "Süzgeçler bir raporun alt gruplarının oluşturulmasını sağlar. Örneğin bu raporu yalnızca mobil aygıtları görüntüleyecek şekilde süzebilirsiniz.", + "ReportSubcategory": "Rapor alt kategorisi", + "ReportSubcategoryHelp": "Bu raporu istediğiniz bir rapor sayfasına ekleyebilirsiniz. Bir alt kategori seçmezseniz seçilmiş kategori altına rapor adı ile yeni bir rapor sayfası eklenir.", + "ReportType": "Rapor türü", + "ReportUpdated": "Rapor güncellendi.", + "ResumeExceptionMessage": "Rapor sürdürülemedi. Site eşleşmiyor", + "ResumeReportConfirm": "Bu raporu sürdürdüğünüzde, arşivleme bugünden itibaren yeniden başlar. Bu özel raporu sürdürmek istediğinize emin misiniz?", + "ResumeReportInfo": "Bu raporu sürdürdüğünüzde, arşivleme bugünden itibaren yeniden başlar.", + "ResumedReport": "Rapor sürdürüldü.", + "SelectMeasurablesMatchingSearch": "ya da şu ifadeyi içeren tüm ölçülebilirleri ekleyin", + "Type": "Tür", + "Unlock": "Kilidi aç", + "UpdatingData": "Veriler güncelleniyor…", + "ViewReportInfo": "Raporu görüntüle", + "WarningOnUpdateReportMightGetLost": "Bu özel raporu güncellediğinizde, bu özel rapor için daha önce üretilmiş raporlar kullanılamayacak.", + "WarningOnUpdateReportMightGetLostBrowserArchivingDisabled": "Bu özel raporu güncellediğinizde, daha önce üretilmiş raporlar kullanılamayacak ve son %1$s ayın raporları yeniden üretilecek.", + "WarningProductRevenueMetricDependency": "Ürün geliri ölçümleri için aynı raporda eşlik edecek bir ürün adeti ölçümü gereklidir. Eşlik edecek ölçüm otomatik olarak eklendi. %1$sAyrıntılı bilgi alın%2$s.", + "WarningRequiresUnlock": "Bu rapor içeriğinde değişiklik yapmak için \"Kilidini açmalısınız\". Rapor yapılandırmasını değiştirip güncelledikten sonra, yeni rapor verilerinin üretilmesi gerekir ve daha önce üretilmiş raporlar artık kullanılamaz.", + "WarningRequiresUnlockBrowserArchivingDisabled": "Bu rapor içeriğinde değişiklik yapmak için \"Kilidini açmalısınız\". Rapor yapılandırmasını değiştirip güncelledikten sonra, son %1$s ayın yeni rapor verileri yeniden üretilecek ve daha önce üretilmiş raporlar artık kullanılamayacak.", + "WebsiteName": "Site adı" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/uk.json b/files/plugin-CustomReports-5.4.3/lang/uk.json new file mode 100644 index 0000000..5b3fb0a --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/uk.json @@ -0,0 +1,5 @@ +{ + "CustomReports": { + "CustomReports": "Спеціальні звіти" + } +} diff --git a/files/plugin-CustomReports-5.4.3/lang/zh-cn.json b/files/plugin-CustomReports-5.4.3/lang/zh-cn.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/zh-cn.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-CustomReports-5.4.3/lang/zh-tw.json b/files/plugin-CustomReports-5.4.3/lang/zh-tw.json new file mode 100644 index 0000000..7f8e2d7 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/lang/zh-tw.json @@ -0,0 +1,12 @@ +{ + "CustomReports": { + "Category": "分類", + "ErrorNotAnArray": "「%1$s」必須是陣列。", + "ErrorXNotProvided": "請輸入「%1$s」的值。", + "ErrorXNotWhitelisted": "「%1$s」的值不允許,使用以下其一:%2$s。", + "ErrorXTooLong": "「%1$s」過長,最多允許 %2$s 個字元。", + "Filter": "過濾", + "UpdatingData": "數據更新中…", + "ViewReportInfo": "查看報表" + } +} diff --git a/files/plugin-CustomReports-5.4.3/phpcs.xml b/files/plugin-CustomReports-5.4.3/phpcs.xml new file mode 100644 index 0000000..7208e4b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/phpcs.xml @@ -0,0 +1,36 @@ + + + + Matomo Coding Standard for CustomReports plugin + + + + . + + tests/javascript/* + */vendor/* + + + + + + + + tests/* + + + + + Updates/* + + + + + tests/* + + + + + tests/* + + \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/phpstan.neon b/files/plugin-CustomReports-5.4.3/phpstan.neon new file mode 100644 index 0000000..c3fa656 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/phpstan.neon @@ -0,0 +1,15 @@ +parameters: + level: 0 + phpVersion: 70200 + paths: + - . + excludePaths: + - tests/* + bootstrapFiles: + - ../../bootstrap-phpstan.php + universalObjectCratesClasses: + - Piwik\Config + - Piwik\View + - Piwik\ViewDataTable\Config + scanDirectories: + - ../../plugins/ diff --git a/files/plugin-CustomReports-5.4.3/plugin.json b/files/plugin-CustomReports-5.4.3/plugin.json new file mode 100644 index 0000000..910ca83 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/plugin.json @@ -0,0 +1,31 @@ +{ + "name": "CustomReports", + "description": "Pull out the information you need in order to be successful. Develop your custom strategy to meet your individualized goals while saving money & time.", + "version": "5.4.3", + "theme": false, + "require": { + "matomo": ">=5.0.0-rc5,<6.0.0-b1" + }, + "authors": [ + { + "name": "InnoCraft", + "email": "contact@innocraft.com", + "homepage": "https:\/\/www.innocraft.com" + } + ], + "price": { + "base": 220 + }, + "preview": { + "video_url": "https://www.youtube-nocookie.com/embed/Ss0jtGLaeDM", + "demo_url": "https://demo.matomo.cloud/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday#?idSite=1&period=day&date=yesterday&segment=&category=CustomReports_CustomReports&subcategory=2" + }, + "homepage": "https:\/\/www.innocraft.com", + "license": "InnoCraft EULA", + "keywords": [ + "custom", + "reports", + "filter", + "segment" + ] +} diff --git a/files/plugin-CustomReports-5.4.3/pull_request_template.md b/files/plugin-CustomReports-5.4.3/pull_request_template.md new file mode 100644 index 0000000..e7d9cf5 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/pull_request_template.md @@ -0,0 +1,26 @@ +## Description + + +## Issue No + + +## Steps to Replicate the Issue +1. +2. +3. + + + +## Checklist +- [✔/✖] Tested locally or on demo2/demo3? +- [✔/✖/NA] New test case added/updated? +- [✔/✖/NA] Are all newly added texts included via translation? +- [✔/✖/NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue) +- [✔/✖/NA] Version bumped? \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/templates/manage.twig b/files/plugin-CustomReports-5.4.3/templates/manage.twig new file mode 100644 index 0000000..0c10e1f --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/templates/manage.twig @@ -0,0 +1,21 @@ +{% extends 'admin.twig' %} + +{% block topcontrols %} +
+
+
+{% endblock %} + +{% block content %} +
+{% endblock %} \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/vue/dist/CustomReports.umd.js b/files/plugin-CustomReports-5.4.3/vue/dist/CustomReports.umd.js new file mode 100644 index 0000000..04a71bb --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/dist/CustomReports.umd.js @@ -0,0 +1,2594 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("CoreHome"), require("vue"), require("CorePluginsAdmin"), require("SegmentEditor")); + else if(typeof define === 'function' && define.amd) + define(["CoreHome", , "CorePluginsAdmin", "SegmentEditor"], factory); + else if(typeof exports === 'object') + exports["CustomReports"] = factory(require("CoreHome"), require("vue"), require("CorePluginsAdmin"), require("SegmentEditor")); + else + root["CustomReports"] = factory(root["CoreHome"], root["Vue"], root["CorePluginsAdmin"], root["SegmentEditor"]); +})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__19dc__, __WEBPACK_EXTERNAL_MODULE__8bbf__, __WEBPACK_EXTERNAL_MODULE_a5a2__, __WEBPACK_EXTERNAL_MODULE_f06f__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "plugins/CustomReports/vue/dist/"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "fae3"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "19dc": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__19dc__; + +/***/ }), + +/***/ "8bbf": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__; + +/***/ }), + +/***/ "a5a2": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_a5a2__; + +/***/ }), + +/***/ "f06f": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_f06f__; + +/***/ }), + +/***/ "fae3": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, "ReportEdit", function() { return /* reexport */ Edit; }); +__webpack_require__.d(__webpack_exports__, "ReportsList", function() { return /* reexport */ List; }); +__webpack_require__.d(__webpack_exports__, "ReportsManage", function() { return /* reexport */ Manage; }); + +// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js +// This file is imported into lib/wc client bundles. + +if (typeof window !== 'undefined') { + var currentScript = window.document.currentScript + if (false) { var getCurrentScript; } + + var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/) + if (src) { + __webpack_require__.p = src[1] // eslint-disable-line + } +} + +// Indicate to webpack that this file can be concatenated +/* harmony default export */ var setPublicPath = (null); + +// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"} +var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf"); + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CustomReports/vue/src/Reports/Edit.vue?vue&type=template&id=769922f2 + +var _hoisted_1 = { + class: "loadingPiwik" +}; + +var _hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + src: "plugins/Morpheus/images/loading-blue.gif" +}, null, -1); + +var _hoisted_3 = { + class: "loadingPiwik" +}; + +var _hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + src: "plugins/Morpheus/images/loading-blue.gif" +}, null, -1); + +var _hoisted_5 = { + class: "alert alert-warning" +}; +var _hoisted_6 = { + key: 0 +}; +var _hoisted_7 = { + key: 1 +}; +var _hoisted_8 = { + key: 0, + class: "alert alert-warning" +}; +var _hoisted_9 = ["innerHTML"]; +var _hoisted_10 = { + key: 1 +}; +var _hoisted_11 = { + name: "name" +}; +var _hoisted_12 = { + name: "description" +}; +var _hoisted_13 = { + class: "form-group row" +}; +var _hoisted_14 = { + class: "col s12" +}; +var _hoisted_15 = { + class: "col s12 m6" +}; +var _hoisted_16 = { + for: "all_websites", + class: "siteSelectorLabel" +}; +var _hoisted_17 = { + class: "sites_autocomplete" +}; +var _hoisted_18 = { + class: "col s12 m6" +}; +var _hoisted_19 = { + class: "form-help" +}; +var _hoisted_20 = { + key: 0, + class: "inline-help" +}; +var _hoisted_21 = { + key: 1, + class: "inline-help" +}; +var _hoisted_22 = { + key: 0, + class: "col s12 m6" +}; +var _hoisted_23 = { + key: 0 +}; +var _hoisted_24 = { + for: "websitecontains" +}; + +var _hoisted_25 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_26 = ["placeholder"]; +var _hoisted_27 = ["disabled", "value"]; +var _hoisted_28 = { + key: 1 +}; + +var _hoisted_29 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_30 = { + class: "entityTable" +}; +var _hoisted_31 = { + class: "siteId" +}; +var _hoisted_32 = { + class: "siteName" +}; +var _hoisted_33 = { + key: 0, + class: "siteAction" +}; +var _hoisted_34 = { + colspan: "3" +}; +var _hoisted_35 = { + key: 0, + class: "siteAction" +}; +var _hoisted_36 = ["onClick"]; +var _hoisted_37 = { + class: "form-group row" +}; +var _hoisted_38 = { + class: "col s12" +}; +var _hoisted_39 = { + class: "unlockAlert alert alert-info" +}; +var _hoisted_40 = { + key: 0 +}; +var _hoisted_41 = { + key: 1 +}; + +var _hoisted_42 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_43 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_44 = ["value"]; +var _hoisted_45 = { + class: "alertUnlocked alert alert-warning" +}; +var _hoisted_46 = { + key: 0 +}; +var _hoisted_47 = { + key: 1 +}; +var _hoisted_48 = { + name: "reportType" +}; +var _hoisted_49 = { + class: "form-group row" +}; +var _hoisted_50 = { + class: "col s12 m6 dimensionsGroup" +}; + +var _hoisted_51 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_52 = { + class: "groupValueSelect", + name: "dimensions" +}; +var _hoisted_53 = ["title", "onClick"]; +var _hoisted_54 = { + class: "groupValueSelect addDimension", + name: "dimensions" +}; +var _hoisted_55 = { + class: "col s12 m6" +}; +var _hoisted_56 = { + class: "form-help" +}; +var _hoisted_57 = ["innerHTML"]; +var _hoisted_58 = { + class: "form-group row" +}; +var _hoisted_59 = { + class: "col s12 m6 metricsGroup" +}; + +var _hoisted_60 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_61 = { + class: "groupValueSelect", + name: "metrics" +}; +var _hoisted_62 = ["title", "onClick"]; +var _hoisted_63 = { + class: "groupValueSelect addMetric", + name: "metrics" +}; +var _hoisted_64 = { + class: "col s12 m6" +}; +var _hoisted_65 = { + class: "form-help" +}; +var _hoisted_66 = { + class: "inline-help" +}; +var _hoisted_67 = ["innerHTML"]; +var _hoisted_68 = { + class: "form-group row segmentFilterGroup" +}; +var _hoisted_69 = { + class: "col s12" +}; +var _hoisted_70 = { + style: { + "margin": "8px 0", + "display": "inline-block" + } +}; +var _hoisted_71 = { + class: "form-group row" +}; +var _hoisted_72 = { + class: "col s12" +}; + +var _hoisted_73 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_74 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); + +var _hoisted_75 = { + name: "reportCategories" +}; +var _hoisted_76 = { + name: "reportSubcategories" +}; +var _hoisted_77 = { + class: "alert alert-warning" +}; +var _hoisted_78 = { + key: 0 +}; +var _hoisted_79 = { + key: 1 +}; +var _hoisted_80 = { + class: "alert alert-warning" +}; +var _hoisted_81 = { + key: 0 +}; +var _hoisted_82 = { + key: 1 +}; +var _hoisted_83 = { + key: 0, + class: "form-group row" +}; +var _hoisted_84 = ["textContent"]; +var _hoisted_85 = { + class: "col s12 m6" +}; +var _hoisted_86 = { + id: "childReports", + class: "col s12 m6" +}; +var _hoisted_87 = ["data-id"]; + +var _hoisted_88 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "ui-icon ui-icon-arrowthick-2-n-s" +}, null, -1); + +var _hoisted_89 = { + class: "col s12 m6" +}; +var _hoisted_90 = { + class: "form-help" +}; +var _hoisted_91 = ["textContent"]; +var _hoisted_92 = { + class: "entityCancel" +}; +var _hoisted_93 = { + class: "ui-confirm", + id: "confirmUnlockReport", + ref: "confirmUnlockReport" +}; +var _hoisted_94 = { + key: 0 +}; +var _hoisted_95 = { + key: 1 +}; +var _hoisted_96 = ["value"]; +var _hoisted_97 = ["value"]; +var _hoisted_98 = { + class: "ui-confirm", + id: "infoReportIsLocked", + ref: "infoReportIsLocked" +}; +var _hoisted_99 = { + key: 0 +}; +var _hoisted_100 = { + key: 1 +}; +var _hoisted_101 = ["value"]; +var _hoisted_102 = ["value"]; +function render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_SiteSelector = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SiteSelector"); + + var _component_SegmentGenerator = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SegmentGenerator"); + + var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + + var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContentBlock, { + class: "editReport", + "content-title": _ctx.contentTitle + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + var _ctx$report$metrics, _ctx$report$dimension, _ctx$report$subcatego; + + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_1, [_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_3, [_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_5, [_ctx.multipleSites.length && !_ctx.report.allowedToEdit ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportEditNotAllowedMultipleWebsitesAccessIssue')), 1)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportEditNotAllowedAllWebsitesUpdated')), 1))], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.canEdit]]), _ctx.report.status === 'paused' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_8, [_ctx.report.allowedToEdit ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { + key: 0, + innerHTML: _ctx.getPausedStateAdminMessage + }, null, 8, _hoisted_9)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_10, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_NoDataMessagePausedStateNonAdminUser')), 1))])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + onSubmit: _cache[15] || (_cache[15] = function ($event) { + return _ctx.edit ? _ctx.updateReport() : _ctx.createReport(); + }) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "name", + "model-value": _ctx.report.name, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + _ctx.report.name = $event; + + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('General_Name'), + maxlength: 50, + disabled: !_ctx.canEdit, + placeholder: _ctx.translate('CustomReports_FieldNamePlaceholder'), + "inline-help": _ctx.translate('CustomReports_ReportNameHelp') + }, null, 8, ["model-value", "title", "disabled", "placeholder", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "textarea", + name: "description", + "model-value": _ctx.report.description, + "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + _ctx.report.description = $event; + + _ctx.setValueHasChanged(); + }), + title: "".concat(_ctx.translate('General_Description'), " (optional)"), + maxlength: 1000, + disabled: !_ctx.canEdit, + rows: 3, + placeholder: _ctx.translate('CustomReports_FieldDescriptionPlaceholder'), + "inline-help": _ctx.translate('CustomReports_ReportDescriptionHelp') + }, null, 8, ["model-value", "title", "disabled", "placeholder", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", _hoisted_14, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ApplyTo')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", _hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Website')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SiteSelector, { + id: "all_websites", + "model-value": _ctx.report.site, + "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) { + _ctx.report.site = $event; + + _ctx.setWebsiteChanged($event); + }), + "show-all-sites-item": _ctx.isSuperUser, + "switch-site-on-select": false, + "show-selected-site": true + }, null, 8, ["model-value", "show-all-sites-item"])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_19, [_ctx.isSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_20, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportAllWebsitesHelp')), 1)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_21, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportAllWebsitesNonSuperUserHelp')), 1))])]), _ctx.report.site.id !== 'all' && _ctx.report.site.id !== '0' && _ctx.report.site.id !== 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_22, [_ctx.report.allowedToEdit ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_23, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_24, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_SelectMeasurablesMatchingSearch')), 1), _hoisted_25, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + class: "control_text customReportSearchMeasurablesField", + type: "text", + id: "websitecontains", + "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) { + return _ctx.containsText = $event; + }), + placeholder: _ctx.translate('General_Search') + }, null, 8, _hoisted_26), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vModelText"], _ctx.containsText]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + style: { + "margin-left": "3.5px" + }, + disabled: !_ctx.containsText, + class: "btn customReportSearchFindMeasurables", + type: "button", + onClick: _cache[4] || (_cache[4] = function ($event) { + return _ctx.addSitesContaining(_ctx.containsText); + }), + value: _ctx.translate('CustomReports_FindMeasurables') + }, null, 8, _hoisted_27)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.report.allowedToEdit || _ctx.multipleSites.length ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_28, [_hoisted_29, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", _hoisted_30, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", _hoisted_31, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Id')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", _hoisted_32, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), _ctx.report.allowedToEdit ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("th", _hoisted_33, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Remove')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_34, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_NoMeasurableAssignedYet')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.multipleSites.length]]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.multipleSites, function (site, index) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + key: index + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(site.idsite), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(site.name), 1), _ctx.report.allowedToEdit ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", _hoisted_35, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-minus table-action", + onClick: function onClick($event) { + return _ctx.removeSite(site); + } + }, null, 8, _hoisted_36)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.multipleSites.length > 0]]); + }), 128))])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_37, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", _hoisted_38, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportContent')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_39, [_ctx.browserArchivingDisabled && _ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_40, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_WarningRequiresUnlockBrowserArchivingDisabled', _ctx.reArchiveLastN)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.browserArchivingDisabled || !_ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_41, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_WarningRequiresUnlock')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _hoisted_42, _hoisted_43, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "button", + class: "btn unlockReport", + onClick: _cache[5] || (_cache[5] = function ($event) { + return _ctx.unlockReport(); + }), + value: _ctx.translate('CustomReports_Unlock') + }, null, 8, _hoisted_44)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLocked]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_45, [_ctx.browserArchivingDisabled && _ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_46, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_WarningOnUpdateReportMightGetLostBrowserArchivingDisabled', _ctx.reArchiveLastN)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.browserArchivingDisabled || !_ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_47, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_WarningOnUpdateReportMightGetLost')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUnlocked]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_48, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "radio", + name: "reportType", + "model-value": _ctx.report.report_type, + "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { + return _ctx.setReportTypeHasChanged($event); + }), + title: _ctx.translate('CustomReports_ReportType'), + disabled: !_ctx.canEdit, + options: _ctx.reportTypes + }, null, 8, ["model-value", "title", "disabled", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_49, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_50, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_Dimensions')), 1), _hoisted_51, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.report.dimensions, function (dimension, dimIndex) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])("selectedDimension selectedDimension".concat(dimIndex)), + key: dimIndex + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_52, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "expandable-select", + name: "dimensions", + "model-value": dimension, + "onUpdate:modelValue": function onUpdateModelValue($event) { + return _ctx.changeDimension($event, dimIndex); + }, + title: _ctx.dimensionsReadable[dimension] || dimension, + "full-width": true, + options: _ctx.dimensions + }, null, 8, ["model-value", "onUpdate:modelValue", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-minus", + title: _ctx.translate('CustomReports_RemoveDimension'), + onClick: function onClick($event) { + return _ctx.removeDimension(dimIndex); + } + }, null, 8, _hoisted_53)], 2); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_54, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "expandable-select", + name: "dimensions", + "model-value": '', + "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) { + _ctx.addDimension($event); + }), + title: _ctx.translate('CustomReports_AddDimension'), + "full-width": true, + options: _ctx.dimensions + }, null, 8, ["title", "options"])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.report.dimensions.length < _ctx.maxDimensions]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_55, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_56, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "inline-help", + innerHTML: _ctx.$sanitize(_ctx.getDimensionsHelpText) + }, null, 8, _hoisted_57)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.report.report_type !== 'evolution']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_58, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_59, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Metrics')), 1), _hoisted_60, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.report.metrics, function (metric, metricIndex) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])("selectedMetric selectedMetric".concat(metricIndex)), + key: metricIndex + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_61, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "expandable-select", + name: "metrics", + "model-value": metric, + "onUpdate:modelValue": function onUpdateModelValue($event) { + return _ctx.changeMetric($event, metricIndex); + }, + title: _ctx.metricsReadable[metric] || metric, + "full-width": true, + options: _ctx.metrics + }, null, 8, ["model-value", "onUpdate:modelValue", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-minus", + title: _ctx.translate('CustomReports_RemoveMetric'), + onClick: function onClick($event) { + return _ctx.removeMetric(metricIndex); + } + }, null, 8, _hoisted_62)], 2); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_63, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "expandable-select", + name: "metrics", + "model-value": '', + "onUpdate:modelValue": _cache[8] || (_cache[8] = function ($event) { + _ctx.addMetric($event); + }), + title: _ctx.translate('CustomReports_AddMetric'), + "full-width": true, + options: _ctx.metrics + }, null, 8, ["title", "options"])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_64, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_65, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_66, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportMetricsHelp')), 1)])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "alert alert-warning", + innerHTML: _ctx.getProductRevenueDependencyMessage + }, null, 8, _hoisted_67), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.dependencyAdded]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_68, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_69, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", _hoisted_70, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_Filter')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportSegmentHelp')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SegmentGenerator, { + "model-value": _ctx.report.segment_filter, + "onUpdate:modelValue": _cache[9] || (_cache[9] = function ($event) { + return _ctx.setSegmentFilterHasChanged($event); + }), + idsite: _ctx.report.site.id + }, null, 8, ["model-value", "idsite"])])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_71, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_72, [_hoisted_73, _hoisted_74, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + class: "showPreviewButton", + disabled: !((_ctx$report$metrics = _ctx.report.metrics) !== null && _ctx$report$metrics !== void 0 && _ctx$report$metrics.length) || !((_ctx$report$dimension = _ctx.report.dimensions) !== null && _ctx$report$dimension !== void 0 && _ctx$report$dimension.length), + onConfirm: _cache[10] || (_cache[10] = function ($event) { + return _ctx.showPreview(); + }), + value: _ctx.translate('CustomReports_PreviewReport') + }, null, 8, ["disabled", "value"])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.report.report_type === 'table']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_75, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "reportCategories", + "model-value": _ctx.report.category.id, + "onUpdate:modelValue": _cache[11] || (_cache[11] = function ($event) { + _ctx.report.category.id = $event; + + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('CustomReports_ReportCategory'), + disabled: !_ctx.canEdit, + options: _ctx.categories, + introduction: _ctx.translate('CustomReports_ReportPage'), + "inline-help": _ctx.translate('CustomReports_ReportCategoryHelp') + }, null, 8, ["model-value", "title", "disabled", "options", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_76, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "reportSubcategories", + "model-value": (_ctx$report$subcatego = _ctx.report.subcategory) === null || _ctx$report$subcatego === void 0 ? void 0 : _ctx$report$subcatego.id, + "onUpdate:modelValue": _cache[12] || (_cache[12] = function ($event) { + _ctx.setSubcategory($event); + + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('CustomReports_ReportSubcategory'), + disabled: !_ctx.canEdit, + options: _ctx.subcategories[_ctx.report.category.id], + "inline-help": _ctx.translate('CustomReports_ReportSubcategoryHelp') + }, null, 8, ["model-value", "title", "disabled", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_77, [_ctx.browserArchivingDisabled && _ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_78, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_WarningOnUpdateReportMightGetLostBrowserArchivingDisabled', _ctx.reArchiveLastN)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.browserArchivingDisabled || !_ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_79, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_WarningOnUpdateReportMightGetLost')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUnlocked]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_80, [_ctx.multipleSites.length && !_ctx.report.allowedToEdit ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_81, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportEditNotAllowedMultipleWebsitesAccessIssue')), 1)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_82, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ReportEditNotAllowedAllWebsitesUpdated')), 1))], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.canEdit]]), _ctx.childReports.length ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_83, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", { + class: "col s12", + textContent: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_OrderSubCategoryReports')) + }, null, 8, _hoisted_84), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_85, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", _hoisted_86, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.childReports, function (childReport) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: childReport.idcustomreport, + "data-id": childReport.idcustomreport + }, [_hoisted_88, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(childReport.name), 1)], 8, _hoisted_87); + }), 128))])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_89, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_90, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "form-description", + textContent: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_OrderSubCategoryReportsDescription')) + }, null, 8, _hoisted_91)])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + class: "createButton", + onConfirm: _cache[13] || (_cache[13] = function ($event) { + return _ctx.edit ? _ctx.updateReport() : _ctx.createReport(); + }), + disabled: _ctx.isUpdating || !_ctx.isDirty, + saving: _ctx.isUpdating, + value: _ctx.saveButtonText + }, null, 8, ["disabled", "saving", "value"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.canEdit]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_92, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + onClick: _cache[14] || (_cache[14] = function ($event) { + return _ctx.cancel(); + }) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Cancel')), 1)])])], 32), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_93, [_ctx.browserArchivingDisabled && _ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("h2", _hoisted_94, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ConfirmUnlockReportBrowserArchivingDisabled', _ctx.reArchiveLastN)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.browserArchivingDisabled || !_ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("h2", _hoisted_95, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ConfirmUnlockReport')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, _hoisted_96), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, _hoisted_97)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_98, [_ctx.browserArchivingDisabled && _ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("h2", _hoisted_99, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_InfoReportIsLockedBrowserArchivingDisabled', _ctx.reArchiveLastN)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), !_ctx.browserArchivingDisabled || !_ctx.reArchiveLastN ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("h2", _hoisted_100, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_InfoReportIsLocked')), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "unlock", + type: "button", + value: _ctx.translate('CustomReports_Unlock') + }, null, 8, _hoisted_101), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "ok", + type: "button", + value: _ctx.translate('General_Cancel') + }, null, 8, _hoisted_102)], 512)]; + }), + _: 1 + }, 8, ["content-title"]); +} +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/Edit.vue?vue&type=template&id=769922f2 + +// EXTERNAL MODULE: external "CoreHome" +var external_CoreHome_ = __webpack_require__("19dc"); + +// EXTERNAL MODULE: external "CorePluginsAdmin" +var external_CorePluginsAdmin_ = __webpack_require__("a5a2"); + +// EXTERNAL MODULE: external "SegmentEditor" +var external_SegmentEditor_ = __webpack_require__("f06f"); + +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/CustomReports.store.ts +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _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; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + + + +function arrayFilterAndRemoveDuplicates(values) { + return _toConsumableArray(new Set(values)).filter(function (v) { + return !!v; + }); +} + +function formatExpandableList(listByCategories, subcategoryField, extraField) { + var list = []; + listByCategories.forEach(function (category) { + category[subcategoryField].forEach(function (value) { + list.push(Object.assign({ + group: category.category, + key: value.uniqueId, + value: value.name, + tooltip: value.description || undefined + }, extraField ? _defineProperty({}, extraField, value[extraField]) : {})); + }); + }); + return list; +} + +var EMPTY_CAT = { + key: '', + value: '' +}; + +var CustomReports_store_CustomReportsStore = /*#__PURE__*/function () { + function CustomReportsStore() { + var _this = this; + + _classCallCheck(this, CustomReportsStore); + + _defineProperty(this, "privateState", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ + reports: [], + reportTypesReadable: {}, + dimensionsReadable: {}, + metricsReadable: {}, + categories: [], + subcategories: {}, + isLoading: false, + isUpdating: false, + allMetrics: [], + allDimensions: [] + })); + + _defineProperty(this, "state", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(_this.privateState); + })); + + _defineProperty(this, "fetchPromise", null); + + _defineProperty(this, "availableReportTypesPromise", null); + + _defineProperty(this, "dimensionsPromise", null); + + _defineProperty(this, "dimensionsIdsiteLoaded", 0); + + _defineProperty(this, "metricsPromise", null); + + _defineProperty(this, "metricsIdsiteLoaded", 0); + + _defineProperty(this, "categoriesPromise", null); + + _defineProperty(this, "categoriesIdsiteLoaded", null); + } + + _createClass(CustomReportsStore, [{ + key: "reload", + value: function reload() { + this.privateState.reports = []; + this.fetchPromise = null; + return this.fetchReports(); + } + }, { + key: "cleanupSegmentDefinition", + value: function cleanupSegmentDefinition(definition) { + var result = definition; + result = result.replace('\'', '%27'); + result = result.replace('&', '%26'); + return result; + } + }, { + key: "getAvailableReportTypes", + value: function getAvailableReportTypes() { + var _this2 = this; + + if (!this.availableReportTypesPromise) { + this.availableReportTypesPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'CustomReports.getAvailableReportTypes', + filter_limit: '-1' + }).then(function (reportTypes) { + var reportTypeMap = {}; + reportTypes.forEach(function (rt) { + reportTypeMap[rt.key] = rt.value; + }); + _this2.privateState.reportTypesReadable = reportTypeMap; + }); + } + + return this.availableReportTypesPromise.then(function () { + return _this2.state.value.reportTypesReadable; + }); + } + }, { + key: "getAvailableDimensions", + value: function getAvailableDimensions(idSite) { + var _this3 = this; + + if (!this.dimensionsPromise || this.dimensionsIdsiteLoaded !== idSite) { + this.dimensionsIdsiteLoaded = idSite; + this.dimensionsPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'CustomReports.getAvailableDimensions', + filter_limit: '-1', + idSite: idSite + }).then(function (dimensions) { + var dimensionMap = {}; + dimensions.forEach(function (category) { + category.dimensions.forEach(function (dimension) { + dimensionMap[dimension.uniqueId] = dimension.name; + }); + }); + _this3.privateState.dimensionsReadable = dimensionMap; + _this3.privateState.allDimensions = formatExpandableList(dimensions, 'dimensions', 'sqlSegment'); + }); + } + + return this.dimensionsPromise.then(function () { + return _this3.state.value.dimensionsReadable; + }); + } + }, { + key: "getAvailableMetrics", + value: function getAvailableMetrics(idSite) { + var _this4 = this; + + if (!this.metricsPromise || this.metricsIdsiteLoaded !== idSite) { + this.metricsIdsiteLoaded = idSite; + this.metricsPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'CustomReports.getAvailableMetrics', + filter_limit: '-1', + idSite: idSite + }).then(function (metrics) { + var metricsMap = {}; + metrics.forEach(function (metricsCategory) { + metricsCategory.metrics.forEach(function (metric) { + metricsMap[metric.uniqueId] = metric.name; + }); + }); + _this4.privateState.metricsReadable = metricsMap; + _this4.privateState.allMetrics = formatExpandableList(metrics, 'metrics'); + }); + } + + return this.metricsPromise.then(function () { + return _this4.state.value.metricsReadable; + }); + } + }, { + key: "getAvailableCategories", + value: function getAvailableCategories(idSite) { + var _this5 = this; + + var idSiteToUse = !idSite || idSite === 'all' ? external_CoreHome_["Matomo"].idSite : idSite; + + if (!this.categoriesPromise || this.categoriesIdsiteLoaded !== idSite) { + this.categoriesPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'CustomReports.getAvailableCategories', + filter_limit: '-1', + idSite: idSiteToUse + }).then(function (response) { + var categories = []; + var subcategories = {}; + response.forEach(function (category) { + categories.push({ + key: category.uniqueId, + value: category.name + }); + category.subcategories.forEach(function (subcat) { + subcategories[category.uniqueId] = subcategories[category.uniqueId] || [EMPTY_CAT]; + subcategories[category.uniqueId].push({ + key: subcat.uniqueId, + value: subcat.name + }); + }); + }); + _this5.privateState.categories = categories; + _this5.privateState.subcategories = subcategories; + }); + } + + return this.categoriesPromise; + } + }, { + key: "fetchReports", + value: function fetchReports() { + var _this6 = this; + + if (!this.fetchPromise) { + this.fetchPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'CustomReports.getConfiguredReports', + filter_limit: '-1' + }); + } + + this.privateState.isLoading = true; + this.privateState.reports = []; + return this.fetchPromise.then(function (reports) { + _this6.privateState.reports = reports.map(function (report) { + var _report$subcategory, _report$category; + + var subcategoryLink = undefined; + + if (report !== null && report !== void 0 && (_report$subcategory = report.subcategory) !== null && _report$subcategory !== void 0 && _report$subcategory.id) { + subcategoryLink = report.subcategory.id; + } else if ((report === null || report === void 0 ? void 0 : (_report$category = report.category) === null || _report$category === void 0 ? void 0 : _report$category.id) === 'CustomReports_CustomReports') { + subcategoryLink = report.idcustomreport; + } else { + subcategoryLink = report.name; + } + + return Object.assign(Object.assign({}, report), {}, { + // report.idsite is falsey when report is set for all sites + linkIdSite: report.idsite ? report.idsite : external_CoreHome_["Matomo"].idSite, + subcategoryLink: subcategoryLink + }); + }); + return _this6.state.value.reports; + }).finally(function () { + _this6.privateState.isLoading = false; + }); + } + }, { + key: "findReport", + value: function findReport(idCustomReport, isReload) { + var _this7 = this; + + // before going through an API request we first try to find it in loaded reports + var found = this.state.value.reports.find(function (r) { + return parseInt("".concat(r.idcustomreport), 10) === idCustomReport; + }); + + if (found && !isReload) { + return Promise.resolve(found); + } // otherwise we fetch it via API + + + this.privateState.isLoading = true; + return external_CoreHome_["AjaxHelper"].fetch({ + idCustomReport: idCustomReport, + method: 'CustomReports.getConfiguredReport' + }).finally(function () { + _this7.privateState.isLoading = false; + }); + } + }, { + key: "deleteReport", + value: function deleteReport(idCustomReport, idSite) { + var _this8 = this; + + this.privateState.isUpdating = true; + this.privateState.reports = []; + return external_CoreHome_["AjaxHelper"].fetch({ + idCustomReport: idCustomReport, + idSite: "".concat(idSite), + method: 'CustomReports.deleteCustomReport' + }, { + withTokenInUrl: true + }).then(function () { + return { + type: 'success' + }; + }).catch(function (e) { + return { + type: 'error', + message: e.message || e + }; + }).finally(function () { + _this8.privateState.isUpdating = false; + }); + } + }, { + key: "pauseReport", + value: function pauseReport(idCustomReport, idSite) { + var _this9 = this; + + this.privateState.isUpdating = true; + this.privateState.reports = []; + return external_CoreHome_["AjaxHelper"].fetch({ + idCustomReport: idCustomReport, + idSite: "".concat(idSite), + method: 'CustomReports.pauseCustomReport' + }, { + withTokenInUrl: true + }).then(function () { + return { + type: 'success' + }; + }).catch(function (e) { + return { + type: 'error', + message: e.message || e + }; + }).finally(function () { + _this9.privateState.isUpdating = false; + }); + } + }, { + key: "resumeReport", + value: function resumeReport(idCustomReport, idSite) { + var _this10 = this; + + this.privateState.isUpdating = true; + this.privateState.reports = []; + return external_CoreHome_["AjaxHelper"].fetch({ + idCustomReport: idCustomReport, + idSite: "".concat(idSite), + method: 'CustomReports.resumeCustomReport' + }, { + withTokenInUrl: true + }).then(function () { + return { + type: 'success' + }; + }).catch(function (e) { + return { + type: 'error', + message: e.message || e + }; + }).finally(function () { + _this10.privateState.isUpdating = false; + }); + } + }, { + key: "createOrUpdateReport", + value: function createOrUpdateReport(report, method, childReportIds, multipleIdSites) { + var _report$category2, + _report$subcategory2, + _this11 = this; + + this.privateState.isUpdating = true; + return external_CoreHome_["AjaxHelper"].post({ + method: method, + idCustomReport: report.idcustomreport, + reportType: report.report_type, + name: report.name.trim(), + description: report.description.trim(), + segmentFilter: encodeURIComponent(report.segment_filter), + categoryId: (_report$category2 = report.category) === null || _report$category2 === void 0 ? void 0 : _report$category2.id, + subcategoryId: (_report$subcategory2 = report.subcategory) === null || _report$subcategory2 === void 0 ? void 0 : _report$subcategory2.id, + idSite: report.site.id, + subCategoryReportIds: childReportIds, + multipleIdSites: multipleIdSites + }, { + dimensionIds: arrayFilterAndRemoveDuplicates(report.dimensions), + metricIds: arrayFilterAndRemoveDuplicates(report.metrics) + }, { + withTokenInUrl: true + }).then(function (response) { + return { + type: 'success', + response: response + }; + }).catch(function (error) { + return { + type: 'error', + message: error.message || error + }; + }).finally(function () { + _this11.privateState.isUpdating = false; + }); + } + }]); + + return CustomReportsStore; +}(); + +/* harmony default export */ var CustomReports_store = (new CustomReports_store_CustomReportsStore()); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CustomReports/vue/src/Reports/Edit.vue?vue&type=script&lang=ts +function Editvue_type_script_lang_ts_toConsumableArray(arr) { return Editvue_type_script_lang_ts_arrayWithoutHoles(arr) || Editvue_type_script_lang_ts_iterableToArray(arr) || Editvue_type_script_lang_ts_unsupportedIterableToArray(arr) || Editvue_type_script_lang_ts_nonIterableSpread(); } + +function Editvue_type_script_lang_ts_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function Editvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Editvue_type_script_lang_ts_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Editvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } + +function Editvue_type_script_lang_ts_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function Editvue_type_script_lang_ts_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Editvue_type_script_lang_ts_arrayLikeToArray(arr); } + +function Editvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + + + + + + +var notificationId = 'reportsmanagement'; +var productMetricNotificationId = 'reportsmanagementProductMetric'; + +function Editvue_type_script_lang_ts_arrayFilterAndRemoveDuplicates(values) { + return Editvue_type_script_lang_ts_toConsumableArray(new Set(values)).filter(function (v) { + return !!v; + }); +} + +function makeDefaultReport() { + return { + dimensions: [], + site: { + id: external_CoreHome_["Matomo"].idSite, + name: external_CoreHome_["Matomo"].currentSiteName + }, + category: {} + }; +} + +/* harmony default export */ var Editvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + idCustomReport: Number, + browserArchivingDisabled: Boolean, + reArchiveLastN: Number, + maxDimensions: Number, + isCloud: Boolean + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"], + SiteSelector: external_CoreHome_["SiteSelector"], + SegmentGenerator: external_SegmentEditor_["SegmentGenerator"], + SaveButton: external_CorePluginsAdmin_["SaveButton"] + }, + data: function data() { + return { + isDirty: false, + report: makeDefaultReport(), + isLocked: false, + isUnlocked: false, + canEdit: true, + dependencyAdded: false, + childReports: [], + childReportIds: [], + containsText: '', + multipleSites: [], + multipleIdSites: [] + }; + }, + created: function created() { + CustomReports_store.getAvailableReportTypes(); + this.init(); + }, + watch: { + idCustomReport: function idCustomReport(newValue) { + if (newValue === null) { + return; + } + + this.init(); + } + }, + methods: { + initReportOptions: function initReportOptions() { + var idsite = parseInt("".concat(this.report.site.id), 10) || 'all'; + CustomReports_store.getAvailableDimensions(idsite); + CustomReports_store.getAvailableMetrics(idsite); + CustomReports_store.getAvailableCategories(idsite); + }, + doUnlock: function doUnlock() { + this.isLocked = false; + this.isUnlocked = true; + }, + confirmReportIsLocked: function confirmReportIsLocked(callback) { + var _this = this; + + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.infoReportIsLocked, { + unlock: function unlock() { + _this.doUnlock(); + + if (callback) { + callback(); + } + } + }); + }, + removeAnyReportNotification: function removeAnyReportNotification() { + external_CoreHome_["NotificationsStore"].remove(notificationId); + external_CoreHome_["NotificationsStore"].remove(productMetricNotificationId); + external_CoreHome_["NotificationsStore"].remove('ajaxHelper'); + }, + showApiErrorMessage: function showApiErrorMessage(errorMessage, responseType) { + if (errorMessage && responseType) { + this.removeAnyReportNotification(); + var elem = document.createElement('textarea'); + elem.innerHTML = errorMessage; + this.showNotification(elem.value, responseType, 'toast'); + } + }, + showNotification: function showNotification(message, context) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var instanceId = external_CoreHome_["NotificationsStore"].show({ + message: message, + context: context, + id: notificationId, + type: type !== null && type !== void 0 ? type : 'transient', + prepend: true + }); + setTimeout(function () { + external_CoreHome_["NotificationsStore"].scrollToNotification(instanceId); + }, 100); + }, + showProductMetricNotification: function showProductMetricNotification(message, shouldScrollToNotification) { + var instanceId = external_CoreHome_["NotificationsStore"].show({ + message: message, + context: 'warning', + id: productMetricNotificationId, + type: 'transient' + }); + + if (!shouldScrollToNotification) { + return; + } + + setTimeout(function () { + external_CoreHome_["NotificationsStore"].scrollToNotification(instanceId); + }, 100); + }, + showErrorFieldNotProvidedNotification: function showErrorFieldNotProvidedNotification(title) { + var message = Object(external_CoreHome_["translate"])('CustomReports_ErrorXNotProvided', [title]); + this.showNotification(message, 'error'); + }, + init: function init() { + var _this2 = this; + + var idCustomReport = this.idCustomReport; + this.canEdit = true; + this.report = makeDefaultReport(); + external_CoreHome_["Matomo"].helper.lazyScrollToContent(); + + if (this.edit && idCustomReport) { + CustomReports_store.findReport(idCustomReport, true).then(function (report) { + var _this2$report$child_r; + + if (!report) { + return; + } + + _this2.report = Object(external_CoreHome_["clone"])(report); + _this2.isLocked = true; + _this2.isUnlocked = false; + _this2.canEdit = true; + _this2.childReports = (_this2$report$child_r = _this2.report.child_reports) !== null && _this2$report$child_r !== void 0 ? _this2$report$child_r : []; + + if (_this2.report.multipleIdSites && _this2.report.multipleIdSites.length && _this2.report.site.id !== 'all' && _this2.report.site.id !== '0' && _this2.report.site.id !== 0) { + _this2.multipleSites = _this2.report.multipleIdSites; + + if (!_this2.report.allowedToEdit) { + _this2.canEdit = false; + _this2.isLocked = false; + } + } + + if (_this2.childReports.length) { + Object.values(_this2.childReports).forEach(function (value) { + _this2.childReportIds.push(value.idcustomreport); + }); + } + + $(document).ready(function () { + $('#childReports').sortable({ + connectWith: '#childReports', + update: function update() { + _this2.isDirty = true; + var childReportsListItems = $('#childReports li'); + _this2.childReportIds = []; + childReportsListItems.each(function (idx, li) { + if (li.dataset.id) { + _this2.childReportIds.push(li.dataset.id); + } + }); + } + }); + }); + var idSite = _this2.report.idsite; + + if (idSite === 0 || idSite === '0' || idSite === 'all') { + // we need to make sure to send 'all' and not '0' as otherwise piwikApi would + // consider 0 as no value set and replace it with the current idsite. Also the + // site selector expects us to set 'all' instead of 0 + idSite = 'all'; + + if (!_this2.isSuperUser) { + // a lock does not make sense because report cannot be changed anyway. we do not want + // to show a warning related to this in such a case + _this2.canEdit = false; + _this2.isLocked = false; + } + } + + _this2.report.site = { + id: idSite, + name: _this2.report.site.name + }; + _this2.isDirty = false; + + _this2.initReportOptions(); + }); + return; + } + + if (this.create) { + this.report = { + idsite: external_CoreHome_["Matomo"].idSite, + site: { + id: external_CoreHome_["Matomo"].idSite, + name: external_CoreHome_["Matomo"].currentSiteName || external_CoreHome_["Matomo"].siteName + }, + name: '', + description: '', + dimensions: [], + metrics: ['nb_visits'], + report_type: 'table', + category: { + id: 'CustomReports_CustomReports' + }, + subcategory: null, + segment_filter: '', + child_reports: [], + allowedToEdit: true + }; + this.isLocked = false; + this.canEdit = true; + this.isDirty = false; + this.initReportOptions(); + } + }, + cancel: function cancel() { + var newParams = Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value); + delete newParams.idCustomReport; + external_CoreHome_["MatomoUrl"].updateHash(newParams); + }, + unlockReport: function unlockReport() { + var _this3 = this; + + if (!this.report) { + return; + } + + if (this.isLocked) { + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmUnlockReport, { + yes: function yes() { + _this3.doUnlock(); + } + }); + } + }, + createReport: function createReport() { + var _this4 = this; + + var method = 'CustomReports.addCustomReport'; + this.removeAnyReportNotification(); + + if (!this.checkRequiredFieldsAreSet()) { + return; + } + + this.multipleIdSites = []; + + if (this.multipleSites && this.multipleSites.length && this.report.site.id !== 'all' && this.report.site.id !== '0' && this.report.site.id !== 0) { + this.multipleIdSites.push(external_CoreHome_["Matomo"].idSite); + this.multipleSites.forEach(function (item) { + var idSite = item.idsite; + + if (!_this4.multipleIdSites.includes(idSite)) { + _this4.multipleIdSites.push(idSite); + } + }); + } + + if (this.multipleIdSites && this.multipleIdSites.length) { + // need to update this else this creates an issue after save + this.report.site.id = external_CoreHome_["Matomo"].idSite; + } + + CustomReports_store.createOrUpdateReport(this.report, method, this.childReportIds, this.multipleIdSites).then(function (response) { + if (!response || response.type === 'error' || !response.response) { + var _response$message, _response$type; + + _this4.showApiErrorMessage((_response$message = response.message) !== null && _response$message !== void 0 ? _response$message : '', (_response$type = response.type) !== null && _response$type !== void 0 ? _response$type : 'error'); + + return; + } + + _this4.isDirty = false; + var idCustomReport = response.response.value; + + if (_this4.report.site) { + var idSite = _this4.report.site.id; + + if (idSite && idSite !== 'all' && "".concat(idSite) !== "".concat(external_CoreHome_["Matomo"].idSite)) { + // when creating a report for a different site... + // we need to reload this page for a different idsite, otherwise the report won't + // be found + external_CoreHome_["MatomoUrl"].updateUrl(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { + idSite: idSite + }), Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { + idCustomReport: idCustomReport + })); + return; + } + } + + CustomReports_store.reload().then(function () { + if (external_CoreHome_["Matomo"].helper.isReportingPage()) { + external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); + } + + external_CoreHome_["MatomoUrl"].updateHash(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { + idCustomReport: idCustomReport + })); + setTimeout(function () { + _this4.showNotification(Object(external_CoreHome_["translate"])('CustomReports_ReportCreated'), response.type); + }, 200); + }); + }); + }, + showPreview: function showPreview() { + var _this$report$site, _this$report$dimensio, _this$report$metrics; + + if (!this.isProductRevenueDependencyMet(true)) { + return; + } + + var idSite = (_this$report$site = this.report.site) !== null && _this$report$site !== void 0 && _this$report$site.id && this.report.site.id !== 'all' ? this.report.site.id : external_CoreHome_["Matomo"].idSite; + var hasDimensions = ((_this$report$dimensio = this.report.dimensions) === null || _this$report$dimensio === void 0 ? void 0 : _this$report$dimensio.length) && this.report.report_type && this.report.report_type !== 'evolution'; + var dimensions = hasDimensions ? this.report.dimensions.join(',') : undefined; + var hasMetrics = !!((_this$report$metrics = this.report.metrics) !== null && _this$report$metrics !== void 0 && _this$report$metrics.length); + var metrics = hasMetrics ? this.report.metrics.join(',') : undefined; + var url = external_CoreHome_["MatomoUrl"].stringify({ + module: 'CustomReports', + action: 'previewReport', + period: 'day', + date: 'today', + idSite: idSite, + report_type: this.report.report_type, + dimensions: dimensions, + metrics: metrics, + segment: this.report.segment_filter || undefined + }); + var title = Object(external_CoreHome_["translate"])('CustomReports_Preview'); + window.Piwik_Popover.createPopupAndLoadUrl(url, title, 'customReportPreview'); + }, + setValueHasChanged: function setValueHasChanged() { + this.isDirty = true; + }, + addDimension: function addDimension(dimension) { + var _this5 = this; + + if (!this.report || !dimension) { + return; + } + + if (this.isLocked) { + this.confirmReportIsLocked(function () { + _this5.addDimension(dimension); + }); + return; + } + + if (!this.report.dimensions) { + this.report.dimensions = []; + } + + this.report.dimensions = [].concat(Editvue_type_script_lang_ts_toConsumableArray(this.report.dimensions), [dimension]); + this.setValueHasChanged(); + }, + changeDimension: function changeDimension(dimension, index) { + var _this6 = this, + _this$report$dimensio2; + + if (!this.report || !dimension) { + return; + } + + if (this.isLocked) { + this.confirmReportIsLocked(function () { + _this6.changeDimension(dimension, index); + }); + return; + } + + if (!((_this$report$dimensio2 = this.report.dimensions) !== null && _this$report$dimensio2 !== void 0 && _this$report$dimensio2[index])) { + return; + } + + this.report.dimensions = Editvue_type_script_lang_ts_toConsumableArray(this.report.dimensions); + this.report.dimensions[index] = dimension; + this.setValueHasChanged(); + }, + changeMetric: function changeMetric(metric, index) { + var _this7 = this, + _this$report$metrics2; + + this.dependencyAdded = false; + + if (!this.report || !metric) { + return; + } + + if (this.isLocked) { + this.confirmReportIsLocked(function () { + _this7.changeMetric(metric, index); + }); + return; + } + + if (!((_this$report$metrics2 = this.report.metrics) !== null && _this$report$metrics2 !== void 0 && _this$report$metrics2[index])) { + return; + } + + this.report.metrics = Editvue_type_script_lang_ts_toConsumableArray(this.report.metrics); + this.report.metrics[index] = metric; + this.setValueHasChanged(); + this.addMetricIfMissingDependency(metric); + }, + setWebsiteChanged: function setWebsiteChanged(newValue) { + this.setValueHasChanged(); + this.initReportOptions(); + + if (this.report.site.id === 'all' || this.report.site.id === '0' || this.report.site.id === 0) { + this.multipleSites = []; + } else if (this.report.allowedToEdit && !this.isSiteIncludedAlready("".concat(newValue.id)) && this.multipleSites) { + this.multipleSites.push({ + idsite: newValue.id, + name: newValue.name + }); + } + }, + removeDimension: function removeDimension(index) { + var _this8 = this; + + if (this.isLocked) { + this.confirmReportIsLocked(function () { + _this8.removeDimension(index); + }); + return; + } + + window.$('div.ui-tooltip[role="tooltip"]:not([style*="display: none"])').remove(); + + if (index > -1) { + this.report.dimensions = Editvue_type_script_lang_ts_toConsumableArray(this.report.dimensions); + this.report.dimensions.splice(index, 1); + this.setValueHasChanged(); + } + }, + addMetric: function addMetric(metric) { + var _this9 = this; + + this.dependencyAdded = false; + + if (!this.report || !metric) { + return; + } + + if (!this.report.metrics) { + this.report.metrics = []; + } + + if (this.isLocked) { + this.confirmReportIsLocked(function () { + _this9.addMetric(metric); + }); + return; + } + + this.report.metrics = [].concat(Editvue_type_script_lang_ts_toConsumableArray(this.report.metrics), [metric]); + this.setValueHasChanged(); + this.addMetricIfMissingDependency(metric); + }, + addMetricIfMissingDependency: function addMetricIfMissingDependency(metric) { + // If the metric isn't Product Revenue or the dependency is already met, return + if (!['sum_product_revenue', 'avg_product_revenue'].includes(metric) || this.doesReportIncludeProductQuantityMetric()) { + return; + } + + var dependency = metric === 'avg_product_revenue' ? 'avg_ecommerce_productquantity' : 'sum_ecommerce_productquantity'; + this.addMetric(dependency); + this.dependencyAdded = true; + }, + removeMetric: function removeMetric(index) { + var _this10 = this; + + this.dependencyAdded = false; + + if (this.isLocked) { + this.confirmReportIsLocked(function () { + _this10.removeMetric(index); + }); + return; + } + + window.$('div.ui-tooltip[role="tooltip"]:not([style*="display: none"])').remove(); + + if (index > -1) { + this.report.metrics = Editvue_type_script_lang_ts_toConsumableArray(this.report.metrics); + this.report.metrics.splice(index, 1); + this.setValueHasChanged(); + } + }, + setReportTypeHasChanged: function setReportTypeHasChanged(newReportType) { + var _this11 = this; + + if (this.report && this.isLocked) { + if (newReportType !== this.report.report_type) { + this.confirmReportIsLocked(function () { + _this11.report.report_type = newReportType; + + _this11.setValueHasChanged(); + }); + } + } else { + this.report.report_type = newReportType; + this.setValueHasChanged(); + } + }, + setSegmentFilterHasChanged: function setSegmentFilterHasChanged(newSegmentFilter) { + var _this12 = this; + + if (this.report && this.isLocked) { + if (newSegmentFilter !== this.report.segment_filter) { + this.confirmReportIsLocked(function () { + _this12.report.segment_filter = newSegmentFilter; + + _this12.setValueHasChanged(); + }); + } + } else { + this.report.segment_filter = newSegmentFilter; + this.setValueHasChanged(); + } + }, + updateReport: function updateReport() { + var _this13 = this; + + this.removeAnyReportNotification(); + + if (!this.checkRequiredFieldsAreSet()) { + return; + } + + this.multipleIdSites = []; + + if (this.multipleSites && this.multipleSites.length && this.report.site.id !== 'all' && this.report.site.id !== '0' && this.report.site.id !== 0) { + this.multipleIdSites.push(external_CoreHome_["Matomo"].idSite); + this.multipleSites.forEach(function (item) { + var idSite = item.idsite; + + if (!_this13.multipleIdSites.includes(idSite)) { + _this13.multipleIdSites.push(idSite); + } + }); + } + + var method = 'CustomReports.updateCustomReport'; + + if (this.multipleIdSites && this.multipleIdSites.length) { + // need to update this else this creates an issue after save + this.report.site.id = external_CoreHome_["Matomo"].idSite; + } + + CustomReports_store.createOrUpdateReport(this.report, method, this.childReportIds, this.multipleIdSites).then(function (response) { + if (!response || response.type === 'error') { + var _response$message2, _response$type2; + + _this13.showApiErrorMessage((_response$message2 = response.message) !== null && _response$message2 !== void 0 ? _response$message2 : '', (_response$type2 = response.type) !== null && _response$type2 !== void 0 ? _response$type2 : 'error'); + + return; + } + + var idSite = _this13.report.site.id; + _this13.isDirty = false; + _this13.canEdit = true; + + if (idSite && idSite !== 'all' && "".concat(idSite) !== "".concat(external_CoreHome_["Matomo"].idSite)) { + // when moving a report from one site to another... + // we need to reload this page for a different idsite, otherwise the report won't be found + external_CoreHome_["MatomoUrl"].updateUrl(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { + idSite: idSite + }), Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value)); + return; + } + + CustomReports_store.reload().then(function () { + _this13.init(); + }); + + _this13.showNotification(Object(external_CoreHome_["translate"])('CustomReports_ReportUpdated'), response.type); + }); + }, + checkRequiredFieldsAreSet: function checkRequiredFieldsAreSet() { + var _this$report$metrics3; + + if (!this.report.name) { + var title = Object(external_CoreHome_["translate"])('General_Name'); + this.showErrorFieldNotProvidedNotification(title); + return false; + } + + if (this.report.report_type !== 'evolution') { + var _this$report$dimensio3; + + if (!((_this$report$dimensio3 = this.report.dimensions) !== null && _this$report$dimensio3 !== void 0 && _this$report$dimensio3.length) || !Editvue_type_script_lang_ts_arrayFilterAndRemoveDuplicates(this.report.dimensions).length) { + var _title = Object(external_CoreHome_["translate"])('CustomReports_ErrorMissingDimension'); + + this.showNotification(_title, 'error'); + return false; + } + } + + if (!((_this$report$metrics3 = this.report.metrics) !== null && _this$report$metrics3 !== void 0 && _this$report$metrics3.length) || !Editvue_type_script_lang_ts_arrayFilterAndRemoveDuplicates(this.report.metrics).length) { + var _title2 = Object(external_CoreHome_["translate"])('CustomReports_ErrorMissingMetric'); + + this.showNotification(_title2, 'error'); + return false; + } // Don't fail validation since we automatically add the dependency + + + this.isProductRevenueDependencyMet(false); + return true; + }, + setSubcategory: function setSubcategory(subcategoryId) { + this.report.subcategory = this.report.subcategory || { + id: '' + }; + this.report.subcategory.id = subcategoryId; + }, + isProductRevenueDependencyMet: function isProductRevenueDependencyMet(shouldScrollToNotification) { + var linkString = Object(external_CoreHome_["externalLink"])('https://matomo.org/faq/custom-reports/why-is-there-an-error-when-i-try-to-run-a-custom-report-with-the-product-revenue-metric/'); + var notificationText = Object(external_CoreHome_["translate"])('CustomReports_WarningProductRevenueMetricDependency', linkString, ''); + + if (this.report.metrics.includes('sum_product_revenue') && !this.doesReportIncludeProductQuantityMetric()) { + this.addMetric('sum_ecommerce_productquantity'); + this.showProductMetricNotification(notificationText, shouldScrollToNotification); + return false; + } + + if (this.report.metrics.includes('avg_product_revenue') && !this.doesReportIncludeProductQuantityMetric()) { + this.addMetric('avg_ecommerce_productquantity'); + this.showProductMetricNotification(notificationText, shouldScrollToNotification); + return false; + } + + return true; + }, + doesReportIncludeProductQuantityMetric: function doesReportIncludeProductQuantityMetric() { + return this.report.metrics.includes('sum_ecommerce_productquantity') || this.report.metrics.includes('avg_ecommerce_productquantity'); + }, + isSiteIncludedAlready: function isSiteIncludedAlready(idSite) { + if (this.multipleSites && this.multipleSites.length) { + return this.multipleSites.some(function (item) { + return "".concat(item.idsite) === "".concat(idSite); + }); + } + + return false; + }, + removeSite: function removeSite(site) { + if (this.multipleSites) { + this.isDirty = true; + this.multipleSites = this.multipleSites.filter(function (item) { + return item.idsite !== site.idsite; + }); + } + }, + addSitesContaining: function addSitesContaining(searchTerm) { + var _this14 = this; + + if (!searchTerm) { + return; + } + + var displaySearchTerm = "\"".concat(external_CoreHome_["Matomo"].helper.escape(external_CoreHome_["Matomo"].helper.htmlEntities(searchTerm)), "\""); + external_CoreHome_["AjaxHelper"].fetch({ + method: 'SitesManager.getSitesWithAdminAccess', + pattern: searchTerm, + filter_limit: -1 + }).then(function (sites) { + if (!sites || !sites.length) { + var _sitesToAdd = "
\n

".concat(Object(external_CoreHome_["translate"])('CustomReports_MatchingSearchNotFound', displaySearchTerm), "

\n \n
"); + + external_CoreHome_["Matomo"].helper.modalConfirm(_sitesToAdd); + return; + } + + var newSites = []; + var alreadyAddedSites = []; + sites.forEach(function (site) { + var siteName = window.vueSanitize(external_CoreHome_["Matomo"].helper.htmlEntities(site.name)); + var siteTitle = "".concat(siteName, " (id ").concat(parseInt("".concat(site.idsite), 10), ")
"); + + if (_this14.isSiteIncludedAlready("".concat(site.idsite))) { + alreadyAddedSites.push(siteTitle); + } else { + newSites.push(siteTitle); + } + }); + var title = Object(external_CoreHome_["translate"])('CustomReports_MatchingSearchConfirmTitle', newSites.length); + + if (alreadyAddedSites.length) { + var text = Object(external_CoreHome_["translate"])('CustomReports_MatchingSearchConfirmTitleAlreadyAdded', alreadyAddedSites.length); + title += " (".concat(text, ")"); + } + + var sitesToAdd = "

".concat(title, "

\n ").concat(Object(external_CoreHome_["translate"])('CustomReports_MatchingSearchMatchedAdd', newSites.length, displaySearchTerm), ":\n

"); + sitesToAdd += newSites.join(''); + + if (alreadyAddedSites.length) { + var _text = Object(external_CoreHome_["translate"])('CustomReports_MatchingSearchMatchedAlreadyAdded', alreadyAddedSites.length, displaySearchTerm); + + sitesToAdd += "
".concat(_text, ":

").concat(alreadyAddedSites.join('')); + } + + sitesToAdd += "

\n \n
"); + external_CoreHome_["Matomo"].helper.modalConfirm(sitesToAdd, { + yes: function yes() { + sites.forEach(function (site) { + if (_this14.multipleSites) { + if (!_this14.isSiteIncludedAlready("".concat(site.idsite))) { + _this14.isDirty = true; + + _this14.multipleSites.push({ + idsite: site.idsite, + name: site.name + }); + } + } + }); + _this14.containsText = ''; + } + }); + }); + } + }, + computed: { + isSuperUser: function isSuperUser() { + return !!external_CoreHome_["Matomo"].hasSuperUserAccess; + }, + allMetrics: function allMetrics() { + return CustomReports_store.state.value.allMetrics; + }, + metrics: function metrics() { + var _this$report; + + // if any of the page generation times in the report is used than allow all of them + // otherwise don't show any of thme. + var pageGenerationMetrics = ['pageviews_with_generation_time', 'avg_page_generation_time', 'max_actions_pagegenerationtime', 'sum_actions_pagegenerationtime']; + var hasPageGenerationMetric = (((_this$report = this.report) === null || _this$report === void 0 ? void 0 : _this$report.metrics) || []).some(function (m) { + return pageGenerationMetrics.indexOf(m) >= 0; + }); + var shouldRemoveGenerationTime = !hasPageGenerationMetric; + return this.allMetrics.filter(function (m) { + if (!m) { + return false; + } + + if (shouldRemoveGenerationTime && pageGenerationMetrics.indexOf(m.key) >= 0) { + return false; + } + + return true; + }); + }, + allDimensions: function allDimensions() { + return CustomReports_store.state.value.allDimensions; + }, + reportTypes: function reportTypes() { + return CustomReports_store.state.value.reportTypesReadable; + }, + create: function create() { + return !this.idCustomReport; + }, + edit: function edit() { + return !this.create; + }, + editTitle: function editTitle() { + return this.create ? 'CustomReports_CreateNewReport' : 'CustomReports_EditReport'; + }, + contentTitle: function contentTitle() { + return Object(external_CoreHome_["translate"])(this.editTitle, this.report.name ? "\"".concat(this.report.name, "\"") : ''); + }, + categories: function categories() { + return CustomReports_store.state.value.categories; + }, + subcategories: function subcategories() { + return CustomReports_store.state.value.subcategories; + }, + dimensions: function dimensions() { + var _this$report2; + + var result = Editvue_type_script_lang_ts_toConsumableArray(this.allDimensions); + + if (!((_this$report2 = this.report) !== null && _this$report2 !== void 0 && _this$report2.dimensions)) { + return result; + } + + var hasPageGenerationDimension = this.report.dimensions.indexOf('Actions.PageGenerationTime') !== -1; // we do not allow to select eg grouping by "Page URL, Clicked URL" as it wouldn't show any + // data + + var usedSqlSegments = this.report.dimensions.map(function (dimensionId) { + var _result$find; + + return (_result$find = result.find(function (dim) { + return dim.key === dimensionId; + })) === null || _result$find === void 0 ? void 0 : _result$find.sqlSegment; + }).filter(function (sqlSegment) { + return !!sqlSegment; + }); // make sure these dimensions cannot be selected a second time + + for (var j = 0; j < result.length; j += 1) { + var dim = result[j]; + + if (!hasPageGenerationDimension && dim.key === 'Actions.PageGenerationTime') { + // we only show this metric if it was used before already in the report + result.splice(j, 1); + j -= 1; + break; + } + + if (dim.sqlSegment && usedSqlSegments.indexOf(dim.sqlSegment) > -1 && this.report.dimensions.indexOf(dim.key) === -1) { + // we want to make sure to not show incompatible dimensions but we still want to show an + // already selected dimension again so users can eg easily swap dimensions etc. + result.splice(j, 1); + j -= 1; + } + } + + return result; + }, + isLoading: function isLoading() { + return CustomReports_store.state.value.isLoading; + }, + isUpdating: function isUpdating() { + return CustomReports_store.state.value.isUpdating; + }, + dimensionsReadable: function dimensionsReadable() { + return CustomReports_store.state.value.dimensionsReadable; + }, + metricsReadable: function metricsReadable() { + return CustomReports_store.state.value.metricsReadable; + }, + saveButtonText: function saveButtonText() { + return this.edit ? Object(external_CoreHome_["translate"])('CoreUpdater_UpdateTitle') : Object(external_CoreHome_["translate"])('CustomReports_CreateNewReport'); + }, + getProductRevenueDependencyMessage: function getProductRevenueDependencyMessage() { + var linkString = Object(external_CoreHome_["externalLink"])('https://matomo.org/faq/custom-reports/why-is-there-an-error-when-i-try-to-run-a-custom-report-with-the-product-revenue-metric/'); + return Object(external_CoreHome_["translate"])('CustomReports_WarningProductRevenueMetricDependency', linkString, ''); + }, + getPausedStateAdminMessage: function getPausedStateAdminMessage() { + var url = "?".concat(external_CoreHome_["MatomoUrl"].stringify(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { + module: 'CustomReports', + action: 'manage' + }))); + return Object(external_CoreHome_["translate"])('CustomReports_ReportInPausedStateAdmin', ""), ''); + }, + getDimensionsHelpText: function getDimensionsHelpText() { + var helpText = Object(external_CoreHome_["translate"])('CustomReports_ReportDimensionsHelpNew'); + var extended = this.getDimensionsHelpTextExtended; + + if (extended) { + return "".concat(helpText, "

").concat(extended); + } + + return helpText; + }, + getDimensionsHelpTextExtended: function getDimensionsHelpTextExtended() { + if (this.isCloud) { + return ''; + } + + var linkString = Object(external_CoreHome_["externalLink"])('https://matomo.org/faq/custom-reports/faq_25655/'); + return Object(external_CoreHome_["translate"])('CustomReports_ReportDimensionsHelpExtended', linkString, ''); + } + } +})); +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/Edit.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/Edit.vue + + + +Editvue_type_script_lang_ts.render = render + +/* harmony default export */ var Edit = (Editvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CustomReports/vue/src/Reports/List.vue?vue&type=template&id=81f7b908 + +var Listvue_type_template_id_81f7b908_hoisted_1 = { + class: "reportSearchFilter" +}; +var Listvue_type_template_id_81f7b908_hoisted_2 = { + class: "index" +}; +var Listvue_type_template_id_81f7b908_hoisted_3 = { + class: "name" +}; +var Listvue_type_template_id_81f7b908_hoisted_4 = { + class: "description" +}; +var Listvue_type_template_id_81f7b908_hoisted_5 = { + class: "reportType" +}; +var Listvue_type_template_id_81f7b908_hoisted_6 = { + class: "reportCategory" +}; +var Listvue_type_template_id_81f7b908_hoisted_7 = { + class: "action" +}; +var Listvue_type_template_id_81f7b908_hoisted_8 = { + colspan: "7" +}; +var Listvue_type_template_id_81f7b908_hoisted_9 = { + class: "loadingPiwik" +}; + +var Listvue_type_template_id_81f7b908_hoisted_10 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + src: "plugins/Morpheus/images/loading-blue.gif" +}, null, -1); + +var Listvue_type_template_id_81f7b908_hoisted_11 = { + colspan: "7" +}; +var Listvue_type_template_id_81f7b908_hoisted_12 = ["id"]; +var Listvue_type_template_id_81f7b908_hoisted_13 = { + class: "index" +}; +var Listvue_type_template_id_81f7b908_hoisted_14 = { + class: "name" +}; +var Listvue_type_template_id_81f7b908_hoisted_15 = ["title"]; +var Listvue_type_template_id_81f7b908_hoisted_16 = ["title"]; +var Listvue_type_template_id_81f7b908_hoisted_17 = ["title"]; +var Listvue_type_template_id_81f7b908_hoisted_18 = ["title"]; +var Listvue_type_template_id_81f7b908_hoisted_19 = ["title"]; +var Listvue_type_template_id_81f7b908_hoisted_20 = { + class: "reportType" +}; +var Listvue_type_template_id_81f7b908_hoisted_21 = ["title"]; +var Listvue_type_template_id_81f7b908_hoisted_22 = { + key: 0 +}; +var Listvue_type_template_id_81f7b908_hoisted_23 = { + class: "action" +}; +var Listvue_type_template_id_81f7b908_hoisted_24 = ["title", "onClick"]; +var Listvue_type_template_id_81f7b908_hoisted_25 = ["title", "onClick"]; +var Listvue_type_template_id_81f7b908_hoisted_26 = ["title", "onClick"]; +var Listvue_type_template_id_81f7b908_hoisted_27 = ["title", "href"]; +var Listvue_type_template_id_81f7b908_hoisted_28 = ["title", "onClick"]; +var Listvue_type_template_id_81f7b908_hoisted_29 = { + class: "tableActionBar" +}; + +var Listvue_type_template_id_81f7b908_hoisted_30 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-add" +}, null, -1); + +var Listvue_type_template_id_81f7b908_hoisted_31 = { + class: "ui-confirm", + ref: "confirmDeleteReport" +}; +var Listvue_type_template_id_81f7b908_hoisted_32 = ["value"]; +var Listvue_type_template_id_81f7b908_hoisted_33 = ["value"]; +var Listvue_type_template_id_81f7b908_hoisted_34 = { + class: "ui-confirm", + ref: "confirmPauseReport" +}; +var Listvue_type_template_id_81f7b908_hoisted_35 = ["value"]; +var Listvue_type_template_id_81f7b908_hoisted_36 = ["value"]; +var Listvue_type_template_id_81f7b908_hoisted_37 = { + class: "ui-confirm", + ref: "confirmResumeReport" +}; +var Listvue_type_template_id_81f7b908_hoisted_38 = ["value"]; +var Listvue_type_template_id_81f7b908_hoisted_39 = ["value"]; +function Listvue_type_template_id_81f7b908_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + + var _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('CustomReports_ManageReports'), + feature: _ctx.translate('CustomReports_ManageReports') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_CustomReportIntroduction')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_81f7b908_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "reportSearch", + title: _ctx.translate('General_Search'), + modelValue: _ctx.searchFilter, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + return _ctx.searchFilter = $event; + }) + }, null, 8, ["title", "modelValue"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.reports.length > 0]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_81f7b908_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Id')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_81f7b908_hoisted_3, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_81f7b908_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Description')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_81f7b908_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_Type')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_81f7b908_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_Category')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_81f7b908_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_81f7b908_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Listvue_type_template_id_81f7b908_hoisted_9, [Listvue_type_template_id_81f7b908_hoisted_10, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_81f7b908_hoisted_11, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_NoCustomReportsFound')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isLoading && _ctx.reports.length == 0]]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.sortedReports, function (report) { + var _report$subcategory; + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + id: "report".concat(report.idcustomreport), + class: "customReports", + key: report.idcustomreport + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_81f7b908_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(report.idcustomreport), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_81f7b908_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(report.name) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-locked", + title: _ctx.translate('CustomReports_ReportEditNotAllowedAllWebsitesUpdated') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_15), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !report.idsite && !_ctx.isSuperUser]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-info2", + title: _ctx.translate('CustomReports_ReportAvailableToAllWebsites') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_16), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !report.idsite && _ctx.isSuperUser]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-locked", + title: _ctx.translate('CustomReports_ReportEditNotAllowedMultipleWebsitesAccessIssue') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_17), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !report.allowedToEdit && _ctx.isMultiSiteReport(report)]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-info2", + title: _ctx.translate('CustomReports_ReportAvailableToMultipleWebsites') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_18), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], report.allowedToEdit && _ctx.isMultiSiteReport(report)]])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + class: "description", + title: _ctx.htmlEntities(report.description) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncate(report.description.trim(), 60)), 9, Listvue_type_template_id_81f7b908_hoisted_19), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_81f7b908_hoisted_20, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.reportTypesReadable[report.report_type]), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + class: "reportCategory", + title: _ctx.htmlEntities(report.category.name) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncate(report.category.name.trim(), 60)) + " ", 1), (_report$subcategory = report.subcategory) !== null && _report$subcategory !== void 0 && _report$subcategory.name ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Listvue_type_template_id_81f7b908_hoisted_22, " - " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.truncate(report.subcategory.name.trim(), 60)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 8, Listvue_type_template_id_81f7b908_hoisted_21), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_81f7b908_hoisted_23, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-pause", + title: _ctx.translate('CustomReports_PauseReportInfo'), + onClick: function onClick($event) { + return _ctx.pauseReport(report); + } + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], (report.idsite && !_ctx.isMultiSiteReport(report) || report.allowedToEdit) && report.status === 'active']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-play", + title: _ctx.translate('CustomReports_ResumeReportInfo'), + onClick: function onClick($event) { + return _ctx.resumeReport(report); + } + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_25), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], (report.idsite && !_ctx.isMultiSiteReport(report) || report.allowedToEdit) && report.status === 'paused']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-edit", + title: _ctx.translate('CustomReports_EditReport'), + onClick: function onClick($event) { + return _ctx.editReport(report.idcustomreport); + } + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_26), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + target: "_blank", + class: "table-action icon-show", + title: _ctx.translate('CustomReports_ViewReportInfo'), + href: _ctx.getViewReportLink(report) + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_27), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-delete", + title: _ctx.translate('CustomReports_DeleteReportInfo'), + onClick: function onClick($event) { + return _ctx.deleteReport(report); + } + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_28), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], report.idsite && !_ctx.isMultiSiteReport(report) || report.allowedToEdit]])])], 8, Listvue_type_template_id_81f7b908_hoisted_12); + }), 128))])], 512), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_81f7b908_hoisted_29, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "createNewReport", + onClick: _cache[1] || (_cache[1] = function ($event) { + return _ctx.createReport(); + }) + }, [Listvue_type_template_id_81f7b908_hoisted_30, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_CreateNewReport')), 1)])])]; + }), + _: 1 + }, 8, ["content-title", "feature"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_81f7b908_hoisted_31, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_DeleteReportConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_32), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_33)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_81f7b908_hoisted_34, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_PauseReportConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_35), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_36)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_81f7b908_hoisted_37, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CustomReports_ResumeReportConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_38), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Listvue_type_template_id_81f7b908_hoisted_39)], 512)]); +} +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/List.vue?vue&type=template&id=81f7b908 + +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/truncateText2.ts +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ +function truncateText2(text, length) { + if (text && text.length > length) { + return "".concat(text.substr(0, length - 3), "..."); + } + + return text; +} +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CustomReports/vue/src/Reports/List.vue?vue&type=script&lang=ts +function Listvue_type_script_lang_ts_toConsumableArray(arr) { return Listvue_type_script_lang_ts_arrayWithoutHoles(arr) || Listvue_type_script_lang_ts_iterableToArray(arr) || Listvue_type_script_lang_ts_unsupportedIterableToArray(arr) || Listvue_type_script_lang_ts_nonIterableSpread(); } + +function Listvue_type_script_lang_ts_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function Listvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Listvue_type_script_lang_ts_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Listvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } + +function Listvue_type_script_lang_ts_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function Listvue_type_script_lang_ts_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Listvue_type_script_lang_ts_arrayLikeToArray(arr); } + +function Listvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + + + + + + +var Listvue_type_script_lang_ts_notificationId = 'customreportmanagementlist'; +/* harmony default export */ var Listvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: {}, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"] + }, + directives: { + ContentTable: external_CoreHome_["ContentTable"] + }, + data: function data() { + return { + searchFilter: '' + }; + }, + created: function created() { + CustomReports_store.getAvailableReportTypes(); + CustomReports_store.fetchReports(); + }, + methods: { + createReport: function createReport() { + this.editReport(0); + }, + editReport: function editReport(idCustomReport) { + external_CoreHome_["MatomoUrl"].updateHash(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { + idCustomReport: idCustomReport + })); + }, + pauseReport: function pauseReport(report) { + var _this = this; + + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmPauseReport, { + yes: function yes() { + CustomReports_store.pauseReport(report.idcustomreport, report.idsite).then(function (response) { + if (!response || response.type === 'error') { + CustomReports_store.reload(); + return; + } + + CustomReports_store.reload().then(function () { + _this.showNotification(_this.translate('CustomReports_PausedReport'), 'success'); + }); + external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); + }); + } + }); + }, + resumeReport: function resumeReport(report) { + var _this2 = this; + + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmResumeReport, { + yes: function yes() { + CustomReports_store.resumeReport(report.idcustomreport, report.idsite).then(function (response) { + if (!response || response.type === 'error') { + CustomReports_store.reload(); + return; + } + + CustomReports_store.reload().then(function () { + _this2.showNotification(_this2.translate('CustomReports_ResumedReport'), 'success'); + }); + external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); + }); + } + }); + }, + showNotification: function showNotification(message, context) { + var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + var instanceId = external_CoreHome_["NotificationsStore"].show({ + message: message, + context: context, + id: Listvue_type_script_lang_ts_notificationId, + type: type !== null ? type : 'toast' + }); + setTimeout(function () { + external_CoreHome_["NotificationsStore"].scrollToNotification(instanceId); + }, 200); + }, + deleteReport: function deleteReport(report) { + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteReport, { + yes: function yes() { + CustomReports_store.deleteReport(report.idcustomreport, report.idsite).then(function () { + CustomReports_store.reload(); + external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); + }); + } + }); + }, + getViewReportLink: function getViewReportLink(report) { + return "?".concat(external_CoreHome_["MatomoUrl"].stringify({ + module: 'CoreHome', + action: 'index', + idSite: report.linkIdSite, + period: 'day', + date: 'yesterday' + }), "#?").concat(external_CoreHome_["MatomoUrl"].stringify({ + category: report.category.id, + idSite: report.linkIdSite, + date: external_CoreHome_["MatomoUrl"].parsed.value.date, + period: external_CoreHome_["MatomoUrl"].parsed.value.period, + segment: external_CoreHome_["MatomoUrl"].parsed.value.segment, + subcategory: report.subcategoryLink + })); + }, + truncate: truncateText2, + htmlEntities: function htmlEntities(v) { + return external_CoreHome_["Matomo"].helper.htmlEntities(v); + }, + isMultiSiteReport: function isMultiSiteReport(report) { + return report.multiple_idsites && report.multiple_idsites.split(','); + } + }, + computed: { + isSuperUser: function isSuperUser() { + return external_CoreHome_["Matomo"].hasSuperUserAccess; + }, + reports: function reports() { + return CustomReports_store.state.value.reports; + }, + sortedReports: function sortedReports() { + var searchFilter = this.searchFilter.toLowerCase(); // look through string properties of custom reports for values that have searchFilter in them + // (mimics angularjs filter() filter) + + var result = Listvue_type_script_lang_ts_toConsumableArray(this.reports).filter(function (h) { + return Object.keys(h).some(function (propName) { + var entity = h; + return typeof entity[propName] === 'string' && entity[propName].toLowerCase().indexOf(searchFilter) !== -1; + }); + }); + + result.sort(function (lhs, rhs) { + var lhsId = parseInt("".concat(lhs.idcustomreport), 10); + var rhsId = parseInt("".concat(rhs.idcustomreport), 10); + return lhsId - rhsId; + }); + return result; + }, + isLoading: function isLoading() { + return CustomReports_store.state.value.isLoading; + }, + isUpdating: function isUpdating() { + return CustomReports_store.state.value.isUpdating; + }, + reportTypesReadable: function reportTypesReadable() { + return CustomReports_store.state.value.reportTypesReadable; + } + } +})); +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/List.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/List.vue + + + +Listvue_type_script_lang_ts.render = Listvue_type_template_id_81f7b908_render + +/* harmony default export */ var List = (Listvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CustomReports/vue/src/Reports/Manage.vue?vue&type=template&id=03955ed8 + +var Managevue_type_template_id_03955ed8_hoisted_1 = { + class: "manageReports" +}; +var Managevue_type_template_id_03955ed8_hoisted_2 = { + key: 0 +}; +var Managevue_type_template_id_03955ed8_hoisted_3 = { + key: 1 +}; +function Managevue_type_template_id_03955ed8_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_CustomReportsList = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("CustomReportsList"); + + var _component_CustomReportsEdit = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("CustomReportsEdit"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Managevue_type_template_id_03955ed8_hoisted_1, [!_ctx.editMode ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Managevue_type_template_id_03955ed8_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_CustomReportsList)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.editMode ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Managevue_type_template_id_03955ed8_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_CustomReportsEdit, { + "id-custom-report": _ctx.idCustomReport, + "browser-archiving-disabled": _ctx.browserArchivingDisabled, + "re-archive-last-n": _ctx.reArchiveLastN, + "max-dimensions": _ctx.maxDimensions, + "is-cloud": _ctx.isCloud + }, null, 8, ["id-custom-report", "browser-archiving-disabled", "re-archive-last-n", "max-dimensions", "is-cloud"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]); +} +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/Manage.vue?vue&type=template&id=03955ed8 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/CustomReports/vue/src/Reports/Manage.vue?vue&type=script&lang=ts + + + + +/* harmony default export */ var Managevue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + browserArchivingDisabled: Boolean, + reArchiveLastN: Number, + maxDimensions: Number, + isCloud: Boolean + }, + components: { + CustomReportsList: List, + CustomReportsEdit: Edit + }, + data: function data() { + return { + editMode: false, + idCustomReport: null + }; + }, + watch: { + editMode: function editMode() { + // when changing edit modes, the tooltip can sometimes get stuck on the screen + $('.ui-tooltip').remove(); + } + }, + created: function created() { + var _this = this; + + // doing this in a watch because we don't want to post an event in a computed property + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(function () { + return external_CoreHome_["MatomoUrl"].hashParsed.value.idCustomReport; + }, function (idCustomReport) { + _this.initState(idCustomReport); + }); + this.initState(external_CoreHome_["MatomoUrl"].hashParsed.value.idCustomReport); + }, + methods: { + removeAnyReportNotification: function removeAnyReportNotification() { + var shouldHideProductMetricNotification = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + external_CoreHome_["NotificationsStore"].remove('reportsmanagement'); + + if (shouldHideProductMetricNotification) { + external_CoreHome_["NotificationsStore"].remove('reportsmanagementProductMetric'); + } + }, + initState: function initState(idCustomReport) { + if (idCustomReport) { + if (idCustomReport === '0') { + var parameters = { + isAllowed: true + }; + external_CoreHome_["Matomo"].postEvent('CustomReports.initAddReport', parameters); + + if (parameters && !parameters.isAllowed) { + this.editMode = false; + this.idCustomReport = null; + return; + } + } + + this.editMode = true; + this.idCustomReport = parseInt(idCustomReport, 10); + } else { + this.editMode = false; + this.idCustomReport = null; + } + + this.removeAnyReportNotification(!idCustomReport); + } + } +})); +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/Manage.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/Reports/Manage.vue + + + +Managevue_type_script_lang_ts.render = Managevue_type_template_id_03955ed8_render + +/* harmony default export */ var Manage = (Managevue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/CustomReports/vue/src/index.ts +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + + + +// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js + + + + +/***/ }) + +/******/ }); +}); +//# sourceMappingURL=CustomReports.umd.js.map \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/vue/dist/CustomReports.umd.min.js b/files/plugin-CustomReports-5.4.3/vue/dist/CustomReports.umd.min.js new file mode 100644 index 0000000..9bbc062 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/dist/CustomReports.umd.min.js @@ -0,0 +1,44 @@ +(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin"),require("SegmentEditor")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin","SegmentEditor"],t):"object"===typeof exports?exports["CustomReports"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin"),require("SegmentEditor")):e["CustomReports"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"],e["SegmentEditor"])})("undefined"!==typeof self?self:this,(function(e,t,o,r){return function(e){var t={};function o(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(r,i,function(t){return e[t]}.bind(null,i));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="plugins/CustomReports/vue/dist/",o(o.s="fae3")}({"19dc":function(t,o){t.exports=e},"8bbf":function(e,o){e.exports=t},a5a2:function(e,t){e.exports=o},f06f:function(e,t){e.exports=r},fae3:function(e,t,o){"use strict";if(o.r(t),o.d(t,"ReportEdit",(function(){return Mt})),o.d(t,"ReportsList",(function(){return Vo})),o.d(t,"ReportsManage",(function(){return Io})),"undefined"!==typeof window){var r=window.document.currentScript,i=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);i&&(o.p=i[1])}var n=o("8bbf"),s={class:"loadingPiwik"},a=Object(n["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),l={class:"loadingPiwik"},c=Object(n["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),d={class:"alert alert-warning"},u={key:0},p={key:1},m={key:0,class:"alert alert-warning"},h=["innerHTML"],b={key:1},f={name:"name"},v={name:"description"},g={class:"form-group row"},j={class:"col s12"},O={class:"col s12 m6"},y={for:"all_websites",class:"siteSelectorLabel"},R={class:"sites_autocomplete"},S={class:"col s12 m6"},C={class:"form-help"},N={key:0,class:"inline-help"},E={key:1,class:"inline-help"},k={key:0,class:"col s12 m6"},V={key:0},w={for:"websitecontains"},_=Object(n["createElementVNode"])("br",null,null,-1),M=["placeholder"],D=["disabled","value"],A={key:1},I=Object(n["createElementVNode"])("br",null,null,-1),U={class:"entityTable"},B={class:"siteId"},T={class:"siteName"},L={key:0,class:"siteAction"},x={colspan:"3"},P={key:0,class:"siteAction"},H=["onClick"],G={class:"form-group row"},q={class:"col s12"},F={class:"unlockAlert alert alert-info"},W={key:0},Y={key:1},z=Object(n["createElementVNode"])("br",null,null,-1),Q=Object(n["createElementVNode"])("br",null,null,-1),X=["value"],J={class:"alertUnlocked alert alert-warning"},K={key:0},Z={key:1},ee={name:"reportType"},te={class:"form-group row"},oe={class:"col s12 m6 dimensionsGroup"},re=Object(n["createElementVNode"])("br",null,null,-1),ie={class:"groupValueSelect",name:"dimensions"},ne=["title","onClick"],se={class:"groupValueSelect addDimension",name:"dimensions"},ae={class:"col s12 m6"},le={class:"form-help"},ce=["innerHTML"],de={class:"form-group row"},ue={class:"col s12 m6 metricsGroup"},pe=Object(n["createElementVNode"])("br",null,null,-1),me={class:"groupValueSelect",name:"metrics"},he=["title","onClick"],be={class:"groupValueSelect addMetric",name:"metrics"},fe={class:"col s12 m6"},ve={class:"form-help"},ge={class:"inline-help"},je=["innerHTML"],Oe={class:"form-group row segmentFilterGroup"},ye={class:"col s12"},Re={style:{margin:"8px 0",display:"inline-block"}},Se={class:"form-group row"},Ce={class:"col s12"},Ne=Object(n["createElementVNode"])("br",null,null,-1),Ee=Object(n["createElementVNode"])("br",null,null,-1),ke={name:"reportCategories"},Ve={name:"reportSubcategories"},we={class:"alert alert-warning"},_e={key:0},Me={key:1},De={class:"alert alert-warning"},Ae={key:0},Ie={key:1},Ue={key:0,class:"form-group row"},Be=["textContent"],Te={class:"col s12 m6"},Le={id:"childReports",class:"col s12 m6"},xe=["data-id"],Pe=Object(n["createElementVNode"])("span",{class:"ui-icon ui-icon-arrowthick-2-n-s"},null,-1),He={class:"col s12 m6"},Ge={class:"form-help"},qe=["textContent"],Fe={class:"entityCancel"},We={class:"ui-confirm",id:"confirmUnlockReport",ref:"confirmUnlockReport"},$e={key:0},Ye={key:1},ze=["value"],Qe=["value"],Xe={class:"ui-confirm",id:"infoReportIsLocked",ref:"infoReportIsLocked"},Je={key:0},Ke={key:1},Ze=["value"],et=["value"];function tt(e,t,o,r,i,$){var tt=Object(n["resolveComponent"])("Field"),ot=Object(n["resolveComponent"])("SiteSelector"),rt=Object(n["resolveComponent"])("SegmentGenerator"),it=Object(n["resolveComponent"])("SaveButton"),nt=Object(n["resolveComponent"])("ContentBlock");return Object(n["openBlock"])(),Object(n["createBlock"])(nt,{class:"editReport","content-title":e.contentTitle},{default:Object(n["withCtx"])((function(){var o,r,i;return[Object(n["withDirectives"])(Object(n["createElementVNode"])("p",null,[Object(n["createElementVNode"])("span",s,[a,Object(n["createTextVNode"])(" "+Object(n["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[n["vShow"],e.isLoading]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("p",null,[Object(n["createElementVNode"])("span",l,[c,Object(n["createTextVNode"])(" "+Object(n["toDisplayString"])(e.translate("CustomReports_UpdatingData")),1)])],512),[[n["vShow"],e.isUpdating]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("div",d,[e.multipleSites.length&&!e.report.allowedToEdit?(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",u,Object(n["toDisplayString"])(e.translate("CustomReports_ReportEditNotAllowedMultipleWebsitesAccessIssue")),1)):(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",p,Object(n["toDisplayString"])(e.translate("CustomReports_ReportEditNotAllowedAllWebsitesUpdated")),1))],512),[[n["vShow"],!e.canEdit]]),"paused"===e.report.status?(Object(n["openBlock"])(),Object(n["createElementBlock"])("div",m,[e.report.allowedToEdit?(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",{key:0,innerHTML:e.getPausedStateAdminMessage},null,8,h)):(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",b,Object(n["toDisplayString"])(e.translate("CustomReports_NoDataMessagePausedStateNonAdminUser")),1))])):Object(n["createCommentVNode"])("",!0),Object(n["createElementVNode"])("form",{onSubmit:t[15]||(t[15]=function(t){return e.edit?e.updateReport():e.createReport()})},[Object(n["createElementVNode"])("div",null,[Object(n["createElementVNode"])("div",f,[Object(n["createVNode"])(tt,{uicontrol:"text",name:"name","model-value":e.report.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.report.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,disabled:!e.canEdit,placeholder:e.translate("CustomReports_FieldNamePlaceholder"),"inline-help":e.translate("CustomReports_ReportNameHelp")},null,8,["model-value","title","disabled","placeholder","inline-help"])]),Object(n["createElementVNode"])("div",v,[Object(n["createVNode"])(tt,{uicontrol:"textarea",name:"description","model-value":e.report.description,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.report.description=t,e.setValueHasChanged()}),title:"".concat(e.translate("General_Description")," (optional)"),maxlength:1e3,disabled:!e.canEdit,rows:3,placeholder:e.translate("CustomReports_FieldDescriptionPlaceholder"),"inline-help":e.translate("CustomReports_ReportDescriptionHelp")},null,8,["model-value","title","disabled","placeholder","inline-help"])]),Object(n["createElementVNode"])("div",g,[Object(n["createElementVNode"])("h3",j,Object(n["toDisplayString"])(e.translate("CustomReports_ApplyTo")),1),Object(n["createElementVNode"])("div",O,[Object(n["createElementVNode"])("div",null,[Object(n["createElementVNode"])("label",y,Object(n["toDisplayString"])(e.translate("General_Website")),1),Object(n["createElementVNode"])("div",R,[Object(n["createVNode"])(ot,{id:"all_websites","model-value":e.report.site,"onUpdate:modelValue":t[2]||(t[2]=function(t){e.report.site=t,e.setWebsiteChanged(t)}),"show-all-sites-item":e.isSuperUser,"switch-site-on-select":!1,"show-selected-site":!0},null,8,["model-value","show-all-sites-item"])])])]),Object(n["createElementVNode"])("div",S,[Object(n["createElementVNode"])("div",C,[e.isSuperUser?(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",N,Object(n["toDisplayString"])(e.translate("CustomReports_ReportAllWebsitesHelp")),1)):(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",E,Object(n["toDisplayString"])(e.translate("CustomReports_ReportAllWebsitesNonSuperUserHelp")),1))])]),"all"!==e.report.site.id&&"0"!==e.report.site.id&&0!==e.report.site.id?(Object(n["openBlock"])(),Object(n["createElementBlock"])("div",k,[e.report.allowedToEdit?(Object(n["openBlock"])(),Object(n["createElementBlock"])("div",V,[Object(n["createElementVNode"])("span",w,Object(n["toDisplayString"])(e.translate("CustomReports_SelectMeasurablesMatchingSearch")),1),_,Object(n["withDirectives"])(Object(n["createElementVNode"])("input",{class:"control_text customReportSearchMeasurablesField",type:"text",id:"websitecontains","onUpdate:modelValue":t[3]||(t[3]=function(t){return e.containsText=t}),placeholder:e.translate("General_Search")},null,8,M),[[n["vModelText"],e.containsText]]),Object(n["createElementVNode"])("input",{style:{"margin-left":"3.5px"},disabled:!e.containsText,class:"btn customReportSearchFindMeasurables",type:"button",onClick:t[4]||(t[4]=function(t){return e.addSitesContaining(e.containsText)}),value:e.translate("CustomReports_FindMeasurables")},null,8,D)])):Object(n["createCommentVNode"])("",!0),e.report.allowedToEdit||e.multipleSites.length?(Object(n["openBlock"])(),Object(n["createElementBlock"])("div",A,[I,Object(n["createElementVNode"])("table",U,[Object(n["createElementVNode"])("thead",null,[Object(n["createElementVNode"])("tr",null,[Object(n["createElementVNode"])("th",B,Object(n["toDisplayString"])(e.translate("General_Id")),1),Object(n["createElementVNode"])("th",T,Object(n["toDisplayString"])(e.translate("General_Name")),1),e.report.allowedToEdit?(Object(n["openBlock"])(),Object(n["createElementBlock"])("th",L,Object(n["toDisplayString"])(e.translate("General_Remove")),1)):Object(n["createCommentVNode"])("",!0)])]),Object(n["createElementVNode"])("tbody",null,[Object(n["withDirectives"])(Object(n["createElementVNode"])("tr",null,[Object(n["createElementVNode"])("td",x,Object(n["toDisplayString"])(e.translate("CustomReports_NoMeasurableAssignedYet")),1)],512),[[n["vShow"],!e.multipleSites.length]]),(Object(n["openBlock"])(!0),Object(n["createElementBlock"])(n["Fragment"],null,Object(n["renderList"])(e.multipleSites,(function(t,o){return Object(n["withDirectives"])((Object(n["openBlock"])(),Object(n["createElementBlock"])("tr",{key:o},[Object(n["createElementVNode"])("td",null,Object(n["toDisplayString"])(t.idsite),1),Object(n["createElementVNode"])("td",null,Object(n["toDisplayString"])(t.name),1),e.report.allowedToEdit?(Object(n["openBlock"])(),Object(n["createElementBlock"])("td",P,[Object(n["createElementVNode"])("span",{class:"icon-minus table-action",onClick:function(o){return e.removeSite(t)}},null,8,H)])):Object(n["createCommentVNode"])("",!0)],512)),[[n["vShow"],e.multipleSites.length>0]])})),128))])])])):Object(n["createCommentVNode"])("",!0)])):Object(n["createCommentVNode"])("",!0)]),Object(n["createElementVNode"])("div",G,[Object(n["createElementVNode"])("h3",q,Object(n["toDisplayString"])(e.translate("CustomReports_ReportContent")),1)]),Object(n["withDirectives"])(Object(n["createElementVNode"])("div",F,[e.browserArchivingDisabled&&e.reArchiveLastN?(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",W,Object(n["toDisplayString"])(e.translate("CustomReports_WarningRequiresUnlockBrowserArchivingDisabled",e.reArchiveLastN)),1)):Object(n["createCommentVNode"])("",!0),e.browserArchivingDisabled&&e.reArchiveLastN?Object(n["createCommentVNode"])("",!0):(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",Y,Object(n["toDisplayString"])(e.translate("CustomReports_WarningRequiresUnlock")),1)),z,Q,Object(n["createElementVNode"])("input",{type:"button",class:"btn unlockReport",onClick:t[5]||(t[5]=function(t){return e.unlockReport()}),value:e.translate("CustomReports_Unlock")},null,8,X)],512),[[n["vShow"],e.isLocked]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("div",J,[e.browserArchivingDisabled&&e.reArchiveLastN?(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",K,Object(n["toDisplayString"])(e.translate("CustomReports_WarningOnUpdateReportMightGetLostBrowserArchivingDisabled",e.reArchiveLastN)),1)):Object(n["createCommentVNode"])("",!0),e.browserArchivingDisabled&&e.reArchiveLastN?Object(n["createCommentVNode"])("",!0):(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",Z,Object(n["toDisplayString"])(e.translate("CustomReports_WarningOnUpdateReportMightGetLost")),1))],512),[[n["vShow"],e.isUnlocked]]),Object(n["createElementVNode"])("div",ee,[Object(n["createVNode"])(tt,{uicontrol:"radio",name:"reportType","model-value":e.report.report_type,"onUpdate:modelValue":t[6]||(t[6]=function(t){return e.setReportTypeHasChanged(t)}),title:e.translate("CustomReports_ReportType"),disabled:!e.canEdit,options:e.reportTypes},null,8,["model-value","title","disabled","options"])]),Object(n["withDirectives"])(Object(n["createElementVNode"])("div",te,[Object(n["createElementVNode"])("div",oe,[Object(n["createElementVNode"])("label",null,Object(n["toDisplayString"])(e.translate("CustomReports_Dimensions")),1),re,Object(n["createElementVNode"])("div",null,[(Object(n["openBlock"])(!0),Object(n["createElementBlock"])(n["Fragment"],null,Object(n["renderList"])(e.report.dimensions,(function(t,o){return Object(n["openBlock"])(),Object(n["createElementBlock"])("div",{class:Object(n["normalizeClass"])("selectedDimension selectedDimension".concat(o)),key:o},[Object(n["createElementVNode"])("div",ie,[Object(n["createVNode"])(tt,{uicontrol:"expandable-select",name:"dimensions","model-value":t,"onUpdate:modelValue":function(t){return e.changeDimension(t,o)},title:e.dimensionsReadable[t]||t,"full-width":!0,options:e.dimensions},null,8,["model-value","onUpdate:modelValue","title","options"])]),Object(n["createElementVNode"])("span",{class:"icon-minus",title:e.translate("CustomReports_RemoveDimension"),onClick:function(t){return e.removeDimension(o)}},null,8,ne)],2)})),128)),Object(n["withDirectives"])(Object(n["createElementVNode"])("div",se,[Object(n["createVNode"])(tt,{uicontrol:"expandable-select",name:"dimensions","model-value":"","onUpdate:modelValue":t[7]||(t[7]=function(t){e.addDimension(t)}),title:e.translate("CustomReports_AddDimension"),"full-width":!0,options:e.dimensions},null,8,["title","options"])],512),[[n["vShow"],e.report.dimensions.lengthe.length)&&(t=e.length);for(var o=0,r=new Array(t);oe.length)&&(t=e.length);for(var o=0,r=new Array(t);o2&&void 0!==arguments[2]?arguments[2]:null,r=ot["NotificationsStore"].show({message:e,context:t,id:Et,type:null!==o&&void 0!==o?o:"transient",prepend:!0});setTimeout((function(){ot["NotificationsStore"].scrollToNotification(r)}),100)},showProductMetricNotification:function(e,t){var o=ot["NotificationsStore"].show({message:e,context:"warning",id:kt,type:"transient"});t&&setTimeout((function(){ot["NotificationsStore"].scrollToNotification(o)}),100)},showErrorFieldNotProvidedNotification:function(e){var t=Object(ot["translate"])("CustomReports_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init:function(){var e=this,t=this.idCustomReport;this.canEdit=!0,this.report=wt(),ot["Matomo"].helper.lazyScrollToContent(),this.edit&&t?jt.findReport(t,!0).then((function(t){var o;if(t){e.report=Object(ot["clone"])(t),e.isLocked=!0,e.isUnlocked=!1,e.canEdit=!0,e.childReports=null!==(o=e.report.child_reports)&&void 0!==o?o:[],e.report.multipleIdSites&&e.report.multipleIdSites.length&&"all"!==e.report.site.id&&"0"!==e.report.site.id&&0!==e.report.site.id&&(e.multipleSites=e.report.multipleIdSites,e.report.allowedToEdit||(e.canEdit=!1,e.isLocked=!1)),e.childReports.length&&Object.values(e.childReports).forEach((function(t){e.childReportIds.push(t.idcustomreport)})),$(document).ready((function(){$("#childReports").sortable({connectWith:"#childReports",update:function(){e.isDirty=!0;var t=$("#childReports li");e.childReportIds=[],t.each((function(t,o){o.dataset.id&&e.childReportIds.push(o.dataset.id)}))}})}));var r=e.report.idsite;0!==r&&"0"!==r&&"all"!==r||(r="all",e.isSuperUser||(e.canEdit=!1,e.isLocked=!1)),e.report.site={id:r,name:e.report.site.name},e.isDirty=!1,e.initReportOptions()}})):this.create&&(this.report={idsite:ot["Matomo"].idSite,site:{id:ot["Matomo"].idSite,name:ot["Matomo"].currentSiteName||ot["Matomo"].siteName},name:"",description:"",dimensions:[],metrics:["nb_visits"],report_type:"table",category:{id:"CustomReports_CustomReports"},subcategory:null,segment_filter:"",child_reports:[],allowedToEdit:!0},this.isLocked=!1,this.canEdit=!0,this.isDirty=!1,this.initReportOptions())},cancel:function(){var e=Object.assign({},ot["MatomoUrl"].hashParsed.value);delete e.idCustomReport,ot["MatomoUrl"].updateHash(e)},unlockReport:function(){var e=this;this.report&&this.isLocked&&ot["Matomo"].helper.modalConfirm(this.$refs.confirmUnlockReport,{yes:function(){e.doUnlock()}})},createReport:function(){var e=this,t="CustomReports.addCustomReport";this.removeAnyReportNotification(),this.checkRequiredFieldsAreSet()&&(this.multipleIdSites=[],this.multipleSites&&this.multipleSites.length&&"all"!==this.report.site.id&&"0"!==this.report.site.id&&0!==this.report.site.id&&(this.multipleIdSites.push(ot["Matomo"].idSite),this.multipleSites.forEach((function(t){var o=t.idsite;e.multipleIdSites.includes(o)||e.multipleIdSites.push(o)}))),this.multipleIdSites&&this.multipleIdSites.length&&(this.report.site.id=ot["Matomo"].idSite),jt.createOrUpdateReport(this.report,t,this.childReportIds,this.multipleIdSites).then((function(t){if(t&&"error"!==t.type&&t.response){e.isDirty=!1;var o=t.response.value;if(e.report.site){var r=e.report.site.id;if(r&&"all"!==r&&"".concat(r)!=="".concat(ot["Matomo"].idSite))return void ot["MatomoUrl"].updateUrl(Object.assign(Object.assign({},ot["MatomoUrl"].urlParsed.value),{},{idSite:r}),Object.assign(Object.assign({},ot["MatomoUrl"].hashParsed.value),{},{idCustomReport:o}))}jt.reload().then((function(){ot["Matomo"].helper.isReportingPage()&&ot["Matomo"].postEvent("updateReportingMenu"),ot["MatomoUrl"].updateHash(Object.assign(Object.assign({},ot["MatomoUrl"].hashParsed.value),{},{idCustomReport:o})),setTimeout((function(){e.showNotification(Object(ot["translate"])("CustomReports_ReportCreated"),t.type)}),200)}))}else{var i,n;e.showApiErrorMessage(null!==(i=t.message)&&void 0!==i?i:"",null!==(n=t.type)&&void 0!==n?n:"error")}})))},showPreview:function(){var e,t,o;if(this.isProductRevenueDependencyMet(!0)){var r=null!==(e=this.report.site)&&void 0!==e&&e.id&&"all"!==this.report.site.id?this.report.site.id:ot["Matomo"].idSite,i=(null===(t=this.report.dimensions)||void 0===t?void 0:t.length)&&this.report.report_type&&"evolution"!==this.report.report_type,n=i?this.report.dimensions.join(","):void 0,s=!(null===(o=this.report.metrics)||void 0===o||!o.length),a=s?this.report.metrics.join(","):void 0,l=ot["MatomoUrl"].stringify({module:"CustomReports",action:"previewReport",period:"day",date:"today",idSite:r,report_type:this.report.report_type,dimensions:n,metrics:a,segment:this.report.segment_filter||void 0}),c=Object(ot["translate"])("CustomReports_Preview");window.Piwik_Popover.createPopupAndLoadUrl(l,c,"customReportPreview")}},setValueHasChanged:function(){this.isDirty=!0},addDimension:function(e){var t=this;this.report&&e&&(this.isLocked?this.confirmReportIsLocked((function(){t.addDimension(e)})):(this.report.dimensions||(this.report.dimensions=[]),this.report.dimensions=[].concat(Ot(this.report.dimensions),[e]),this.setValueHasChanged()))},changeDimension:function(e,t){var o,r=this;this.report&&e&&(this.isLocked?this.confirmReportIsLocked((function(){r.changeDimension(e,t)})):null!==(o=this.report.dimensions)&&void 0!==o&&o[t]&&(this.report.dimensions=Ot(this.report.dimensions),this.report.dimensions[t]=e,this.setValueHasChanged()))},changeMetric:function(e,t){var o,r=this;this.dependencyAdded=!1,this.report&&e&&(this.isLocked?this.confirmReportIsLocked((function(){r.changeMetric(e,t)})):null!==(o=this.report.metrics)&&void 0!==o&&o[t]&&(this.report.metrics=Ot(this.report.metrics),this.report.metrics[t]=e,this.setValueHasChanged(),this.addMetricIfMissingDependency(e)))},setWebsiteChanged:function(e){this.setValueHasChanged(),this.initReportOptions(),"all"===this.report.site.id||"0"===this.report.site.id||0===this.report.site.id?this.multipleSites=[]:this.report.allowedToEdit&&!this.isSiteIncludedAlready("".concat(e.id))&&this.multipleSites&&this.multipleSites.push({idsite:e.id,name:e.name})},removeDimension:function(e){var t=this;this.isLocked?this.confirmReportIsLocked((function(){t.removeDimension(e)})):(window.$('div.ui-tooltip[role="tooltip"]:not([style*="display: none"])').remove(),e>-1&&(this.report.dimensions=Ot(this.report.dimensions),this.report.dimensions.splice(e,1),this.setValueHasChanged()))},addMetric:function(e){var t=this;this.dependencyAdded=!1,this.report&&e&&(this.report.metrics||(this.report.metrics=[]),this.isLocked?this.confirmReportIsLocked((function(){t.addMetric(e)})):(this.report.metrics=[].concat(Ot(this.report.metrics),[e]),this.setValueHasChanged(),this.addMetricIfMissingDependency(e)))},addMetricIfMissingDependency:function(e){if(["sum_product_revenue","avg_product_revenue"].includes(e)&&!this.doesReportIncludeProductQuantityMetric()){var t="avg_product_revenue"===e?"avg_ecommerce_productquantity":"sum_ecommerce_productquantity";this.addMetric(t),this.dependencyAdded=!0}},removeMetric:function(e){var t=this;this.dependencyAdded=!1,this.isLocked?this.confirmReportIsLocked((function(){t.removeMetric(e)})):(window.$('div.ui-tooltip[role="tooltip"]:not([style*="display: none"])').remove(),e>-1&&(this.report.metrics=Ot(this.report.metrics),this.report.metrics.splice(e,1),this.setValueHasChanged()))},setReportTypeHasChanged:function(e){var t=this;this.report&&this.isLocked?e!==this.report.report_type&&this.confirmReportIsLocked((function(){t.report.report_type=e,t.setValueHasChanged()})):(this.report.report_type=e,this.setValueHasChanged())},setSegmentFilterHasChanged:function(e){var t=this;this.report&&this.isLocked?e!==this.report.segment_filter&&this.confirmReportIsLocked((function(){t.report.segment_filter=e,t.setValueHasChanged()})):(this.report.segment_filter=e,this.setValueHasChanged())},updateReport:function(){var e=this;if(this.removeAnyReportNotification(),this.checkRequiredFieldsAreSet()){this.multipleIdSites=[],this.multipleSites&&this.multipleSites.length&&"all"!==this.report.site.id&&"0"!==this.report.site.id&&0!==this.report.site.id&&(this.multipleIdSites.push(ot["Matomo"].idSite),this.multipleSites.forEach((function(t){var o=t.idsite;e.multipleIdSites.includes(o)||e.multipleIdSites.push(o)})));var t="CustomReports.updateCustomReport";this.multipleIdSites&&this.multipleIdSites.length&&(this.report.site.id=ot["Matomo"].idSite),jt.createOrUpdateReport(this.report,t,this.childReportIds,this.multipleIdSites).then((function(t){if(t&&"error"!==t.type){var o=e.report.site.id;e.isDirty=!1,e.canEdit=!0,o&&"all"!==o&&"".concat(o)!=="".concat(ot["Matomo"].idSite)?ot["MatomoUrl"].updateUrl(Object.assign(Object.assign({},ot["MatomoUrl"].urlParsed.value),{},{idSite:o}),Object.assign({},ot["MatomoUrl"].hashParsed.value)):(jt.reload().then((function(){e.init()})),e.showNotification(Object(ot["translate"])("CustomReports_ReportUpdated"),t.type))}else{var r,i;e.showApiErrorMessage(null!==(r=t.message)&&void 0!==r?r:"",null!==(i=t.type)&&void 0!==i?i:"error")}}))}},checkRequiredFieldsAreSet:function(){var e,t;if(!this.report.name){var o=Object(ot["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(o),!1}if("evolution"!==this.report.report_type&&(null===(t=this.report.dimensions)||void 0===t||!t.length||!Vt(this.report.dimensions).length)){var r=Object(ot["translate"])("CustomReports_ErrorMissingDimension");return this.showNotification(r,"error"),!1}if(null===(e=this.report.metrics)||void 0===e||!e.length||!Vt(this.report.metrics).length){var i=Object(ot["translate"])("CustomReports_ErrorMissingMetric");return this.showNotification(i,"error"),!1}return this.isProductRevenueDependencyMet(!1),!0},setSubcategory:function(e){this.report.subcategory=this.report.subcategory||{id:""},this.report.subcategory.id=e},isProductRevenueDependencyMet:function(e){var t=Object(ot["externalLink"])("https://matomo.org/faq/custom-reports/why-is-there-an-error-when-i-try-to-run-a-custom-report-with-the-product-revenue-metric/"),o=Object(ot["translate"])("CustomReports_WarningProductRevenueMetricDependency",t,"");return this.report.metrics.includes("sum_product_revenue")&&!this.doesReportIncludeProductQuantityMetric()?(this.addMetric("sum_ecommerce_productquantity"),this.showProductMetricNotification(o,e),!1):!(this.report.metrics.includes("avg_product_revenue")&&!this.doesReportIncludeProductQuantityMetric())||(this.addMetric("avg_ecommerce_productquantity"),this.showProductMetricNotification(o,e),!1)},doesReportIncludeProductQuantityMetric:function(){return this.report.metrics.includes("sum_ecommerce_productquantity")||this.report.metrics.includes("avg_ecommerce_productquantity")},isSiteIncludedAlready:function(e){return!(!this.multipleSites||!this.multipleSites.length)&&this.multipleSites.some((function(t){return"".concat(t.idsite)==="".concat(e)}))},removeSite:function(e){this.multipleSites&&(this.isDirty=!0,this.multipleSites=this.multipleSites.filter((function(t){return t.idsite!==e.idsite})))},addSitesContaining:function(e){var t=this;if(e){var o='"'.concat(ot["Matomo"].helper.escape(ot["Matomo"].helper.htmlEntities(e)),'"');ot["AjaxHelper"].fetch({method:"SitesManager.getSitesWithAdminAccess",pattern:e,filter_limit:-1}).then((function(e){if(e&&e.length){var r=[],i=[];e.forEach((function(e){var o=window.vueSanitize(ot["Matomo"].helper.htmlEntities(e.name)),n="".concat(o," (id ").concat(parseInt("".concat(e.idsite),10),")
");t.isSiteIncludedAlready("".concat(e.idsite))?i.push(n):r.push(n)}));var n=Object(ot["translate"])("CustomReports_MatchingSearchConfirmTitle",r.length);if(i.length){var s=Object(ot["translate"])("CustomReports_MatchingSearchConfirmTitleAlreadyAdded",i.length);n+=" (".concat(s,")")}var a="

".concat(n,"

\n ").concat(Object(ot["translate"])("CustomReports_MatchingSearchMatchedAdd",r.length,o),":\n

");if(a+=r.join(""),i.length){var l=Object(ot["translate"])("CustomReports_MatchingSearchMatchedAlreadyAdded",i.length,o);a+="
".concat(l,":

").concat(i.join(""))}a+='

\n \n
'),ot["Matomo"].helper.modalConfirm(a,{yes:function(){e.forEach((function(e){t.multipleSites&&(t.isSiteIncludedAlready("".concat(e.idsite))||(t.isDirty=!0,t.multipleSites.push({idsite:e.idsite,name:e.name})))})),t.containsText=""}})}else{var c="
\n

".concat(Object(ot["translate"])("CustomReports_MatchingSearchNotFound",o),'

\n \n
');ot["Matomo"].helper.modalConfirm(c)}}))}}},computed:{isSuperUser:function(){return!!ot["Matomo"].hasSuperUserAccess},allMetrics:function(){return jt.state.value.allMetrics},metrics:function(){var e,t=["pageviews_with_generation_time","avg_page_generation_time","max_actions_pagegenerationtime","sum_actions_pagegenerationtime"],o=((null===(e=this.report)||void 0===e?void 0:e.metrics)||[]).some((function(e){return t.indexOf(e)>=0})),r=!o;return this.allMetrics.filter((function(e){return!!e&&!(r&&t.indexOf(e.key)>=0)}))},allDimensions:function(){return jt.state.value.allDimensions},reportTypes:function(){return jt.state.value.reportTypesReadable},create:function(){return!this.idCustomReport},edit:function(){return!this.create},editTitle:function(){return this.create?"CustomReports_CreateNewReport":"CustomReports_EditReport"},contentTitle:function(){return Object(ot["translate"])(this.editTitle,this.report.name?'"'.concat(this.report.name,'"'):"")},categories:function(){return jt.state.value.categories},subcategories:function(){return jt.state.value.subcategories},dimensions:function(){var e,t=Ot(this.allDimensions);if(null===(e=this.report)||void 0===e||!e.dimensions)return t;for(var o=-1!==this.report.dimensions.indexOf("Actions.PageGenerationTime"),r=this.report.dimensions.map((function(e){var o;return null===(o=t.find((function(t){return t.key===e})))||void 0===o?void 0:o.sqlSegment})).filter((function(e){return!!e})),i=0;i-1&&-1===this.report.dimensions.indexOf(n.key)&&(t.splice(i,1),i-=1)}return t},isLoading:function(){return jt.state.value.isLoading},isUpdating:function(){return jt.state.value.isUpdating},dimensionsReadable:function(){return jt.state.value.dimensionsReadable},metricsReadable:function(){return jt.state.value.metricsReadable},saveButtonText:function(){return this.edit?Object(ot["translate"])("CoreUpdater_UpdateTitle"):Object(ot["translate"])("CustomReports_CreateNewReport")},getProductRevenueDependencyMessage:function(){var e=Object(ot["externalLink"])("https://matomo.org/faq/custom-reports/why-is-there-an-error-when-i-try-to-run-a-custom-report-with-the-product-revenue-metric/");return Object(ot["translate"])("CustomReports_WarningProductRevenueMetricDependency",e,"")},getPausedStateAdminMessage:function(){var e="?".concat(ot["MatomoUrl"].stringify(Object.assign(Object.assign({},ot["MatomoUrl"].urlParsed.value),{},{module:"CustomReports",action:"manage"})));return Object(ot["translate"])("CustomReports_ReportInPausedStateAdmin",''),"")},getDimensionsHelpText:function(){var e=Object(ot["translate"])("CustomReports_ReportDimensionsHelpNew"),t=this.getDimensionsHelpTextExtended;return t?"".concat(e,"

").concat(t):e},getDimensionsHelpTextExtended:function(){if(this.isCloud)return"";var e=Object(ot["externalLink"])("https://matomo.org/faq/custom-reports/faq_25655/");return Object(ot["translate"])("CustomReports_ReportDimensionsHelpExtended",e,"")}}});_t.render=tt;var Mt=_t,Dt={class:"reportSearchFilter"},At={class:"index"},It={class:"name"},Ut={class:"description"},Bt={class:"reportType"},Tt={class:"reportCategory"},Lt={class:"action"},xt={colspan:"7"},Pt={class:"loadingPiwik"},Ht=Object(n["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Gt={colspan:"7"},qt=["id"],Ft={class:"index"},Wt={class:"name"},$t=["title"],Yt=["title"],zt=["title"],Qt=["title"],Xt=["title"],Jt={class:"reportType"},Kt=["title"],Zt={key:0},eo={class:"action"},to=["title","onClick"],oo=["title","onClick"],ro=["title","onClick"],io=["title","href"],no=["title","onClick"],so={class:"tableActionBar"},ao=Object(n["createElementVNode"])("span",{class:"icon-add"},null,-1),lo={class:"ui-confirm",ref:"confirmDeleteReport"},co=["value"],uo=["value"],po={class:"ui-confirm",ref:"confirmPauseReport"},mo=["value"],ho=["value"],bo={class:"ui-confirm",ref:"confirmResumeReport"},fo=["value"],vo=["value"];function go(e,t,o,r,i,s){var a=Object(n["resolveComponent"])("Field"),l=Object(n["resolveComponent"])("ContentBlock"),c=Object(n["resolveDirective"])("content-table");return Object(n["openBlock"])(),Object(n["createElementBlock"])("div",null,[Object(n["createVNode"])(l,{"content-title":e.translate("CustomReports_ManageReports"),feature:e.translate("CustomReports_ManageReports")},{default:Object(n["withCtx"])((function(){return[Object(n["createElementVNode"])("p",null,Object(n["toDisplayString"])(e.translate("CustomReports_CustomReportIntroduction")),1),Object(n["createElementVNode"])("div",Dt,[Object(n["withDirectives"])(Object(n["createVNode"])(a,{uicontrol:"text",name:"reportSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.searchFilter=t})},null,8,["title","modelValue"]),[[n["vShow"],e.reports.length>0]])]),Object(n["withDirectives"])(Object(n["createElementVNode"])("table",null,[Object(n["createElementVNode"])("thead",null,[Object(n["createElementVNode"])("tr",null,[Object(n["createElementVNode"])("th",At,Object(n["toDisplayString"])(e.translate("General_Id")),1),Object(n["createElementVNode"])("th",It,Object(n["toDisplayString"])(e.translate("General_Name")),1),Object(n["createElementVNode"])("th",Ut,Object(n["toDisplayString"])(e.translate("General_Description")),1),Object(n["createElementVNode"])("th",Bt,Object(n["toDisplayString"])(e.translate("CustomReports_Type")),1),Object(n["createElementVNode"])("th",Tt,Object(n["toDisplayString"])(e.translate("CustomReports_Category")),1),Object(n["createElementVNode"])("th",Lt,Object(n["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(n["createElementVNode"])("tbody",null,[Object(n["withDirectives"])(Object(n["createElementVNode"])("tr",null,[Object(n["createElementVNode"])("td",xt,[Object(n["createElementVNode"])("span",Pt,[Ht,Object(n["createTextVNode"])(" "+Object(n["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[n["vShow"],e.isLoading||e.isUpdating]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("tr",null,[Object(n["createElementVNode"])("td",Gt,Object(n["toDisplayString"])(e.translate("CustomReports_NoCustomReportsFound")),1)],512),[[n["vShow"],!e.isLoading&&0==e.reports.length]]),(Object(n["openBlock"])(!0),Object(n["createElementBlock"])(n["Fragment"],null,Object(n["renderList"])(e.sortedReports,(function(t){var o;return Object(n["openBlock"])(),Object(n["createElementBlock"])("tr",{id:"report".concat(t.idcustomreport),class:"customReports",key:t.idcustomreport},[Object(n["createElementVNode"])("td",Ft,Object(n["toDisplayString"])(t.idcustomreport),1),Object(n["createElementVNode"])("td",Wt,[Object(n["createTextVNode"])(Object(n["toDisplayString"])(t.name)+" ",1),Object(n["withDirectives"])(Object(n["createElementVNode"])("span",{class:"icon-locked",title:e.translate("CustomReports_ReportEditNotAllowedAllWebsitesUpdated")},null,8,$t),[[n["vShow"],!t.idsite&&!e.isSuperUser]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("span",{class:"icon-info2",title:e.translate("CustomReports_ReportAvailableToAllWebsites")},null,8,Yt),[[n["vShow"],!t.idsite&&e.isSuperUser]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("span",{class:"icon-locked",title:e.translate("CustomReports_ReportEditNotAllowedMultipleWebsitesAccessIssue")},null,8,zt),[[n["vShow"],!t.allowedToEdit&&e.isMultiSiteReport(t)]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("span",{class:"icon-info2",title:e.translate("CustomReports_ReportAvailableToMultipleWebsites")},null,8,Qt),[[n["vShow"],t.allowedToEdit&&e.isMultiSiteReport(t)]])]),Object(n["createElementVNode"])("td",{class:"description",title:e.htmlEntities(t.description)},Object(n["toDisplayString"])(e.truncate(t.description.trim(),60)),9,Xt),Object(n["createElementVNode"])("td",Jt,Object(n["toDisplayString"])(e.reportTypesReadable[t.report_type]),1),Object(n["createElementVNode"])("td",{class:"reportCategory",title:e.htmlEntities(t.category.name)},[Object(n["createTextVNode"])(Object(n["toDisplayString"])(e.truncate(t.category.name.trim(),60))+" ",1),null!==(o=t.subcategory)&&void 0!==o&&o.name?(Object(n["openBlock"])(),Object(n["createElementBlock"])("span",Zt," - "+Object(n["toDisplayString"])(e.truncate(t.subcategory.name.trim(),60)),1)):Object(n["createCommentVNode"])("",!0)],8,Kt),Object(n["createElementVNode"])("td",eo,[Object(n["withDirectives"])(Object(n["createElementVNode"])("a",{class:"table-action icon-pause",title:e.translate("CustomReports_PauseReportInfo"),onClick:function(o){return e.pauseReport(t)}},null,8,to),[[n["vShow"],(t.idsite&&!e.isMultiSiteReport(t)||t.allowedToEdit)&&"active"===t.status]]),Object(n["withDirectives"])(Object(n["createElementVNode"])("a",{class:"table-action icon-play",title:e.translate("CustomReports_ResumeReportInfo"),onClick:function(o){return e.resumeReport(t)}},null,8,oo),[[n["vShow"],(t.idsite&&!e.isMultiSiteReport(t)||t.allowedToEdit)&&"paused"===t.status]]),Object(n["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("CustomReports_EditReport"),onClick:function(o){return e.editReport(t.idcustomreport)}},null,8,ro),Object(n["createElementVNode"])("a",{target:"_blank",class:"table-action icon-show",title:e.translate("CustomReports_ViewReportInfo"),href:e.getViewReportLink(t)},null,8,io),Object(n["withDirectives"])(Object(n["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("CustomReports_DeleteReportInfo"),onClick:function(o){return e.deleteReport(t)}},null,8,no),[[n["vShow"],t.idsite&&!e.isMultiSiteReport(t)||t.allowedToEdit]])])],8,qt)})),128))])],512),[[c]]),Object(n["createElementVNode"])("div",so,[Object(n["createElementVNode"])("a",{class:"createNewReport",onClick:t[1]||(t[1]=function(t){return e.createReport()})},[ao,Object(n["createTextVNode"])(" "+Object(n["toDisplayString"])(e.translate("CustomReports_CreateNewReport")),1)])])]})),_:1},8,["content-title","feature"]),Object(n["createElementVNode"])("div",lo,[Object(n["createElementVNode"])("h2",null,Object(n["toDisplayString"])(e.translate("CustomReports_DeleteReportConfirm")),1),Object(n["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,co),Object(n["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,uo)],512),Object(n["createElementVNode"])("div",po,[Object(n["createElementVNode"])("h2",null,Object(n["toDisplayString"])(e.translate("CustomReports_PauseReportConfirm")),1),Object(n["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,mo),Object(n["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ho)],512),Object(n["createElementVNode"])("div",bo,[Object(n["createElementVNode"])("h2",null,Object(n["toDisplayString"])(e.translate("CustomReports_ResumeReportConfirm")),1),Object(n["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,fo),Object(n["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,vo)],512)])} +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */function jo(e,t){return e&&e.length>t?"".concat(e.substr(0,t-3),"..."):e}function Oo(e){return Co(e)||So(e)||Ro(e)||yo()}function yo(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ro(e,t){if(e){if("string"===typeof e)return No(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?No(e,t):void 0}}function So(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function Co(e){if(Array.isArray(e))return No(e)}function No(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o2&&void 0!==arguments[2]?arguments[2]:null,r=ot["NotificationsStore"].show({message:e,context:t,id:Eo,type:null!==o?o:"toast"});setTimeout((function(){ot["NotificationsStore"].scrollToNotification(r)}),200)},deleteReport:function(e){ot["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteReport,{yes:function(){jt.deleteReport(e.idcustomreport,e.idsite).then((function(){jt.reload(),ot["Matomo"].postEvent("updateReportingMenu")}))}})},getViewReportLink:function(e){return"?".concat(ot["MatomoUrl"].stringify({module:"CoreHome",action:"index",idSite:e.linkIdSite,period:"day",date:"yesterday"}),"#?").concat(ot["MatomoUrl"].stringify({category:e.category.id,idSite:e.linkIdSite,date:ot["MatomoUrl"].parsed.value.date,period:ot["MatomoUrl"].parsed.value.period,segment:ot["MatomoUrl"].parsed.value.segment,subcategory:e.subcategoryLink}))},truncate:jo,htmlEntities:function(e){return ot["Matomo"].helper.htmlEntities(e)},isMultiSiteReport:function(e){return e.multiple_idsites&&e.multiple_idsites.split(",")}},computed:{isSuperUser:function(){return ot["Matomo"].hasSuperUserAccess},reports:function(){return jt.state.value.reports},sortedReports:function(){var e=this.searchFilter.toLowerCase(),t=Oo(this.reports).filter((function(t){return Object.keys(t).some((function(o){var r=t;return"string"===typeof r[o]&&-1!==r[o].toLowerCase().indexOf(e)}))}));return t.sort((function(e,t){var o=parseInt("".concat(e.idcustomreport),10),r=parseInt("".concat(t.idcustomreport),10);return o-r})),t},isLoading:function(){return jt.state.value.isLoading},isUpdating:function(){return jt.state.value.isUpdating},reportTypesReadable:function(){return jt.state.value.reportTypesReadable}}});ko.render=go;var Vo=ko,wo={class:"manageReports"},_o={key:0},Mo={key:1};function Do(e,t,o,r,i,s){var a=Object(n["resolveComponent"])("CustomReportsList"),l=Object(n["resolveComponent"])("CustomReportsEdit");return Object(n["openBlock"])(),Object(n["createElementBlock"])("div",wo,[e.editMode?Object(n["createCommentVNode"])("",!0):(Object(n["openBlock"])(),Object(n["createElementBlock"])("div",_o,[Object(n["createVNode"])(a)])),e.editMode?(Object(n["openBlock"])(),Object(n["createElementBlock"])("div",Mo,[Object(n["createVNode"])(l,{"id-custom-report":e.idCustomReport,"browser-archiving-disabled":e.browserArchivingDisabled,"re-archive-last-n":e.reArchiveLastN,"max-dimensions":e.maxDimensions,"is-cloud":e.isCloud},null,8,["id-custom-report","browser-archiving-disabled","re-archive-last-n","max-dimensions","is-cloud"])])):Object(n["createCommentVNode"])("",!0)])}var Ao=Object(n["defineComponent"])({props:{browserArchivingDisabled:Boolean,reArchiveLastN:Number,maxDimensions:Number,isCloud:Boolean},components:{CustomReportsList:Vo,CustomReportsEdit:Mt},data:function(){return{editMode:!1,idCustomReport:null}},watch:{editMode:function(){$(".ui-tooltip").remove()}},created:function(){var e=this;Object(n["watch"])((function(){return ot["MatomoUrl"].hashParsed.value.idCustomReport}),(function(t){e.initState(t)})),this.initState(ot["MatomoUrl"].hashParsed.value.idCustomReport)},methods:{removeAnyReportNotification:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];ot["NotificationsStore"].remove("reportsmanagement"),e&&ot["NotificationsStore"].remove("reportsmanagementProductMetric")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(ot["Matomo"].postEvent("CustomReports.initAddReport",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idCustomReport=null)}this.editMode=!0,this.idCustomReport=parseInt(e,10)}else this.editMode=!1,this.idCustomReport=null;this.removeAnyReportNotification(!e)}}});Ao.render=Do;var Io=Ao; +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */}})})); +//# sourceMappingURL=CustomReports.umd.min.js.map \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/vue/dist/umd.metadata.json b/files/plugin-CustomReports-5.4.3/vue/dist/umd.metadata.json new file mode 100644 index 0000000..3abfd12 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/dist/umd.metadata.json @@ -0,0 +1,7 @@ +{ + "dependsOn": [ + "CoreHome", + "CorePluginsAdmin", + "SegmentEditor" + ] +} \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/vue/src/CustomReports.store.ts b/files/plugin-CustomReports-5.4.3/vue/src/CustomReports.store.ts new file mode 100644 index 0000000..a829438 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/CustomReports.store.ts @@ -0,0 +1,424 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +import { + reactive, + computed, + readonly, + DeepReadonly, +} from 'vue'; +import { AjaxHelper, Matomo } from 'CoreHome'; +import { CustomReport, CustomReportType } from './types'; + +interface Option { + key: string; + value: string; +} + +type GetAvailableCategoriesResponse = { + uniqueId: string; + name: string; + subcategories: { + uniqueId: string; + name: string; + }[]; +}[]; + +type ListByCategory = ({ + category: string; +} & { + [S in SubcategoryField]: ({ + uniqueId: string; + name: string; + description?: string; + } & { + [E in ExtraField]?: string; + })[]; +})[]; + +type GetAvailableMetricsResponse = ListByCategory<'metrics'>; +type GetAvailableDimensionsResponse = ListByCategory<'dimensions', 'sqlSegment'>; + +function arrayFilterAndRemoveDuplicates(values: T[]) { + return [...new Set(values)].filter((v) => !!v); +} + +type FormattedListItem = ({ + group: string; + key: string; + value: string; + tooltip?: string; +} & { + [E in ExtraField]?: string; +}); + +function formatExpandableList( + listByCategories: ListByCategory, + subcategoryField: SubcategoryField, + extraField?: ExtraField, +) { + const list: FormattedListItem[] = []; + + listByCategories.forEach((category) => { + category[subcategoryField].forEach((value) => { + list.push({ + group: category.category, + key: value.uniqueId, + value: value.name, + tooltip: value.description || undefined, + ...(extraField ? { [extraField]: value[extraField] } : {}), + }); + }); + }); + + return list; +} + +const EMPTY_CAT = { + key: '', + value: '', +}; + +interface CustomReportsStoreState { + reports: CustomReport[]; + reportTypesReadable: Record; + dimensionsReadable: Record; + metricsReadable: Record; + categories: Option[]; + subcategories: Record; + isLoading: boolean; + isUpdating: boolean; + allMetrics: FormattedListItem[]; + allDimensions: FormattedListItem<'sqlSegment'>[]; +} + +class CustomReportsStore { + private privateState = reactive({ + reports: [], + reportTypesReadable: {}, + dimensionsReadable: {}, + metricsReadable: {}, + categories: [], + subcategories: {}, + isLoading: false, + isUpdating: false, + allMetrics: [], + allDimensions: [], + }); + + readonly state = computed(() => readonly(this.privateState)); + + private fetchPromise: Promise|null = null; + + private availableReportTypesPromise: Promise|null = null; + + private dimensionsPromise: Promise|null = null; + + private dimensionsIdsiteLoaded: number|string = 0; + + private metricsPromise: Promise|null = null; + + private metricsIdsiteLoaded: number|string = 0; + + reload() { + this.privateState.reports = []; + this.fetchPromise = null; + return this.fetchReports(); + } + + cleanupSegmentDefinition(definition: string) { + let result = definition; + result = result.replace('\'', '%27'); + result = result.replace('&', '%26'); + return result; + } + + getAvailableReportTypes(): Promise { + if (!this.availableReportTypesPromise) { + this.availableReportTypesPromise = AjaxHelper.fetch({ + method: 'CustomReports.getAvailableReportTypes', + filter_limit: '-1', + }).then((reportTypes) => { + const reportTypeMap: Record = {}; + reportTypes.forEach((rt) => { + reportTypeMap[rt.key] = rt.value; + }); + this.privateState.reportTypesReadable = reportTypeMap; + }); + } + + return this.availableReportTypesPromise!.then(() => this.state.value.reportTypesReadable); + } + + getAvailableDimensions( + idSite: number|'all', + ): Promise { + if (!this.dimensionsPromise || this.dimensionsIdsiteLoaded !== idSite) { + this.dimensionsIdsiteLoaded = idSite; + + this.dimensionsPromise = AjaxHelper.fetch({ + method: 'CustomReports.getAvailableDimensions', + filter_limit: '-1', + idSite, + }).then((dimensions) => { + const dimensionMap: Record = {}; + dimensions.forEach((category) => { + category.dimensions.forEach((dimension) => { + dimensionMap[dimension.uniqueId] = dimension.name; + }); + }); + this.privateState.dimensionsReadable = dimensionMap; + + this.privateState.allDimensions = formatExpandableList( + dimensions, + 'dimensions', + 'sqlSegment', + ); + }); + } + + return this.dimensionsPromise!.then(() => this.state.value.dimensionsReadable); + } + + getAvailableMetrics( + idSite: number|'all', + ): Promise { + if (!this.metricsPromise || this.metricsIdsiteLoaded !== idSite) { + this.metricsIdsiteLoaded = idSite; + this.metricsPromise = AjaxHelper.fetch({ + method: 'CustomReports.getAvailableMetrics', + filter_limit: '-1', + idSite, + }).then((metrics) => { + const metricsMap: Record = {}; + metrics.forEach((metricsCategory) => { + metricsCategory.metrics.forEach((metric) => { + metricsMap[metric.uniqueId] = metric.name; + }); + }); + this.privateState.metricsReadable = metricsMap; + + this.privateState.allMetrics = formatExpandableList(metrics, 'metrics'); + }); + } + + return this.metricsPromise!.then(() => this.state.value.metricsReadable); + } + + private categoriesPromise: Promise|null = null; + + private categoriesIdsiteLoaded: number|null = null; + + getAvailableCategories(idSite?: number|'all'): Promise { + const idSiteToUse = !idSite || idSite === 'all' ? Matomo.idSite : idSite; + + if (!this.categoriesPromise || this.categoriesIdsiteLoaded !== idSite) { + this.categoriesPromise = AjaxHelper.fetch({ + method: 'CustomReports.getAvailableCategories', + filter_limit: '-1', + idSite: idSiteToUse, + }).then((response) => { + const categories: Option[] = []; + const subcategories: Record = {}; + + response.forEach((category) => { + categories.push({ key: category.uniqueId, value: category.name }); + + category.subcategories.forEach((subcat) => { + subcategories[category.uniqueId] = subcategories[category.uniqueId] || [EMPTY_CAT]; + subcategories[category.uniqueId].push({ key: subcat.uniqueId, value: subcat.name }); + }); + }); + + this.privateState.categories = categories; + this.privateState.subcategories = subcategories; + }); + } + + return this.categoriesPromise!; + } + + fetchReports(): Promise { + if (!this.fetchPromise) { + this.fetchPromise = AjaxHelper.fetch({ + method: 'CustomReports.getConfiguredReports', + filter_limit: '-1', + }); + } + + this.privateState.isLoading = true; + this.privateState.reports = []; + return this.fetchPromise.then((reports) => { + this.privateState.reports = reports.map((report) => { + let subcategoryLink: string|number|undefined = undefined; + if (report?.subcategory?.id) { + subcategoryLink = report.subcategory.id; + } else if (report?.category?.id === 'CustomReports_CustomReports') { + subcategoryLink = report.idcustomreport; + } else { + subcategoryLink = report.name; + } + + return { + ...report, + // report.idsite is falsey when report is set for all sites + linkIdSite: report.idsite ? report.idsite : Matomo.idSite, + subcategoryLink, + }; + }); + + return this.state.value.reports; + }).finally(() => { + this.privateState.isLoading = false; + }); + } + + findReport(idCustomReport: number, isReload: boolean): Promise> { + // before going through an API request we first try to find it in loaded reports + const found = this.state.value.reports.find( + (r) => parseInt(`${r.idcustomreport}`, 10) === idCustomReport, + ); + + if (found && !isReload) { + return Promise.resolve(found); + } + + // otherwise we fetch it via API + this.privateState.isLoading = true; + return AjaxHelper.fetch({ + idCustomReport, + method: 'CustomReports.getConfiguredReport', + }).finally(() => { + this.privateState.isLoading = false; + }); + } + + deleteReport( + idCustomReport: number|string, + idSite: number|string, + ): Promise<{ type: string, message?: string }> { + this.privateState.isUpdating = true; + this.privateState.reports = []; + + return AjaxHelper.fetch( + { + idCustomReport, + idSite: `${idSite}`, + method: 'CustomReports.deleteCustomReport', + }, + { + withTokenInUrl: true, + }, + ).then(() => ({ + type: 'success', + })).catch((e) => ({ + type: 'error', + message: e.message || e as string, + })).finally(() => { + this.privateState.isUpdating = false; + }); + } + + pauseReport( + idCustomReport: number|string, + idSite: number|string, + ): Promise<{ type: string, message?: string }> { + this.privateState.isUpdating = true; + this.privateState.reports = []; + + return AjaxHelper.fetch( + { + idCustomReport, + idSite: `${idSite}`, + method: 'CustomReports.pauseCustomReport', + }, + { + withTokenInUrl: true, + }, + ).then(() => ({ + type: 'success', + })).catch((e) => ({ + type: 'error', + message: e.message || e as string, + })).finally(() => { + this.privateState.isUpdating = false; + }); + } + + resumeReport( + idCustomReport: number|string, + idSite: number|string, + ): Promise<{ type: string, message?: string }> { + this.privateState.isUpdating = true; + this.privateState.reports = []; + + return AjaxHelper.fetch( + { + idCustomReport, + idSite: `${idSite}`, + method: 'CustomReports.resumeCustomReport', + }, + { + withTokenInUrl: true, + }, + ).then(() => ({ + type: 'success', + })).catch((e) => ({ + type: 'error', + message: e.message || e as string, + })).finally(() => { + this.privateState.isUpdating = false; + }); + } + + createOrUpdateReport( + report: CustomReport, + method: string, + childReportIds: Array, + multipleIdSites: Array, + ): Promise<{ type: string, message?: string, response?: { value: number|string }}> { + this.privateState.isUpdating = true; + return AjaxHelper.post<{ value: number|string }>( + { + method, + idCustomReport: report.idcustomreport, + reportType: report.report_type, + name: report.name.trim(), + description: report.description.trim(), + segmentFilter: encodeURIComponent(report.segment_filter), + categoryId: report.category?.id, + subcategoryId: report.subcategory?.id, + idSite: report.site.id, + subCategoryReportIds: childReportIds, + multipleIdSites, + }, + { + dimensionIds: arrayFilterAndRemoveDuplicates(report.dimensions), + metricIds: arrayFilterAndRemoveDuplicates(report.metrics), + }, + { withTokenInUrl: true }, + ).then((response) => ({ + type: 'success', + response, + })).catch((error) => ({ + type: 'error', + message: error.message || error as string, + })).finally(() => { + this.privateState.isUpdating = false; + }); + } +} + +export default new CustomReportsStore(); diff --git a/files/plugin-CustomReports-5.4.3/vue/src/Reports/Edit.less b/files/plugin-CustomReports-5.4.3/vue/src/Reports/Edit.less new file mode 100644 index 0000000..fbadbe3 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/Reports/Edit.less @@ -0,0 +1,114 @@ +.editReport { + min-width: 1070px; + + form > div { + .matomo-form-field { + margin-left: -.75rem; + } + + > .form-group { + margin-left: -.75rem; + } + } + + .icon-help { + color: #888; + cursor: help; + &:hover { + color: @theme-color-text; + } + } + + .alertUnlocked, + .unlockAlert { + margin-top: -24px; + } + + .icon-close { + cursor: pointer; + } + + .metricsGroup, + .dimensionsGroup { + padding: 0 0.75rem; + + .groupValueSelect { + min-width: 300px; + display: inline-block; + + .expandableList { + margin-top: -32px; + margin-left: 12px; + } + } + + .selectedMetric, + .selectedDimension { + .select-dropdown { + background: #e4e4e4 !important; + } + } + + .icon-minus { + display: inline-block; + vertical-align: top; + margin-top: 20px; + margin-left: 53.5px; + color: #666; + cursor: pointer; + } + + label { + font-size: 0.8rem; + } + .form-group.row { + margin-top: 11px; + margin-bottom: 0; + } + + .input-field { + margin-top: 0; + .caret { + right: -25px; + z-index: 9; + cursor: pointer; + } + .select-dropdown { + margin-bottom: 0; + border: 0; + background: #f2f2f2; + display: inline-block; + height: 32px; + font-size: 13px; + font-weight: 500; + color: rgba(0,0,0,0.6); + line-height: 32px; + border-radius: 3em; + padding-left: 12px; + padding-right: 30px; + box-shadow: 0 2px 5px 0 rgba(0,0,0,0.16), 0 2px 10px 0 rgba(0,0,0,0.12) !important; + } + } + } + + .expandableSelector { + label { + white-space: nowrap; + top: -0.8rem; + } + } + + ul#childReports li { + cursor: move; + line-height: 2rem; + + .ui-icon { + margin-left: -1rem; + } + } + + .customReportSearchMeasurablesField { + width: 50% !important; + display: inline-block; + } +} \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/vue/src/Reports/Edit.vue b/files/plugin-CustomReports-5.4.3/vue/src/Reports/Edit.vue new file mode 100644 index 0000000..800f118 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/Reports/Edit.vue @@ -0,0 +1,1419 @@ + + + + + diff --git a/files/plugin-CustomReports-5.4.3/vue/src/Reports/List.less b/files/plugin-CustomReports-5.4.3/vue/src/Reports/List.less new file mode 100644 index 0000000..f32f753 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/Reports/List.less @@ -0,0 +1,54 @@ +.manageReports { + .reportSearchFilter { + .form-group { + .theWidgetContent & { + margin-top: 0 !important; + } + } + .input-field { + margin-left: -0.75em !important; + margin-top: 0; + + .theWidgetContent & { + margin-left: 0 !important; + } + } + } + .info { + color: @color-silver; + } + + .icon-info2, + .icon-locked { + color: @color-silver; + cursor: help; + } + + p, pre { + max-width: 900px; + } + + th.action, td.action { + width: 250px; + + a { + color: #000; + margin-top: -16px; + } + } + + .index { + width: 60px; + } + + td { + .icon-ok { + color: #43a047; + } + } +} + +.customReportsHigherDimensions table.dataTable td { + width: calc(100% - 4rem) !important; + max-width: 160px !important; +} \ No newline at end of file diff --git a/files/plugin-CustomReports-5.4.3/vue/src/Reports/List.vue b/files/plugin-CustomReports-5.4.3/vue/src/Reports/List.vue new file mode 100644 index 0000000..61cacf4 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/Reports/List.vue @@ -0,0 +1,357 @@ + + + + + diff --git a/files/plugin-CustomReports-5.4.3/vue/src/Reports/Manage.vue b/files/plugin-CustomReports-5.4.3/vue/src/Reports/Manage.vue new file mode 100644 index 0000000..d093cd5 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/Reports/Manage.vue @@ -0,0 +1,108 @@ + + + + + diff --git a/files/plugin-CustomReports-5.4.3/vue/src/index.ts b/files/plugin-CustomReports-5.4.3/vue/src/index.ts new file mode 100644 index 0000000..cd7392b --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/index.ts @@ -0,0 +1,18 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +export { default as ReportEdit } from './Reports/Edit.vue'; +export { default as ReportsList } from './Reports/List.vue'; +export { default as ReportsManage } from './Reports/Manage.vue'; diff --git a/files/plugin-CustomReports-5.4.3/vue/src/truncateText2.ts b/files/plugin-CustomReports-5.4.3/vue/src/truncateText2.ts new file mode 100644 index 0000000..ee32085 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/truncateText2.ts @@ -0,0 +1,21 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +export default function truncateText2(text: string, length: number): string { + if (text && text.length > length) { + return `${text.substr(0, length - 3)}...`; + } + return text; +} diff --git a/files/plugin-CustomReports-5.4.3/vue/src/types.ts b/files/plugin-CustomReports-5.4.3/vue/src/types.ts new file mode 100644 index 0000000..96145c9 --- /dev/null +++ b/files/plugin-CustomReports-5.4.3/vue/src/types.ts @@ -0,0 +1,70 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +import { SiteRef } from 'CoreHome'; + +export interface CustomReportType { + key: string; + value: string; +} + +interface Category { + id: string; + name?: string; + order?: number; + icon?: string; +} + +interface Subcategory { + id: string|number; + name?: string; + order?: number; +} + +export interface Site { + idsite: string | number; + name: string; +} + +export interface ChildReport { + idcustomreport: string|number; + name: string; + subcategory_order: string|number; +} + +export interface CustomReport { + category: Category; + created_date: string; + description: string; + dimensions: string[]; + idcustomreport: string|number; + idsite: string|number; + metrics: string[]; + name: string; + report_type: string; + revision: string|number; + segment_filter: string; + site: SiteRef; + status: string; + subcategory: Subcategory|null; + updated_date: string; + child_reports: ChildReport[] + multipleIdSites: Site[]; + multiple_idsites: null|string; + allowedToEdit: boolean; + + linkIdSite?: string|number; + subcategoryLink?: string|number; +} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/dist/HeatmapSessionRecording.umd.min.js b/files/plugin-HeatmapSessionRecording-5.2.3/vue/dist/HeatmapSessionRecording.umd.min.js deleted file mode 100644 index 257347a..0000000 --- a/files/plugin-HeatmapSessionRecording-5.2.3/vue/dist/HeatmapSessionRecording.umd.min.js +++ /dev/null @@ -1,73 +0,0 @@ -(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["HeatmapSessionRecording"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["HeatmapSessionRecording"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(a,i,function(t){return e[t]}.bind(null,i));return a},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/HeatmapSessionRecording/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"246e":function(e,t,n){var a,i;(function(r,o,s){e.exports?e.exports=s():(a=s,i="function"===typeof a?a.call(t,n,t,e):a,void 0===i||(e.exports=i))})(0,0,(function(){var e={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},t=function(){var t=function(e){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=e["xField"]||e.defaultXField,this._yField=e["yField"]||e.defaultYField,this._valueField=e["valueField"]||e.defaultValueField,e["radius"]&&(this._cfgRadius=e["radius"])},n=e.defaultRadius;return t.prototype={_organiseData:function(e,t){var a=e[this._xField],i=e[this._yField],r=this._radi,o=this._data,s=this._max,l=this._min,c=e[this._valueField]||1,d=e.radius||this._cfgRadius||n;o[a]||(o[a]=[],r[a]=[]),o[a][i]?o[a][i]+=c:(o[a][i]=c,r[a][i]=d);var u=o[a][i];return u>s?(t?this.setDataMax(u):this._max=u,!1):u0){var e=arguments[0],t=e.length;while(t--)this.addData.call(this,e[t])}else{var n=this._organiseData(arguments[0],!0);n&&(0===this._data.length&&(this._min=this._max=n.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[n]}))}return this},setData:function(e){var t=e.data,n=t.length;this._data=[],this._radi=[];for(var a=0;a0&&(this._drawAlpha(e),this._colorize())},renderAll:function(e){this._clear(),e.data.length>0&&(this._drawAlpha(n(e)),this._colorize())},_updateGradient:function(t){this._palette=e(t)},updateConfig:function(e){e["gradient"]&&this._updateGradient(e),this._setStyles(e)},setDimensions:function(e,t){this._width=e,this._height=t,this.canvas.width=this.shadowCanvas.width=e,this.canvas.height=this.shadowCanvas.height=t},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(e){this._blur=0==e.blur?0:e.blur||e.defaultBlur,e.backgroundColor&&(this.canvas.style.backgroundColor=e.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=e.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=e.height||this._height,this._opacity=255*(e.opacity||0),this._maxOpacity=255*(e.maxOpacity||e.defaultMaxOpacity),this._minOpacity=255*(e.minOpacity||e.defaultMinOpacity),this._useGradientOpacity=!!e.useGradientOpacity},_drawAlpha:function(e){var n=this._min=e.min,a=this._max=e.max,i=(e=e.data||[],e.length),r=1-this._blur;while(i--){var o,s=e[i],l=s.x,c=s.y,d=s.radius,u=Math.min(s.value,a),m=l-d,p=c-d,h=this.shadowCtx;this._templates[d]?o=this._templates[d]:this._templates[d]=o=t(d,r);var g=(u-n)/(a-n);h.globalAlpha=g<.01?.01:g,h.drawImage(o,m,p),mthis._renderBoundaries[2]&&(this._renderBoundaries[2]=m+2*d),p+2*d>this._renderBoundaries[3]&&(this._renderBoundaries[3]=p+2*d)}},_colorize:function(){var e=this._renderBoundaries[0],t=this._renderBoundaries[1],n=this._renderBoundaries[2]-e,a=this._renderBoundaries[3]-t,i=this._width,r=this._height,o=this._opacity,s=this._maxOpacity,l=this._minOpacity,c=this._useGradientOpacity;e<0&&(e=0),t<0&&(t=0),e+n>i&&(n=i-e),t+a>r&&(a=r-t);for(var d=this.shadowCtx.getImageData(e,t,n,a),u=d.data,m=u.length,p=this._palette,h=3;h0?o:f>0,t},getDataURL:function(){return this.canvas.toDataURL()}},a}(),a=function(){var t=!1;return"canvas2d"===e["defaultRenderer"]&&(t=n),t}(),i={merge:function(){for(var e={},t=arguments.length,n=0;ns&&(e.position.left=n.clientX+i-c.width-10),c.bottom>l&&(e.position.top=n.clientY+a-c.height-10);var d=r.getBoundingClientRect();d.left<0&&(e.position.left=i+10),d.top<0&&(e.position.top=a+10)}}))}function i(){e.visible=!1}return Object.assign(Object.assign({},Object(r["toRefs"])(e)),{},{tooltipRef:t,show:a,hide:i,tooltipStyle:n,translate:I["translate"]})},computed:{getClickCount:function(){return I["NumberFormatter"].formatNumber(this.clickCount)},getClickRate:function(){return I["NumberFormatter"].formatPercent(this.clickRate)},getClickCountTranslation:function(){var e=this.isMoves?"HeatmapSessionRecording_Moves":"HeatmapSessionRecording_Clicks";return Object(I["translate"])(e)},getClickRateTranslation:function(){var e=this.isMoves?"HeatmapSessionRecording_MoveRate":"HeatmapSessionRecording_ClickRate";return Object(I["translate"])(e)}}});K.render=Y;var Q=K;function Z(e,t){return ie(e)||ae(e,t)||te(e,t)||ee()}function ee(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function te(e,t){if(e){if("string"===typeof e)return ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n')),oe(t).find("#heatmap".concat(o)).css({height:"".concat(s,"px")})}return r}function pe(e,t,n,a){var i=oe(t);i.css("height","400px");var r=n.getIframeHeight();i.css("height","".concat(r,"px"));var o=1e3,s=r/o,l=a.reduce((function(e,t){return e+parseInt(t.value,10)}),0),c=[],d=0,u=null,m=100,p=0;function h(e,t,n,a,i){return a+(e-t)/(n-t)*(i-a)}function g(e,t,n){if(t===n||!t&&!n)return[255,255,0];var a=h(e,t,n,0,255),i=(n-t)/5;return a>204?[255,h(e,n-i,n,255,0),0]:a>153?[h(e,n-2*i,n-i,0,255),255,0]:a>102?[0,255,h(e,n-3*i,n-2*i,255,0)]:a>51?[0,h(e,n-4*i,n-3*i,0,255),255]:[h(e,t,n-4*i,255,0),0,255]}if(a.forEach((function(e){var t=parseInt(e.value,10),n=parseInt(e.label,10),a=Math.round(n*s);u&&u.position===a?d+=t:(0!==l&&(m=(l-d)/l*100),d+=t,u={percentageValue:10*parseFloat(m.toFixed(1)),position:p,percent:m.toFixed(1)},c.push(u)),p=a})),c.length){var f=c.some((function(e){return 0===e.position}));f||c.unshift({percent:"100.0",percentageValue:1e3,position:0})}else c.push({percent:"0",percentageValue:0,position:0});var b=0,v=1e3;c&&c.length&&c[0]&&(b=c[c.length-1].percentageValue);for(var y=i.width(),O=null,j=0;j'))}oe(".scrollHeatmapLeaf",e).tooltip({track:!0,items:"*",tooltipClass:"heatmapTooltip",show:!1,hide:!1}),oe(".legend-area .min").text("".concat((b/10).toFixed(1),"%")),oe(".legend-area .max").text("".concat((v/10).toFixed(1),"%"))}function he(e,t,n,a){var i=me(e,t,n),r=document.createElement("canvas");r.width=100,r.height=10;var o=document.querySelector(".legend-area .min"),s=document.querySelector(".legend-area .max"),l=document.querySelector(".legend-area .gradient"),c=r.getContext("2d"),d={};function u(e){if(o.innerHTML="".concat(e.min),s.innerHTML="".concat(e.max),e.gradient&&e.gradient!==d){d=e.gradient;var t=c.createLinearGradient(0,0,100,1);Object.keys(d).forEach((function(e){t.addColorStop(parseFloat(e),d[e])})),c.fillStyle=t,c.fillRect(0,0,100,10),l.src=r.toDataURL()}}for(var m=[],p=function(e){var t={min:a.min,max:a.max,data:[]},n={container:document.getElementById("heatmap".concat(e)),radius:10,maxOpacity:.5,minOpacity:0,blur:.75};if(1===e&&(n.onExtremaChange=u),a&&a.data&&a.data.length>=2e4?n.radius=8:a&&a.data&&a.data.length>=2e3&&(n.radius=9),1===i)t.data=a.data;else{var r=(e-1)*de,o=r+de-1;a.data.forEach((function(e){if(e.y>=r&&e.y<=o){var n=Object.assign(Object.assign({},e),{},{y:e.y-r});t.data.push(n)}}))}var s=U.a.create(n);s.setData(t),m.push(s)},h=1;h<=i;h+=1)p(h);return m}ue.match(/(iPod|iPhone|iPad|Android|IEMobile|Windows Phone)/i)?de=2e3:(ue.indexOf("msie ")>0||ue.indexOf("trident/")>0||ue.indexOf("edge")>0)&&(de=8e3);var ge=Object(r["defineComponent"])({props:{idSiteHsr:{type:Number,required:!0},deviceTypes:{type:Array,required:!0},heatmapTypes:{type:Array,required:!0},breakpointMobile:{type:Number,required:!0},breakpointTablet:{type:Number,required:!0},offsetAccuracy:{type:Number,required:!0},heatmapPeriod:{type:String,required:!0},heatmapDate:{type:String,required:!0},url:{type:String,required:!0},isActive:Boolean,numSamples:{type:Object,required:!0},excludedElements:{type:String,required:!0},createdDate:{type:String,required:!0},desktopPreviewSize:{type:Number,required:!0},iframeResolutionsValues:{type:Object,required:!0}},components:{Field:L["Field"],SaveButton:L["SaveButton"],Tooltip:Q},data:function(){return{isLoading:!1,iframeWidth:this.desktopPreviewSize,customIframeWidth:this.desktopPreviewSize,avgFold:0,heatmapType:this.heatmapTypes[0].key,deviceType:this.deviceTypes[0].key,iframeResolutions:this.iframeResolutionsValues,actualNumSamples:this.numSamples,dataCoordinates:[],currentElement:null,totalClicks:0,tooltipShowTimeoutId:null,clickCount:0,clickRate:0}},setup:function(e){var t=Object(r["ref"])(null),n=null,a=new Promise((function(e){n=e})),i=null,o=function(t){return i||(i=F(t).recordingFrame,i.excludeElements(e.excludedElements),i.addClass("html","piwikHeatmap"),i.addClass("html","matomoHeatmap"),i.addWorkaroundForSharepointHeatmaps()),i},s=Object(r["ref"])(null),l=function(e,t,n,a){s.value=he(e,t,n,a)};return{iframeLoadedPromise:a,onLoaded:n,getRecordedHeatmap:W("HeatmapSessionRecording.getRecordedHeatmap"),getRecordedHeatmapMetadata:W("HeatmapSessionRecording.getRecordedHeatmapMetadata"),getRecordingIframe:o,heatmapInstances:s,renderHeatmap:l,tooltip:t}},created:function(){-1===this.iframeResolutions.indexOf(this.breakpointMobile)&&this.iframeResolutions.push(this.breakpointMobile),-1===this.iframeResolutions.indexOf(this.breakpointTablet)&&this.iframeResolutions.push(this.breakpointTablet),this.iframeResolutions=this.iframeResolutions.sort((function(e,t){return e-t})),this.fetchHeatmap(),I["Matomo"].postEvent("hidePeriodSelector")},watch:{isLoading:function(){var e=this;if(!0!==this.isLoading){var t=window.document.getElementById("heatmapContainer");t&&(t.addEventListener("mouseleave",(function(t){e.tooltipShowTimeoutId&&(clearTimeout(e.tooltipShowTimeoutId),e.tooltipShowTimeoutId=null),e.currentElement=null,e.handleTooltip(t,0,0,"hide");var n=window.document.getElementById("highlightDiv");n&&(n.hidden=!0)})),t.addEventListener("mousemove",(function(t){e.handleMouseMove(t)})))}}},beforeUnmount:function(){this.removeScrollHeatmap()},methods:{removeScrollHeatmap:function(){var e=this.$refs.iframeRecordingContainer;oe(e).find(".scrollHeatmapLeaf").remove()},deleteScreenshot:function(){var e=this;I["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmapScreenshot,{yes:function(){e.isLoading=!0,I["AjaxHelper"].fetch({method:"HeatmapSessionRecording.deleteHeatmapScreenshot",idSiteHsr:e.idSiteHsr}).then((function(){e.isLoading=!1,window.location.reload()}))}})},fetchHeatmap:function(){var e=this;if(this.removeScrollHeatmap(),this.heatmapInstances){var t=this.heatmapInstances;t.forEach((function(e){e.setData({max:1,min:0,data:[]})}))}this.isLoading=!0,this.avgFold=0;var n=I["MatomoUrl"].parsed.value.segment?decodeURIComponent(I["MatomoUrl"].parsed.value.segment):void 0,a={idSiteHsr:this.idSiteHsr,heatmapType:this.heatmapType,deviceType:this.deviceType,period:this.heatmapPeriod,date:this.heatmapDate,filter_limit:-1,segment:n},i=this.getRecordedHeatmap(a),r=this.getRecordedHeatmapMetadata(a);Promise.all([i,r,this.iframeLoadedPromise]).then((function(t){var n=e.$refs.recordingPlayer,a=e.getRecordingIframe(n);me(e.$refs.recordingPlayer,e.$refs.heatmapContainer,a),e.removeScrollHeatmap();var i=t[0],r=t[1];if(Array.isArray(r)&&r[0]){var o=Z(r,1);e.actualNumSamples=o[0]}else e.actualNumSamples=r;if(e.isLoading=!1,e.isScrollHeatmapType)pe(e.$refs.iframeRecordingContainer,n,a,i);else{for(var s,l={min:0,max:0,data:[]},c=0;c1&&(m+=1)})),m/l.data.length>=.1&&l.data.length>120?l.max=2:l.max=1}else{var p=10,h={};if(l.data.forEach((function(e){if(e&&e.value){var t=parseInt(e.value,10);t>l.max&&(l.max=t),t>p&&(t=p);var n="".concat(t);n in h?h[n]+=1:h[n]=0}})),l.max>p){for(var g=0,f=p;f>1;f-=1){var b="".concat(f);if(b in h&&(g+=h[b]),g/l.data.length>=.2){l.max=f;break}}if(l.max>p){l.max=5;for(var v=5;v>0;v-=1){var y="".concat(v);if(y in h){l.max=v;break}}}}}if(e.renderHeatmap(e.$refs.recordingPlayer,e.$refs.heatmapContainer,a,l),null!==(s=e.actualNumSamples)&&void 0!==s&&s["avg_fold_device_".concat(e.deviceType)]){var O=e.actualNumSamples["avg_fold_device_".concat(e.deviceType)],j=a.getIframeHeight();j&&(e.avgFold=parseInt("".concat(O/100*j),10))}}})).finally((function(){e.isLoading=!1}))},changeDeviceType:function(e){this.deviceType=e,this.deviceType===se?this.changeIframeWidth(this.desktopPreviewSize,!1):this.deviceType===le?this.changeIframeWidth(this.breakpointTablet||960,!1):this.deviceType===ce&&this.changeIframeWidth(this.breakpointMobile||600,!1)},changeIframeWidth:function(e,t){this.iframeWidth=e,this.customIframeWidth=this.iframeWidth,this.totalClicks=0,this.dataCoordinates=[],this.fetchHeatmap(),t&&I["Matomo"].helper.lazyScrollToContent()},changeHeatmapType:function(e){this.heatmapType=e,this.totalClicks=0,this.clickCount=0,this.clickRate=0,this.dataCoordinates=[],this.fetchHeatmap()},handleMouseMove:function(e){var t=this,n=window.document.getElementById("highlightDiv");if(n){this.tooltipShowTimeoutId&&(clearTimeout(this.tooltipShowTimeoutId),this.tooltipShowTimeoutId=null,this.currentElement=null),n.hidden||this.handleTooltip(e,0,0,"move");var a=this.lookUpRecordedElementAtEventLocation(e);if(a&&a!==this.currentElement){this.handleTooltip(e,0,0,"hide"),n.hidden=!0;var i=a.getBoundingClientRect(),r=0;this.dataCoordinates.forEach((function(e){e.yi.bottom||e.xi.right||(r+=parseInt(e.value,10))})),this.tooltipShowTimeoutId=setTimeout((function(){t.currentElement=a,n.hidden=!1;var i=t.totalClicks?Math.round(r/t.totalClicks*1e4)/100:0,o=a.getBoundingClientRect();n.style.top="".concat(o.top,"px"),n.style.left="".concat(o.left,"px"),n.style.width="".concat(o.width,"px"),n.style.height="".concat(o.height,"px"),t.handleTooltip(e,r,i,"show"),t.tooltipShowTimeoutId=null}),100)}}},lookUpRecordedElementAtEventLocation:function(e){var t=e.target;if(!t)return null;var n=window.document.getElementById("recordingPlayer");if(!n)return null;var a=n.contentWindow?n.contentWindow.document:n.contentDocument;if(!a)return null;var i=t.getBoundingClientRect();return a.elementFromPoint(e.clientX-i.left,e.clientY-i.top)},handleTooltip:function(e,t,n,a){this.tooltip&&("show"===a?(this.clickCount=t,this.clickRate=n,this.tooltip.show(e)):"move"===a?this.tooltip.show(e):this.tooltip.hide())}},computed:{isScrollHeatmapType:function(){return 3===this.heatmapType},tokenAuth:function(){return I["MatomoUrl"].parsed.value.token_auth},embedUrl:function(){return"?".concat(I["MatomoUrl"].stringify({module:"HeatmapSessionRecording",action:"embedPage",idSite:I["Matomo"].idSite,idSiteHsr:this.idSiteHsr,token_auth:this.tokenAuth||void 0}))},iframeWidthOptions:function(){return this.iframeResolutions.map((function(e){return{key:e,value:"".concat(e,"px")}}))},recordedSamplesSince:function(){var e=Object(I["translate"])("HeatmapSessionRecording_HeatmapXRecordedSamplesSince",''.concat(this.actualNumSamples.nb_samples_device_all,""),this.createdDate),t=Object(I["externalLink"])("https://matomo.org/subcategory/troubleshoot-7/"),n=Object(I["translate"])("HeatmapSessionRecording_HeatmapTroubleshoot",t,"");return"".concat(e," ").concat(n)},deviceTypesWithSamples:function(){var e=this;return this.deviceTypes.map((function(t){var n;n=e.actualNumSamples["nb_samples_device_".concat(t.key)]?e.actualNumSamples["nb_samples_device_".concat(t.key)]:0;var a=Object(I["translate"])("HeatmapSessionRecording_XSamples","".concat(t.name," - ").concat(n));return Object.assign(Object.assign({},t),{},{numSamples:n,tooltip:a})}))},hasWriteAccess:function(){return!(null===I["Matomo"]||void 0===I["Matomo"]||!I["Matomo"].heatmapWriteAccess)},showDeleteScreenshot:function(){return this.isActive&&this.hasWriteAccess},gradientImgData:function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAKCAYAAABCHPt+AAAAnklEQVRYR+2WQQqDQBAES5wB/f8/Y05RcMWwSu6JIT0Dm4WlH1DUdHew7/z6WYFhhnGRpnlhAEaQpi/ADbh/np0MiBhGhW+2ymFU+DZfg1EhaoB4jCFuMYYcQKZrXwPEVvm5Og0pcYakBvI35G1jNIZ4jCHexxjSpz9ZFUjAynLbpOvqteaODkm9sloz5JF+ZTVmSAWSu9Qb65AvgDwBQoLgVDlWfAQAAAAASUVORK5CYII="}}});ge.render=A;var fe,be,ve=ge,ye={class:"sessionRecordingPlayer"},Oe={class:"controls"},je={class:"playerActions"},Se=["title"],_e=["title"],He=["title"],Ve=["title"],Ne=["title"],we=["title"],Ee=["title"],ke=["title"],Re={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ce=Object(r["createElementVNode"])("path",{d:"M480 576.5v-321h-64.5v129h-63v-129h-64.5v192h127.5v129h64.5zM607.5 127.999c34.5 0\n 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z"},null,-1),xe=[Ce],Te={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},De=Object(r["createElementVNode"])("path",{d:"M448.5 576.5v-321h-129v64.5h64.5v256.5h64.5zM607.5 127.999c34.5 0 64.5 30 64.5\n 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5 0-64.5-30-64.5-64.5v-447c0-34.5\n 30-64.5 64.5-64.5h447z"},null,-1),Me=[De],Pe={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ae=Object(r["createElementVNode"])("path",{d:"M480 384.5v-64.5c0-36-30-64.5-64.5-64.5h-127.5v64.5h127.5v64.5h-63c-34.5 0-64.5\n 27-64.5 63v129h192v-64.5h-127.5v-64.5h63c34.5 0 64.5-27 64.5-63zM607.5 127.999c34.5\n 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z"},null,-1),Be=[Ae],Ue={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ie=Object(r["createElementVNode"])("path",{d:"M480 320v-64.5h-127.5c-34.5 0-64.5 28.5-64.5 64.5v192c0 36 30 64.5 64.5\n 64.5h63c34.5 0 64.5-28.5 64.5-64.5v-64.5c0-36-30-63-64.5-63h-63v-64.5h127.5zM607.5\n 127.999c34.5 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447zM352.5 512v-64.5h63v64.5h-63z"},null,-1),Le=[Ie],Fe=["title"],We=Object(r["createElementVNode"])("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},[Object(r["createElementVNode"])("path",{d:"M223.5 415.5h111l-64.5-63h-46.5v63zM72 72l624 624-42 40.5-88.5-90c-51 36-114\n 57-181.5 57-177 0-319.5-142.5-319.5-319.5 0-67.5 21-130.5 57-181.5l-90-88.5zM544.5\n 352.5h-111l-231-231c51-36 114-57 181.5-57 177 0 319.5 142.5 319.5 319.5 0 67.5-21\n 130.5-57 181.5l-148.5-150h46.5v-63z"})],-1),qe=[We],ze=["title"],Ge=Object(r["createElementVNode"])("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 768 768"},[Object(r["createElementVNode"])("path",{d:"M544.5 609v-129h63v192h-384v96l-127.5-127.5 127.5-127.5v96h321zM223.5\n 288v129h-63v-192h384v-96l127.5 127.5-127.5 127.5v-96h-321z"})],-1),$e=[Ge],Je={class:"duration"},Xe={class:"playerHelp"},Ye=Object(r["createElementVNode"])("span",{class:"clickEvent"},null,-1),Ke=Object(r["createElementVNode"])("span",{class:"moveEvent"},null,-1),Qe=Object(r["createElementVNode"])("span",{class:"scrollEvent"},null,-1),Ze=Object(r["createElementVNode"])("span",{class:"resizeEvent"},null,-1),et=Object(r["createElementVNode"])("span",{class:"formChange"},null,-1),tt=Object(r["createElementVNode"])("span",{class:"mutationEvent"},null,-1),nt=Object(r["createElementVNode"])("br",{style:{clear:"right"}},null,-1),at=["title"],it=Object(r["createElementVNode"])("br",null,null,-1),rt=Object(r["createElementVNode"])("div",{class:"loadingUnderlay"},null,-1),ot={class:"valign-wrapper loadingInner"},st={class:"loadingContent"},lt=["src","width","height"];function ct(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ye,[Object(r["createElementVNode"])("div",Oe,[Object(r["createElementVNode"])("span",je,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-skip-previous",title:e.skipPreviousButtonTitle,onClick:t[0]||(t[0]=function(t){return e.loadNewRecording(e.previousRecordingId)})},null,8,Se),[[r["vShow"],e.previousRecordingId]]),Object(r["createElementVNode"])("span",{class:"playerAction icon-fast-rewind",title:e.translate("HeatmapSessionRecording_PlayerRewindFast",10,"J"),onClick:t[1]||(t[1]=function(t){return e.jumpRelative(10,!1)})},null,8,_e),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-play",title:e.translate("HeatmapSessionRecording_PlayerPlay","K"),onClick:t[2]||(t[2]=function(t){return e.play()})},null,8,He),[[r["vShow"],!e.isPlaying&&!e.isFinished]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-replay",title:e.translate("HeatmapSessionRecording_PlayerReplay","K"),onClick:t[3]||(t[3]=function(t){return e.replay()})},null,8,Ve),[[r["vShow"],!e.isPlaying&&e.isFinished]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-pause",title:e.translate("HeatmapSessionRecording_PlayerPause","K"),onClick:t[4]||(t[4]=function(t){return e.pause()})},null,8,Ne),[[r["vShow"],e.isPlaying]]),Object(r["createElementVNode"])("span",{class:"playerAction icon-fast-forward",title:e.translate("HeatmapSessionRecording_PlayerForwardFast",10,"L"),onClick:t[5]||(t[5]=function(t){return e.jumpRelative(10,!0)})},null,8,we),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"playerAction icon-skip-next",title:e.translate("HeatmapSessionRecording_PlayerPageViewNext",e.nextRecordingInfo,"N"),onClick:t[6]||(t[6]=function(t){return e.loadNewRecording(e.nextRecordingId)})},null,8,Ee),[[r["vShow"],e.nextRecordingId]]),Object(r["createElementVNode"])("span",{class:"changeReplaySpeed",title:e.translate("HeatmapSessionRecording_ChangeReplaySpeed","S"),onClick:t[7]||(t[7]=function(t){return e.increaseReplaySpeed()})},[Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Re,xe,512)),[[r["vShow"],4===e.actualReplaySpeed]]),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Te,Me,512)),[[r["vShow"],1===e.actualReplaySpeed]]),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Pe,Be,512)),[[r["vShow"],2===e.actualReplaySpeed]]),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("svg",Ue,Le,512)),[[r["vShow"],6===e.actualReplaySpeed]])],8,ke),Object(r["createElementVNode"])("span",{class:Object(r["normalizeClass"])(["toggleSkipPause",{active:e.actualSkipPausesEnabled}]),title:e.translate("HeatmapSessionRecording_ClickToSkipPauses",e.skipPausesEnabledText,"B"),onClick:t[8]||(t[8]=function(t){return e.toggleSkipPauses()})},qe,10,Fe),Object(r["createElementVNode"])("span",{class:Object(r["normalizeClass"])(["toggleAutoPlay",{active:e.actualAutoPlayEnabled}]),title:e.translate("HeatmapSessionRecording_AutoPlayNextPageview",e.autoplayEnabledText,"A"),onClick:t[9]||(t[9]=function(t){return e.toggleAutoPlay()})},$e,10,ze),Object(r["createElementVNode"])("span",Je,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_PlayerDurationXofY",e.positionPretty,e.durationPretty)),1)]),Object(r["createElementVNode"])("div",Xe,[Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",null,[Ye,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityClick")),1)]),Object(r["createElementVNode"])("li",null,[Ke,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityMove")),1)]),Object(r["createElementVNode"])("li",null,[Qe,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityScroll")),1)]),Object(r["createElementVNode"])("li",null,[Ze,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityResize")),1)]),Object(r["createElementVNode"])("li",null,[et,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityFormChange")),1)]),Object(r["createElementVNode"])("li",null,[tt,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityPageChange")),1)])])]),nt]),Object(r["createElementVNode"])("div",{class:"timelineOuter",onClick:t[10]||(t[10]=function(t){return e.seekEvent(t)}),style:Object(r["normalizeStyle"])({width:"".concat(e.replayWidth,"px")})},[Object(r["createElementVNode"])("div",{class:"timelineInner",style:Object(r["normalizeStyle"])({width:"".concat(e.progress,"%")})},null,4),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.clues,(function(e,t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{title:e.title,class:Object(r["normalizeClass"])(e.type),style:Object(r["normalizeStyle"])({left:"".concat(e.left,"%")}),key:t},null,14,at)})),128))],4),it,Object(r["withDirectives"])(Object(r["createElementVNode"])("div",{class:"hsrLoadingOuter",style:Object(r["normalizeStyle"])({width:"".concat(e.replayWidth,"px"),height:"".concat(e.replayHeight,"px")})},[rt,Object(r["createElementVNode"])("div",ot,[Object(r["createElementVNode"])("div",st,Object(r["toDisplayString"])(e.translate("General_Loading")),1)])],4),[[r["vShow"],e.isLoading]]),Object(r["createElementVNode"])("div",{class:"replayContainerOuter",onClick:t[12]||(t[12]=function(t){return e.togglePlay()}),style:Object(r["normalizeStyle"])({height:"".concat(e.replayHeight,"px"),width:"".concat(e.replayWidth,"px")})},[Object(r["createElementVNode"])("div",{class:"replayContainerInner",style:Object(r["normalizeStyle"])([{"transform-origin":"0 0"},{transform:"scale(".concat(e.replayScale,")"),"margin-left":"".concat(e.replayMarginLeft,"px")}])},[e.embedUrl?(Object(r["openBlock"])(),Object(r["createElementBlock"])("iframe",{key:0,id:"recordingPlayer",ref:"recordingPlayer",onLoad:t[11]||(t[11]=function(t){return e.onLoaded()}),scrolling:"no",sandbox:"allow-scripts allow-same-origin",referrerpolicy:"no-referrer",src:e.embedUrl,width:e.recording.viewport_w_px,height:e.recording.viewport_h_px},null,40,lt)):Object(r["createCommentVNode"])("",!0)],4)],4)])}function dt(e){return dt="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dt(e)}function ut(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mt=20,pt=1,ht=2,gt=3,ft=4,bt=5,vt=6,yt=9,Ot=10,jt=12,St=(fe={},ut(fe,ht,"clickEvent"),ut(fe,pt,"moveEvent"),ut(fe,gt,"scrollEvent"),ut(fe,jt,"scrollEvent"),ut(fe,ft,"resizeEvent"),ut(fe,yt,"formChange"),ut(fe,Ot,"formChange"),ut(fe,bt,"mutationEvent"),ut(fe,vt,"mutationEvent"),fe),_t=(be={},ut(be,ht,Object(I["translate"])("HeatmapSessionRecording_ActivityClick")),ut(be,pt,Object(I["translate"])("HeatmapSessionRecording_ActivityMove")),ut(be,gt,Object(I["translate"])("HeatmapSessionRecording_ActivityScroll")),ut(be,jt,Object(I["translate"])("HeatmapSessionRecording_ActivityScroll")),ut(be,ft,Object(I["translate"])("HeatmapSessionRecording_ActivityResize")),ut(be,yt,Object(I["translate"])("HeatmapSessionRecording_ActivityFormChange")),ut(be,Ot,Object(I["translate"])("HeatmapSessionRecording_ActivityFormChange")),ut(be,bt,Object(I["translate"])("HeatmapSessionRecording_ActivityPageChange")),ut(be,vt,Object(I["translate"])("HeatmapSessionRecording_ActivityPageChange")),be),Ht='\n
\n \n \n \n
\n',Vt=window,Nt=Vt.$,wt=Vt.Mousetrap;function Et(e){return"number"===typeof e?e:parseInt(e,10)}function kt(e){if(null!==e&&void 0!==e&&e.event_type)return Et(e.event_type)}function Rt(e){var t=Math.floor(e/1e3),n=Math.floor(t/60),a=t%60;return n<10&&(n="0".concat(n)),a<10&&(a="0".concat(a)),"".concat(n,":").concat(a)}var Ct=Object(r["defineComponent"])({props:{offsetAccuracy:{type:Number,required:!0},scrollAccuracy:{type:Number,required:!0},autoPlayEnabled:Boolean,skipPausesEnabled:Boolean,replaySpeed:{type:Number,default:1}},data:function(){return{isPlaying:!1,progress:0,isFinished:!1,isLoading:!0,seekTimeout:null,lastFramePainted:0,recording:JSON.parse(JSON.stringify(window.sessionRecordingData)),positionPretty:"00:00",previousRecordingId:null,previousRecordingInfo:null,nextRecordingId:null,nextRecordingInfo:null,frame:0,hasFoundPrevious:!1,hasFoundNext:!1,videoPlayerInterval:null,lastCanvasCoordinates:!1,actualAutoPlayEnabled:!!this.autoPlayEnabled,replayWidth:0,replayHeight:0,replayScale:0,replayMarginLeft:0,seek:function(e){return e},actualSkipPausesEnabled:!!this.skipPausesEnabled,actualReplaySpeed:this.replaySpeed}},setup:function(){var e=Object(r["ref"])(!1),t=null,n=new Promise((function(n){t=n,e.value=!0})),a=function(){setTimeout((function(){t("loaded")}),500)};return{iframeLoadedPromise:n,onLoaded:a,iframeLoaded:e}},created:function(){var e=this;this.recording.duration=Et(this.recording.duration),this.recording.pageviews.forEach((function(t){t&&t.idloghsr&&("".concat(t.idloghsr)==="".concat(e.recording.idLogHsr)?e.hasFoundPrevious=!0:e.hasFoundPrevious?e.hasFoundNext||(e.hasFoundNext=!0,e.nextRecordingId=t.idloghsr,e.nextRecordingInfo=[t.label,t.server_time_pretty,t.time_on_page_pretty].join(" - ")):(e.previousRecordingId=t.idloghsr,e.previousRecordingInfo=[t.label,t.server_time_pretty,t.time_on_page_pretty].join(" - ")))}))},mounted:function(){var e=this;wt.bind(["space","k"],(function(){e.togglePlay()})),wt.bind("0",(function(){e.isFinished&&e.replay()})),wt.bind("p",(function(){e.loadNewRecording(e.previousRecordingId)})),wt.bind("n",(function(){e.loadNewRecording(e.nextRecordingId)})),wt.bind("s",(function(){e.increaseReplaySpeed()})),wt.bind("a",(function(){e.toggleAutoPlay()})),wt.bind("b",(function(){e.toggleSkipPauses()})),wt.bind("left",(function(){var t=5,n=!1;e.jumpRelative(t,n)})),wt.bind("right",(function(){var t=5,n=!0;e.jumpRelative(t,n)})),wt.bind("j",(function(){var t=10,n=!1;e.jumpRelative(t,n)})),wt.bind("l",(function(){var t=10,n=!0;e.jumpRelative(t,n)})),this.initViewport(),Nt(window).on("resize",(function(){return e.initViewport()})),this.iframeLoadedPromise.then((function(){e.initPlayer()})),window.addEventListener("beforeunload",(function(){e.isPlaying=!1,e.videoPlayerInterval&&(clearInterval(e.videoPlayerInterval),e.videoPlayerInterval=null)}))},methods:{initPlayer:function(){var e=this,t=this.$refs.recordingPlayer,n=F(t).recordingFrame;if(n&&n.isSupportedBrowser()){n.addClass("html","piwikSessionRecording"),n.addClass("html","matomoSessionRecording");var a=null,i=function(t,i){a&&a.css({left:"".concat(t.x-8,"px"),top:"".concat(t.y-8,"px")}),e.lastCanvasCoordinates&&(n.drawLine(e.lastCanvasCoordinates.x,e.lastCanvasCoordinates.y,t.x,t.y,i),e.lastCanvasCoordinates=t)},r=function(t,r){if(e.lastCanvasCoordinates&&a){var o=n.getScrollTop(),s=n.getScrollLeft();n.scrollTo(t,r);var l=r-o,c=t-s,d=c+e.lastCanvasCoordinates.x,u=l+e.lastCanvasCoordinates.y;d<=0&&(d=0),u<=0&&(u=0),i({x:d,y:u},"blue")}else n.scrollTo(t,r)},o=function(e,t,n){null!==e&&void 0!==e&&e.scrollTo?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)},s=null,l=function(t){var a=e.isPlaying;e.isPlaying=!1;var i=kt(t),l=null;if(i===pt)t.selector&&(l=n.getCoordinatesInFrame(t.selector,t.x,t.y,e.offsetAccuracy,!1),l&&s(l));else if(i===ht)t.selector&&(l=n.getCoordinatesInFrame(t.selector,t.x,t.y,e.offsetAccuracy,!1),l&&(s(l),n.drawCircle(l.x,l.y,"#ff9407")));else if(i===vt)t.text&&n.applyMutation(t.text);else if(i===gt){var c=n.getIframeHeight(),d=n.getIframeWidth(),u=parseInt("".concat(c/e.scrollAccuracy*Et(t.y)),10),m=parseInt("".concat(d/e.scrollAccuracy*Et(t.x)),10);r(m,u)}else if(i===jt){if(t.selector){var p=n.findElement(t.selector);if(p&&p.length&&p[0]){var h=Math.max(p[0].scrollHeight,p[0].offsetHeight,p.height(),0),g=Math.max(p[0].scrollWidth,p[0].offsetWidth,p.width(),0);if(h&&g){var f=parseInt("".concat(h/e.scrollAccuracy*Et(t.y)),10),b=parseInt("".concat(g/e.scrollAccuracy*Et(t.x)),10);o(p[0],b,f)}}}}else if(i===ft)e.setViewportResolution(t.x,t.y);else if(i===yt){if(t.selector){var v=n.findElement(t.selector);if(v.length){var y=v.attr("type");y&&"file"==="".concat(y).toLowerCase()||v.val(t.text).change()}}}else if(i===Ot&&t.selector){var O=n.findElement(t.selector);O.is("input")?O.prop("checked",1===t.text||"1"===t.text):O.is("select")&&O.val(t.text).change()}e.isPlaying=a};s=function(t){var r=function(){var t=n.getIframeWidth(),a=n.getIframeHeight();n.makeSvg(t,a);for(var i=function(t){if(!e.timeFrameBuckets[t])return{v:void 0};e.timeFrameBuckets[t].forEach((function(n){var a=kt(n);a!==pt&&a!==gt&&a!==jt&&a!==ht||(e.lastFramePainted=t,l(n))}))},r=0;r<=e.frame;r+=mt){var o=i(r);if("object"===dt(o))return o.v}},o=n.getIframeWindow();if(!e.lastCanvasCoordinates){var s=n.getIframeHeight(),c=n.getIframeWidth();return n.appendContent(Ht),a=n.findElement(".mousePointer"),n.makeSvg(c,s),o.removeEventListener("resize",r,!1),o.addEventListener("resize",r,!1),e.lastCanvasCoordinates=t,void a.css({left:"".concat(t.x-8,"px"),top:"".concat(t.y-8,"px")})}var d=n.getScrollTop(),u=n.getScrollLeft();(t.y>d+Et(e.recording.viewport_h_px)||t.yu+Et(e.recording.viewport_w_px)||t.xe.frame?(a=0,e.lastCanvasCoordinates=!1,e.initialMutation&&n.initialMutation(e.initialMutation.text),n.scrollTo(0,0),e.setViewportResolution(window.sessionRecordingData.viewport_w_px,window.sessionRecordingData.viewport_h_px),e.seekTimeout&&(clearTimeout(e.seekTimeout),e.seekTimeout=null),function(t){e.seekTimeout=setTimeout((function(){i(t),e.isLoading=!1}),1050)}(a)):(e.seekTimeout&&(clearTimeout(e.seekTimeout),e.seekTimeout=null),i(a),e.isLoading=!1)}},this.isLoading=!1,this.isPlaying=!0;var c=0,d=function(){if(e.isPlaying&&!e.isLoading){c+=1;var t=Et(e.recording.duration);if(e.frame>=t?(e.isPlaying=!1,e.progress=100,e.isFinished=!0,e.positionPretty=e.durationPretty,e.actualAutoPlayEnabled&&e.nextRecordingId&&e.loadNewRecording(e.nextRecordingId)):(e.progress=parseFloat(parseFloat("".concat(e.frame/t*100)).toFixed(2)),20===c&&(c=0,e.positionPretty=Rt(e.frame))),(e.timeFrameBuckets[e.frame]||[]).forEach((function(t){e.lastFramePainted=e.frame,l(t)})),e.actualSkipPausesEnabled&&e.frame-e.lastFramePainted>1800){var n=Object.keys(e.timeFrameBuckets).map((function(e){return parseInt(e,10)}));n=n.sort((function(e,t){return e-t}));var a=n.find((function(t){return t>e.frame})),i=!!a;if(a){var r=a-e.frame>1e3;r&&(e.frame=a-20*mt)}if(!i){var o=t-e.frame>1e3;o&&(e.frame=t-20*mt)}}e.frame+=mt}};this.videoPlayerInterval=setInterval((function(){for(var t=1;t<=e.actualReplaySpeed;t+=1)d()}),mt)}},initViewport:function(){this.replayHeight=Nt(window).height()-48-Nt(".sessionRecording .sessionRecordingHead").outerHeight(!0)-Nt(".sessionRecordingPlayer .controls").outerHeight(!0),this.replayWidth=Nt(window).width()-48;var e=Et(this.recording.viewport_w_px),t=Et(this.recording.viewport_h_px),n=400;this.replayWidthn&&(this.replayWidth=n);var a=400;this.replayHeighta&&(this.replayHeight=a);var i=1,r=1;e>this.replayWidth&&(i=parseFloat(parseFloat("".concat(this.replayWidth/e)).toFixed(4))),t>this.replayHeight&&(r=parseFloat(parseFloat("".concat(this.replayHeight/t)).toFixed(4))),this.replayScale=Math.min(i,r),this.replayMarginLeft=(this.replayWidth-this.replayScale*e)/2},setViewportResolution:function(e,t){this.recording.viewport_w_px=parseInt("".concat(e),10),this.recording.viewport_h_px=parseInt("".concat(t),10),Nt(".recordingWidth").text(e),Nt(".recordingHeight").text(t),this.initViewport()},increaseReplaySpeed:function(){1===this.actualReplaySpeed?this.actualReplaySpeed=2:2===this.actualReplaySpeed?this.actualReplaySpeed=4:4===this.actualReplaySpeed?this.actualReplaySpeed=6:this.actualReplaySpeed=1,this.updateSettings()},updateSettings:function(){I["AjaxHelper"].fetch({module:"HeatmapSessionRecording",action:"saveSessionRecordingSettings",autoplay:this.actualAutoPlayEnabled?1:0,skippauses:this.actualSkipPausesEnabled?1:0,replayspeed:this.actualReplaySpeed},{format:"html"})},toggleAutoPlay:function(){this.actualAutoPlayEnabled=!this.actualAutoPlayEnabled,this.updateSettings()},toggleSkipPauses:function(){this.actualSkipPausesEnabled=!this.actualSkipPausesEnabled,this.updateSettings()},loadNewRecording:function(e){e&&(this.isPlaying=!1,I["MatomoUrl"].updateUrl(Object.assign(Object.assign({},I["MatomoUrl"].urlParsed.value),{},{idLogHsr:parseInt("".concat(e),10),updated:I["MatomoUrl"].urlParsed.value.updated?parseInt(I["MatomoUrl"].urlParsed.value.updated,10)+1:1})))},jumpRelative:function(e,t){var n,a=1e3*e;t?(n=this.frame+a,n>this.recording.duration&&(n=Et(this.recording.duration)-mt)):(n=this.frame-a,n<0&&(n=0)),this.seek(n)},replay:function(){this.isFinished=!1,this.lastFramePainted=0,this.seek(0),this.play()},pause:function(){this.isPlaying=!1},togglePlay:function(){this.isFinished?this.replay():this.isPlaying?this.pause():this.play()},seekEvent:function(e){var t=Nt(e.currentTarget).offset(),n=e.pageX-t.left,a=this.replayWidth,i=n/a,r=Et(this.recording.duration)*i;this.seek(r)},play:function(){this.isPlaying=!0}},computed:{durationPretty:function(){return Rt(Et(this.recording.duration))},embedUrl:function(){return"?".concat(I["MatomoUrl"].stringify({module:"HeatmapSessionRecording",action:"embedPage",idSite:this.recording.idSite,idLogHsr:this.recording.idLogHsr,idSiteHsr:this.recording.idSiteHsr,token_auth:I["MatomoUrl"].urlParsed.value.token_auth||void 0}))},skipPreviousButtonTitle:function(){return Object(I["translate"])("HeatmapSessionRecording_PlayerPageViewPrevious",this.previousRecordingInfo||"","P")},skipPausesEnabledText:function(){return this.actualSkipPausesEnabled?Object(I["translate"])("HeatmapSessionRecording_disable"):Object(I["translate"])("HeatmapSessionRecording_enable")},autoplayEnabledText:function(){return this.actualAutoPlayEnabled?Object(I["translate"])("HeatmapSessionRecording_disable"):Object(I["translate"])("HeatmapSessionRecording_enable")},recordingEvents:function(){return this.recording?this.recording.events.map((function(e){var t=kt(e),n=e.text;return t!==bt&&t!==vt||"string"!==typeof n||(n=JSON.parse(n)),Object.assign(Object.assign({},e),{},{text:n})})):[]},initialMutation:function(){var e=this.recordingEvents.find((function(e){var t=kt(e),n=t===bt||t===vt,a=n&&(t===bt||!e.time_since_load||"0"===e.time_since_load);return a}));return e},timeFrameBuckets:function(){var e=this,t={};return this.recordingEvents.forEach((function(n){if(n!==e.initialMutation){var a=Math.round(Et(n.time_since_load)/mt)*mt;t[a]=t[a]||[],t[a].push(n)}})),t},clues:function(){var e=this,t=[];return this.recordingEvents.forEach((function(n){if(n!==e.initialMutation){var a=kt(n),i=St[a]||"",r=_t[a]||"";if(i){if((0===n.time_since_load||"0"===n.time_since_load)&&"moveEvent"===i)return;t.push({left:parseFloat("".concat(Et(n.time_since_load)/Et(e.recording.duration)*100)).toFixed(2),type:i,title:r})}}})),t}}});Ct.render=ct;var xt=Ct,Tt={class:"form-group hsrTargetTest"},Dt={class:"loadingPiwik loadingMatchingSteps"},Mt=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:""},null,-1),Pt=Object(r["createElementVNode"])("div",{id:"hsrTargetValidationError"},null,-1);function At(e,t,n,a,i,o){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Tt,[Object(r["createElementVNode"])("label",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestTitle"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestLabel")),1)]),Object(r["withDirectives"])(Object(r["createElementVNode"])("input",{type:"text",id:"urltargettest",placeholder:"http://www.example.com/","onUpdate:modelValue":t[0]||(t[0]=function(t){return e.url=t}),class:Object(r["normalizeClass"])({invalid:e.url&&!e.matches&&e.isValid})},null,2),[[r["vModelText"],e.url]]),Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"testInfo"},Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestErrorInvalidUrl")),513),[[r["vShow"],e.url&&!e.isValid]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"testInfo matches"},Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestUrlMatches")),513),[[r["vShow"],e.url&&e.matches&&e.isValid]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"testInfo notMatches"},Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestUrlNotMatches")),513),[[r["vShow"],e.url&&!e.matches&&e.isValid]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",Dt,[Mt,Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)],512),[[r["vShow"],e.isLoadingTestMatchPage]])]),Pt])}function Bt(e){return e.indexOf("://")>3}var Ut=Object(r["defineComponent"])({props:{includedTargets:Array},data:function(){return{url:"",matches:!1,isLoadingTestMatchPage:!1}},watch:{isValid:function(e){e||(this.matches=!1)},includedTargets:function(){this.runTest()},url:function(){this.runTest()}},setup:function(){return{testUrlMatchPages:W("HeatmapSessionRecording.testUrlMatchPages",{errorElement:"#hsrTargetValidationError"})}},created:function(){this.runTest=Object(I["debounce"])(this.runTest,200)},methods:{checkIsMatchingUrl:function(){var e=this;if(this.isValid){var t=this.targetUrl,n=this.filteredIncludedTargets;null!==n&&void 0!==n&&n.length&&(this.isLoadingTestMatchPage=!0,this.testUrlMatchPages({url:t},{matchPageRules:n}).then((function(t){var n;null!==(n=e.filteredIncludedTargets)&&void 0!==n&&n.length&&(null===t||void 0===t?void 0:t.url)===e.targetUrl&&(e.matches=t.matches)})).finally((function(){e.isLoadingTestMatchPage=!1})))}},runTest:function(){this.isValid&&this.checkIsMatchingUrl()}},computed:{targetUrl:function(){return(this.url||"").trim()},isValid:function(){return this.targetUrl&&Bt(this.targetUrl)},filteredIncludedTargets:function(){if(this.includedTargets)return this.includedTargets.filter((function(e){return(null===e||void 0===e?void 0:e.value)||"any"===(null===e||void 0===e?void 0:e.type)})).map((function(e){return Object.assign(Object.assign({},e),{},{value:e.value?e.value.trim():""})}))}}});Ut.render=At;var It=Ut,Lt={style:{width:"100%"}},Ft={name:"targetAttribute"},Wt={name:"targetType"},qt={name:"targetValue"},zt={name:"targetValue2"},Gt=["title"],$t=["title"];function Jt(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])(["form-group hsrUrltarget valign-wrapper",{disabled:e.disableIfNoValue&&!e.modelValue.value}])},[Object(r["createElementVNode"])("div",Lt,[Object(r["createElementVNode"])("div",Ft,[Object(r["createVNode"])(s,{uicontrol:"select",name:"targetAttribute","model-value":e.modelValue.attribute,"onUpdate:modelValue":t[0]||(t[0]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{attribute:t}))}),title:e.translate("HeatmapSessionRecording_Rule"),options:e.targetAttributes,"full-width":!0},null,8,["model-value","title","options"])]),Object(r["createElementVNode"])("div",Wt,[Object(r["createVNode"])(s,{uicontrol:"select",name:"targetType","model-value":e.pattern_type,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.onTypeChange(t)}),options:e.targetOptions[e.modelValue.attribute],"full-width":!0},null,8,["model-value","options"])]),Object(r["createElementVNode"])("div",qt,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"targetValue",placeholder:"eg. ".concat(e.targetExamples[e.modelValue.attribute]),"model-value":e.modelValue.value,"onUpdate:modelValue":t[2]||(t[2]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value:t.trim()}))}),maxlength:500,"full-width":!0},null,8,["placeholder","model-value"]),[[r["vShow"],"any"!==e.pattern_type]])]),Object(r["createElementVNode"])("div",zt,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"targetValue2","model-value":e.modelValue.value2,"onUpdate:modelValue":t[3]||(t[3]=function(t){return e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value2:t.trim()}))}),maxlength:500,"full-width":!0,placeholder:e.translate("HeatmapSessionRecording_UrlParameterValueToMatchPlaceholder")},null,8,["model-value","placeholder"]),[[r["vShow"],"urlparam"===e.modelValue.attribute&&e.pattern_type&&"exists"!==e.pattern_type&&"not_exists"!==e.pattern_type]])])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-plus valign",title:e.translate("General_Add"),onClick:t[4]||(t[4]=function(t){return e.$emit("addUrl")})},null,8,Gt),[[r["vShow"],e.showAddUrl]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",{class:"icon-minus valign",title:e.translate("General_Remove"),onClick:t[5]||(t[5]=function(t){return e.$emit("removeUrl")})},null,8,$t),[[r["vShow"],e.canBeRemoved]])],2)}function Xt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yt(e,t){for(var n=0;n0,"can-be-removed":a>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"])]),pn],2)})),128))]),Object(r["createElementVNode"])("div",hn,[Object(r["createElementVNode"])("div",gn,[Object(r["createElementVNode"])("span",fn,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_FieldIncludedTargetsHelp"))+" ",1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"included-targets":e.siteHsr.match_page_rules},null,8,["included-targets"])])])])])]),Object(r["createElementVNode"])("div",bn,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleRate","model-value":e.siteHsr.sample_rate,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.siteHsr.sample_rate=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SampleRate"),options:e.sampleRates,introduction:e.translate("HeatmapSessionRecording_AdvancedOptions"),"inline-help":e.translate("HeatmapSessionRecording_HeatmapSampleRateHelp")},null,8,["model-value","title","options","introduction","inline-help"])]),Object(r["createElementVNode"])("div",vn,[Object(r["createVNode"])(s,{uicontrol:"text",name:"excludedElements","model-value":e.siteHsr.excluded_elements,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.siteHsr.excluded_elements=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_ExcludedElements"),maxlength:1e3,"inline-help":e.translate("HeatmapSessionRecording_ExcludedElementsHelp")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",yn,[Object(r["createVNode"])(s,{uicontrol:"text",name:"screenshotUrl","model-value":e.siteHsr.screenshot_url,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.siteHsr.screenshot_url=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_ScreenshotUrl"),maxlength:300,disabled:!!e.siteHsr.page_treemirror,"inline-help":e.translate("HeatmapSessionRecording_ScreenshotUrlHelp")},null,8,["model-value","title","disabled","inline-help"])]),Object(r["createElementVNode"])("div",On,[Object(r["createVNode"])(s,{uicontrol:"text",name:"breakpointMobile","model-value":e.siteHsr.breakpoint_mobile,"onUpdate:modelValue":t[7]||(t[7]=function(t){e.siteHsr.breakpoint_mobile=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_BreakpointX",e.translate("General_Mobile")),maxlength:4,"inline-help":e.breakpointMobileInlineHelp},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",jn,[Object(r["createVNode"])(s,{uicontrol:"text",name:"breakpointTablet","model-value":e.siteHsr.breakpoint_tablet,"onUpdate:modelValue":t[8]||(t[8]=function(t){e.siteHsr.breakpoint_tablet=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_BreakpointX",e.translate("DevicesDetection_Tablet")),maxlength:4,"inline-help":e.breakpointGeneralHelp},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",Sn,[Object(r["createVNode"])(s,{uicontrol:"checkbox",name:"capture_manually",title:e.translate("HeatmapSessionRecording_CaptureDomTitle"),"inline-help":e.captureDomInlineHelp,"model-value":e.siteHsr.capture_manually,"onUpdate:modelValue":t[9]||(t[9]=function(t){e.siteHsr.capture_manually=t,e.setValueHasChanged()})},null,8,["title","inline-help","model-value"])]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.personalInformationNote)},null,8,_n),Object(r["createVNode"])(d,{class:"createButton",onConfirm:t[10]||(t[10]=function(t){return e.edit?e.updateHsr():e.createHsr()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",Hn,[Object(r["createElementVNode"])("a",{onClick:t[11]||(t[11]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function Nn(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wn(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1&&(this.siteHsr.match_page_rules=Tn(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules.splice(e,1),this.isDirty=!0)},cancel:function(){var e=Object.assign({},I["MatomoUrl"].hashParsed.value);delete e.idSiteHsr,I["MatomoUrl"].updateHash(e)},createHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&Cn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.addHeatmap").then((function(t){if(t&&"error"!==t.type&&t.response){e.isDirty=!1;var n=t.response.value;Cn.reload().then((function(){I["Matomo"].helper.isReportingPage()&&I["Matomo"].postEvent("updateReportingMenu"),I["MatomoUrl"].updateHash(Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idSiteHsr:n})),setTimeout((function(){e.showNotification(Object(I["translate"])("HeatmapSessionRecording_HeatmapCreated"),t.type)}),200)}))}}))},setValueHasChanged:function(){this.isDirty=!0},updateHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&Cn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.updateHeatmap").then((function(t){"error"!==t.type&&(e.isDirty=!1,e.siteHsr={},Cn.reload().then((function(){e.init()})),e.showNotification(Object(I["translate"])("HeatmapSessionRecording_HeatmapUpdated"),t.type))}))},checkRequiredFieldsAreSet:function(){var e;if(!this.siteHsr.name){var t=Object(I["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(t),!1}if(null===(e=this.siteHsr.match_page_rules)||void 0===e||!e.length||!Cn.filterRules(this.siteHsr.match_page_rules).length){var n=Object(I["translate"])("HeatmapSessionRecording_ErrorPageRuleRequired");return this.showNotification(n,"error"),!1}return!0},setMatchPageRule:function(e,t){this.siteHsr.match_page_rules=Tn(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules[t]=e}},computed:{sampleLimits:function(){return[1e3,2e3,5e3].map((function(e){return{key:"".concat(e),value:e}}))},sampleRates:function(){var e=[.1,.5,1,2,3,4,5,6,8,10,15,20,30,40,50,60,70,80,90,100];return e.map((function(e){return{key:e.toFixed(1),value:"".concat(e,"%")}}))},create:function(){return!this.idSiteHsr},edit:function(){return!this.create},editTitle:function(){var e=this.create?"HeatmapSessionRecording_CreateNewHeatmap":"HeatmapSessionRecording_EditHeatmapX";return e},contentTitle:function(){return Object(I["translate"])(this.editTitle,this.siteHsr.name?'"'.concat(this.siteHsr.name,'"'):"")},isLoading:function(){return Cn.state.value.isLoading},isUpdating:function(){return Cn.state.value.isUpdating},breakpointMobileInlineHelp:function(){var e=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelp"),t=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelpManage");return"".concat(e," ").concat(t)},breakpointGeneralHelp:function(){var e=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelp"),t=Object(I["translate"])("HeatmapSessionRecording_BreakpointGeneralHelpManage");return"".concat(e," ").concat(t)},captureDomInlineHelp:function(){var e=this.idSiteHsr?this.idSiteHsr:"{idHeatmap}",t="

_paq.push(['HeatmapSessionRecording::captureInitialDom', ".concat(e,"])");return Object(I["translate"])("HeatmapSessionRecording_CaptureDomInlineHelp",t,"

","")},personalInformationNote:function(){var e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website";return Object(I["translate"])("HeatmapSessionRecording_PersonalInformationNote",Object(I["translate"])("HeatmapSessionRecording_Heatmap"),"","",''),"")},saveButtonText:function(){return this.edit?Object(I["translate"])("CoreUpdater_UpdateTitle"):Object(I["translate"])("HeatmapSessionRecording_CreateNewHeatmap")}}});In.render=Vn;var Ln=In,Fn={class:"heatmapList"},Wn={class:"filterStatus"},qn={class:"hsrSearchFilter",style:{"margin-left":"3.5px"}},zn={class:"index"},Gn={class:"name"},$n={class:"creationDate"},Jn={class:"sampleLimit"},Xn={class:"status"},Yn={class:"action"},Kn={colspan:"7"},Qn={class:"loadingPiwik"},Zn=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),ea={colspan:"7"},ta=["id"],na={class:"index"},aa={class:"name"},ia={class:"creationDate"},ra={class:"sampleLimit"},oa={key:0,class:"status status-paused"},sa=["title"],la={key:1,class:"status"},ca={class:"action"},da=["title","onClick"],ua=["title","onClick"],ma=["title","href"],pa=["title","onClick"],ha={class:"tableActionBar"},ga=Object(r["createElementVNode"])("span",{class:"icon-add"},null,-1),fa={class:"ui-confirm",id:"confirmDeleteHeatmap",ref:"confirmDeleteHeatmap"},ba=["value"],va=["value"],ya={class:"ui-confirm",id:"confirmEndHeatmap",ref:"confirmEndHeatmap"},Oa=["value"],ja=["value"];function Sa(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("ContentBlock"),c=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Fn,[Object(r["createVNode"])(l,{"content-title":e.translate("HeatmapSessionRecording_ManageHeatmaps")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapUsageBenefits")),1),Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",Wn,[Object(r["createVNode"])(s,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.setFilterStatus(t)}),title:e.translate("HeatmapSessionRecording_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(r["createElementVNode"])("div",qn,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"hsrSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchFilter=t}),"full-width":!0},null,8,["title","modelValue"]),[[r["vShow"],e.hsrs.length>0]])])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",zn,Object(r["toDisplayString"])(e.translate("General_Id")),1),Object(r["createElementVNode"])("th",Gn,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",$n,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreationDate")),1),Object(r["createElementVNode"])("th",Jn,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_SampleLimit")),1),Object(r["createElementVNode"])("th",Xn,Object(r["toDisplayString"])(e.translate("CorePluginsAdmin_Status")),1),Object(r["createElementVNode"])("th",Yn,Object(r["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Kn,[Object(r["createElementVNode"])("span",Qn,[Zn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",ea,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_NoHeatmapsFound")),1)],512),[[r["vShow"],!e.isLoading&&0===e.hsrs.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedHsrs,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"hsr".concat(t.idsitehsr),class:"hsrs",key:t.idsitehsr},[Object(r["createElementVNode"])("td",na,Object(r["toDisplayString"])(t.idsitehsr),1),Object(r["createElementVNode"])("td",aa,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",ia,Object(r["toDisplayString"])(t.created_date_pretty),1),Object(r["createElementVNode"])("td",ra,Object(r["toDisplayString"])(t.sample_limit),1),"paused"===t.status?(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",oa,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(t.status))+" ",1),Object(r["createElementVNode"])("span",{class:"icon icon-help",title:e.pauseReason},null,8,sa)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",la,Object(r["toDisplayString"])(e.ucfirst(t.status)),1)),Object(r["createElementVNode"])("td",ca,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("HeatmapSessionRecording_EditX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:function(n){return e.editHsr(t.idsitehsr)}},null,8,da),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{a:"",class:"table-action stopRecording icon-drop-crossed",title:e.translate("HeatmapSessionRecording_StopX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:function(n){return e.completeHsr(t)}},null,8,ua),[[r["vShow"],"ended"!==t.status]]),Object(r["createElementVNode"])("a",{target:"_blank",class:"table-action icon-show",title:e.translate("HeatmapSessionRecording_ViewReport"),href:e.getViewReportLink(t)},null,8,ma),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("HeatmapSessionRecording_DeleteX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:function(n){return e.deleteHsr(t)}},null,8,pa)])],8,ta)})),128))])],512),[[c]]),Object(r["createElementVNode"])("div",ha,[Object(r["createElementVNode"])("a",{class:"createNewHsr",value:"",onClick:t[2]||(t[2]=function(t){return e.createHsr()})},[ga,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreateNewHeatmap")),1)])])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",fa,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteHeatmapConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,ba),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,va)],512),Object(r["createElementVNode"])("div",ya,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_EndHeatmapConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Oa),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,ja)],512)])}function _a(e){return wa(e)||Na(e)||Va(e)||Ha()}function Ha(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Va(e,t){if(e){if("string"===typeof e)return Ea(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ea(e,t):void 0}}function Na(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function wa(e){if(Array.isArray(e))return Ea(e)}function Ea(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n',"")}}});Aa.render=Pa;var Ba=Aa,Ua=window,Ia=Ua.$,La=Object(r["defineComponent"])({props:{breakpointMobile:Number,breakpointTablet:Number,pauseReason:String,isMatomoJsWritable:{type:Boolean,required:!0}},data:function(){return{editMode:!1,idSiteHsr:null}},components:{MatomoJsNotWritableAlert:Ba,HeatmapList:Ra,HeatmapEdit:Ln},watch:{editMode:function(){Ia(".ui-tooltip").remove()}},created:function(){var e=this;Object(r["watch"])((function(){return I["MatomoUrl"].hashParsed.value.idSiteHsr}),(function(t){e.initState(t)})),this.initState(I["MatomoUrl"].hashParsed.value.idSiteHsr)},methods:{removeAnyHsrNotification:function(){I["NotificationsStore"].remove("hsrmanagement")},initState:function(e){if(e){if("0"===e){var t={isAllowed:!0};if(I["Matomo"].postEvent("HeatmapSessionRecording.initAddHeatmap",t),t&&!t.isAllowed)return this.editMode=!1,void(this.idSiteHsr=null)}this.editMode=!0,this.idSiteHsr=parseInt(e,10)}else this.editMode=!1,this.idSiteHsr=null;this.removeAnyHsrNotification()}}});La.render=Da;var Fa=La,Wa={class:"loadingPiwik"},qa=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),za={class:"loadingPiwik"},Ga=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),$a={name:"name"},Ja={name:"sampleLimit"},Xa={class:"form-group row"},Ya={class:"col s12"},Ka={class:"col s12 m6",style:{"padding-left":"0"}},Qa=Object(r["createElementVNode"])("hr",null,null,-1),Za={class:"col s12 m6"},ei={class:"form-help"},ti={class:"inline-help"},ni={name:"sampleRate"},ai={name:"minSessionTime"},ii={name:"requiresActivity"},ri={class:"inline-help-node"},oi=["innerHTML"],si=["innerHTML"],li={class:"entityCancel"};function ci(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("HsrUrlTarget"),c=Object(r["resolveComponent"])("HsrTargetTest"),d=Object(r["resolveComponent"])("SaveButton"),u=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(u,{class:"editHsr","content-title":e.contentTitle},{default:Object(r["withCtx"])((function(){return[Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",Wa,[qa,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[r["vShow"],e.isLoading]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("span",za,[Ga,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_UpdatingData")),1)])],512),[[r["vShow"],e.isUpdating]]),Object(r["createElementVNode"])("form",{onSubmit:t[10]||(t[10]=function(t){return e.edit?e.updateHsr():e.createHsr()})},[Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",$a,[Object(r["createVNode"])(s,{uicontrol:"text",name:"name","model-value":e.siteHsr.name,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.siteHsr.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,placeholder:e.translate("HeatmapSessionRecording_FieldNamePlaceholder"),"inline-help":e.translate("HeatmapSessionRecording_SessionNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(r["createElementVNode"])("div",Ja,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleLimit","model-value":e.siteHsr.sample_limit,"onUpdate:modelValue":t[1]||(t[1]=function(t){e.siteHsr.sample_limit=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SessionSampleLimit"),options:e.sampleLimits,"inline-help":e.translate("HeatmapSessionRecording_SessionSampleLimitHelp")},null,8,["model-value","title","options","inline-help"])]),Object(r["createElementVNode"])("div",Xa,[Object(r["createElementVNode"])("div",Ya,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPages"))+":",1)]),Object(r["createElementVNode"])("div",Ka,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.siteHsr.match_page_rules,(function(n,a){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])("matchPageRules ".concat(a," multiple")),key:a},[Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(l,{"model-value":n,"onUpdate:modelValue":function(t){return e.setMatchPageRule(t,a)},onAddUrl:t[2]||(t[2]=function(t){return e.addMatchPageRule()}),onRemoveUrl:function(t){return e.removeMatchPageRule(a)},onAnyChange:t[3]||(t[3]=function(t){return e.setValueHasChanged()}),"allow-any":!0,"disable-if-no-value":a>0,"can-be-removed":a>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"])]),Qa],2)})),128))]),Object(r["createElementVNode"])("div",Za,[Object(r["createElementVNode"])("div",ei,[Object(r["createElementVNode"])("span",ti,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_FieldIncludedTargetsHelpSessions"))+" ",1),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(c,{"included-targets":e.siteHsr.match_page_rules},null,8,["included-targets"])])])])])]),Object(r["createElementVNode"])("div",ni,[Object(r["createVNode"])(s,{uicontrol:"select",name:"sampleRate","model-value":e.siteHsr.sample_rate,"onUpdate:modelValue":t[4]||(t[4]=function(t){e.siteHsr.sample_rate=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SampleRate"),options:e.sampleRates,introduction:e.translate("HeatmapSessionRecording_AdvancedOptions"),"inline-help":e.translate("HeatmapSessionRecording_SessionSampleRateHelp")},null,8,["model-value","title","options","introduction","inline-help"])]),Object(r["createElementVNode"])("div",ai,[Object(r["createVNode"])(s,{uicontrol:"select",name:"minSessionTime","model-value":e.siteHsr.min_session_time,"onUpdate:modelValue":t[5]||(t[5]=function(t){e.siteHsr.min_session_time=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_MinSessionTime"),options:e.minSessionTimes,"inline-help":e.translate("HeatmapSessionRecording_MinSessionTimeHelp")},null,8,["model-value","title","options","inline-help"])]),Object(r["createElementVNode"])("div",ii,[Object(r["createVNode"])(s,{uicontrol:"checkbox",name:"requiresActivity","model-value":e.siteHsr.requires_activity,"onUpdate:modelValue":t[6]||(t[6]=function(t){e.siteHsr.requires_activity=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_RequiresActivity"),"inline-help":e.translate("HeatmapSessionRecording_RequiresActivityHelp")},null,8,["model-value","title","inline-help"])]),Object(r["createElementVNode"])("div",null,[Object(r["createVNode"])(s,{uicontrol:"checkbox",name:"captureKeystrokes","model-value":e.siteHsr.capture_keystrokes,"onUpdate:modelValue":t[7]||(t[7]=function(t){e.siteHsr.capture_keystrokes=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_CaptureKeystrokes")},{"inline-help":Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("div",ri,[Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.captureKeystrokesHelp)},null,8,oi)])]})),_:1},8,["model-value","title"])]),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.personalInformationNote)},null,8,si),Object(r["createVNode"])(d,{class:"createButton",onConfirm:t[8]||(t[8]=function(t){return e.edit?e.updateHsr():e.createHsr()}),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),Object(r["createElementVNode"])("div",li,[Object(r["createElementVNode"])("a",{onClick:t[9]||(t[9]=function(t){return e.cancel()})},Object(r["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]})),_:1},8,["content-title"])}function di(e){return hi(e)||pi(e)||mi(e)||ui()}function ui(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function mi(e,t){if(e){if("string"===typeof e)return gi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gi(e,t):void 0}}function pi(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function hi(e){if(Array.isArray(e))return gi(e)}function gi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);n-1&&(this.siteHsr.match_page_rules=di(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules.splice(e,1),this.isDirty=!0)},cancel:function(){var e=Object.assign({},I["MatomoUrl"].hashParsed.value);delete e.idSiteHsr,I["MatomoUrl"].updateHash(e)},createHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&xn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.addSessionRecording").then((function(t){if(t&&"error"!==t.type&&t.response){e.isDirty=!1;var n=t.response.value;xn.reload().then((function(){I["Matomo"].helper.isReportingPage()&&I["Matomo"].postEvent("updateReportingMenu"),I["MatomoUrl"].updateHash(Object.assign(Object.assign({},I["MatomoUrl"].hashParsed.value),{},{idSiteHsr:n})),setTimeout((function(){e.showNotification(Object(I["translate"])("HeatmapSessionRecording_SessionRecordingCreated"),t.type)}),200)}))}}))},setValueHasChanged:function(){this.isDirty=!0},updateHsr:function(){var e=this;this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&xn.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.updateSessionRecording").then((function(t){"error"!==t.type&&(e.isDirty=!1,e.siteHsr={},xn.reload().then((function(){e.init()})),e.showNotification(Object(I["translate"])("HeatmapSessionRecording_SessionRecordingUpdated"),t.type))}))},checkRequiredFieldsAreSet:function(){var e;if(!this.siteHsr.name){var t=this.translate("General_Name");return this.showErrorFieldNotProvidedNotification(t),!1}if(null===(e=this.siteHsr.match_page_rules)||void 0===e||!e.length||!xn.filterRules(this.siteHsr.match_page_rules).length){var n=this.translate("HeatmapSessionRecording_ErrorPageRuleRequired");return this.showNotification(n,"error"),!1}return!0},setMatchPageRule:function(e,t){this.siteHsr.match_page_rules=di(this.siteHsr.match_page_rules),this.siteHsr.match_page_rules[t]=e}},computed:{minSessionTimes:function(){return[0,5,10,15,20,30,45,60,90,120].map((function(e){return{key:"".concat(e),value:"".concat(e," seconds")}}))},sampleRates:function(){var e=[.1,.5,1,2,3,4,5,6,8,10,15,20,30,40,50,60,70,80,90,100];return e.map((function(e){return{key:"".concat(e.toFixed(1)),value:"".concat(e,"%")}}))},create:function(){return!this.idSiteHsr},edit:function(){return!this.create},editTitle:function(){var e=this.create?"HeatmapSessionRecording_CreateNewSessionRecording":"HeatmapSessionRecording_EditSessionRecordingX";return e},contentTitle:function(){return Object(I["translate"])(this.editTitle,this.siteHsr.name?'"'.concat(this.siteHsr.name,'"'):"")},isLoading:function(){return Cn.state.value.isLoading},isUpdating:function(){return Cn.state.value.isUpdating},captureKeystrokesHelp:function(){var e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-keystrokes-in-form-fields";return Object(I["translate"])("HeatmapSessionRecording_CaptureKeystrokesHelp",''),"")},personalInformationNote:function(){var e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website";return Object(I["translate"])("HeatmapSessionRecording_PersonalInformationNote",Object(I["translate"])("HeatmapSessionRecording_SessionRecording"),"","",''),"")},saveButtonText:function(){return this.edit?Object(I["translate"])("CoreUpdater_UpdateTitle"):Object(I["translate"])("HeatmapSessionRecording_CreateNewSessionRecording")}}});bi.render=ci;var vi=bi,yi={class:"sessionRecordingList"},Oi={class:"filterStatus"},ji={class:"hsrSearchFilter",style:{"margin-left":"3.5px"}},Si={class:"index"},_i={class:"name"},Hi={class:"creationDate"},Vi={class:"sampleLimit"},Ni={class:"status"},wi={class:"action"},Ei={colspan:"7"},ki={class:"loadingPiwik"},Ri=Object(r["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Ci={colspan:"7"},xi=["id"],Ti={class:"index"},Di={class:"name"},Mi={class:"creationDate"},Pi={class:"sampleLimit"},Ai={key:0,class:"status status-paused"},Bi=["title"],Ui={key:1,class:"status"},Ii={class:"action"},Li=["title","onClick"],Fi=["title","onClick"],Wi=["title","href"],qi=["title","onClick"],zi={class:"tableActionBar"},Gi=Object(r["createElementVNode"])("span",{class:"icon-add"},null,-1),$i={class:"ui-confirm",ref:"confirmDeleteSessionRecording"},Ji=["value"],Xi=["value"],Yi={class:"ui-confirm",ref:"confirmEndSessionRecording"},Ki=["value"],Qi=["value"];function Zi(e,t,n,a,i,o){var s=Object(r["resolveComponent"])("Field"),l=Object(r["resolveComponent"])("ContentBlock"),c=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",yi,[Object(r["createVNode"])(l,{"content-title":e.translate("HeatmapSessionRecording_ManageSessionRecordings")},{default:Object(r["withCtx"])((function(){return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_SessionRecordingsUsageBenefits")),1),Object(r["createElementVNode"])("div",null,[Object(r["createElementVNode"])("div",Oi,[Object(r["createVNode"])(s,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=function(t){e.setFilterStatus(t)}),title:e.translate("HeatmapSessionRecording_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(r["createElementVNode"])("div",ji,[Object(r["withDirectives"])(Object(r["createVNode"])(s,{uicontrol:"text",name:"hsrSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=function(t){return e.searchFilter=t}),"full-width":!0},null,8,["title","modelValue"]),[[r["vShow"],e.hsrs.length>0]])])]),Object(r["withDirectives"])(Object(r["createElementVNode"])("table",null,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",Si,Object(r["toDisplayString"])(e.translate("General_Id")),1),Object(r["createElementVNode"])("th",_i,Object(r["toDisplayString"])(e.translate("General_Name")),1),Object(r["createElementVNode"])("th",Hi,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreationDate")),1),Object(r["createElementVNode"])("th",Vi,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_SampleLimit")),1),Object(r["createElementVNode"])("th",Ni,Object(r["toDisplayString"])(e.translate("CorePluginsAdmin_Status")),1),Object(r["createElementVNode"])("th",wi,Object(r["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(r["createElementVNode"])("tbody",null,[Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ei,[Object(r["createElementVNode"])("span",ki,[Ri,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[r["vShow"],e.isLoading||e.isUpdating]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("td",Ci,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_NoSessionRecordingsFound")),1)],512),[[r["vShow"],!e.isLoading&&0==e.hsrs.length]]),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.sortedHsrs,(function(t){return Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{id:"hsr".concat(t.idsitehsr),class:"hsrs",key:t.idsitehsr},[Object(r["createElementVNode"])("td",Ti,Object(r["toDisplayString"])(t.idsitehsr),1),Object(r["createElementVNode"])("td",Di,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("td",Mi,Object(r["toDisplayString"])(t.created_date_pretty),1),Object(r["createElementVNode"])("td",Pi,Object(r["toDisplayString"])(t.sample_limit),1),"paused"===t.status?(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",Ai,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.ucfirst(t.status))+" ",1),Object(r["createElementVNode"])("span",{class:"icon icon-help",title:e.pauseReason},null,8,Bi)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("td",Ui,Object(r["toDisplayString"])(e.ucfirst(t.status)),1)),Object(r["createElementVNode"])("td",Ii,[Object(r["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("HeatmapSessionRecording_EditX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:function(n){return e.editHsr(t.idsitehsr)}},null,8,Li),Object(r["withDirectives"])(Object(r["createElementVNode"])("a",{class:"table-action stopRecording icon-drop-crossed",title:e.translate("HeatmapSessionRecording_StopX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:function(n){return e.completeHsr(t)}},null,8,Fi),[[r["vShow"],"ended"!==t.status]]),Object(r["createElementVNode"])("a",{class:"table-action icon-show",title:e.translate("HeatmapSessionRecording_ViewReport"),href:e.getViewReportLink(t),target:"_blank"},null,8,Wi),Object(r["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("HeatmapSessionRecording_DeleteX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:function(n){return e.deleteHsr(t)}},null,8,qi)])],8,xi)})),128))])],512),[[c]]),Object(r["createElementVNode"])("div",zi,[Object(r["createElementVNode"])("a",{class:"createNewHsr",value:"",onClick:t[2]||(t[2]=function(t){return e.createHsr()})},[Gi,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_CreateNewSessionRecording")),1)])])]})),_:1},8,["content-title"]),Object(r["createElementVNode"])("div",$i,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteSessionRecordingConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ji),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Xi)],512),Object(r["createElementVNode"])("div",Yi,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("HeatmapSessionRecording_EndSessionRecordingConfirm")),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ki),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Qi)],512)])}function er(e){return ir(e)||ar(e)||nr(e)||tr()}function tr(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function nr(e,t){if(e){if("string"===typeof e)return rr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rr(e,t):void 0}}function ar(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function ir(e){if(Array.isArray(e))return rr(e)}function rr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=new Array(t);nsiteHsr->addHeatmap($idSite, $name, $matchPageRules, $sampleLimit, $sampleRate, $excludedElements, $screenshotUrl, $breakpointMobile, $breakpointTablet, $captureDomManually, $createdDate); } + /** + * Copies a specified heatmap to one or more sites. If a heatmap with the same name already exists, the new heatmap + * will have an automatically adjusted name to make it unique to the assigned site. + * + * @param int $idSite + * @param int $idSiteHsr ID of the heatmap to duplicate. + * @param int[] $idDestinationSites Optional array of IDs identifying which site(s) the new heatmap is to be + * assigned to. The default is [idSite] when nothing is provided. + * @return array + * @throws Exception + */ + public function duplicateHeatmap(int $idSite, int $idSiteHsr, array $idDestinationSites = []): array + { + // Define data array before any alterations to the variables + $additionalData = [ + 'idSite' => $idSite, + 'idDestinationSites' => $idDestinationSites, + 'idSiteHsr' => $idSiteHsr, + ]; + + $idDestinationSites = count($idDestinationSites) > 0 ? $idDestinationSites : [$idSite]; + $idSitesToCheck = array_unique(array_merge([$idSite], $idDestinationSites)); + $this->validator->checkSitesDuplicationPermission($idSitesToCheck); + + // Initialise the common response values + $duplicateRequestResponse = new DuplicateRequestResponse(); + + $heatmap = null; + try { + $heatmap = $this->getHeatmap($idSite, $idSiteHsr); + } catch (\Throwable $e) { + // Log the error, but continue for the proper response to be built later + $this->logError('Uncaught exception looking up heatmap to duplicate: {exception}', $e); + } + if (empty($heatmap['name']) || empty($heatmap['match_page_rules'])) { + $duplicateRequestResponse->setSuccess(false); + $duplicateRequestResponse->setMessage(Piwik::translate('HeatmapSessionRecording_SourceHeatmapLookupError')); + $duplicateRequestResponse->setAdditionalData($additionalData); + + return $duplicateRequestResponse->getResponseArray(); + } + + $idSitesFailed = $idHrsNew = []; + foreach ($idDestinationSites as $idDestinationSite) { + try { + // Make sure that the new name is unique. + $newName = $heatmap['name']; + $heatmaps = $this->siteHsr->getHeatmaps($idDestinationSite, false, true); + // It can only be a duplicate name if some heatmaps were found for the site. + if (is_array($heatmaps) && count($heatmaps) > 0) { + $heatmapNames = array_column($heatmaps, 'name'); + $newName = EntityDuplicatorHelper::getUniqueNameComparedToList($newName, $heatmapNames, 50); + } + + $response = $this->addHeatmap( + $idDestinationSite, + $newName, + $heatmap['match_page_rules'], + $heatmap['sample_limit'] ?? 1000, + $heatmap['sample_rate'] ?? 5, + $heatmap['excluded_elements'] ?? false, + $heatmap['screenshot_url'] ?? false, + $heatmap['breakpoint_mobile'] ?? false, + $heatmap['breakpoint_tablet'] ?? false, + $heatmap['capture_manually'] ?? false + ); + + // Check response for success or failure. The only return is the new ID, so make sure it's a valid int + if (!is_int($response) || $response < 1) { + $idSitesFailed[] = $idDestinationSite; + continue; + } + + $idHrsNew[] = $response; + } catch (\Throwable $e) { + $idSitesFailed[] = $idDestinationSite; + + // Log the error, but continue in case there are other sites to copy to + $this->logError('Uncaught exception duplicating heatmap: {exception}', $e); + } + } + + // Set the values for success response + $duplicateRequestResponse->setSuccess(true); + $duplicateRequestResponse->setMessage(Piwik::translate('HeatmapSessionRecording_HeatmapCopied')); + $additionalData['newIds'] = $idHrsNew; + $duplicateRequestResponse->setAdditionalData($additionalData); + + // If any of the sites failed, update to error response + if (count($idSitesFailed) > 0) { + $successSites = array_diff($idDestinationSites, $idSitesFailed); + $sitesString = count($successSites) ? implode(',', $successSites) : Piwik::translate('HeatmapSessionRecording_None'); + $message = Piwik::translate('HeatmapSessionRecording_HeatmapDuplicationError', [implode(',', $idSitesFailed), $sitesString]); + $duplicateRequestResponse->setSuccess(false); + $duplicateRequestResponse->setMessage($message); + } + + return $duplicateRequestResponse->getResponseArray(); + } + + private function logError(string $message, \Throwable $e): void + { + StaticContainer::get(\Piwik\Log\LoggerInterface::class)->error( + $message, + [ + 'exception' => $e, + 'ignoreInScreenWriter' => true, + ] + ); + } + private function unsanitizeScreenshotUrl($screenshotUrl) { if (!empty($screenshotUrl) && is_string($screenshotUrl)) { diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Actions/ActionHsr.php b/files/plugin-HeatmapSessionRecording-5.2.6/Actions/ActionHsr.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Actions/ActionHsr.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Actions/ActionHsr.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/BaseActivity.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/BaseActivity.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/BaseActivity.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/BaseActivity.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapAdded.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapAdded.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapAdded.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapAdded.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapDeleted.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapDeleted.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapDeleted.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapDeleted.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapEnded.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapEnded.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapEnded.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapEnded.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapPaused.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapPaused.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapPaused.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapPaused.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapResumed.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapResumed.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapResumed.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapResumed.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapScreenshotDeleted.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapScreenshotDeleted.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapScreenshotDeleted.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapScreenshotDeleted.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapUpdated.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapUpdated.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/HeatmapUpdated.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/HeatmapUpdated.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/RecordedPageviewDeleted.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/RecordedPageviewDeleted.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/RecordedPageviewDeleted.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/RecordedPageviewDeleted.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/RecordedSessionDeleted.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/RecordedSessionDeleted.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/RecordedSessionDeleted.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/RecordedSessionDeleted.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingAdded.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingAdded.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingAdded.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingAdded.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingDeleted.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingDeleted.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingDeleted.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingDeleted.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingEnded.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingEnded.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingEnded.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingEnded.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingPaused.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingPaused.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingPaused.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingPaused.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingResumed.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingResumed.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingResumed.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingResumed.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingUpdated.php b/files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingUpdated.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Activity/SessionRecordingUpdated.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Activity/SessionRecordingUpdated.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Archiver/Aggregator.php b/files/plugin-HeatmapSessionRecording-5.2.6/Archiver/Aggregator.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Archiver/Aggregator.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Archiver/Aggregator.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/CHANGELOG.md b/files/plugin-HeatmapSessionRecording-5.2.6/CHANGELOG.md similarity index 97% rename from files/plugin-HeatmapSessionRecording-5.2.3/CHANGELOG.md rename to files/plugin-HeatmapSessionRecording-5.2.6/CHANGELOG.md index 8030089..fdb3218 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/CHANGELOG.md +++ b/files/plugin-HeatmapSessionRecording-5.2.6/CHANGELOG.md @@ -1,5 +1,15 @@ ## Changelog +5.2.6 - 2025-08-04 +- Added ability to copy configured heatmaps when Matomo 5.4.0-b4 or later is installed + +5.2.5 - 2025-07-07 +- Textual changes + +5.2.4 - 2025-06-09 +- Started showing the troubleshooting link even when no heatmap sample has been recorded +- Do not crash when displaying a heatmap for a page with invalid HTML + 5.2.3 - 2025-01-20 - Added an activity for pause and resume action - Added a troubleshooting FAQ link for heatmaps diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Categories/HeatmapCategory.php b/files/plugin-HeatmapSessionRecording-5.2.6/Categories/HeatmapCategory.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Categories/HeatmapCategory.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Categories/HeatmapCategory.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Categories/ManageHeatmapSubcategory.php b/files/plugin-HeatmapSessionRecording-5.2.6/Categories/ManageHeatmapSubcategory.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Categories/ManageHeatmapSubcategory.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Categories/ManageHeatmapSubcategory.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Categories/ManageSessionRecordingSubcategory.php b/files/plugin-HeatmapSessionRecording-5.2.6/Categories/ManageSessionRecordingSubcategory.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Categories/ManageSessionRecordingSubcategory.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Categories/ManageSessionRecordingSubcategory.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Categories/SessionRecordingsCategory.php b/files/plugin-HeatmapSessionRecording-5.2.6/Categories/SessionRecordingsCategory.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Categories/SessionRecordingsCategory.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Categories/SessionRecordingsCategory.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/BaseMetric.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/BaseMetric.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/BaseMetric.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/BaseMetric.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/Browser.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/Browser.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/Browser.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/Browser.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/Device.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/Device.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/Device.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/Device.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/Location.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/Location.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/Location.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/Location.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/OperatingSystem.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/OperatingSystem.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/OperatingSystem.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/OperatingSystem.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/SessionTime.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/SessionTime.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/SessionTime.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/SessionTime.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/TimeOnPage.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/TimeOnPage.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/TimeOnPage.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/TimeOnPage.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/TimeOnSite.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/TimeOnSite.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/TimeOnSite.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/TimeOnSite.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/TotalEvents.php b/files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/TotalEvents.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Columns/Metrics/TotalEvents.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Columns/Metrics/TotalEvents.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Commands/RemoveHeatmapScreenshot.php b/files/plugin-HeatmapSessionRecording-5.2.6/Commands/RemoveHeatmapScreenshot.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Commands/RemoveHeatmapScreenshot.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Commands/RemoveHeatmapScreenshot.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Configuration.php b/files/plugin-HeatmapSessionRecording-5.2.6/Configuration.php similarity index 93% rename from files/plugin-HeatmapSessionRecording-5.2.3/Configuration.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Configuration.php index 12e8054..b8dd31a 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/Configuration.php +++ b/files/plugin-HeatmapSessionRecording-5.2.6/Configuration.php @@ -34,7 +34,6 @@ class Configuration public const KEY_DEFAULT_HEATMAP_WIDTH = 'default_heatmap_width'; public const DEFAULT_HEATMAP_WIDTH = 1920; public const HEATMAP_ALLOWED_WIDTHS = [320, 360, 480, 600, 640, 900, 960, 1024, 1200, 1280, 1366, 1440, 1600, 1680, 1920, 2560]; - public const KEY_CAN_VIEW_SYSTEM_REPORT_GENERAL = 'can_view_system_report'; public function install() { @@ -118,16 +117,6 @@ public function getDefaultHeatmapWidth() return $width; } - public function canViewSystemReport() - { - $config = $this->getConfig(); - if (!isset($config->General[self::KEY_CAN_VIEW_SYSTEM_REPORT_GENERAL])) { - return true; - } - - return (bool) $config->General[self::KEY_CAN_VIEW_SYSTEM_REPORT_GENERAL]; - } - private function getConfig() { return Config::getInstance(); diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Controller.php b/files/plugin-HeatmapSessionRecording-5.2.6/Controller.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Controller.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Controller.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsr.php b/files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsr.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsr.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsr.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsrBlob.php b/files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsrBlob.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsrBlob.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsrBlob.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsrEvent.php b/files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsrEvent.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsrEvent.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsrEvent.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsrSite.php b/files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsrSite.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Dao/LogHsrSite.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Dao/LogHsrSite.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Dao/SiteHsrDao.php b/files/plugin-HeatmapSessionRecording-5.2.6/Dao/SiteHsrDao.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Dao/SiteHsrDao.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Dao/SiteHsrDao.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/DataTable/Filter/EnrichRecordedSessions.php b/files/plugin-HeatmapSessionRecording-5.2.6/DataTable/Filter/EnrichRecordedSessions.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/DataTable/Filter/EnrichRecordedSessions.php rename to files/plugin-HeatmapSessionRecording-5.2.6/DataTable/Filter/EnrichRecordedSessions.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Diagnostic/ConfigsPhpCheck.php b/files/plugin-HeatmapSessionRecording-5.2.6/Diagnostic/ConfigsPhpCheck.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Diagnostic/ConfigsPhpCheck.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Diagnostic/ConfigsPhpCheck.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/HeatmapSessionRecording.php b/files/plugin-HeatmapSessionRecording-5.2.6/HeatmapSessionRecording.php similarity index 98% rename from files/plugin-HeatmapSessionRecording-5.2.3/HeatmapSessionRecording.php rename to files/plugin-HeatmapSessionRecording-5.2.6/HeatmapSessionRecording.php index 706431e..54e26a1 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/HeatmapSessionRecording.php +++ b/files/plugin-HeatmapSessionRecording-5.2.6/HeatmapSessionRecording.php @@ -5,7 +5,7 @@ * Description: Truly understand your visitors by seeing where they click, hover, type and scroll. Replay their actions in a video and ultimately increase conversions * Author: InnoCraft * Author URI: https://www.innocraft.com - * Version: 5.2.3 + * Version: 5.2.6 * License: InnoCraft EULA * License URI: https://www.innocraft.com/license * Plugin URI: https://plugins.matomo.org/HeatmapSessionRecording @@ -277,7 +277,7 @@ public function registerEvents() 'function' => 'addStylesheets', 'after' => true, ], - 'Db.getTablesInstalled' => 'getTablesInstalled' + 'Db.getTablesInstalled' => 'getTablesInstalled', ); } @@ -677,6 +677,11 @@ public function getClientSideTranslationKeys(&$result) $result[] = 'HeatmapSessionRecording_Moves'; $result[] = 'HeatmapSessionRecording_MoveRate'; $result[] = 'HeatmapSessionRecording_HeatmapTroubleshoot'; + $result[] = 'General_Required'; + $result[] = 'HeatmapSessionRecording_ErrorHeatmapNameDuplicate'; + $result[] = 'HeatmapSessionRecording_QuotaReachedForX'; + $result[] = 'HeatmapSessionRecording_HeatmapDuplicationError'; + $result[] = 'HeatmapSessionRecording_None'; } public function getJsFiles(&$jsFiles) @@ -813,18 +818,16 @@ public function changeSessionLengthIfEmbedPage() public static function getTranslationKey($type) { - $config = new Configuration(); - $appendWithoutSystemConfiguration = ($config->canViewSystemReport() ? '' : 'WithoutSystemConfiguration'); $key = ''; switch ($type) { case 'pause': $key = 'HeatmapSessionRecording_PauseReason'; break; case 'noDataSession': - $key = 'HeatmapSessionRecording_NoSessionRecordedYet' . $appendWithoutSystemConfiguration; + $key = 'HeatmapSessionRecording_NoSessionRecordedYetWithoutSystemConfiguration'; break; case 'noDataHeatmap': - $key = 'HeatmapSessionRecording_NoHeatmapSamplesRecordedYet' . $appendWithoutSystemConfiguration; + $key = 'HeatmapSessionRecording_NoHeatmapSamplesRecordedYetWithoutSystemConfiguration'; break; } diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/Breakpoint.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/Breakpoint.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/Breakpoint.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/Breakpoint.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/CaptureKeystrokes.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/CaptureKeystrokes.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/CaptureKeystrokes.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/CaptureKeystrokes.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/ExcludedElements.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/ExcludedElements.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/ExcludedElements.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/ExcludedElements.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/MinSessionTime.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/MinSessionTime.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/MinSessionTime.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/MinSessionTime.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/Name.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/Name.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/Name.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/Name.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/PageRule.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/PageRule.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/PageRule.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/PageRule.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/PageRules.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/PageRules.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/PageRules.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/PageRules.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/RequiresActivity.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/RequiresActivity.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/RequiresActivity.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/RequiresActivity.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/SampleLimit.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/SampleLimit.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/SampleLimit.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/SampleLimit.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/SampleRate.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/SampleRate.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/SampleRate.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/SampleRate.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/ScreenshotUrl.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/ScreenshotUrl.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/ScreenshotUrl.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/ScreenshotUrl.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Input/Validator.php b/files/plugin-HeatmapSessionRecording-5.2.6/Input/Validator.php similarity index 70% rename from files/plugin-HeatmapSessionRecording-5.2.3/Input/Validator.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Input/Validator.php index e1b99c3..15cba61 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/Input/Validator.php +++ b/files/plugin-HeatmapSessionRecording-5.2.6/Input/Validator.php @@ -18,6 +18,7 @@ use Piwik\Piwik; use Piwik\Plugins\HeatmapSessionRecording\Configuration; +use Piwik\Plugins\HeatmapSessionRecording\Dao\SiteHsrDao; use Piwik\Site; use Piwik\Plugins\HeatmapSessionRecording\SystemSettings; @@ -46,27 +47,14 @@ private function supportsMethod($method) public function checkHasSomeWritePermission() { - if ($this->supportsMethod('checkUserHasSomeWriteAccess')) { - // since Matomo 3.6.0 - Piwik::checkUserHasSomeWriteAccess(); - return; - } - - Piwik::checkUserHasSomeAdminAccess(); + Piwik::checkUserHasSomeWriteAccess(); } public function checkWritePermission($idSite) { $this->checkSiteExists($idSite); Piwik::checkUserIsNotAnonymous(); - - if ($this->supportsMethod('checkUserHasWriteAccess')) { - // since Matomo 3.6.0 - Piwik::checkUserHasWriteAccess($idSite); - return; - } - - Piwik::checkUserHasAdminAccess($idSite); + Piwik::checkUserHasWriteAccess($idSite); } public function checkHeatmapReportViewPermission($idSite) @@ -110,6 +98,46 @@ public function checkHeatmapRecordingEnabled() } } + /** + * Check whether the current user is allowed to duplicate to specified sites. + * + * @param int[] $idSites + * @param int $hsrType Optional type indicating the permission check is for Heatmaps (1) or SessionRecordings (2). + * The default is Heatmaps. + * @return void + * @throws \Exception If heatmaps aren't enabled, the user doesn't have write permission, or the site is a rollup + */ + public function checkSitesDuplicationPermission(array $idSites, int $hsrType = SiteHsrDao::RECORD_TYPE_HEATMAP) + { + if ($hsrType === SiteHsrDao::RECORD_TYPE_HEATMAP) { + $this->checkHeatmapRecordingEnabled(); + } elseif ($hsrType === SiteHsrDao::RECORD_TYPE_SESSION) { + $this->checkSessionRecordingEnabled(); + } else { + throw new \Exception('Unsupported HSR Type: ' . $hsrType); + } + + if (count($idSites) < 1) { + throw new \Exception(Piwik::translate('General_Required', ['idSites'])); + } + + Piwik::checkUserHasWriteAccess($idSites); + // Check if any of the specified sites are rollups + $rollupSiteNames = []; + foreach ($idSites as $idSite) { + if (Site::getTypeFor($idSite) === 'rollup') { + $rollupSiteNames[] = Site::getNameFor($idSite); + } + } + + if (count($rollupSiteNames) > 0) { + throw new \Exception(Piwik::translate( + 'HeatmapSessionRecording_HeatmapDuplicationSiteTypeError', + ['\'' . implode('\', \'', $rollupSiteNames) . '\''] + )); + } + } + private function checkUserIsNotAnonymousForView($idSite) { if ($this->configuration->isAnonymousSessionRecordingAccessEnabled($idSite)) { @@ -156,12 +184,7 @@ public function canWrite($idSite) return false; } - if ($this->supportsMethod('isUserHasWriteAccess')) { - // since Matomo 3.6.0 - return Piwik::isUserHasWriteAccess($idSite); - } - - return Piwik::isUserHasAdminAccess($idSite); + return Piwik::isUserHasWriteAccess($idSite); } public function isSessionRecordingDisabled() diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Install/HtAccess.php b/files/plugin-HeatmapSessionRecording-5.2.6/Install/HtAccess.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Install/HtAccess.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Install/HtAccess.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Install/htaccessTemplate b/files/plugin-HeatmapSessionRecording-5.2.6/Install/htaccessTemplate similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Install/htaccessTemplate rename to files/plugin-HeatmapSessionRecording-5.2.6/Install/htaccessTemplate diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/LEGALNOTICE b/files/plugin-HeatmapSessionRecording-5.2.6/LEGALNOTICE similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/LEGALNOTICE rename to files/plugin-HeatmapSessionRecording-5.2.6/LEGALNOTICE diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/LICENSE b/files/plugin-HeatmapSessionRecording-5.2.6/LICENSE new file mode 100644 index 0000000..4686f35 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/LICENSE @@ -0,0 +1,49 @@ +InnoCraft License + +This InnoCraft End User License Agreement (the "InnoCraft EULA") is between you and InnoCraft Ltd (NZBN 6106769) ("InnoCraft"). If you are agreeing to this Agreement not as an individual but on behalf of your company, then "Customer" or "you" means your company, and you are binding your company to this Agreement. InnoCraft may modify this Agreement from time to time, subject to the terms in Section (xii) below. + +By clicking on the "I’ve read and accept the terms & conditions (https://shop.matomo.org/terms-conditions/)" (or similar button) that is presented to you at the time of your Order, or by using or accessing InnoCraft products, you indicate your assent to be bound by this Agreement. + + +InnoCraft EULA + +(i) InnoCraft is the licensor of the Plugin for Matomo Analytics (the "Software"). + +(ii) Subject to the terms and conditions of this Agreement, InnoCraft grants you a limited, worldwide, non-exclusive, non-transferable and non-sublicensable license to install and use the Software only on hardware systems owned, leased or controlled by you, during the applicable License Term. The term of each Software license ("License Term") will be specified in your Order. Your License Term will end upon any breach of this Agreement. + +(iii) Unless otherwise specified in your Order, for each Software license that you purchase, you may install one production instance of the Software in a Matomo Analytics instance owned or operated by you, and accessible via one URL ("Matomo instance"). Additional licenses must be purchased in order to deploy the Software in multiple Matomo instances, including when these multiple Matomo instances are hosted on a single hardware system. + +(iv) Licenses granted by InnoCraft are granted subject to the condition that you must ensure the maximum number of Authorized Users and Authorized Sites that are able to access and use the Software is equal to the number of User and Site Licenses for which the necessary fees have been paid to InnoCraft for the Subscription period. You may upgrade your license at any time on payment of the appropriate fees to InnoCraft in order to increase the maximum number of authorized users or sites. The number of User and Site Licenses granted to you is dependent on the fees paid by you. “User License” means a license granted under this EULA to you to permit an Authorized User to use the Software. “Authorized User” means a person who has an account in the Matomo instance and for which the necessary fees (“Subscription fees”) have been paid to InnoCraft for the current license term. "Site License" means a license granted under this EULA to you to permit an Authorized Site to use the Matomo Marketplace Plugin. “Authorized Sites” means a website or a measurable within Matomo instance and for which the necessary fees (“Subscription fees”) have been paid to InnoCraft for the current license term. These restrictions also apply if you install the Matomo Analytics Platform as part of your WordPress. + +(v) Piwik Analytics was renamed to Matomo Analytics in January 2018. The same terms and conditions as well as any restrictions or grants apply if you are using any version of Piwik. + +(vi) The Software requires a license key in order to operate, which will be delivered to the email addresses specified in your Order when we have received payment of the applicable fees. + +(vii) Any information that InnoCraft may collect from you or your device will be subject to InnoCraft Privacy Policy (https://www.innocraft.com/privacy). + +(viii) You are bound by the Matomo Marketplace Terms and Conditions (https://shop.matomo.org/terms-conditions/). + +(ix) You may not reverse engineer or disassemble or re-distribute the Software in whole or in part, or create any derivative works from or sublicense any rights in the Software, unless otherwise expressly authorized in writing by InnoCraft. + +(x) The Software is protected by copyright and other intellectual property laws and treaties. InnoCraft own all title, copyright and other intellectual property rights in the Software, and the Software is licensed to you directly by InnoCraft, not sold. + +(xi) The Software is provided under an "as is" basis and without any support or maintenance. Nothing in this Agreement shall require InnoCraft to provide you with support or fixes to any bug, failure, mis-performance or other defect in The Software. InnoCraft may provide you, from time to time, according to his sole discretion, with updates of the Software. You hereby warrant to keep the Software up-to-date and install all relevant updates. InnoCraft shall provide any update free of charge. + +(xii) The Software is provided "as is", and InnoCraft hereby disclaim all warranties, including but not limited to any implied warranties of title, non-infringement, merchantability or fitness for a particular purpose. InnoCraft shall not be liable or responsible in any way for any losses or damage of any kind, including lost profits or other indirect or consequential damages, relating to your use of or reliance upon the Software. + +(xiii) We may update or modify this Agreement from time to time, including the referenced Privacy Policy and the Matomo Marketplace Terms and Conditions. If a revision meaningfully reduces your rights, we will use reasonable efforts to notify you (by, for example, sending an email to the billing or technical contact you designate in the applicable Order). If we modify the Agreement during your License Term or Subscription Term, the modified version will be effective upon your next renewal of a License Term. + + +About InnoCraft Ltd + +At InnoCraft Ltd, we create innovating quality products to grow your business and to maximize your success. + +Our software products are built on top of Matomo Analytics: the leading open digital analytics platform used by more than one million websites worldwide. We are the creators and makers of the Matomo Analytics platform. + + +Contact + +Email: contact@innocraft.com +Contact form: https://www.innocraft.com/#contact +Website: https://www.innocraft.com/ +Buy our products: Premium Features for Matomo Analytics https://plugins.matomo.org/premium diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Menu.php b/files/plugin-HeatmapSessionRecording-5.2.6/Menu.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Menu.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Menu.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Model/SiteHsrModel.php b/files/plugin-HeatmapSessionRecording-5.2.6/Model/SiteHsrModel.php similarity index 98% rename from files/plugin-HeatmapSessionRecording-5.2.3/Model/SiteHsrModel.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Model/SiteHsrModel.php index f95767c..06ec0fc 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/Model/SiteHsrModel.php +++ b/files/plugin-HeatmapSessionRecording-5.2.6/Model/SiteHsrModel.php @@ -309,12 +309,17 @@ public function endSessionRecording($idSite, $idSiteHsr) /** * @param $idSite * @param bool $includePageTreeMirror performance and IO tweak has some heatmaps might have a 16MB or more treemirror and it would be loaded on every request causing a lot of IO etc. + * @param bool $skipEnrich option to skip enriching heatmaps in order to get unaltered data * @return array */ - public function getHeatmaps($idSite, $includePageTreeMirror) + public function getHeatmaps($idSite, $includePageTreeMirror, $skipEnrich = false) { $heatmaps = $this->dao->getRecords($idSite, SiteHsrDao::RECORD_TYPE_HEATMAP, $includePageTreeMirror); + if ($skipEnrich) { + return $heatmaps; + } + return $this->enrichHeatmaps($heatmaps); } diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/MutationManipulator.php b/files/plugin-HeatmapSessionRecording-5.2.6/MutationManipulator.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/MutationManipulator.php rename to files/plugin-HeatmapSessionRecording-5.2.6/MutationManipulator.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/README.md b/files/plugin-HeatmapSessionRecording-5.2.6/README.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/README.md rename to files/plugin-HeatmapSessionRecording-5.2.6/README.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Reports/GetRecordedSessions.php b/files/plugin-HeatmapSessionRecording-5.2.6/Reports/GetRecordedSessions.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Reports/GetRecordedSessions.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Reports/GetRecordedSessions.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Settings/TrackingDisableDefault.php b/files/plugin-HeatmapSessionRecording-5.2.6/Settings/TrackingDisableDefault.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Settings/TrackingDisableDefault.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Settings/TrackingDisableDefault.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/SystemSettings.php b/files/plugin-HeatmapSessionRecording-5.2.6/SystemSettings.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/SystemSettings.php rename to files/plugin-HeatmapSessionRecording-5.2.6/SystemSettings.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tasks.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tasks.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tasks.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tasks.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/Configs.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/Configs.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/Configs.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/Configs.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/HsrMatcher.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/HsrMatcher.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/HsrMatcher.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/HsrMatcher.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/LogTable/LogHsr.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/LogTable/LogHsr.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/LogTable/LogHsr.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/LogTable/LogHsr.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/LogTable/LogHsrBlob.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/LogTable/LogHsrBlob.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/LogTable/LogHsrBlob.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/LogTable/LogHsrBlob.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/LogTable/LogHsrEvent.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/LogTable/LogHsrEvent.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/LogTable/LogHsrEvent.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/LogTable/LogHsrEvent.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/PageRuleMatcher.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/PageRuleMatcher.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/PageRuleMatcher.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/PageRuleMatcher.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Tracker/RequestProcessor.php b/files/plugin-HeatmapSessionRecording-5.2.6/Tracker/RequestProcessor.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Tracker/RequestProcessor.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Tracker/RequestProcessor.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Updates/3.0.10.php b/files/plugin-HeatmapSessionRecording-5.2.6/Updates/3.0.10.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Updates/3.0.10.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Updates/3.0.10.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Updates/3.0.11.php b/files/plugin-HeatmapSessionRecording-5.2.6/Updates/3.0.11.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Updates/3.0.11.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Updates/3.0.11.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Updates/3.0.3.php b/files/plugin-HeatmapSessionRecording-5.2.6/Updates/3.0.3.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Updates/3.0.3.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Updates/3.0.3.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Updates/4.0.0.php b/files/plugin-HeatmapSessionRecording-5.2.6/Updates/4.0.0.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Updates/4.0.0.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Updates/4.0.0.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Updates/5.1.0.php b/files/plugin-HeatmapSessionRecording-5.2.6/Updates/5.1.0.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Updates/5.1.0.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Updates/5.1.0.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/VisitorDetails.php b/files/plugin-HeatmapSessionRecording-5.2.6/VisitorDetails.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/VisitorDetails.php rename to files/plugin-HeatmapSessionRecording-5.2.6/VisitorDetails.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GetManageHeatmaps.php b/files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GetManageHeatmaps.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GetManageHeatmaps.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GetManageHeatmaps.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GetManageSessionRecordings.php b/files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GetManageSessionRecordings.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GetManageSessionRecordings.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GetManageSessionRecordings.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GettingStartedHeatmap.php b/files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GettingStartedHeatmap.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GettingStartedHeatmap.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GettingStartedHeatmap.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GettingStartedSessions.php b/files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GettingStartedSessions.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/Widgets/GettingStartedSessions.php rename to files/plugin-HeatmapSessionRecording-5.2.6/Widgets/GettingStartedSessions.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/config/config.php b/files/plugin-HeatmapSessionRecording-5.2.6/config/config.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/config/config.php rename to files/plugin-HeatmapSessionRecording-5.2.6/config/config.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/configs.php b/files/plugin-HeatmapSessionRecording-5.2.6/configs.php similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/configs.php rename to files/plugin-HeatmapSessionRecording-5.2.6/configs.php diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/docs/index.md b/files/plugin-HeatmapSessionRecording-5.2.6/docs/index.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/docs/index.md rename to files/plugin-HeatmapSessionRecording-5.2.6/docs/index.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/javascripts/recording.js b/files/plugin-HeatmapSessionRecording-5.2.6/javascripts/recording.js similarity index 98% rename from files/plugin-HeatmapSessionRecording-5.2.3/javascripts/recording.js rename to files/plugin-HeatmapSessionRecording-5.2.6/javascripts/recording.js index c38375c..5900cbe 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/javascripts/recording.js +++ b/files/plugin-HeatmapSessionRecording-5.2.6/javascripts/recording.js @@ -166,12 +166,12 @@ function HsrRecordingIframe (url) { } return false; } - if (tagName === 'iframe' && 'src' in data.attributes && data.attributes.src.indexOf('google.com/recaptcha') !== -1) { + if (tagName === 'iframe' && data && 'src' in data.attributes && data.attributes.src.indexOf('google.com/recaptcha') !== -1) { var element = document.createElement('NO_SCRIPT'); element.style.display = 'none'; return element; } - if (isLinkHrefAttr && 'href' in data.attributes && data.attributes['href']) { + if (isLinkHrefAttr && data && 'href' in data.attributes && data.attributes['href']) { if (shouldUnresolve(String(data.attributes['href']))) { data.attributes['href'] = '#not_possible_to_resolve'; // this URL cannot be resolved and is injected dynamically @@ -179,7 +179,7 @@ function HsrRecordingIframe (url) { element.style.display = 'none'; } } - if (isLinkHrefAttr && 'data-matomo-href' in data.attributes && data.attributes['data-matomo-href']) { + if (isLinkHrefAttr && data && 'data-matomo-href' in data.attributes && data.attributes['data-matomo-href']) { if (shouldUnresolve(String(data.attributes['data-matomo-href']))) { data.attributes['href'] = '#not_possible_to_resolve'; // this URL cannot be resolved and is injected dynamically diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/javascripts/rowaction.js b/files/plugin-HeatmapSessionRecording-5.2.6/javascripts/rowaction.js similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/javascripts/rowaction.js rename to files/plugin-HeatmapSessionRecording-5.2.6/javascripts/rowaction.js diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/bg.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/bg.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/bg.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/bg.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/cs.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/cs.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/cs.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/cs.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/lang/da.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/da.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/da.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/de.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/de.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/de.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/de.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/en.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/en.json similarity index 97% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/en.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/en.json index 9f39115..a28e225 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/lang/en.json +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/en.json @@ -164,6 +164,7 @@ "ErrorPageRuleRequired": "At least one page rule has to be set.", "HeatmapCreated": "The heatmap has been successfully created.", "HeatmapUpdated": "The heatmap has been successfully updated.", + "HeatmapCopied": "The heatmap has been successfully copied.", "SessionRecordingCreated": "The session recording has been successfully created.", "SessionRecordingUpdated": "The session recording has been successfully updated.", "FieldNamePlaceholder": "eg 'Sign Up Page'", @@ -232,6 +233,11 @@ "SessionRecordingPausedActivity": "paused the session recording \"%1$s\" for site \"%2$s\"", "SessionRecordingResumedActivity": "resumed the session recording \"%1$s\" for site \"%2$s\"", "RecordedSessionDeletedActivity": "deleted a recorded session for session recording \"%1$s\" for site \"%2$s\"", - "RecordedPageviewDeletedActivity": "deleted a recorded page view for session recording \"%1$s\" for site \"%2$s\"" + "RecordedPageviewDeletedActivity": "deleted a recorded page view for session recording \"%1$s\" for site \"%2$s\"", + "QuotaReachedForX": "You’ve reached your quota limit. Unable to copy the %1$s due to exceeded usage. Consider deleting unused or less critical %2$s to manage your quota.", + "HeatmapDuplicationError": "Process incomplete. The heatmap could not be copied to all selected sites. Failed sites: %1$s. Successful sites: %2$s.", + "None": "None", + "SourceHeatmapLookupError": "There was an unexpected error looking up the source heatmap. Please try again. Contact your administrator or support if the problem persists.", + "HeatmapDuplicationSiteTypeError": "Copy feature is not supported for sites: %1$s." } } diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/es.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/es.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/es.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/es.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/lang/fi.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/fi.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/fi.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/fr.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/fr.json similarity index 93% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/fr.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/fr.json index fb505f8..2763f48 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/lang/fr.json +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/fr.json @@ -24,7 +24,9 @@ "CaptureKeystrokes": "Enregistrement des frappes de clavier", "CaptureKeystrokesHelp": "Si cette option est activée, tout le texte saisi dans les champs de formulaire texte seront enregistrés. Pendant l'enregistrement du texte, tout caractère saisi par l'utilisateur est remplacé par une étoile ('*'). Vous pouvez établir une liste blanche de certains champs qui seront enregistrés en texte brut en spécifiant un attribut \"data-matomo-unmask\" sur un champ de formulaire. Toutefois, les champs relatifs au mot de passe et de nombreux autres champs susceptibles de contenir des informations personnelles (adresse, courriel, informations relatives à la carte de crédit, nom d'utilisateur, numéro de téléphone, ...) seront toujours automatiquement masqués si nous les détectons comme tels (%1$sen savoir plus%2$s). Veuillez noter que lorsque vous activez cette fonction, vous pouvez enregistrer des données personnelles, ce qui peut entrer en conflit avec le RGPD.", "ChangeReplaySpeed": "Modifier la vitesse de lecture (raccourci %s)", + "ClickRate": "Taux de clics :", "ClickToSkipPauses": "Cliquez pour %1$s sauter les pauses (raccourci %2$s)", + "Clicks": "Clics :", "ColumnActionsDocumentation": "Lire la session enregistrée ou supprimez l'enregistrement de façon permanente.", "ColumnBrowserDocumentation": "Le navigateur que le visiteur utilisait au moment de l'enregistrement de cette session.", "ColumnDeviceDocumentation": "L'appareil que le visiteur utilisait lorsque cette session a été enregistrée.", @@ -99,13 +101,21 @@ "Filter": "Filtre", "GettingStarted": "Démarrer", "Heatmap": "Carte de chaleur", + "HeatmapAddedActivity": "a ajouté une carte thermique \"%1$s\" pour le site \"%2$s\"", "HeatmapCreated": "La carte de chaleur a été créée avec succès.", + "HeatmapDeletedActivity": "a supprimé la carte de chaleur \"%1$s\" pour le site \"%2$s\"", + "HeatmapEndedActivity": "a terminé la carte de chaleur \"%1$s\" pour le site \"%2$s\"", "HeatmapInfoTrackVisitsFromCountries": "La carte de chaleur est configurée pour ne suivre que les visites provenant de %1$s.", "HeatmapNameHelp": "Définit le nom sous lequel le rapport de cette carte de chaleur sera disponible.", + "HeatmapPausedActivity": "a mis en pause la carte de chaleur \"%1$s\" pour le site \"%2$s\"", + "HeatmapResumedActivity": "a repris la carte de chaleur \"%1$s\" pour le site \"%2$s\"", "HeatmapSampleLimit": "Nombre de pages vues", "HeatmapSampleLimitHelp": "Définit le nombre de pages vues que vous souhaitez enregistrer au total.", "HeatmapSampleRateHelp": "Également connu sous le nom de \"trafic\". Lorsque vous sélectionnez 100%%, tous les visiteurs qui se rendent sur la page cible sélectionnée seront enregistrés. Si vous sélectionnez par exemple 10 %%, seul un visiteur sur dix sera enregistré. Plus le pourcentage sélectionné est faible, plus il faudra de temps pour atteindre la limite d'échantillonnage choisie.", + "HeatmapScreenshotDeletedActivity": "a supprimé la capture d'écran de la carte de chaleur \"%1$s\" pour le site \"%2$s\"", + "HeatmapTroubleshoot": "Vous rencontrez des problèmes ? %1$sEn savoir plus%2$s.", "HeatmapUpdated": "La carte de chaleur a été mise à jour avec succès.", + "HeatmapUpdatedActivity": "a mis à jour la carte de chaleur \"%1$s\" pour le site \"%2$s\"", "HeatmapUsageBenefits": "Les cartes de chaleur vous permettent d'enregistrer tous les clics, mouvements de souris et activités de défilement de vos visiteurs sur une page donnée. Cela vous permet de savoir où les utilisateurs pensent que quelque chose est cliquable mais ne l'est pas, s'il y a des parties de la page qui sont à peine consultées ou avec lesquelles il y a peu d'interaction, ce que vos visiteurs recherchent, quelle partie de la page est visible lorsque les utilisateurs consultent votre page, et plus encore.", "HeatmapWidth": "Largeur de la carte de chaleur", "HeatmapX": "Carte de chaleur %s", @@ -119,6 +129,8 @@ "MatomoJSNotWritableErrorMessage": "HeatmapSessionRecording : %1$s ne peut actuellement pas suivre les visites, car le fichier matomo.js est en lecture seule. Veuillez consulter la %2$sdocumentation%3$s pour savoir comment rendre le fichier modifiable.", "MinSessionTime": "Durée minimale de la visite", "MinSessionTimeHelp": "Une session ne sera enregistrée que lorsqu'un visiteur aura passé au moins le temps spécifié sur une page.", + "MoveRate": "Taux de mouvements :", + "Moves": "Mouvements :", "NHeatmaps": "%s cartes de chaleur", "NSessionRecordings": "%s enregistrements de sessions", "NoHeatmapSamplesRecordedYet": "Aucune page vue n'a encore été enregistrée pour cette carte de chaleur. Si des enregistrements sont censés avoir lieu à l'heure actuelle, il se peut que les pages cibles configurées pour cette carte de chaleur ne correspondent à aucune page de votre site Web. Il est également recommandé de vérifier la \"Vérification du système\" sous \"Administration\" (uniquement pour les super utilisateurs) pour voir si votre système est configuré pour suivre automatiquement les cartes de chaleur.", @@ -149,6 +161,8 @@ "PlayerRewindFast": "Rembobiner %1$s secondes (raccourci %2$s)", "RecordedHeatmapDocStatusActive": "Cette carte de chaleur est active. Jusqu'à %1$d pages vues seront enregistrées avec un taux d'échantillonnage de %2$s.", "RecordedHeatmapDocStatusEnded": "Cette carte de chaleur est terminée. Aucune nouvelle activité ne sera enregistrée.", + "RecordedPageviewDeletedActivity": "a supprimé une vue de page enregistrée pour l'enregistrement de session \"%1$s\" pour le site \"%2$s\"", + "RecordedSessionDeletedActivity": "a supprimé un enregistrement de session pour l'enregistrement de session \"%1$s\" pour le site \"%2$s\"", "RecordedSessions": "Sessions enregistrées", "RecordedSessionsDocStatusActive": "L'enregistrement de cette session est actif. Jusqu'à %1$d sessions seront enregistrées avec une fréquence d'échantillonnage de %2$s.", "RecordedSessionsDocStatusEnded": "L'enregistrement de cette session est terminé et aucune nouvelle session ne sera enregistrée.", @@ -165,9 +179,15 @@ "ScreenshotUrlHelp": "Par défaut, une capture d'écran est réalisée lorsque le premier visiteur visualise la page cible. Si différentes URLs de pages correspondent à votre page cible, vous pouvez spécifier une URL spécifique qui doit être utilisée pour capturer l'écran. La visualisation de la carte de chaleur ne sera disponible que lorsqu'au moins un visiteur aura visité cette URL dont les activités sont enregistrées. Si elle est définie, l'URL doit correspondre exactement. Pour ignorer le protocole, commencez l'URL par deux doubles barres obliques (//exemple.com). Veuillez noter que cette URL ne peut pas être modifiée dès qu'une capture d'écran a été réalisée.", "SessionNameHelp": "Définit le nom sous lequel les enregistrements de la session seront disponibles.", "SessionRecording": "Enregistrement de sessions", + "SessionRecordingAddedActivity": "a ajouté un enregistrement de session \"%1$s\" pour le site \"%2$s\"", "SessionRecordingCreated": "L'enregistrement de la session a été créé avec succès.", + "SessionRecordingDeletedActivity": "a supprimé l'enregistrement de session \"%1$s\" pour le site %2$s\"", + "SessionRecordingEndedActivity": "a terminé l'enregistrement de session \"%1$s\" pour le site \"%2$s\"", "SessionRecordingInfoTrackVisitsFromCountries": "L'enregistrement de session est configuré pour ne suivre que les visites provenant de %1$s.", + "SessionRecordingPausedActivity": "a mis en pause l'enregistrement de session \"%1$s\" pour le site \"%2$s\"", + "SessionRecordingResumedActivity": "a repris l'enregistrement de session \"%1$s\" pour le site \"%2$s\"", "SessionRecordingUpdated": "L'enregistrement de la session a été mis à jour avec succès.", + "SessionRecordingUpdatedActivity": "a mis à jour l'enregistrement de session \"%1$s\" pour le site \"%2$s\"", "SessionRecordingX": "Enregistrement de session %s", "SessionRecordings": "Enregistrements des sessions", "SessionRecordingsUsageBenefits": "Les enregistrements de session vous permettent d'enregistrer toutes les activités d'un visiteur réel au cours de sa session (visite), telles que les clics, les mouvements de souris, les défilements, les redimensionnements de fenêtre, les changements de page et les interactions de formulaire. Vous pouvez ensuite rejouer ces interactions pour voir exactement comment un visiteur a interagi avec votre site Web. De cette façon, vous comprenez leurs attentes, les problèmes qu'ils peuvent rencontrer, leurs habitudes d'utilisation, etc.", diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/lang/hi.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/hi.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/hi.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/it.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/it.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/it.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/it.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/lang/ja.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/ja.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/ja.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/nb.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/nb.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/nb.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/nb.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/nl.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/nl.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/nl.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/nl.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/pl.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/pl.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/pl.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/pl.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/pt.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/pt.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/pt.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/pt.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/ro.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/ro.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/ro.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/ro.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/lang/ru.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/ru.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/ru.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/sq.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/sq.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/sq.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/sq.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/sv.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/sv.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/sv.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/sv.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/tr.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/tr.json similarity index 94% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/tr.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/tr.json index c6d49fb..1def63f 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/lang/tr.json +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/tr.json @@ -101,13 +101,21 @@ "Filter": "Süzgeç", "GettingStarted": "Başlarken", "Heatmap": "Isı haritası", + "HeatmapAddedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritasını ekledi", "HeatmapCreated": "Isı haritası eklendi.", + "HeatmapDeletedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritasını sildi", + "HeatmapEndedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritasını sonlandırdı", "HeatmapInfoTrackVisitsFromCountries": "Sıcaklık haritası yalnızca %1$s ziyaretlerini izlemek için yapılandırılmış.", "HeatmapNameHelp": "Bu ısı haritası raporu için kullanılacak adı belirler.", + "HeatmapPausedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritasını duraklattı", + "HeatmapResumedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritasını sürdürdü", "HeatmapSampleLimit": "Sayfa gösterimi sayısı", "HeatmapSampleLimitHelp": "Kaydedilmesini istediğiniz toplam sayfa gösterimi sayısı.", "HeatmapSampleRateHelp": "'Trafik' olarak da bilinir. %%100 seçildiğinde, seçilmiş hedef sayfayı ziyaret eden tüm ziyaretçiler kaydedilir. Örneğin %%10 seçildiğinde, her 10 ziyaretçiden biri kaydedilir. Yüzde değerini azalttığınızda seçilmiş örnek sınırına erişilmesi daha uzun zaman alır.", + "HeatmapScreenshotDeletedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritası ekran görüntüsünü sildi", + "HeatmapTroubleshoot": "Sorun mu yaşıyorsunuz? %1$sAyrıntılı bilgi alın%2$s.", "HeatmapUpdated": "Isı haritası güncellendi.", + "HeatmapUpdatedActivity": "\"%2$s\" sitesi için \"%1$s\" sıcaklık haritasını güncelledi", "HeatmapUsageBenefits": "Isı haritaları, belirli bir sayfa için ziyaretçilerin tüm tıklama, fare hareketi ve kaydırma işlemlerinin kaydedilmesini sağlar. Böylece ziyaretçilerin, tıklanabilir olduğunu düşündükleri halde tıklanamayan bileşenleri, sayfada görmedikleri ya da etkileşim içinde oldukları bölümleri, neye baktıklarını, sayfanın ne kadarını gördükleri gibi bilgileri öğrenebilirsiniz.", "HeatmapWidth": "Isı haritası genişliği", "HeatmapX": "%sısı haritası", @@ -153,6 +161,8 @@ "PlayerRewindFast": "%1$s saniye geri git (%2$s kısayolu)", "RecordedHeatmapDocStatusActive": "Bu ısı haritası etkin. %2$s örnekleme hızı ile en çok %1$d sayfa gösterimi kaydedilebilir.", "RecordedHeatmapDocStatusEnded": "Bu ısı haritası sona ermiş. Yeni işlemler kaydedilmeyecek.", + "RecordedPageviewDeletedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydının kaydedilmiş bir sayfa görünümünü sildi", + "RecordedSessionDeletedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydının bir oturum kaydını sildi", "RecordedSessions": "Kaydedilmiş oturumlar", "RecordedSessionsDocStatusActive": "Bu oturum kaydı etkin. %2$s örnekleme hızı ile en çok %1$d oturum kaydedilebilir.", "RecordedSessionsDocStatusEnded": "Bu oturum kaydı sona erdi ve yeni bir oturum kaydedilmeyecek.", @@ -169,9 +179,15 @@ "ScreenshotUrlHelp": "Varsayılan olarak, bir ziyaretçi bir hedef sayfasını ilk kez görüntülediğinde bir ekran görüntüsü kaydedilir. Hedef sayfanız ile birden çok sayfa adresi eşleşiyorsa ekran görüntüsünün kaydedileceği belirli bir adres yazabilirsiniz. Isı haritası görselleştirmesi yalnızca işlemleri kaydedilen bir ziyaretçinin bu adrese erişmesinden sonra oluşturulur. Belirtildiğinde adres tam olarak eşleşmelidir. İletişim kuralının yok sayılması için adresin başına iki tane bölü karakteri ekleyin (//ornek.com gibi). Bir ekran görüntüsü kaydedildikten sonra bu adresin değiştirilemeyeceğini unutmayın.", "SessionNameHelp": "Oturum kayıtları için kullanılacak adı belirler.", "SessionRecording": "Oturum kaydı", + "SessionRecordingAddedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydını ekledi", "SessionRecordingCreated": "Oturum kaydı eklendi.", + "SessionRecordingDeletedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydını sildi", + "SessionRecordingEndedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydını sonlandırdı", "SessionRecordingInfoTrackVisitsFromCountries": "Oturum kaydı yalnızca %1$s ziyaretlerini izlemek için yapılandırılmış.", + "SessionRecordingPausedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydını duraklattı", + "SessionRecordingResumedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydını sürdürdü", "SessionRecordingUpdated": "Oturum kaydı güncellendi.", + "SessionRecordingUpdatedActivity": "\"%2$s\" sitesi için \"%1$s\" oturum kaydını güncelledi", "SessionRecordingX": "%s oturum kaydı", "SessionRecordings": "Oturum kayıtları", "SessionRecordingsUsageBenefits": "Oturum kayıtları, gerçek bir ziyaretçinin oturumu sırasında yaptığı tıklama, fare hareketi, kaydırma, pencereyi yeniden boyutlandırma, sayfa değiştirme ve form etkileşimi gibi işlemlerin kaydedilmesini sağlar. Bir ziyaretçinin sitenizle nasıl etkileşime girdiğini tam olarak görmek için bu etkileşimleri daha sonra yeniden oynatabilirsiniz. Böylece ziyaretçilerin beklentileri, yaşamış olabilecekleri sorunlar, kullanım alışkanlıkları gibi pek çok şeyi öğrenebilirsiniz.", diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/uk.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/uk.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/uk.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/uk.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/lang/zh-cn.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/zh-cn.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/lang/zh-cn.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/lang/zh-tw.json b/files/plugin-HeatmapSessionRecording-5.2.6/lang/zh-tw.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/lang/zh-tw.json rename to files/plugin-HeatmapSessionRecording-5.2.6/lang/zh-tw.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/MutationObserver.js b/files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/MutationObserver.js similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/MutationObserver.js rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/MutationObserver.js diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/README.md b/files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/README.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/README.md rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/README.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/dist/README.md b/files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/dist/README.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/dist/README.md rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/dist/README.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/dist/mutationobserver.min.js b/files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/dist/mutationobserver.min.js similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/dist/mutationobserver.min.js rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/dist/mutationobserver.min.js diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/license b/files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/license similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/license rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/license diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/package.json b/files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/package.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/MutationObserver.js/package.json rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/MutationObserver.js/package.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/COPYING b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/COPYING similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/COPYING rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/COPYING diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/README.md b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/README.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/README.md rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/README.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/package.json b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/package.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/package.json rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/package.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/src/mutation-summary.js b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/src/mutation-summary.js similarity index 95% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/src/mutation-summary.js rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/src/mutation-summary.js index 475fd5d..feef885 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/src/mutation-summary.js +++ b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/src/mutation-summary.js @@ -11,24 +11,32 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; - -// Modified by InnoCraft to not fail if MutationObserver is not defined, eg IE 10 and lower +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); var MutationObserverCtor; -if (typeof WebKitMutationObserver !== 'undefined') { +if (typeof WebKitMutationObserver !== 'undefined') MutationObserverCtor = WebKitMutationObserver; -} else if (typeof MutationObserver !== 'undefined') { +else MutationObserverCtor = MutationObserver; +if (MutationObserverCtor === undefined) { + console.error('DOM Mutation Observers are required.'); + console.error('https://developer.mozilla.org/en-US/docs/DOM/MutationObserver'); + throw Error('DOM Mutation Observers are required'); } - -if (MutationObserverCtor) { - -var NodeMap = (function () { +var NodeMap = /** @class */ (function () { function NodeMap() { this.nodes = []; this.values = []; @@ -54,7 +62,7 @@ var NodeMap = (function () { NodeMap.prototype.has = function (node) { return this.nodeId(node) in this.nodes; }; - NodeMap.prototype.delete = function (node) { + NodeMap.prototype["delete"] = function (node) { var id = this.nodeId(node); delete this.nodes[id]; this.values[id] = undefined; @@ -71,7 +79,7 @@ var NodeMap = (function () { NodeMap.ID_PROP = '__mutation_summary_node_map_id__'; NodeMap.nextId_ = 1; return NodeMap; -})(); +}()); /** * var reachableMatchableProduct = [ * // STAYED_OUT, ENTERED, STAYED_IN, EXITED @@ -93,7 +101,7 @@ var Movement; function enteredOrExited(changeType) { return changeType === Movement.ENTERED || changeType === Movement.EXITED; } -var NodeChange = (function () { +var NodeChange = /** @class */ (function () { function NodeChange(node, childList, attributes, characterData, oldParentNode, added, attributeOldValues, characterDataOldValue) { if (childList === void 0) { childList = false; } if (attributes === void 0) { attributes = false; } @@ -174,8 +182,8 @@ var NodeChange = (function () { return this.node.parentNode; }; return NodeChange; -})(); -var ChildListChange = (function () { +}()); +var ChildListChange = /** @class */ (function () { function ChildListChange() { this.added = new NodeMap(); this.removed = new NodeMap(); @@ -184,43 +192,44 @@ var ChildListChange = (function () { this.moved = undefined; } return ChildListChange; -})(); -var TreeChanges = (function (_super) { +}()); +var TreeChanges = /** @class */ (function (_super) { __extends(TreeChanges, _super); function TreeChanges(rootNode, mutations) { - _super.call(this); - this.rootNode = rootNode; - this.reachableCache = undefined; - this.wasReachableCache = undefined; - this.anyParentsChanged = false; - this.anyAttributesChanged = false; - this.anyCharacterDataChanged = false; + var _this = _super.call(this) || this; + _this.rootNode = rootNode; + _this.reachableCache = undefined; + _this.wasReachableCache = undefined; + _this.anyParentsChanged = false; + _this.anyAttributesChanged = false; + _this.anyCharacterDataChanged = false; for (var m = 0; m < mutations.length; m++) { var mutation = mutations[m]; switch (mutation.type) { case 'childList': - this.anyParentsChanged = true; + _this.anyParentsChanged = true; for (var i = 0; i < mutation.removedNodes.length; i++) { var node = mutation.removedNodes[i]; - this.getChange(node).removedFromParent(mutation.target); + _this.getChange(node).removedFromParent(mutation.target); } for (var i = 0; i < mutation.addedNodes.length; i++) { var node = mutation.addedNodes[i]; - this.getChange(node).insertedIntoParent(); + _this.getChange(node).insertedIntoParent(); } break; case 'attributes': - this.anyAttributesChanged = true; - var change = this.getChange(mutation.target); + _this.anyAttributesChanged = true; + var change = _this.getChange(mutation.target); change.attributeMutated(mutation.attributeName, mutation.oldValue); break; case 'characterData': - this.anyCharacterDataChanged = true; - var change = this.getChange(mutation.target); + _this.anyCharacterDataChanged = true; + var change = _this.getChange(mutation.target); change.characterDataMutated(mutation.oldValue); break; } } + return _this; } TreeChanges.prototype.getChange = function (node) { var change = this.get(node); @@ -270,8 +279,8 @@ var TreeChanges = (function (_super) { Movement.EXITED : Movement.STAYED_OUT; }; return TreeChanges; -})(NodeMap); -var MutationProjection = (function () { +}(NodeMap)); +var MutationProjection = /** @class */ (function () { // TOOD(any) function MutationProjection(rootNode, mutations, selectors, calcReordered, calcOldPreviousSibling) { this.rootNode = rootNode; @@ -583,11 +592,11 @@ var MutationProjection = (function () { var node = mutation.removedNodes[j]; recordOldPrevious(node, oldPrevious); if (change.added.has(node)) { - change.added.delete(node); + change.added["delete"](node); } else { change.removed.set(node, true); - change.maybeMoved.delete(node); + change.maybeMoved["delete"](node); } oldPrevious = node; } @@ -595,7 +604,7 @@ var MutationProjection = (function () { for (var j = 0; j < mutation.addedNodes.length; j++) { var node = mutation.addedNodes[j]; if (change.removed.has(node)) { - change.removed.delete(node); + change.removed["delete"](node); change.maybeMoved.set(node, true); } else { @@ -635,7 +644,7 @@ var MutationProjection = (function () { didMove = getPrevious(node) !== getOldPrevious(node); } if (pendingMoveDecision.has(node)) { - pendingMoveDecision.delete(node); + pendingMoveDecision["delete"](node); change.moved.set(node, didMove); } else { @@ -672,8 +681,8 @@ var MutationProjection = (function () { return change.moved.get(node); }; return MutationProjection; -})(); -var Summary = (function () { +}()); +var Summary = /** @class */ (function () { function Summary(projection, query) { var _this = this; this.projection = projection; @@ -721,7 +730,7 @@ var Summary = (function () { return this.projection.getOldPreviousSibling(node); }; return Summary; -})(); +}()); // TODO(rafaelw): Allow ':' and '.' as valid name characters. var validNameInitialChar = /[a-zA-Z_]+/; var validNameNonInitialChar = /[a-zA-Z0-9_\-]+/; @@ -731,7 +740,7 @@ var validNameNonInitialChar = /[a-zA-Z0-9_\-]+/; function escapeQuotes(value) { return '"' + value.replace(/"/, '\\\"') + '"'; } -var Qualifier = (function () { +var Qualifier = /** @class */ (function () { function Qualifier() { } Qualifier.prototype.matches = function (oldValue) { @@ -760,8 +769,8 @@ var Qualifier = (function () { return '[' + this.attrName + ']'; }; return Qualifier; -})(); -var Selector = (function () { +}()); +var Selector = /** @class */ (function () { function Selector() { this.uid = Selector.nextUid++; this.qualifiers = []; @@ -770,14 +779,14 @@ var Selector = (function () { get: function () { return this.tagName.toUpperCase(); }, - enumerable: true, + enumerable: false, configurable: true }); Object.defineProperty(Selector.prototype, "selectorString", { get: function () { return this.tagName + this.qualifiers.join(''); }, - enumerable: true, + enumerable: false, configurable: true }); Selector.prototype.isMatching = function (el) { @@ -1134,7 +1143,7 @@ var Selector = (function () { return 'matchesSelector'; })(); return Selector; -})(); +}()); var attributeFilterPattern = /^([a-zA-Z:_]+[a-zA-Z0-9_\-:\.]*)$/; function validateAttribute(attribute) { if (typeof attribute != 'string') @@ -1174,7 +1183,7 @@ function elementFilterAttributes(selectors) { }); return Object.keys(attributes); } -var MutationSummary = (function () { +var MutationSummary = /** @class */ (function () { function MutationSummary(opts) { var _this = this; this.connected = false; @@ -1394,5 +1403,4 @@ var MutationSummary = (function () { 'observeOwnChanges': true }; return MutationSummary; -})(); -} \ No newline at end of file +}()); diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/src/mutation-summary.ts b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/src/mutation-summary.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/src/mutation-summary.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/src/mutation-summary.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/util/tree-mirror.js b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/util/tree-mirror.js similarity index 77% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/util/tree-mirror.js rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/util/tree-mirror.js index 075bc42..fb63e09 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/util/tree-mirror.js +++ b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/util/tree-mirror.js @@ -1,19 +1,5 @@ -/** - * Custom changes by innocraft: - * Around line 90 and 60 added this block in try catch: - * try { node.setAttribute(name, nodeData.attributes[name]); } catch (e) { } - * because we had some websites where eg a name is '"' and then browser fails with error invalid name - * - * We also applied some custom changes to make sure objects are actually set to prevent random errors. Eg - * if (node.parentNode) => if (node && node.parentNode) - * as we experienced random errors there where for some reason an object is not defined and then no page is being rendered - * because of a JS error - * - * we also removed a possible exception / error to make sure we don't stop rendering the page in case something goes wrong - */ - /// -var TreeMirror = (function () { +var TreeMirror = /** @class */ (function () { function TreeMirror(root, delegate) { this.root = root; this.delegate = delegate; @@ -34,47 +20,39 @@ var TreeMirror = (function () { var node = _this.deserializeNode(data); var parent = _this.deserializeNode(data.parentNode); var previous = _this.deserializeNode(data.previousSibling); - if (node && node.parentNode) + if (node.parentNode) node.parentNode.removeChild(node); }); removed.forEach(function (data) { var node = _this.deserializeNode(data); - if (node && node.parentNode) + if (node.parentNode) node.parentNode.removeChild(node); }); addedOrMoved.forEach(function (data) { var node = _this.deserializeNode(data); var parent = _this.deserializeNode(data.parentNode); var previous = _this.deserializeNode(data.previousSibling); - if (node && parent) { - parent.insertBefore(node, previous ? previous.nextSibling : parent.firstChild); - } + parent.insertBefore(node, previous ? previous.nextSibling : parent.firstChild); }); attributes.forEach(function (data) { var node = _this.deserializeNode(data); - if (node) { - Object.keys(data.attributes).forEach(function (attrName) { - var newVal = data.attributes[attrName]; - if (newVal === null) { - node.removeAttribute(attrName); - } - else { - if (!_this.delegate || - !_this.delegate.setAttribute || - !_this.delegate.setAttribute(node, attrName, newVal)) { - try { - node.setAttribute(attrName, newVal); - } catch (e) {} - } + Object.keys(data.attributes).forEach(function (attrName) { + var newVal = data.attributes[attrName]; + if (newVal === null) { + node.removeAttribute(attrName); + } + else { + if (!_this.delegate || + !_this.delegate.setAttribute || + !_this.delegate.setAttribute(node, attrName, newVal)) { + node.setAttribute(attrName, newVal); } - }); - } + } + }); }); text.forEach(function (data) { var node = _this.deserializeNode(data); - if (node) { - node.textContent = data.textContent; - } + node.textContent = data.textContent; }); removed.forEach(function (node) { delete _this.idMap[node.id]; @@ -82,45 +60,52 @@ var TreeMirror = (function () { }; TreeMirror.prototype.deserializeNode = function (nodeData, parent) { var _this = this; - if (!nodeData) + if (nodeData === null) return null; var node = this.idMap[nodeData.id]; if (node) return node; var doc = this.root.ownerDocument; - if (!doc) + if (doc === null) doc = this.root; switch (nodeData.nodeType) { case Node.COMMENT_NODE: - node = doc.createComment(nodeData.textContent || ''); + node = doc.createComment(nodeData.textContent); break; case Node.TEXT_NODE: - node = doc.createTextNode(nodeData.textContent || ''); + node = doc.createTextNode(nodeData.textContent); break; case Node.DOCUMENT_TYPE_NODE: node = doc.implementation.createDocumentType(nodeData.name, nodeData.publicId, nodeData.systemId); break; case Node.ELEMENT_NODE: if (this.delegate && this.delegate.createElement) - node = this.delegate.createElement(nodeData.tagName, nodeData); + node = this.delegate.createElement(nodeData.tagName); if (!node) - node = doc.createElement(nodeData.tagName); - - if ('undefined' !== typeof nodeData.attributes) { - Object.keys(nodeData.attributes).forEach(function (name) { - if (!_this.delegate || - !_this.delegate.setAttribute || - !_this.delegate.setAttribute(node, name, nodeData.attributes[name])) { - try { - node.setAttribute(name, nodeData.attributes[name]); - } catch (e) { } + try { + node = doc.createElement(nodeData.tagName); + } + catch (e) { + console.log("Removing invalid node", nodeData); + return null; + } + Object.keys(nodeData.attributes).forEach(function (name) { + if (!_this.delegate || + !_this.delegate.setAttribute || + !_this.delegate.setAttribute(node, name, nodeData.attributes[name])) { + try { + node.setAttribute(name, nodeData.attributes[name]); } - }); - } + catch (e) { + console.log("Removing node due to invalid attribute", nodeData); + return null; + } + } + }); break; } if (!node) - return; + throw "ouch"; this.idMap[nodeData.id] = node; if (parent) parent.appendChild(node); @@ -131,8 +116,8 @@ var TreeMirror = (function () { return node; }; return TreeMirror; -})(); -var TreeMirrorClient = (function () { +}()); +var TreeMirrorClient = /** @class */ (function () { function TreeMirrorClient(target, mirror, testingQueries) { var _this = this; this.target = target; @@ -168,7 +153,7 @@ var TreeMirrorClient = (function () { return id; }; TreeMirrorClient.prototype.forgetNode = function (node) { - this.knownNodes.delete(node); + this.knownNodes["delete"](node); }; TreeMirrorClient.prototype.serializeNode = function (node, recursive) { if (node === null) @@ -235,7 +220,7 @@ var TreeMirrorClient = (function () { data.previousSibling = _this.serializeNode(node.previousSibling); data.parentNode = _this.serializeNode(node.parentNode); moved.push(data); - children.delete(node); + children["delete"](node); node = node.nextSibling; } var keys = children.keys(); @@ -280,4 +265,4 @@ var TreeMirrorClient = (function () { }); }; return TreeMirrorClient; -})(); +}()); diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/util/tree-mirror.ts b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/util/tree-mirror.ts similarity index 95% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/util/tree-mirror.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/util/tree-mirror.ts index ff75412..fd5f0d1 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/libs/mutation-summary/util/tree-mirror.ts +++ b/files/plugin-HeatmapSessionRecording-5.2.6/libs/mutation-summary/util/tree-mirror.ts @@ -140,13 +140,23 @@ class TreeMirror { if (this.delegate && this.delegate.createElement) node = this.delegate.createElement(nodeData.tagName); if (!node) - node = doc.createElement(nodeData.tagName); + try { + node = doc.createElement(nodeData.tagName); + } catch (e) { + console.log("Removing invalid node", nodeData); + return null; + } Object.keys(nodeData.attributes).forEach((name) => { if (!this.delegate || !this.delegate.setAttribute || !this.delegate.setAttribute(node, name, nodeData.attributes[name])) { - (node).setAttribute(name, nodeData.attributes[name]); + try { + (node).setAttribute(name, nodeData.attributes[name]); + } catch (e) { + console.log("Removing node due to invalid attribute", nodeData); + return null; + } } }); diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/CHANGELOG.md b/files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/CHANGELOG.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/CHANGELOG.md rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/CHANGELOG.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/LICENSE.txt b/files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/LICENSE.txt similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/LICENSE.txt rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/LICENSE.txt diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/README.md b/files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/README.md similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/README.md rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/README.md diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/dist/svg.js b/files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/dist/svg.js similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/dist/svg.js rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/dist/svg.js diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/dist/svg.min.js b/files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/dist/svg.min.js similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/dist/svg.min.js rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/dist/svg.min.js diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/package.json b/files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/package.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/libs/svg.js/package.json rename to files/plugin-HeatmapSessionRecording-5.2.6/libs/svg.js/package.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/package-lock.json b/files/plugin-HeatmapSessionRecording-5.2.6/package-lock.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/package-lock.json rename to files/plugin-HeatmapSessionRecording-5.2.6/package-lock.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/package.json b/files/plugin-HeatmapSessionRecording-5.2.6/package.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/package.json rename to files/plugin-HeatmapSessionRecording-5.2.6/package.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/phpcs.xml b/files/plugin-HeatmapSessionRecording-5.2.6/phpcs.xml similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/phpcs.xml rename to files/plugin-HeatmapSessionRecording-5.2.6/phpcs.xml diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/plugin.json b/files/plugin-HeatmapSessionRecording-5.2.6/plugin.json similarity index 97% rename from files/plugin-HeatmapSessionRecording-5.2.3/plugin.json rename to files/plugin-HeatmapSessionRecording-5.2.6/plugin.json index 7e29298..9c1463e 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/plugin.json +++ b/files/plugin-HeatmapSessionRecording-5.2.6/plugin.json @@ -1,7 +1,7 @@ { "name": "HeatmapSessionRecording", "description": "Truly understand your visitors by seeing where they click, hover, type and scroll. Replay their actions in a video and ultimately increase conversions.", - "version": "5.2.3", + "version": "5.2.6", "theme": false, "require": { "matomo": ">=5.0.0-rc1,<6.0.0-b1" diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/pull_request_template.md b/files/plugin-HeatmapSessionRecording-5.2.6/pull_request_template.md new file mode 100644 index 0000000..e7d9cf5 --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/pull_request_template.md @@ -0,0 +1,26 @@ +## Description + + +## Issue No + + +## Steps to Replicate the Issue +1. +2. +3. + + + +## Checklist +- [✔/✖] Tested locally or on demo2/demo3? +- [✔/✖/NA] New test case added/updated? +- [✔/✖/NA] Are all newly added texts included via translation? +- [✔/✖/NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue) +- [✔/✖/NA] Version bumped? \ No newline at end of file diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/edit-entities.less b/files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/edit-entities.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/edit-entities.less rename to files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/edit-entities.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/list-entities.less b/files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/list-entities.less similarity index 84% rename from files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/list-entities.less rename to files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/list-entities.less index c7c1189..f7eb356 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/list-entities.less +++ b/files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/list-entities.less @@ -21,6 +21,10 @@ } } + th.action.duplicate-available, td.action.duplicate-available { + width: 280px; + } + .index { width: 60px; } diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/recordings.less b/files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/recordings.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/stylesheets/recordings.less rename to files/plugin-HeatmapSessionRecording-5.2.6/stylesheets/recordings.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/_detectAdBlocker.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/_detectAdBlocker.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/_detectAdBlocker.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/_detectAdBlocker.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/embedPage.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/embedPage.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/embedPage.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/embedPage.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/gettingStartedHeatmaps.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/gettingStartedHeatmaps.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/gettingStartedHeatmaps.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/gettingStartedHeatmaps.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/gettingStartedSessions.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/gettingStartedSessions.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/gettingStartedSessions.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/gettingStartedSessions.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/manageHeatmap.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/manageHeatmap.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/manageHeatmap.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/manageHeatmap.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/manageSessions.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/manageSessions.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/manageSessions.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/manageSessions.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/replayRecording.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/replayRecording.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/replayRecording.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/replayRecording.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/templates/showHeatmap.twig b/files/plugin-HeatmapSessionRecording-5.2.6/templates/showHeatmap.twig similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/templates/showHeatmap.twig rename to files/plugin-HeatmapSessionRecording-5.2.6/templates/showHeatmap.twig diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/tracker.min.js b/files/plugin-HeatmapSessionRecording-5.2.6/tracker.min.js similarity index 99% rename from files/plugin-HeatmapSessionRecording-5.2.3/tracker.min.js rename to files/plugin-HeatmapSessionRecording-5.2.6/tracker.min.js index 91383a4..c2c4440 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/tracker.min.js +++ b/files/plugin-HeatmapSessionRecording-5.2.6/tracker.min.js @@ -116,7 +116,7 @@ z.recordData(c,aS)}}})}catch(aP){U(aP)}},onResize:function(){var aP=r.getWindowS }}},onClick:function(aU){U("click");if(!Q){Q=true;ak.checkTrackersIfConditionsMet()}if(!("target" in aU)||!("pageY" in aU)||!("pageX" in aU)||!aU.target){return}var aT=au.getTimeSincePageReady();ak.lastMove=null;var aV=aN.getOffset(aU.target);var aR=parseInt(((aU.pageX-aV.left)/aV.width)*aA,10);var aQ=parseInt(((aU.pageY-aV.top)/aV.height)*aA,10);var aP=aN.getSelector(aU.target);if(aR%2===1){aR++}if(aQ%2===1){aQ++}if(l&&(isNaN(aR)||isNaN(aQ))){U("could not detect x or y coordinate for selector "+aP,aU)}var aS={ti:aT,ty:aJ,s:aP,x:aR,y:aQ};if(aP){z.recordData(aD,aS)}else{U("No selector found for click ",aU)}},onCssLoaded:function(aR){var aU=document.styleSheets;var aV=false;for(var aQ=0;aQ { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { - class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["btn-flat", _defineProperty({ - 'visActive': theHeatmapType.key === _ctx.heatmapType - }, "heatmapType".concat(theHeatmapType.key), true)]), - onClick: function onClick($event) { - return _ctx.changeHeatmapType(theHeatmapType.key); - }, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["btn-flat", { + 'visActive': theHeatmapType.key === _ctx.heatmapType, + [`heatmapType${theHeatmapType.key}`]: true + }]), + onClick: $event => _ctx.changeHeatmapType(theHeatmapType.key), key: theHeatmapType.key }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(theHeatmapType.name), 11, _hoisted_5); - }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h4", _hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeviceType')), 1), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.deviceTypesWithSamples, function (theDeviceType) { + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h4", _hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeviceType')), 1), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.deviceTypesWithSamples, theDeviceType => { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { - class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["btn-flat", _defineProperty({ - 'visActive': theDeviceType.key === _ctx.deviceType - }, "deviceType".concat(theDeviceType.key), true)]), + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["btn-flat", { + 'visActive': theDeviceType.key === _ctx.deviceType, + [`deviceType${theDeviceType.key}`]: true + }]), title: theDeviceType.tooltip, - onClick: function onClick($event) { - return _ctx.changeDeviceType(theDeviceType.key); - }, + onClick: $event => _ctx.changeDeviceType(theDeviceType.key), key: theDeviceType.key }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { height: "15", src: theDeviceType.logo, - alt: "".concat(_ctx.translate('DevicesDetection_Device'), " ").concat(theDeviceType.name) - }, null, 8, _hoisted_8), _hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_10, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(theDeviceType.numSamples), 1)], 10, _hoisted_7); - }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h4", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Installation_Legend')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_12, [_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + alt: `${_ctx.translate('DevicesDetection_Device')} ${theDeviceType.name}` + }, null, 8, _hoisted_8), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(theDeviceType.numSamples), 1)], 10, _hoisted_7); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h4", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Installation_Legend')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_11, [_hoisted_12, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { class: "gradient", alt: "gradient", src: _ctx.gradientImgData - }, null, 8, _hoisted_14), _hoisted_15])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + }, null, 8, _hoisted_13), _hoisted_14])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { style: { "margin-left": "2.5rem", "margin-right": "13.5px" }, textContent: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_Width')) - }, null, 8, _hoisted_17), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + }, null, 8, _hoisted_16), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "select", name: "iframewidth", "model-value": _ctx.customIframeWidth, - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => { _ctx.customIframeWidth = $event; - _ctx.changeIframeWidth(_ctx.customIframeWidth, true); }), options: _ctx.iframeWidthOptions - }, null, 8, ["model-value", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_20, null, 512), _hoisted_21]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + }, null, 8, ["model-value", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_19, null, 512), _hoisted_20]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "hsrLoadingOuter", style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])([{ "height": "400px" }, { width: _ctx.iframeWidth + 'px' }]) - }, [_hoisted_22, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_23, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_24, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Loading')), 1)])], 4), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + }, [_hoisted_21, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_22, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_23, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Loading')), 1)])], 4), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "aboveFoldLine", title: _ctx.translate('HeatmapSessionRecording_AvgAboveFoldDescription'), style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ width: _ctx.iframeWidth + 'px', top: _ctx.avgFold + 'px' }) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_AvgAboveFoldTitle', _ctx.avgFold)), 1)], 12, _hoisted_25), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.avgFold]]), _ctx.embedUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("iframe", { + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_AvgAboveFoldTitle', _ctx.avgFold)), 1)], 12, _hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.avgFold]]), _ctx.embedUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("iframe", { key: 0, id: "recordingPlayer", ref: "recordingPlayer", sandbox: "allow-scripts allow-same-origin", referrerpolicy: "no-referrer", - onLoad: _cache[1] || (_cache[1] = function ($event) { - return _ctx.onLoaded(); - }), + onLoad: _cache[1] || (_cache[1] = $event => _ctx.onLoaded()), height: "400", src: _ctx.embedUrl, width: _ctx.iframeWidth - }, null, 40, _hoisted_26)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + }, null, 40, _hoisted_25)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_26, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { style: { "display": "block !important" }, loading: _ctx.isLoading, - onClick: _cache[2] || (_cache[2] = function ($event) { - return _ctx.deleteScreenshot(); - }), + onClick: _cache[2] || (_cache[2] = $event => _ctx.deleteScreenshot()), value: _ctx.translate('HeatmapSessionRecording_DeleteScreenshot') - }, null, 8, ["loading", "value"])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showDeleteScreenshot]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_28, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeleteHeatmapScreenshotConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, ["loading", "value"])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showDeleteScreenshot]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeleteHeatmapScreenshotConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", type: "button", value: _ctx.translate('General_Yes') - }, null, 8, _hoisted_29), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, _hoisted_28), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "no", type: "button", value: _ctx.translate('General_No') - }, null, 8, _hoisted_30)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Tooltip, { + }, null, 8, _hoisted_29)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Tooltip, { ref: "tooltip", "click-count": _ctx.clickCount, "click-rate": _ctx.clickRate, "is-moves": _ctx.heatmapType === 1 }, null, 8, ["click-count", "click-rate", "is-moves"])]); } -// CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVis.vue?vue&type=template&id=0ffe1e93 +// CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVis.vue?vue&type=template&id=d1a5d966 // EXTERNAL MODULE: ./plugins/HeatmapSessionRecording/node_modules/heatmap.js/build/heatmap.js var heatmap = __webpack_require__("246e"); @@ -1122,11 +1100,9 @@ function getIframeWindow(iframeElement) { if (iframeElement && iframeElement.contentWindow) { return iframeElement.contentWindow; } - if (iframeElement && iframeElement.contentDocument && iframeElement.contentDocument.defaultView) { return iframeElement.contentDocument.defaultView; } - return undefined; } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/oneAtATime.ts @@ -1144,44 +1120,43 @@ function getIframeWindow(iframeElement) { * @link https://www.innocraft.com/ * @license For license details see https://www.innocraft.com/license */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any +// eslint-disable-next-line @typescript-eslint/no-explicit-any function oneAtATime(method, options) { - var abortController = null; - return function (params, postParams) { + let abortController = null; + return (params, postParams) => { if (abortController) { abortController.abort(); abortController = null; } - abortController = new AbortController(); return external_CoreHome_["AjaxHelper"].post(Object.assign(Object.assign({}, params), {}, { - method: method + method }), postParams, Object.assign(Object.assign({}, options), {}, { - abortController: abortController - })).finally(function () { + abortController + })).finally(() => { abortController = null; }); }; } -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/Tooltip/Tooltip.vue?vue&type=template&id=6a6ace20 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/Tooltip/Tooltip.vue?vue&type=template&id=6a6ace20 -var Tooltipvue_type_template_id_6a6ace20_hoisted_1 = { +const Tooltipvue_type_template_id_6a6ace20_hoisted_1 = { class: "tooltip-item" }; -var Tooltipvue_type_template_id_6a6ace20_hoisted_2 = { +const Tooltipvue_type_template_id_6a6ace20_hoisted_2 = { class: "tooltip-label" }; -var Tooltipvue_type_template_id_6a6ace20_hoisted_3 = { +const Tooltipvue_type_template_id_6a6ace20_hoisted_3 = { class: "tooltip-value" }; -var Tooltipvue_type_template_id_6a6ace20_hoisted_4 = { +const Tooltipvue_type_template_id_6a6ace20_hoisted_4 = { class: "tooltip-item" }; -var Tooltipvue_type_template_id_6a6ace20_hoisted_5 = { +const Tooltipvue_type_template_id_6a6ace20_hoisted_5 = { class: "tooltip-label" }; -var Tooltipvue_type_template_id_6a6ace20_hoisted_6 = { +const Tooltipvue_type_template_id_6a6ace20_hoisted_6 = { class: "tooltip-value" }; function Tooltipvue_type_template_id_6a6ace20_render(_ctx, _cache, $props, $setup, $data, $options) { @@ -1193,7 +1168,7 @@ function Tooltipvue_type_template_id_6a6ace20_render(_ctx, _cache, $props, $setu } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/Tooltip/Tooltip.vue?vue&type=template&id=6a6ace20 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/Tooltip/Tooltip.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/Tooltip/Tooltip.vue?vue&type=script&lang=ts /* harmony default export */ var Tooltipvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ @@ -1212,85 +1187,75 @@ function Tooltipvue_type_template_id_6a6ace20_render(_ctx, _cache, $props, $setu default: false } }, - setup: function setup() { - var state = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ + setup() { + const state = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ visible: false, position: { top: 0, left: 0 } }); - var tooltipRef = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(null); - var tooltipStyle = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { - return { - top: "".concat(state.position.top, "px"), - left: "".concat(state.position.left, "px"), - position: 'absolute', - zIndex: 1000 - }; - }); - + const tooltipRef = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(null); + const tooltipStyle = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(() => ({ + top: `${state.position.top}px`, + left: `${state.position.left}px`, + position: 'absolute', + zIndex: 1000 + })); function show(event) { - var scrollTop = window.scrollY || document.documentElement.scrollTop; - var scrollLeft = window.scrollX || document.documentElement.scrollLeft; + const scrollTop = window.scrollY || document.documentElement.scrollTop; + const scrollLeft = window.scrollX || document.documentElement.scrollLeft; state.position.top = event.clientY + scrollTop + 10; state.position.left = event.clientX + scrollLeft + 10; state.visible = true; - Object(external_commonjs_vue_commonjs2_vue_root_Vue_["nextTick"])(function () { - var tooltipElement = tooltipRef.value; - + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["nextTick"])(() => { + const tooltipElement = tooltipRef.value; if (tooltipElement) { - var _window = window, - innerWidth = _window.innerWidth, - innerHeight = _window.innerHeight; - var tooltipRect = tooltipElement.getBoundingClientRect(); - + const { + innerWidth, + innerHeight + } = window; + const tooltipRect = tooltipElement.getBoundingClientRect(); if (tooltipRect.right > innerWidth) { state.position.left = event.clientX + scrollLeft - tooltipRect.width - 10; } - if (tooltipRect.bottom > innerHeight) { state.position.top = event.clientY + scrollTop - tooltipRect.height - 10; } - - var adjustedTooltipRect = tooltipElement.getBoundingClientRect(); - + const adjustedTooltipRect = tooltipElement.getBoundingClientRect(); if (adjustedTooltipRect.left < 0) { state.position.left = scrollLeft + 10; } - if (adjustedTooltipRect.top < 0) { state.position.top = scrollTop + 10; } } }); } - function hide() { state.visible = false; } - return Object.assign(Object.assign({}, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toRefs"])(state)), {}, { - tooltipRef: tooltipRef, - show: show, - hide: hide, - tooltipStyle: tooltipStyle, + tooltipRef, + show, + hide, + tooltipStyle, translate: external_CoreHome_["translate"] }); }, computed: { - getClickCount: function getClickCount() { + getClickCount() { return external_CoreHome_["NumberFormatter"].formatNumber(this.clickCount); }, - getClickRate: function getClickRate() { + getClickRate() { return external_CoreHome_["NumberFormatter"].formatPercent(this.clickRate); }, - getClickCountTranslation: function getClickCountTranslation() { - var translation = this.isMoves ? 'HeatmapSessionRecording_Moves' : 'HeatmapSessionRecording_Clicks'; + getClickCountTranslation() { + const translation = this.isMoves ? 'HeatmapSessionRecording_Moves' : 'HeatmapSessionRecording_Clicks'; return Object(external_CoreHome_["translate"])(translation); }, - getClickRateTranslation: function getClickRateTranslation() { - var translation = this.isMoves ? 'HeatmapSessionRecording_MoveRate' : 'HeatmapSessionRecording_ClickRate'; + getClickRateTranslation() { + const translation = this.isMoves ? 'HeatmapSessionRecording_MoveRate' : 'HeatmapSessionRecording_ClickRate'; return Object(external_CoreHome_["translate"])(translation); } } @@ -1304,95 +1269,76 @@ function Tooltipvue_type_template_id_6a6ace20_render(_ctx, _cache, $props, $setu Tooltipvue_type_script_lang_ts.render = Tooltipvue_type_template_id_6a6ace20_render /* harmony default export */ var Tooltip = (Tooltipvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVis.vue?vue&type=script&lang=ts -function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } - -function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - -function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVis.vue?vue&type=script&lang=ts -function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } - - -var _window = window, - $ = _window.$; -var deviceDesktop = 1; -var deviceTablet = 2; -var deviceMobile = 3; -var heightPerHeatmap = 32000; -var userAgent = String(window.navigator.userAgent).toLowerCase(); - +const { + $ +} = window; +const deviceDesktop = 1; +const deviceTablet = 2; +const deviceMobile = 3; +let heightPerHeatmap = 32000; +const userAgent = String(window.navigator.userAgent).toLowerCase(); if (userAgent.match(/(iPod|iPhone|iPad|Android|IEMobile|Windows Phone)/i)) { heightPerHeatmap = 2000; } else if (userAgent.indexOf('msie ') > 0 || userAgent.indexOf('trident/') > 0 || userAgent.indexOf('edge') > 0) { heightPerHeatmap = 8000; } - -function initHeatmap(recordingPlayer, heatmapContainer, // eslint-disable-next-line @typescript-eslint/no-explicit-any +function initHeatmap(recordingPlayer, heatmapContainer, +// eslint-disable-next-line @typescript-eslint/no-explicit-any recordingIframe) { - var $iframe = $(recordingPlayer); // we first set the iframe to the initial 400px again so we can for sure detect the current + const $iframe = $(recordingPlayer); + // we first set the iframe to the initial 400px again so we can for sure detect the current // height of the inner iframe body correctly - $iframe.css('height', '400px'); - var documentHeight = recordingIframe.getIframeHeight(); - $iframe.css('height', "".concat(documentHeight, "px")); - $(heatmapContainer).css('height', "".concat(documentHeight, "px")).css('width', "".concat($iframe.width(), "px")).empty(); - var numHeatmaps = Math.ceil(documentHeight / heightPerHeatmap); - - for (var i = 1; i <= numHeatmaps; i += 1) { - var height = heightPerHeatmap; - + const documentHeight = recordingIframe.getIframeHeight(); + $iframe.css('height', `${documentHeight}px`); + $(heatmapContainer).css('height', `${documentHeight}px`).css('width', `${$iframe.width()}px`).empty(); + const numHeatmaps = Math.ceil(documentHeight / heightPerHeatmap); + for (let i = 1; i <= numHeatmaps; i += 1) { + let height = heightPerHeatmap; if (i === numHeatmaps) { height = documentHeight % heightPerHeatmap; } - - $(heatmapContainer).append("
")); - $(heatmapContainer).find("#heatmap".concat(i)).css({ - height: "".concat(height, "px") + $(heatmapContainer).append(`
`); + $(heatmapContainer).find(`#heatmap${i}`).css({ + height: `${height}px` }); } - return numHeatmaps; } - -function scrollHeatmap(iframeRecordingContainer, recordingPlayer, // eslint-disable-next-line @typescript-eslint/no-explicit-any +function scrollHeatmap(iframeRecordingContainer, recordingPlayer, +// eslint-disable-next-line @typescript-eslint/no-explicit-any recordingIframe, scrollReaches) { - var $iframe = $(recordingPlayer); // we first set the iframe to the initial 400px again so we can for sure detect the current + const $iframe = $(recordingPlayer); + // we first set the iframe to the initial 400px again so we can for sure detect the current // height of the inner iframe body correctly - $iframe.css('height', '400px'); - var documentHeight = recordingIframe.getIframeHeight(); - $iframe.css('height', "".concat(documentHeight, "px")); - var numIntervals = 1000; - var heightToIntervalRatio = documentHeight / numIntervals; - var numViewersTotal = scrollReaches.reduce(function (pv, cv) { - return pv + parseInt(cv.value, 10); - }, 0); - var buckets = []; - var num_viewers = 0; - var lastBucket = null; - var percentage = 100; - var reachScrolledFromPosition = 0; // reachScrolledFromPosition we start from 0, and then always paint to the next bucket. eg when + const documentHeight = recordingIframe.getIframeHeight(); + $iframe.css('height', `${documentHeight}px`); + const numIntervals = 1000; + const heightToIntervalRatio = documentHeight / numIntervals; + const numViewersTotal = scrollReaches.reduce((pv, cv) => pv + parseInt(cv.value, 10), 0); + const buckets = []; + let num_viewers = 0; + let lastBucket = null; + let percentage = 100; + let reachScrolledFromPosition = 0; + // reachScrolledFromPosition we start from 0, and then always paint to the next bucket. eg when // scrollReach is 27 and scrollDepth is 35, then we know that 27 people have scrolled down to // 3.5% of the page. - - scrollReaches.forEach(function (scrollReachObj) { + scrollReaches.forEach(scrollReachObj => { // the number of people that reached this point - var scrollReach = parseInt(scrollReachObj.value, 10); // how far down they scrolled - - var scrollDepth = parseInt(scrollReachObj.label, 10); - var reachScrolledToPosition = Math.round(scrollDepth * heightToIntervalRatio); - + const scrollReach = parseInt(scrollReachObj.value, 10); + // how far down they scrolled + const scrollDepth = parseInt(scrollReachObj.label, 10); + const reachScrolledToPosition = Math.round(scrollDepth * heightToIntervalRatio); if (lastBucket && lastBucket.position === reachScrolledToPosition) { // when page is < 1000 we need to aggregate buckets num_viewers += scrollReach; @@ -1400,9 +1346,8 @@ recordingIframe, scrollReaches) { if (numViewersTotal !== 0) { percentage = (numViewersTotal - num_viewers) / numViewersTotal * 100; } - - num_viewers += scrollReach; // percentage.toFixed(1) * 10 => convert eg 99.8 => 998 - + num_viewers += scrollReach; + // percentage.toFixed(1) * 10 => convert eg 99.8 => 998 lastBucket = { percentageValue: parseFloat(percentage.toFixed(1)) * 10, position: reachScrolledFromPosition, @@ -1410,47 +1355,34 @@ recordingIframe, scrollReaches) { }; buckets.push(lastBucket); } - reachScrolledFromPosition = reachScrolledToPosition; }); - function map(value, istart, istop, ostart, ostop) { return ostart + (ostop - ostart) * ((value - istart) / (istop - istart)); } - function mapColorIntensity(intensity, min, max) { if (min === max || !min && !max) { return [255, 255, 0]; } - - var cint = map(intensity, min, max, 0, 255); - var step = (max - min) / 5; - + const cint = map(intensity, min, max, 0, 255); + const step = (max - min) / 5; if (cint > 204) { return [255, map(intensity, max - step, max, 255, 0), 0]; } - if (cint > 153) { return [map(intensity, max - 2 * step, max - step, 0, 255), 255, 0]; } - if (cint > 102) { return [0, 255, map(intensity, max - 3 * step, max - 2 * step, 255, 0)]; } - if (cint > 51) { return [0, map(intensity, max - 4 * step, max - 3 * step, 0, 255), 255]; } - return [map(intensity, min, max - 4 * step, 255, 0), 0, 255]; } - if (buckets.length) { // we need to make sure to draw scroll heatmap over full page - var found = buckets.some(function (b) { - return b.position === 0; - }); - + const found = buckets.some(b => b.position === 0); if (!found) { buckets.unshift({ percent: '100.0', @@ -1466,20 +1398,15 @@ recordingIframe, scrollReaches) { position: 0 }); } - - var minValue = 0; - var maxValue = 1000; // max value is always 1000 (=100%) - + let minValue = 0; + const maxValue = 1000; // max value is always 1000 (=100%) if (buckets && buckets.length && buckets[0]) { minValue = buckets[buckets.length - 1].percentageValue; } - - var iframeWidth = $iframe.width(); - var nextBucket = null; - - for (var index = 0; index < buckets.length; index += 1) { - var bucket = buckets[index]; - + const iframeWidth = $iframe.width(); + let nextBucket = null; + for (let index = 0; index < buckets.length; index += 1) { + const bucket = buckets[index]; if (buckets[index + 1]) { nextBucket = buckets[index + 1]; } else { @@ -1487,20 +1414,16 @@ recordingIframe, scrollReaches) { position: documentHeight }; } - - var top = bucket.position; - var height = nextBucket.position - bucket.position; - + const top = bucket.position; + let height = nextBucket.position - bucket.position; if (height === 0) { height = 1; // make sure to draw at least one px } - - var percent = "".concat(bucket.percent, " percent reached this point"); - var colorValues = mapColorIntensity(bucket.percentageValue, minValue, maxValue); - var color = "rgb(".concat(colorValues.join(','), ")"); - $(iframeRecordingContainer).append("
")); + const percent = `${bucket.percent} percent reached this point`; + const colorValues = mapColorIntensity(bucket.percentageValue, minValue, maxValue); + const color = `rgb(${colorValues.join(',')})`; + $(iframeRecordingContainer).append(`
`); } - $('.scrollHeatmapLeaf', iframeRecordingContainer).tooltip({ track: true, items: '*', @@ -1508,32 +1431,31 @@ recordingIframe, scrollReaches) { show: false, hide: false }); - $('.legend-area .min').text("".concat((minValue / 10).toFixed(1), "%")); - $('.legend-area .max').text("".concat((maxValue / 10).toFixed(1), "%")); + $('.legend-area .min').text(`${(minValue / 10).toFixed(1)}%`); + $('.legend-area .max').text(`${(maxValue / 10).toFixed(1)}%`); } - -function actualRenderHeatmap(recordingPlayer, heatmapContainer, // eslint-disable-next-line @typescript-eslint/no-explicit-any +function actualRenderHeatmap(recordingPlayer, heatmapContainer, +// eslint-disable-next-line @typescript-eslint/no-explicit-any recordingIframe, dataPoints) { - var numHeatmaps = initHeatmap(recordingPlayer, heatmapContainer, recordingIframe); - var legendCanvas = document.createElement('canvas'); + const numHeatmaps = initHeatmap(recordingPlayer, heatmapContainer, recordingIframe); + const legendCanvas = document.createElement('canvas'); legendCanvas.width = 100; legendCanvas.height = 10; - var min = document.querySelector('.legend-area .min'); - var max = document.querySelector('.legend-area .max'); - var gradientImg = document.querySelector('.legend-area .gradient'); - var legendCtx = legendCanvas.getContext('2d'); - var gradientCfg = {}; - + const min = document.querySelector('.legend-area .min'); + const max = document.querySelector('.legend-area .max'); + const gradientImg = document.querySelector('.legend-area .gradient'); + const legendCtx = legendCanvas.getContext('2d'); + let gradientCfg = {}; function updateLegend(data) { // the onExtremaChange callback gives us min, max, and the gradientConfig // so we can update the legend - min.innerHTML = "".concat(data.min); - max.innerHTML = "".concat(data.max); // regenerate gradient image - + min.innerHTML = `${data.min}`; + max.innerHTML = `${data.max}`; + // regenerate gradient image if (data.gradient && data.gradient !== gradientCfg) { gradientCfg = data.gradient; - var gradient = legendCtx.createLinearGradient(0, 0, 100, 1); - Object.keys(gradientCfg).forEach(function (key) { + const gradient = legendCtx.createLinearGradient(0, 0, 100, 1); + Object.keys(gradientCfg).forEach(key => { gradient.addColorStop(parseFloat(key), gradientCfg[key]); }); legendCtx.fillStyle = gradient; @@ -1541,61 +1463,49 @@ recordingIframe, dataPoints) { gradientImg.src = legendCanvas.toDataURL(); } } - - var heatmapInstances = []; - - var _loop = function _loop(i) { - var dpoints = { + const heatmapInstances = []; + for (let i = 1; i <= numHeatmaps; i += 1) { + const dpoints = { min: dataPoints.min, max: dataPoints.max, data: [] }; - var config = { - container: document.getElementById("heatmap".concat(i)), + const config = { + container: document.getElementById(`heatmap${i}`), radius: 10, maxOpacity: 0.5, minOpacity: 0, blur: 0.75 }; - if (i === 1) { config.onExtremaChange = updateLegend; // typing is wrong here } - if (dataPoints && dataPoints.data && dataPoints.data.length >= 20000) { config.radius = 8; } else if (dataPoints && dataPoints.data && dataPoints.data.length >= 2000) { config.radius = 9; } - if (numHeatmaps === 1) { dpoints.data = dataPoints.data; } else { - var lowerLimit = (i - 1) * heightPerHeatmap; - var upperLimit = lowerLimit + heightPerHeatmap - 1; - dataPoints.data.forEach(function (dp) { + const lowerLimit = (i - 1) * heightPerHeatmap; + const upperLimit = lowerLimit + heightPerHeatmap - 1; + dataPoints.data.forEach(dp => { if (dp.y >= lowerLimit && dp.y <= upperLimit) { - var thePoint = Object.assign(Object.assign({}, dp), {}, { + const thePoint = Object.assign(Object.assign({}, dp), {}, { y: dp.y - lowerLimit }); dpoints.data.push(thePoint); } }); } - - var heatmapInstance = heatmap_default.a.create(config); // heatmap type requires value to be number, but matomo sets it as string - + const heatmapInstance = heatmap_default.a.create(config); + // heatmap type requires value to be number, but matomo sets it as string heatmapInstance.setData(dpoints); heatmapInstances.push(heatmapInstance); - }; - - for (var i = 1; i <= numHeatmaps; i += 1) { - _loop(i); } - return heatmapInstances; } - /* harmony default export */ var HeatmapVisvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { idSiteHsr: { @@ -1661,7 +1571,7 @@ recordingIframe, dataPoints) { SaveButton: external_CorePluginsAdmin_["SaveButton"], Tooltip: Tooltip }, - data: function data() { + data() { return { isLoading: false, iframeWidth: this.desktopPreviewSize, @@ -1679,16 +1589,15 @@ recordingIframe, dataPoints) { clickRate: 0 }; }, - setup: function setup(props) { - var tooltip = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(null); - var iframeLoadedResolve = null; - var iframeLoadedPromise = new Promise(function (resolve) { + setup(props) { + const tooltip = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(null); + let iframeLoadedResolve = null; + const iframeLoadedPromise = new Promise(resolve => { iframeLoadedResolve = resolve; - }); // eslint-disable-next-line @typescript-eslint/no-explicit-any - - var recordingIframe = null; - - var getRecordingIframe = function getRecordingIframe(recordingPlayer) { + }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let recordingIframe = null; + const getRecordingIframe = recordingPlayer => { if (!recordingIframe) { recordingIframe = getIframeWindow(recordingPlayer).recordingFrame; recordingIframe.excludeElements(props.excludedElements); @@ -1696,115 +1605,93 @@ recordingIframe, dataPoints) { recordingIframe.addClass('html', 'matomoHeatmap'); recordingIframe.addWorkaroundForSharepointHeatmaps(); } - return recordingIframe; }; - - var heatmapInstances = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(null); - - var renderHeatmap = function renderHeatmap(recordingPlayer, heatmapContainer, // eslint-disable-next-line @typescript-eslint/no-explicit-any - theRecordingIframe, dataPoints) { + const heatmapInstances = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(null); + const renderHeatmap = (recordingPlayer, heatmapContainer, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + theRecordingIframe, dataPoints) => { heatmapInstances.value = actualRenderHeatmap(recordingPlayer, heatmapContainer, theRecordingIframe, dataPoints); }; - return { - iframeLoadedPromise: iframeLoadedPromise, + iframeLoadedPromise, onLoaded: iframeLoadedResolve, getRecordedHeatmap: oneAtATime('HeatmapSessionRecording.getRecordedHeatmap'), getRecordedHeatmapMetadata: oneAtATime('HeatmapSessionRecording.getRecordedHeatmapMetadata'), - getRecordingIframe: getRecordingIframe, - heatmapInstances: heatmapInstances, - renderHeatmap: renderHeatmap, - tooltip: tooltip + getRecordingIframe, + heatmapInstances, + renderHeatmap, + tooltip }; }, - created: function created() { + created() { if (this.iframeResolutions.indexOf(this.breakpointMobile) === -1) { this.iframeResolutions.push(this.breakpointMobile); } - if (this.iframeResolutions.indexOf(this.breakpointTablet) === -1) { this.iframeResolutions.push(this.breakpointTablet); } - - this.iframeResolutions = this.iframeResolutions.sort(function (a, b) { - return a - b; - }); - this.fetchHeatmap(); // Hide the period selector since we don't filter the heatmap by period - + this.iframeResolutions = this.iframeResolutions.sort((a, b) => a - b); + this.fetchHeatmap(); + // Hide the period selector since we don't filter the heatmap by period external_CoreHome_["Matomo"].postEvent('hidePeriodSelector'); }, watch: { - isLoading: function isLoading() { - var _this = this; - + isLoading() { if (this.isLoading === true) { return; } - - var heatmapContainer = window.document.getElementById('heatmapContainer'); - + const heatmapContainer = window.document.getElementById('heatmapContainer'); if (!heatmapContainer) { return; } - - heatmapContainer.addEventListener('mouseleave', function (event) { + heatmapContainer.addEventListener('mouseleave', event => { // Stop processing tooltip when moving mouse out of parent element - if (_this.tooltipShowTimeoutId) { - clearTimeout(_this.tooltipShowTimeoutId); - _this.tooltipShowTimeoutId = null; - } // Reset the highlight and tooltip when leaving the container - - - _this.currentElement = null; - - _this.handleTooltip(event, 0, 0, 'hide'); - - var highlightDiv = window.document.getElementById('highlightDiv'); - + if (this.tooltipShowTimeoutId) { + clearTimeout(this.tooltipShowTimeoutId); + this.tooltipShowTimeoutId = null; + } + // Reset the highlight and tooltip when leaving the container + this.currentElement = null; + this.handleTooltip(event, 0, 0, 'hide'); + const highlightDiv = window.document.getElementById('highlightDiv'); if (!highlightDiv) { return; } - highlightDiv.hidden = true; }); - heatmapContainer.addEventListener('mousemove', function (e) { - _this.handleMouseMove(e); + heatmapContainer.addEventListener('mousemove', e => { + this.handleMouseMove(e); }); } }, - beforeUnmount: function beforeUnmount() { + beforeUnmount() { this.removeScrollHeatmap(); }, methods: { - removeScrollHeatmap: function removeScrollHeatmap() { - var element = this.$refs.iframeRecordingContainer; + removeScrollHeatmap() { + const element = this.$refs.iframeRecordingContainer; $(element).find('.scrollHeatmapLeaf').remove(); }, - deleteScreenshot: function deleteScreenshot() { - var _this2 = this; - + deleteScreenshot() { external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmapScreenshot, { - yes: function yes() { - _this2.isLoading = true; + yes: () => { + this.isLoading = true; external_CoreHome_["AjaxHelper"].fetch({ method: 'HeatmapSessionRecording.deleteHeatmapScreenshot', - idSiteHsr: _this2.idSiteHsr - }).then(function () { - _this2.isLoading = false; + idSiteHsr: this.idSiteHsr + }).then(() => { + this.isLoading = false; window.location.reload(); }); } }); }, - fetchHeatmap: function fetchHeatmap() { - var _this3 = this; - + fetchHeatmap() { this.removeScrollHeatmap(); - if (this.heatmapInstances) { - var instances = this.heatmapInstances; - instances.forEach(function (heatmapInstance) { + const instances = this.heatmapInstances; + instances.forEach(heatmapInstance => { heatmapInstance.setData({ max: 1, min: 0, @@ -1812,80 +1699,62 @@ recordingIframe, dataPoints) { }); }); } - this.isLoading = true; this.avgFold = 0; - var segment = external_CoreHome_["MatomoUrl"].parsed.value.segment ? decodeURIComponent(external_CoreHome_["MatomoUrl"].parsed.value.segment) : undefined; - var requestParams = { + const segment = external_CoreHome_["MatomoUrl"].parsed.value.segment ? decodeURIComponent(external_CoreHome_["MatomoUrl"].parsed.value.segment) : undefined; + const requestParams = { idSiteHsr: this.idSiteHsr, heatmapType: this.heatmapType, deviceType: this.deviceType, period: this.heatmapPeriod, date: this.heatmapDate, filter_limit: -1, - segment: segment + segment }; - var heatmapDataPromise = this.getRecordedHeatmap(requestParams); - var heatmapMetaDataPromise = this.getRecordedHeatmapMetadata(requestParams); - Promise.all([heatmapDataPromise, heatmapMetaDataPromise, this.iframeLoadedPromise]).then(function (response) { - var iframeElement = _this3.$refs.recordingPlayer; - - var recordingIframe = _this3.getRecordingIframe(iframeElement); - - initHeatmap(_this3.$refs.recordingPlayer, _this3.$refs.heatmapContainer, recordingIframe); - - _this3.removeScrollHeatmap(); - - var rows = response[0]; - var numSamples = response[1]; - + const heatmapDataPromise = this.getRecordedHeatmap(requestParams); + const heatmapMetaDataPromise = this.getRecordedHeatmapMetadata(requestParams); + Promise.all([heatmapDataPromise, heatmapMetaDataPromise, this.iframeLoadedPromise]).then(response => { + const iframeElement = this.$refs.recordingPlayer; + const recordingIframe = this.getRecordingIframe(iframeElement); + initHeatmap(this.$refs.recordingPlayer, this.$refs.heatmapContainer, recordingIframe); + this.removeScrollHeatmap(); + const rows = response[0]; + const numSamples = response[1]; if (Array.isArray(numSamples) && numSamples[0]) { - var _numSamples = _slicedToArray(numSamples, 1); - - _this3.actualNumSamples = _numSamples[0]; + [this.actualNumSamples] = numSamples; } else { - _this3.actualNumSamples = numSamples; + this.actualNumSamples = numSamples; } - - _this3.isLoading = false; - - if (_this3.isScrollHeatmapType) { - scrollHeatmap(_this3.$refs.iframeRecordingContainer, iframeElement, recordingIframe, rows); + this.isLoading = false; + if (this.isScrollHeatmapType) { + scrollHeatmap(this.$refs.iframeRecordingContainer, iframeElement, recordingIframe, rows); } else { - var _this3$actualNumSampl; - - var dataPoints = { + var _this$actualNumSample; + const dataPoints = { min: 0, max: 0, data: [] }; - - for (var i = 0; i < rows.length; i += 1) { - var row = rows[i]; - + for (let i = 0; i < rows.length; i += 1) { + const row = rows[i]; if (row.selector) { - var dataPoint = recordingIframe.getCoordinatesInFrame(row.selector, row.offset_x, row.offset_y, _this3.offsetAccuracy, true); - + const dataPoint = recordingIframe.getCoordinatesInFrame(row.selector, row.offset_x, row.offset_y, this.offsetAccuracy, true); if (dataPoint) { dataPoint.value = row.value; dataPoints.data.push(dataPoint); - - _this3.dataCoordinates.push(dataPoint); - - _this3.totalClicks += parseInt(row.value, 10); + this.dataCoordinates.push(dataPoint); + this.totalClicks += parseInt(row.value, 10); } } } - - if (_this3.heatmapType === 2) { + if (this.heatmapType === 2) { // click - var numEntriesHigherThan1 = 0; - dataPoints.data.forEach(function (dp) { + let numEntriesHigherThan1 = 0; + dataPoints.data.forEach(dp => { if (dp !== null && dp !== void 0 && dp.value && parseInt(dp.value, 10) > 1) { numEntriesHigherThan1 += 1; } }); - if (numEntriesHigherThan1 / dataPoints.data.length >= 0.10 && dataPoints.data.length > 120) { // if at least 10% have .value >= 2, then we set max to 2 to differntiate better // between 1 and 2 clicks but only if we also have more than 80 data points @@ -1895,95 +1764,78 @@ recordingIframe, dataPoints) { dataPoints.max = 1; } } else { - var LIMIT_MAX_DATA_POINT = 10; - var values = {}; - dataPoints.data.forEach(function (dp) { + const LIMIT_MAX_DATA_POINT = 10; + const values = {}; + dataPoints.data.forEach(dp => { if (!dp || !dp.value) { return; } - - var value = parseInt(dp.value, 10); - + let value = parseInt(dp.value, 10); if (value > dataPoints.max) { dataPoints.max = value; } - if (value > LIMIT_MAX_DATA_POINT) { value = LIMIT_MAX_DATA_POINT; } - - var valueStr = "".concat(value); - + const valueStr = `${value}`; if (valueStr in values) { values[valueStr] += 1; } else { values[valueStr] = 0; } }); - if (dataPoints.max > LIMIT_MAX_DATA_POINT) { // we limit it to 10 otherwise many single points are not visible etc // if there is no single entry having value 10, we set it to 9, 8 or 7 // to make sure there is actually a dataPoint for this max value. - var sumValuesAboveThreshold = 0; - - for (var k = LIMIT_MAX_DATA_POINT; k > 1; k -= 1) { - var kStr = "".concat(k); - + let sumValuesAboveThreshold = 0; + for (let k = LIMIT_MAX_DATA_POINT; k > 1; k -= 1) { + const kStr = `${k}`; if (kStr in values) { // we need to aggregate the value sumValuesAboveThreshold += values[kStr]; } - if (sumValuesAboveThreshold / dataPoints.data.length >= 0.2) { // we make sure to have at least 20% of entries in that max value dataPoints.max = k; break; - } // todo ideally in this case also require that akk 2 - (k-1) have a distribution + } + // todo ideally in this case also require that akk 2 - (k-1) have a distribution // of 0.2 to make sure we have enough values in between, and if not select k-1 or // so. Otherwise we have maybe 75% with value 1, 20% with value 10, and only 5% in // between... which would be barely visible those 75% maybe - } - if (dataPoints.max > LIMIT_MAX_DATA_POINT) { // when no entry has more than 15% distribution, we set a default of 5 dataPoints.max = 5; - - for (var _k = 5; _k > 0; _k -= 1) { - var _kStr = "".concat(_k); - - if (_kStr in values) { + for (let k = 5; k > 0; k -= 1) { + const kStr = `${k}`; + if (kStr in values) { // we limit it to 10 otherwise many single points are not visible etc // also if there is no single entry having value 10, we set it to 9, 8 or 7 // to make sure there is actually a dataPoint for this max value. - dataPoints.max = _k; + dataPoints.max = k; break; } } } } } - - _this3.renderHeatmap(_this3.$refs.recordingPlayer, _this3.$refs.heatmapContainer, recordingIframe, dataPoints); - - if ((_this3$actualNumSampl = _this3.actualNumSamples) !== null && _this3$actualNumSampl !== void 0 && _this3$actualNumSampl["avg_fold_device_".concat(_this3.deviceType)]) { - var avgFoldPercent = _this3.actualNumSamples["avg_fold_device_".concat(_this3.deviceType)]; - - var height = recordingIframe.getIframeHeight(); - + this.renderHeatmap(this.$refs.recordingPlayer, this.$refs.heatmapContainer, recordingIframe, dataPoints); + if ((_this$actualNumSample = this.actualNumSamples) !== null && _this$actualNumSample !== void 0 && _this$actualNumSample[`avg_fold_device_${this.deviceType}`]) { + const avgFoldPercent = this.actualNumSamples[`avg_fold_device_${this.deviceType}`]; + const height = recordingIframe.getIframeHeight(); if (height) { - _this3.avgFold = parseInt("".concat(avgFoldPercent / 100 * height), 10); + this.avgFold = parseInt(`${avgFoldPercent / 100 * height}`, 10); } } } - }).finally(function () { - _this3.isLoading = false; + }).finally(() => { + this.isLoading = false; }); }, - changeDeviceType: function changeDeviceType(deviceType) { + changeDeviceType(deviceType) { this.deviceType = deviceType; - if (this.deviceType === deviceDesktop) { this.changeIframeWidth(this.desktopPreviewSize, false); } else if (this.deviceType === deviceTablet) { @@ -1992,18 +1844,17 @@ recordingIframe, dataPoints) { this.changeIframeWidth(this.breakpointMobile || 600, false); } }, - changeIframeWidth: function changeIframeWidth(iframeWidth, scrollToTop) { + changeIframeWidth(iframeWidth, scrollToTop) { this.iframeWidth = iframeWidth; this.customIframeWidth = this.iframeWidth; this.totalClicks = 0; this.dataCoordinates = []; this.fetchHeatmap(); - if (scrollToTop) { external_CoreHome_["Matomo"].helper.lazyScrollToContent(); } }, - changeHeatmapType: function changeHeatmapType(heatmapType) { + changeHeatmapType(heatmapType) { this.heatmapType = heatmapType; this.totalClicks = 0; this.clickCount = 0; @@ -2011,86 +1862,70 @@ recordingIframe, dataPoints) { this.dataCoordinates = []; this.fetchHeatmap(); }, - handleMouseMove: function handleMouseMove(event) { - var _this4 = this; - - var highlightDiv = window.document.getElementById('highlightDiv'); - + handleMouseMove(event) { + const highlightDiv = window.document.getElementById('highlightDiv'); if (!highlightDiv) { return; - } // Keep the tooltip from showing until the cursor has stopped moving - - + } + // Keep the tooltip from showing until the cursor has stopped moving if (this.tooltipShowTimeoutId) { clearTimeout(this.tooltipShowTimeoutId); this.tooltipShowTimeoutId = null; this.currentElement = null; - } // If the highlight is visible, move the tooltip around with the cursor - - + } + // If the highlight is visible, move the tooltip around with the cursor if (!highlightDiv.hidden) { this.handleTooltip(event, 0, 0, 'move'); } - - var element = this.lookUpRecordedElementAtEventLocation(event); // If there's no element, don't do anything else + const element = this.lookUpRecordedElementAtEventLocation(event); + // If there's no element, don't do anything else // If the element hasn't changed, there's no need to do anything else - if (!element || element === this.currentElement) { return; } - this.handleTooltip(event, 0, 0, 'hide'); highlightDiv.hidden = true; - var elementRect = element.getBoundingClientRect(); - var elementClicks = 0; - this.dataCoordinates.forEach(function (dataPoint) { + const elementRect = element.getBoundingClientRect(); + let elementClicks = 0; + this.dataCoordinates.forEach(dataPoint => { // Return if the dataPoint isn't within the element if (dataPoint.y < elementRect.top || dataPoint.y > elementRect.bottom || dataPoint.x < elementRect.left || dataPoint.x > elementRect.right) { return; } - elementClicks += parseInt(dataPoint.value, 10); - }); // Have a slight delay so that it's not jarring when it displays - - this.tooltipShowTimeoutId = setTimeout(function () { - _this4.currentElement = element; - highlightDiv.hidden = false; // Multiplying by 10000 and then dividing by 100 to get 2 decimal points of precision - - var clickRate = _this4.totalClicks ? Math.round(elementClicks / _this4.totalClicks * 10000) / 100 : 0; - var rect = element.getBoundingClientRect(); - highlightDiv.style.top = "".concat(rect.top, "px"); - highlightDiv.style.left = "".concat(rect.left, "px"); - highlightDiv.style.width = "".concat(rect.width, "px"); - highlightDiv.style.height = "".concat(rect.height, "px"); - - _this4.handleTooltip(event, elementClicks, clickRate, 'show'); - - _this4.tooltipShowTimeoutId = null; + }); + // Have a slight delay so that it's not jarring when it displays + this.tooltipShowTimeoutId = setTimeout(() => { + this.currentElement = element; + highlightDiv.hidden = false; + // Multiplying by 10000 and then dividing by 100 to get 2 decimal points of precision + const clickRate = this.totalClicks ? Math.round(elementClicks / this.totalClicks * 10000) / 100 : 0; + const rect = element.getBoundingClientRect(); + highlightDiv.style.top = `${rect.top}px`; + highlightDiv.style.left = `${rect.left}px`; + highlightDiv.style.width = `${rect.width}px`; + highlightDiv.style.height = `${rect.height}px`; + this.handleTooltip(event, elementClicks, clickRate, 'show'); + this.tooltipShowTimeoutId = null; }, 100); }, - lookUpRecordedElementAtEventLocation: function lookUpRecordedElementAtEventLocation(event) { - var targetElement = event.target; - + lookUpRecordedElementAtEventLocation(event) { + const targetElement = event.target; if (!targetElement) { return null; } - - var frameElement = window.document.getElementById('recordingPlayer'); - + const frameElement = window.document.getElementById('recordingPlayer'); if (!frameElement) { return null; } - - var frameRef = frameElement.contentWindow ? frameElement.contentWindow.document : frameElement.contentDocument; - + const frameRef = frameElement.contentWindow ? frameElement.contentWindow.document : frameElement.contentDocument; if (!frameRef) { return null; } - - var rect = targetElement.getBoundingClientRect(); + const rect = targetElement.getBoundingClientRect(); return frameRef.elementFromPoint(event.clientX - rect.left, event.clientY - rect.top); }, - handleTooltip: function handleTooltip(event, clickCount, clickRate, action) { + handleTooltip(event, clickCount, clickRate, action) { if (this.tooltip) { if (action === 'show') { this.clickCount = clickCount; @@ -2105,61 +1940,55 @@ recordingIframe, dataPoints) { } }, computed: { - isScrollHeatmapType: function isScrollHeatmapType() { + isScrollHeatmapType() { return this.heatmapType === 3; }, - tokenAuth: function tokenAuth() { + tokenAuth() { return external_CoreHome_["MatomoUrl"].parsed.value.token_auth; }, - embedUrl: function embedUrl() { - return "?".concat(external_CoreHome_["MatomoUrl"].stringify({ + embedUrl() { + return `?${external_CoreHome_["MatomoUrl"].stringify({ module: 'HeatmapSessionRecording', action: 'embedPage', idSite: external_CoreHome_["Matomo"].idSite, idSiteHsr: this.idSiteHsr, token_auth: this.tokenAuth || undefined - })); - }, - iframeWidthOptions: function iframeWidthOptions() { - return this.iframeResolutions.map(function (width) { - return { - key: width, - value: "".concat(width, "px") - }; - }); + })}`; }, - recordedSamplesSince: function recordedSamplesSince() { - var string1 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapXRecordedSamplesSince', "".concat(this.actualNumSamples.nb_samples_device_all, ""), this.createdDate); - var linkString = Object(external_CoreHome_["externalLink"])('https://matomo.org/subcategory/troubleshoot-7/'); - var string2 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapTroubleshoot', linkString, ''); - return "".concat(string1, " ").concat(string2); + iframeWidthOptions() { + return this.iframeResolutions.map(width => ({ + key: width, + value: `${width}px` + })); }, - deviceTypesWithSamples: function deviceTypesWithSamples() { - var _this5 = this; - - return this.deviceTypes.map(function (deviceType) { - var numSamples; - - if (_this5.actualNumSamples["nb_samples_device_".concat(deviceType.key)]) { - numSamples = _this5.actualNumSamples["nb_samples_device_".concat(deviceType.key)]; + recordedSamplesSince() { + const string1 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapXRecordedSamplesSince', `${this.actualNumSamples.nb_samples_device_all}`, this.createdDate); + const linkString = Object(external_CoreHome_["externalLink"])('https://matomo.org/faq/heatmap-session-recording/troubleshooting-heatmaps/'); + const string2 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapTroubleshoot', linkString, ''); + return `${string1} ${string2}`; + }, + deviceTypesWithSamples() { + return this.deviceTypes.map(deviceType => { + let numSamples; + if (this.actualNumSamples[`nb_samples_device_${deviceType.key}`]) { + numSamples = this.actualNumSamples[`nb_samples_device_${deviceType.key}`]; } else { numSamples = 0; } - - var tooltip = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_XSamples', "".concat(deviceType.name, " - ").concat(numSamples)); + const tooltip = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_XSamples', `${deviceType.name} - ${numSamples}`); return Object.assign(Object.assign({}, deviceType), {}, { - numSamples: numSamples, - tooltip: tooltip + numSamples, + tooltip }); }); }, - hasWriteAccess: function hasWriteAccess() { + hasWriteAccess() { return !!(external_CoreHome_["Matomo"] !== null && external_CoreHome_["Matomo"] !== void 0 && external_CoreHome_["Matomo"].heatmapWriteAccess); }, - showDeleteScreenshot: function showDeleteScreenshot() { + showDeleteScreenshot() { return this.isActive && this.hasWriteAccess; }, - gradientImgData: function gradientImgData() { + gradientImgData() { return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAKCAYAAABCHPt+AAAAnklEQVRYR+2WQQq' + 'DQBAES5wB/f8/Y05RcMWwSu6JIT0Dm4WlH1DUdHew7/z6WYFhhnGRpnlhAEaQpi/ADbh/np0MiBhGhW+2ymFU+DZ' + 'fg1EhaoB4jCFuMYYcQKZrXwPEVvm5Og0pcYakBvI35G1jNIZ4jCHexxjSpz9ZFUjAynLbpOvqteaODkm9sloz5JF' + '+ZTVmSAWSu9Qb65AvgDwBQoLgVDlWfAQAAAAASUVORK5CYII='; } } @@ -2173,80 +2002,71 @@ recordingIframe, dataPoints) { HeatmapVisvue_type_script_lang_ts.render = render /* harmony default export */ var HeatmapVis = (HeatmapVisvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/SessionRecordingVis/SessionRecordingVis.vue?vue&type=template&id=6f77b61e +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/SessionRecordingVis/SessionRecordingVis.vue?vue&type=template&id=6f77b61e -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_1 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_1 = { class: "sessionRecordingPlayer" }; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_2 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_2 = { class: "controls" }; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_3 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_3 = { class: "playerActions" }; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_4 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_5 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_6 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_7 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_8 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_9 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_10 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_11 = ["title"]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_12 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_4 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_5 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_6 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_7 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_8 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_9 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_10 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_11 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_12 = { version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 768 768" }; - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_13 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_13 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { d: "M480 576.5v-321h-64.5v129h-63v-129h-64.5v192h127.5v129h64.5zM607.5 127.999c34.5 0\n 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z" }, null, -1); - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_14 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_13]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_15 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_14 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_13]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_15 = { version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 768 768" }; - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_16 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_16 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { d: "M448.5 576.5v-321h-129v64.5h64.5v256.5h64.5zM607.5 127.999c34.5 0 64.5 30 64.5\n 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5 0-64.5-30-64.5-64.5v-447c0-34.5\n 30-64.5 64.5-64.5h447z" }, null, -1); - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_17 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_16]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_18 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_17 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_16]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_18 = { version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 768 768" }; - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_19 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_19 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { d: "M480 384.5v-64.5c0-36-30-64.5-64.5-64.5h-127.5v64.5h127.5v64.5h-63c-34.5 0-64.5\n 27-64.5 63v129h192v-64.5h-127.5v-64.5h63c34.5 0 64.5-27 64.5-63zM607.5 127.999c34.5\n 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z" }, null, -1); - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_20 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_19]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_21 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_20 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_19]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_21 = { version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 768 768" }; - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_22 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_22 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { d: "M480 320v-64.5h-127.5c-34.5 0-64.5 28.5-64.5 64.5v192c0 36 30 64.5 64.5\n 64.5h63c34.5 0 64.5-28.5 64.5-64.5v-64.5c0-36-30-63-64.5-63h-63v-64.5h127.5zM607.5\n 127.999c34.5 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447zM352.5 512v-64.5h63v64.5h-63z" }, null, -1); - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_23 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_22]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_24 = ["title"]; - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_25 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("svg", { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_23 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_22]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_24 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_25 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "20", @@ -2255,11 +2075,9 @@ var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_25 = /*#__PURE__*/O }, [/*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { d: "M223.5 415.5h111l-64.5-63h-46.5v63zM72 72l624 624-42 40.5-88.5-90c-51 36-114\n 57-181.5 57-177 0-319.5-142.5-319.5-319.5 0-67.5 21-130.5 57-181.5l-90-88.5zM544.5\n 352.5h-111l-231-231c51-36 114-57 181.5-57 177 0 319.5 142.5 319.5 319.5 0 67.5-21\n 130.5-57 181.5l-148.5-150h46.5v-63z" })], -1); - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_26 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_25]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_27 = ["title"]; - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_28 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("svg", { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_26 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_25]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_27 = ["title"]; +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_28 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", width: "22", @@ -2268,177 +2086,139 @@ var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_28 = /*#__PURE__*/O }, [/*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("path", { d: "M544.5 609v-129h63v192h-384v96l-127.5-127.5 127.5-127.5v96h321zM223.5\n 288v129h-63v-192h384v-96l127.5 127.5-127.5 127.5v-96h-321z" })], -1); - -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_29 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_28]; -var SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_30 = { +const SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_29 = [SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_28]; +const _hoisted_30 = { class: "duration" }; -var _hoisted_31 = { +const _hoisted_31 = { class: "playerHelp" }; - -var _hoisted_32 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const _hoisted_32 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "clickEvent" }, null, -1); - -var _hoisted_33 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const _hoisted_33 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "moveEvent" }, null, -1); - -var _hoisted_34 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const _hoisted_34 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "scrollEvent" }, null, -1); - -var _hoisted_35 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const _hoisted_35 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "resizeEvent" }, null, -1); - -var _hoisted_36 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const _hoisted_36 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "formChange" }, null, -1); - -var _hoisted_37 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const _hoisted_37 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "mutationEvent" }, null, -1); - -var _hoisted_38 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", { +const _hoisted_38 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", { style: { "clear": "right" } }, null, -1); - -var _hoisted_39 = ["title"]; - -var _hoisted_40 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); - -var _hoisted_41 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { +const _hoisted_39 = ["title"]; +const _hoisted_40 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const _hoisted_41 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "loadingUnderlay" }, null, -1); - -var _hoisted_42 = { +const _hoisted_42 = { class: "valign-wrapper loadingInner" }; -var _hoisted_43 = { +const _hoisted_43 = { class: "loadingContent" }; -var _hoisted_44 = ["src", "width", "height"]; +const _hoisted_44 = ["src", "width", "height"]; function SessionRecordingVisvue_type_template_id_6f77b61e_render(_ctx, _cache, $props, $setup, $data, $options) { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-skip-previous", title: _ctx.skipPreviousButtonTitle, - onClick: _cache[0] || (_cache[0] = function ($event) { - return _ctx.loadNewRecording(_ctx.previousRecordingId); - }) + onClick: _cache[0] || (_cache[0] = $event => _ctx.loadNewRecording(_ctx.previousRecordingId)) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_4), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.previousRecordingId]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-fast-rewind", title: _ctx.translate('HeatmapSessionRecording_PlayerRewindFast', 10, 'J'), - onClick: _cache[1] || (_cache[1] = function ($event) { - return _ctx.jumpRelative(10, false); - }) + onClick: _cache[1] || (_cache[1] = $event => _ctx.jumpRelative(10, false)) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_5), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-play", title: _ctx.translate('HeatmapSessionRecording_PlayerPlay', 'K'), - onClick: _cache[2] || (_cache[2] = function ($event) { - return _ctx.play(); - }) + onClick: _cache[2] || (_cache[2] = $event => _ctx.play()) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_6), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isPlaying && !_ctx.isFinished]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-replay", title: _ctx.translate('HeatmapSessionRecording_PlayerReplay', 'K'), - onClick: _cache[3] || (_cache[3] = function ($event) { - return _ctx.replay(); - }) + onClick: _cache[3] || (_cache[3] = $event => _ctx.replay()) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_7), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isPlaying && _ctx.isFinished]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-pause", title: _ctx.translate('HeatmapSessionRecording_PlayerPause', 'K'), - onClick: _cache[4] || (_cache[4] = function ($event) { - return _ctx.pause(); - }) + onClick: _cache[4] || (_cache[4] = $event => _ctx.pause()) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_8), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isPlaying]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-fast-forward", title: _ctx.translate('HeatmapSessionRecording_PlayerForwardFast', 10, 'L'), - onClick: _cache[5] || (_cache[5] = function ($event) { - return _ctx.jumpRelative(10, true); - }) + onClick: _cache[5] || (_cache[5] = $event => _ctx.jumpRelative(10, true)) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_9), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "playerAction icon-skip-next", title: _ctx.translate('HeatmapSessionRecording_PlayerPageViewNext', _ctx.nextRecordingInfo, 'N'), - onClick: _cache[6] || (_cache[6] = function ($event) { - return _ctx.loadNewRecording(_ctx.nextRecordingId); - }) + onClick: _cache[6] || (_cache[6] = $event => _ctx.loadNewRecording(_ctx.nextRecordingId)) }, null, 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_10), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.nextRecordingId]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "changeReplaySpeed", title: _ctx.translate('HeatmapSessionRecording_ChangeReplaySpeed', 'S'), - onClick: _cache[7] || (_cache[7] = function ($event) { - return _ctx.increaseReplaySpeed(); - }) + onClick: _cache[7] || (_cache[7] = $event => _ctx.increaseReplaySpeed()) }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("svg", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_12, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_14, 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.actualReplaySpeed === 4]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("svg", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_15, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_17, 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.actualReplaySpeed === 1]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("svg", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_18, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_20, 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.actualReplaySpeed === 2]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("svg", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_21, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_23, 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.actualReplaySpeed === 6]])], 8, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_11), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["toggleSkipPause", { 'active': _ctx.actualSkipPausesEnabled }]), title: _ctx.translate('HeatmapSessionRecording_ClickToSkipPauses', _ctx.skipPausesEnabledText, 'B'), - onClick: _cache[8] || (_cache[8] = function ($event) { - return _ctx.toggleSkipPauses(); - }) + onClick: _cache[8] || (_cache[8] = $event => _ctx.toggleSkipPauses()) }, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_26, 10, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_24), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["toggleAutoPlay", { 'active': _ctx.actualAutoPlayEnabled }]), title: _ctx.translate('HeatmapSessionRecording_AutoPlayNextPageview', _ctx.autoplayEnabledText, 'A'), - onClick: _cache[9] || (_cache[9] = function ($event) { - return _ctx.toggleAutoPlay(); - }) - }, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_29, 10, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_27), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_30, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_PlayerDurationXofY', _ctx.positionPretty, _ctx.durationPretty)), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_31, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_32, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityClick')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_33, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityMove')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_34, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityScroll')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_35, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityResize')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_36, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityFormChange')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_37, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityPageChange')), 1)])])]), _hoisted_38]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + onClick: _cache[9] || (_cache[9] = $event => _ctx.toggleAutoPlay()) + }, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_29, 10, SessionRecordingVisvue_type_template_id_6f77b61e_hoisted_27), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", _hoisted_30, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_PlayerDurationXofY', _ctx.positionPretty, _ctx.durationPretty)), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_31, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_32, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityClick')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_33, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityMove')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_34, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityScroll')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_35, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityResize')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_36, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityFormChange')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", null, [_hoisted_37, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ActivityPageChange')), 1)])])]), _hoisted_38]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "timelineOuter", - onClick: _cache[10] || (_cache[10] = function ($event) { - return _ctx.seekEvent($event); - }), + onClick: _cache[10] || (_cache[10] = $event => _ctx.seekEvent($event)), style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ - width: "".concat(_ctx.replayWidth, "px") + width: `${_ctx.replayWidth}px` }) }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "timelineInner", style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ - width: "".concat(_ctx.progress, "%") + width: `${_ctx.progress}%` }) - }, null, 4), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.clues, function (clue, index) { + }, null, 4), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.clues, (clue, index) => { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { title: clue.title, class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(clue.type), style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ - left: "".concat(clue.left, "%") + left: `${clue.left}%` }), key: index }, null, 14, _hoisted_39); }), 128))], 4), _hoisted_40, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "hsrLoadingOuter", style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ - width: "".concat(_ctx.replayWidth, "px"), - height: "".concat(_ctx.replayHeight, "px") + width: `${_ctx.replayWidth}px`, + height: `${_ctx.replayHeight}px` }) }, [_hoisted_41, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_42, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_43, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Loading')), 1)])], 4), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "replayContainerOuter", - onClick: _cache[12] || (_cache[12] = function ($event) { - return _ctx.togglePlay(); - }), + onClick: _cache[12] || (_cache[12] = $event => _ctx.togglePlay()), style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])({ - height: "".concat(_ctx.replayHeight, "px"), - width: "".concat(_ctx.replayWidth, "px") + height: `${_ctx.replayHeight}px`, + width: `${_ctx.replayWidth}px` }) }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { class: "replayContainerInner", style: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeStyle"])([{ "transform-origin": "0 0" }, { - transform: "scale(".concat(_ctx.replayScale, ")"), - 'margin-left': "".concat(_ctx.replayMarginLeft, "px") + transform: `scale(${_ctx.replayScale})`, + 'margin-left': `${_ctx.replayMarginLeft}px` }]) }, [_ctx.embedUrl ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("iframe", { key: 0, id: "recordingPlayer", ref: "recordingPlayer", - onLoad: _cache[11] || (_cache[11] = function ($event) { - return _ctx.onLoaded(); - }), + onLoad: _cache[11] || (_cache[11] = $event => _ctx.onLoaded()), scrolling: "no", sandbox: "allow-scripts allow-same-origin", referrerpolicy: "no-referrer", @@ -2449,64 +2229,79 @@ function SessionRecordingVisvue_type_template_id_6f77b61e_render(_ctx, _cache, $ } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/SessionRecordingVis/SessionRecordingVis.vue?vue&type=template&id=6f77b61e -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/SessionRecordingVis/SessionRecordingVis.vue?vue&type=script&lang=ts -var _EVENT_TYPE_TO_NAME, _EVENT_TYPE_TO_TITLE; - -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - -function SessionRecordingVisvue_type_script_lang_ts_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; } - - - - -var FRAME_STEP = 20; -var EVENT_TYPE_MOVEMENT = 1; -var EVENT_TYPE_CLICK = 2; -var EVENT_TYPE_SCROLL = 3; -var EVENT_TYPE_RESIZE = 4; -var EVENT_TYPE_INITIAL_DOM = 5; -var EVENT_TYPE_MUTATION = 6; -var EVENT_TYPE_FORM_TEXT = 9; -var EVENT_TYPE_FORM_VALUE = 10; -var EVENT_TYPE_SCROLL_ELEMENT = 12; -var EVENT_TYPE_TO_NAME = (_EVENT_TYPE_TO_NAME = {}, SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_CLICK, 'clickEvent'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_MOVEMENT, 'moveEvent'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_SCROLL, 'scrollEvent'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_SCROLL_ELEMENT, 'scrollEvent'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_RESIZE, 'resizeEvent'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_FORM_TEXT, 'formChange'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_FORM_VALUE, 'formChange'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_INITIAL_DOM, 'mutationEvent'), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_NAME, EVENT_TYPE_MUTATION, 'mutationEvent'), _EVENT_TYPE_TO_NAME); -var EVENT_TYPE_TO_TITLE = (_EVENT_TYPE_TO_TITLE = {}, SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_CLICK, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityClick')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_MOVEMENT, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityMove')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_SCROLL, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityScroll')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_SCROLL_ELEMENT, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityScroll')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_RESIZE, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityResize')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_FORM_TEXT, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityFormChange')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_FORM_VALUE, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityFormChange')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_INITIAL_DOM, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityPageChange')), SessionRecordingVisvue_type_script_lang_ts_defineProperty(_EVENT_TYPE_TO_TITLE, EVENT_TYPE_MUTATION, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityPageChange')), _EVENT_TYPE_TO_TITLE); -var MOUSE_POINTER_HTML = "\n
\n \n \n \n
\n"; -var SessionRecordingVisvue_type_script_lang_ts_window = window, - SessionRecordingVisvue_type_script_lang_ts_$ = SessionRecordingVisvue_type_script_lang_ts_window.$, - Mousetrap = SessionRecordingVisvue_type_script_lang_ts_window.Mousetrap; - +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/SessionRecordingVis/SessionRecordingVis.vue?vue&type=script&lang=ts + + + +const FRAME_STEP = 20; +const EVENT_TYPE_MOVEMENT = 1; +const EVENT_TYPE_CLICK = 2; +const EVENT_TYPE_SCROLL = 3; +const EVENT_TYPE_RESIZE = 4; +const EVENT_TYPE_INITIAL_DOM = 5; +const EVENT_TYPE_MUTATION = 6; +const EVENT_TYPE_FORM_TEXT = 9; +const EVENT_TYPE_FORM_VALUE = 10; +const EVENT_TYPE_SCROLL_ELEMENT = 12; +const EVENT_TYPE_TO_NAME = { + [EVENT_TYPE_CLICK]: 'clickEvent', + [EVENT_TYPE_MOVEMENT]: 'moveEvent', + [EVENT_TYPE_SCROLL]: 'scrollEvent', + [EVENT_TYPE_SCROLL_ELEMENT]: 'scrollEvent', + [EVENT_TYPE_RESIZE]: 'resizeEvent', + [EVENT_TYPE_FORM_TEXT]: 'formChange', + [EVENT_TYPE_FORM_VALUE]: 'formChange', + [EVENT_TYPE_INITIAL_DOM]: 'mutationEvent', + [EVENT_TYPE_MUTATION]: 'mutationEvent' +}; +const EVENT_TYPE_TO_TITLE = { + [EVENT_TYPE_CLICK]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityClick'), + [EVENT_TYPE_MOVEMENT]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityMove'), + [EVENT_TYPE_SCROLL]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityScroll'), + [EVENT_TYPE_SCROLL_ELEMENT]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityScroll'), + [EVENT_TYPE_RESIZE]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityResize'), + [EVENT_TYPE_FORM_TEXT]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityFormChange'), + [EVENT_TYPE_FORM_VALUE]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityFormChange'), + [EVENT_TYPE_INITIAL_DOM]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityPageChange'), + [EVENT_TYPE_MUTATION]: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ActivityPageChange') +}; +const MOUSE_POINTER_HTML = ` +
+ + + +
+`; +const { + $: SessionRecordingVisvue_type_script_lang_ts_$, + Mousetrap +} = window; function intVal(v) { return typeof v === 'number' ? v : parseInt(v, 10); } - function getEventTypeId(event) { if (!(event !== null && event !== void 0 && event.event_type)) { return undefined; } - return intVal(event.event_type); } - function toPrettyTimeFormat(milliseconds) { - var durationSeconds = Math.floor(milliseconds / 1000); - var minutes = Math.floor(durationSeconds / 60); - var secondsLeft = durationSeconds % 60; - + const durationSeconds = Math.floor(milliseconds / 1000); + let minutes = Math.floor(durationSeconds / 60); + let secondsLeft = durationSeconds % 60; if (minutes < 10) { - minutes = "0".concat(minutes); + minutes = `0${minutes}`; } - if (secondsLeft < 10) { - secondsLeft = "0".concat(secondsLeft); + secondsLeft = `0${secondsLeft}`; } - - return "".concat(minutes, ":").concat(secondsLeft); -} // TODO use something like command pattern and redo actions for each action maybe for more effecient + return `${minutes}:${secondsLeft}`; +} +// TODO use something like command pattern and redo actions for each action maybe for more effecient // and better looking eeking to an earlier position in the video etc: Problem mutations can likely // not be "undone" - - /* harmony default export */ var SessionRecordingVisvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { offsetAccuracy: { @@ -2524,7 +2319,7 @@ function toPrettyTimeFormat(milliseconds) { default: 1 } }, - data: function data() { + data() { return { isPlaying: false, progress: 0, @@ -2548,191 +2343,162 @@ function toPrettyTimeFormat(milliseconds) { replayHeight: 0, replayScale: 0, replayMarginLeft: 0, - seek: function seek(seekToFrame) { - return seekToFrame; - }, + seek: seekToFrame => seekToFrame, actualSkipPausesEnabled: !!this.skipPausesEnabled, actualReplaySpeed: this.replaySpeed }; }, - setup: function setup() { - var iframeLoaded = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(false); - var iframeLoadedResolve = null; - var iframeLoadedPromise = new Promise(function (resolve) { + setup() { + const iframeLoaded = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["ref"])(false); + let iframeLoadedResolve = null; + const iframeLoadedPromise = new Promise(resolve => { iframeLoadedResolve = resolve; iframeLoaded.value = true; }); - - var onLoaded = function onLoaded() { - setTimeout(function () { + const onLoaded = () => { + setTimeout(() => { // just to be sure we wait for another 500ms iframeLoadedResolve('loaded'); }, 500); }; - return { - iframeLoadedPromise: iframeLoadedPromise, - onLoaded: onLoaded, - iframeLoaded: iframeLoaded + iframeLoadedPromise, + onLoaded, + iframeLoaded }; }, - created: function created() { - var _this = this; - + created() { this.recording.duration = intVal(this.recording.duration); - this.recording.pageviews.forEach(function (pageview) { + this.recording.pageviews.forEach(pageview => { if (!pageview || !pageview.idloghsr) { return; } - - if ("".concat(pageview.idloghsr) === "".concat(_this.recording.idLogHsr)) { - _this.hasFoundPrevious = true; - } else if (!_this.hasFoundPrevious) { - _this.previousRecordingId = pageview.idloghsr; - _this.previousRecordingInfo = [pageview.label, pageview.server_time_pretty, pageview.time_on_page_pretty].join(' - '); - } else if (!_this.hasFoundNext) { - _this.hasFoundNext = true; - _this.nextRecordingId = pageview.idloghsr; - _this.nextRecordingInfo = [pageview.label, pageview.server_time_pretty, pageview.time_on_page_pretty].join(' - '); + if (`${pageview.idloghsr}` === `${this.recording.idLogHsr}`) { + this.hasFoundPrevious = true; + } else if (!this.hasFoundPrevious) { + this.previousRecordingId = pageview.idloghsr; + this.previousRecordingInfo = [pageview.label, pageview.server_time_pretty, pageview.time_on_page_pretty].join(' - '); + } else if (!this.hasFoundNext) { + this.hasFoundNext = true; + this.nextRecordingId = pageview.idloghsr; + this.nextRecordingInfo = [pageview.label, pageview.server_time_pretty, pageview.time_on_page_pretty].join(' - '); } }); }, - mounted: function mounted() { - var _this2 = this; - - Mousetrap.bind(['space', 'k'], function () { - _this2.togglePlay(); + mounted() { + Mousetrap.bind(['space', 'k'], () => { + this.togglePlay(); }); - Mousetrap.bind('0', function () { - if (_this2.isFinished) { - _this2.replay(); + Mousetrap.bind('0', () => { + if (this.isFinished) { + this.replay(); } }); - Mousetrap.bind('p', function () { - _this2.loadNewRecording(_this2.previousRecordingId); + Mousetrap.bind('p', () => { + this.loadNewRecording(this.previousRecordingId); }); - Mousetrap.bind('n', function () { - _this2.loadNewRecording(_this2.nextRecordingId); + Mousetrap.bind('n', () => { + this.loadNewRecording(this.nextRecordingId); }); - Mousetrap.bind('s', function () { - _this2.increaseReplaySpeed(); + Mousetrap.bind('s', () => { + this.increaseReplaySpeed(); }); - Mousetrap.bind('a', function () { - _this2.toggleAutoPlay(); + Mousetrap.bind('a', () => { + this.toggleAutoPlay(); }); - Mousetrap.bind('b', function () { - _this2.toggleSkipPauses(); + Mousetrap.bind('b', () => { + this.toggleSkipPauses(); }); - Mousetrap.bind('left', function () { - var numSeconds = 5; - var jumpForward = false; - - _this2.jumpRelative(numSeconds, jumpForward); + Mousetrap.bind('left', () => { + const numSeconds = 5; + const jumpForward = false; + this.jumpRelative(numSeconds, jumpForward); }); - Mousetrap.bind('right', function () { - var numSeconds = 5; - var jumpForward = true; - - _this2.jumpRelative(numSeconds, jumpForward); + Mousetrap.bind('right', () => { + const numSeconds = 5; + const jumpForward = true; + this.jumpRelative(numSeconds, jumpForward); }); - Mousetrap.bind('j', function () { - var numSeconds = 10; - var jumpForward = false; - - _this2.jumpRelative(numSeconds, jumpForward); + Mousetrap.bind('j', () => { + const numSeconds = 10; + const jumpForward = false; + this.jumpRelative(numSeconds, jumpForward); }); - Mousetrap.bind('l', function () { - var numSeconds = 10; - var jumpForward = true; - - _this2.jumpRelative(numSeconds, jumpForward); + Mousetrap.bind('l', () => { + const numSeconds = 10; + const jumpForward = true; + this.jumpRelative(numSeconds, jumpForward); }); this.initViewport(); - SessionRecordingVisvue_type_script_lang_ts_$(window).on('resize', function () { - return _this2.initViewport(); + SessionRecordingVisvue_type_script_lang_ts_$(window).on('resize', () => this.initViewport()); + this.iframeLoadedPromise.then(() => { + this.initPlayer(); }); - this.iframeLoadedPromise.then(function () { - _this2.initPlayer(); - }); - window.addEventListener('beforeunload', function () { + window.addEventListener('beforeunload', () => { // should improve reload / go to next page performance - _this2.isPlaying = false; - - if (_this2.videoPlayerInterval) { - clearInterval(_this2.videoPlayerInterval); - _this2.videoPlayerInterval = null; + this.isPlaying = false; + if (this.videoPlayerInterval) { + clearInterval(this.videoPlayerInterval); + this.videoPlayerInterval = null; } }); }, methods: { - initPlayer: function initPlayer() { - var _this3 = this; - - var iframeElement = this.$refs.recordingPlayer; - var recordingIframe = getIframeWindow(iframeElement).recordingFrame; - + initPlayer() { + const iframeElement = this.$refs.recordingPlayer; + const recordingIframe = getIframeWindow(iframeElement).recordingFrame; if (!recordingIframe || !recordingIframe.isSupportedBrowser()) { return; } - recordingIframe.addClass('html', 'piwikSessionRecording'); recordingIframe.addClass('html', 'matomoSessionRecording'); - var $mousePointerNode = null; - - var drawMouseLine = function drawMouseLine(coordinates, color) { + let $mousePointerNode = null; + const drawMouseLine = (coordinates, color) => { if ($mousePointerNode) { $mousePointerNode.css({ - left: "".concat(coordinates.x - 8, "px"), - top: "".concat(coordinates.y - 8, "px") + left: `${coordinates.x - 8}px`, + top: `${coordinates.y - 8}px` }); } - - if (!_this3.lastCanvasCoordinates) { + if (!this.lastCanvasCoordinates) { return; } - - recordingIframe.drawLine(_this3.lastCanvasCoordinates.x, _this3.lastCanvasCoordinates.y, coordinates.x, coordinates.y, color); - _this3.lastCanvasCoordinates = coordinates; + recordingIframe.drawLine(this.lastCanvasCoordinates.x, this.lastCanvasCoordinates.y, coordinates.x, coordinates.y, color); + this.lastCanvasCoordinates = coordinates; }; - - var scrollFrameTo = function scrollFrameTo(xPos, yPos) { - if (!_this3.lastCanvasCoordinates || !$mousePointerNode) { + const scrollFrameTo = (xPos, yPos) => { + if (!this.lastCanvasCoordinates || !$mousePointerNode) { // we cannot move the mouse pointer since we do not have the initial mouse position yet // only perform scroll action instead recordingIframe.scrollTo(xPos, yPos); return; - } // we only move the mouse pointer but not draw a line for the mouse movement eg when user + } + // we only move the mouse pointer but not draw a line for the mouse movement eg when user // scrolls we also make sure that when the next time the user moves the mouse the mouse // move line will be drawn from this new position - - - var currentScrollTop = recordingIframe.getScrollTop(); - var currentScrollLeft = recordingIframe.getScrollLeft(); - recordingIframe.scrollTo(xPos, yPos); // we detect how far down or up user scrolled (or to the left or right) - - var diffScrollTop = yPos - currentScrollTop; - var diffScrollLeft = xPos - currentScrollLeft; // if user scrolled eg 100px down, we also need to move the cursor down - - var newMousePointerPosLeft = diffScrollLeft + _this3.lastCanvasCoordinates.x; - var newMousePointerPosTop = diffScrollTop + _this3.lastCanvasCoordinates.y; - + const currentScrollTop = recordingIframe.getScrollTop(); + const currentScrollLeft = recordingIframe.getScrollLeft(); + recordingIframe.scrollTo(xPos, yPos); + // we detect how far down or up user scrolled (or to the left or right) + const diffScrollTop = yPos - currentScrollTop; + const diffScrollLeft = xPos - currentScrollLeft; + // if user scrolled eg 100px down, we also need to move the cursor down + let newMousePointerPosLeft = diffScrollLeft + this.lastCanvasCoordinates.x; + let newMousePointerPosTop = diffScrollTop + this.lastCanvasCoordinates.y; if (newMousePointerPosLeft <= 0) { newMousePointerPosLeft = 0; } - if (newMousePointerPosTop <= 0) { newMousePointerPosTop = 0; - } // we make sure to draw the next mouse move line from this position. we use a blue line + } + // we make sure to draw the next mouse move line from this position. we use a blue line // to indicate the mouse was moved by a scroll - - drawMouseLine({ x: newMousePointerPosLeft, y: newMousePointerPosTop }, 'blue'); }; - - var scrollElementTo = function scrollElementTo(element, xPos, yPos) { + const scrollElementTo = (element, xPos, yPos) => { if (element !== null && element !== void 0 && element.scrollTo) { element.scrollTo(xPos, yPos); } else { @@ -2740,29 +2506,26 @@ function toPrettyTimeFormat(milliseconds) { element.scrollTop = yPos; } }; - - var moveMouseTo = null; - - var replayEvent = function replayEvent(event) { + let moveMouseTo = null; + const replayEvent = event => { // fixes some concurrency problems etc by not continueing in the player until the current // action is drawn - var isPlaying = _this3.isPlaying; - _this3.isPlaying = false; - var eventType = getEventTypeId(event); - var offset = null; - + const { + isPlaying + } = this; + this.isPlaying = false; + const eventType = getEventTypeId(event); + let offset = null; if (eventType === EVENT_TYPE_MOVEMENT) { if (event.selector) { - offset = recordingIframe.getCoordinatesInFrame(event.selector, event.x, event.y, _this3.offsetAccuracy, false); - + offset = recordingIframe.getCoordinatesInFrame(event.selector, event.x, event.y, this.offsetAccuracy, false); if (offset) { moveMouseTo(offset); } } } else if (eventType === EVENT_TYPE_CLICK) { if (event.selector) { - offset = recordingIframe.getCoordinatesInFrame(event.selector, event.x, event.y, _this3.offsetAccuracy, false); - + offset = recordingIframe.getCoordinatesInFrame(event.selector, event.x, event.y, this.offsetAccuracy, false); if (offset) { moveMouseTo(offset); recordingIframe.drawCircle(offset.x, offset.y, '#ff9407'); @@ -2773,38 +2536,33 @@ function toPrettyTimeFormat(milliseconds) { recordingIframe.applyMutation(event.text); } } else if (eventType === EVENT_TYPE_SCROLL) { - var docHeight = recordingIframe.getIframeHeight(); - var docWidth = recordingIframe.getIframeWidth(); - var yPos = parseInt("".concat(docHeight / _this3.scrollAccuracy * intVal(event.y)), 10); - var xPos = parseInt("".concat(docWidth / _this3.scrollAccuracy * intVal(event.x)), 10); + const docHeight = recordingIframe.getIframeHeight(); + const docWidth = recordingIframe.getIframeWidth(); + const yPos = parseInt(`${docHeight / this.scrollAccuracy * intVal(event.y)}`, 10); + const xPos = parseInt(`${docWidth / this.scrollAccuracy * intVal(event.x)}`, 10); scrollFrameTo(xPos, yPos); } else if (eventType === EVENT_TYPE_SCROLL_ELEMENT) { if (event.selector) { - var element = recordingIframe.findElement(event.selector); - + const element = recordingIframe.findElement(event.selector); if (element && element.length && element[0]) { - var eleHeight = Math.max(element[0].scrollHeight, element[0].offsetHeight, element.height(), 0); - var eleWidth = Math.max(element[0].scrollWidth, element[0].offsetWidth, element.width(), 0); - + const eleHeight = Math.max(element[0].scrollHeight, element[0].offsetHeight, element.height(), 0); + const eleWidth = Math.max(element[0].scrollWidth, element[0].offsetWidth, element.width(), 0); if (eleHeight && eleWidth) { - var _yPos = parseInt("".concat(eleHeight / _this3.scrollAccuracy * intVal(event.y)), 10); - - var _xPos = parseInt("".concat(eleWidth / _this3.scrollAccuracy * intVal(event.x)), 10); - - scrollElementTo(element[0], _xPos, _yPos); + const yPos = parseInt(`${eleHeight / this.scrollAccuracy * intVal(event.y)}`, 10); + const xPos = parseInt(`${eleWidth / this.scrollAccuracy * intVal(event.x)}`, 10); + scrollElementTo(element[0], xPos, yPos); } } } } else if (eventType === EVENT_TYPE_RESIZE) { - _this3.setViewportResolution(event.x, event.y); + this.setViewportResolution(event.x, event.y); } else if (eventType === EVENT_TYPE_FORM_TEXT) { if (event.selector) { - var formElement = recordingIframe.findElement(event.selector); - + const formElement = recordingIframe.findElement(event.selector); if (formElement.length) { - var formAttrType = formElement.attr('type'); - - if (formAttrType && "".concat(formAttrType).toLowerCase() === 'file') {// cannot be changed to local file, would result in error + const formAttrType = formElement.attr('type'); + if (formAttrType && `${formAttrType}`.toLowerCase() === 'file') { + // cannot be changed to local file, would result in error } else { formElement.val(event.text).change(); } @@ -2812,8 +2570,7 @@ function toPrettyTimeFormat(milliseconds) { } } else if (eventType === EVENT_TYPE_FORM_VALUE) { if (event.selector) { - var $field = recordingIframe.findElement(event.selector); - + const $field = recordingIframe.findElement(event.selector); if ($field.is('input')) { $field.prop('checked', event.text === 1 || event.text === '1'); } else if ($field.is('select')) { @@ -2821,264 +2578,204 @@ function toPrettyTimeFormat(milliseconds) { } } } - - _this3.isPlaying = isPlaying; + this.isPlaying = isPlaying; }; - - moveMouseTo = function moveMouseTo(coordinates) { - var resizeStage = function resizeStage() { - var stageWidth = recordingIframe.getIframeWidth(); - var stageHeight = recordingIframe.getIframeHeight(); + moveMouseTo = coordinates => { + const resizeStage = () => { + const stageWidth = recordingIframe.getIframeWidth(); + const stageHeight = recordingIframe.getIframeHeight(); recordingIframe.makeSvg(stageWidth, stageHeight); - - var _loop = function _loop(crtFrame) { - if (!_this3.timeFrameBuckets[crtFrame]) { - return { - v: void 0 - }; + for (let crtFrame = 0; crtFrame <= this.frame; crtFrame += FRAME_STEP) { + if (!this.timeFrameBuckets[crtFrame]) { + return; } - - _this3.timeFrameBuckets[crtFrame].forEach(function (event) { - var eventType = getEventTypeId(event); - + this.timeFrameBuckets[crtFrame].forEach(event => { + const eventType = getEventTypeId(event); if (eventType === EVENT_TYPE_MOVEMENT || eventType === EVENT_TYPE_SCROLL || eventType === EVENT_TYPE_SCROLL_ELEMENT || eventType === EVENT_TYPE_CLICK) { - _this3.lastFramePainted = crtFrame; + this.lastFramePainted = crtFrame; replayEvent(event); } }); - }; - - for (var crtFrame = 0; crtFrame <= _this3.frame; crtFrame += FRAME_STEP) { - var _ret = _loop(crtFrame); - - if (_typeof(_ret) === "object") return _ret.v; } - }; // Runs each time the DOM window resize event fires. + }; + // Runs each time the DOM window resize event fires. // Resets the canvas dimensions to match window, // then draws the new borders accordingly. - - - var iframeWindow = recordingIframe.getIframeWindow(); - - if (!_this3.lastCanvasCoordinates) { - var stageHeight = recordingIframe.getIframeHeight(); - var stageWidth = recordingIframe.getIframeWidth(); + const iframeWindow = recordingIframe.getIframeWindow(); + if (!this.lastCanvasCoordinates) { + const stageHeight = recordingIframe.getIframeHeight(); + const stageWidth = recordingIframe.getIframeWidth(); recordingIframe.appendContent(MOUSE_POINTER_HTML); $mousePointerNode = recordingIframe.findElement('.mousePointer'); recordingIframe.makeSvg(stageWidth, stageHeight); iframeWindow.removeEventListener('resize', resizeStage, false); iframeWindow.addEventListener('resize', resizeStage, false); - _this3.lastCanvasCoordinates = coordinates; + this.lastCanvasCoordinates = coordinates; $mousePointerNode.css({ - left: "".concat(coordinates.x - 8, "px"), - top: "".concat(coordinates.y - 8, "px") + left: `${coordinates.x - 8}px`, + top: `${coordinates.y - 8}px` }); return; } - - var scrollTop = recordingIframe.getScrollTop(); - var scrollLeft = recordingIframe.getScrollLeft(); - - if (coordinates.y > scrollTop + intVal(_this3.recording.viewport_h_px)) { + let scrollTop = recordingIframe.getScrollTop(); + const scrollLeft = recordingIframe.getScrollLeft(); + if (coordinates.y > scrollTop + intVal(this.recording.viewport_h_px)) { recordingIframe.scrollTo(scrollLeft, coordinates.y - 10); } else if (coordinates.y < scrollTop) { recordingIframe.scrollTo(scrollLeft, coordinates.y - 10); } - scrollTop = recordingIframe.getScrollTop(); - - if (coordinates.x > scrollLeft + intVal(_this3.recording.viewport_w_px)) { + if (coordinates.x > scrollLeft + intVal(this.recording.viewport_w_px)) { recordingIframe.scrollTo(coordinates.x - 10, scrollTop); } else if (coordinates.x < scrollLeft) { recordingIframe.scrollTo(coordinates.x - 10, scrollTop); } - drawMouseLine(coordinates, '#ff9407'); }; - - this.seek = function (seekToFrame) { - if (!_this3.iframeLoaded) { + this.seek = seekToFrame => { + if (!this.iframeLoaded) { return; - } // this operation may take a while so we want to stop any interval and further action + } + // this operation may take a while so we want to stop any interval and further action // until this is completed - - - _this3.isLoading = true; - var previousFrame = _this3.frame; - - var executeSeek = function executeSeek(thePreviousFrame) { - var _loop2 = function _loop2(crtFrame) { - (_this3.timeFrameBuckets[crtFrame] || []).forEach(function (event) { - _this3.lastFramePainted = crtFrame; + this.isLoading = true; + let previousFrame = this.frame; + const executeSeek = thePreviousFrame => { + for (let crtFrame = thePreviousFrame; crtFrame <= this.frame; crtFrame += FRAME_STEP) { + (this.timeFrameBuckets[crtFrame] || []).forEach(event => { + this.lastFramePainted = crtFrame; replayEvent(event); }); - }; - - for (var crtFrame = thePreviousFrame; crtFrame <= _this3.frame; crtFrame += FRAME_STEP) { - _loop2(crtFrame); } }; - - _this3.isFinished = false; - _this3.frame = seekToFrame - seekToFrame % FRAME_STEP; - _this3.progress = parseFloat(parseFloat("".concat(_this3.frame / intVal(_this3.recording.duration) * 100)).toFixed(2)); - _this3.positionPretty = toPrettyTimeFormat(_this3.frame); - - if (previousFrame > _this3.frame) { + this.isFinished = false; + this.frame = seekToFrame - seekToFrame % FRAME_STEP; + this.progress = parseFloat(parseFloat(`${this.frame / intVal(this.recording.duration) * 100}`).toFixed(2)); + this.positionPretty = toPrettyTimeFormat(this.frame); + if (previousFrame > this.frame) { // we start replaying the video from the beginning previousFrame = 0; - _this3.lastCanvasCoordinates = false; - - if (_this3.initialMutation) { - recordingIframe.initialMutation(_this3.initialMutation.text); + this.lastCanvasCoordinates = false; + if (this.initialMutation) { + recordingIframe.initialMutation(this.initialMutation.text); } - recordingIframe.scrollTo(0, 0); - - _this3.setViewportResolution(window.sessionRecordingData.viewport_w_px, window.sessionRecordingData.viewport_h_px); - - if (_this3.seekTimeout) { - clearTimeout(_this3.seekTimeout); - _this3.seekTimeout = null; // make sure when user goes to previous position and we have a timeout to not execute + this.setViewportResolution(window.sessionRecordingData.viewport_w_px, window.sessionRecordingData.viewport_h_px); + if (this.seekTimeout) { + clearTimeout(this.seekTimeout); + this.seekTimeout = null; + // make sure when user goes to previous position and we have a timeout to not execute // it multiple times } - - (function (thePreviousFrame) { - _this3.seekTimeout = setTimeout(function () { + (thePreviousFrame => { + this.seekTimeout = setTimeout(() => { executeSeek(thePreviousFrame); - _this3.isLoading = false; + this.isLoading = false; }, 1050); })(previousFrame); } else { // otherwise we instead play fast forward all new actions for faster performance and // smoother visualization etc - if (_this3.seekTimeout) { - clearTimeout(_this3.seekTimeout); - _this3.seekTimeout = null; + if (this.seekTimeout) { + clearTimeout(this.seekTimeout); + this.seekTimeout = null; } - executeSeek(previousFrame); - _this3.isLoading = false; + this.isLoading = false; } }; - this.isLoading = false; this.isPlaying = true; - var updateTimeCounter = 0; - - var drawFrames = function drawFrames() { - if (_this3.isPlaying && !_this3.isLoading) { + let updateTimeCounter = 0; + const drawFrames = () => { + if (this.isPlaying && !this.isLoading) { updateTimeCounter += 1; - var duration = intVal(_this3.recording.duration); - - if (_this3.frame >= duration) { - _this3.isPlaying = false; - _this3.progress = 100; - _this3.isFinished = true; - _this3.positionPretty = _this3.durationPretty; - - if (_this3.actualAutoPlayEnabled && _this3.nextRecordingId) { - _this3.loadNewRecording(_this3.nextRecordingId); + const duration = intVal(this.recording.duration); + if (this.frame >= duration) { + this.isPlaying = false; + this.progress = 100; + this.isFinished = true; + this.positionPretty = this.durationPretty; + if (this.actualAutoPlayEnabled && this.nextRecordingId) { + this.loadNewRecording(this.nextRecordingId); } } else { - _this3.progress = parseFloat(parseFloat("".concat(_this3.frame / duration * 100)).toFixed(2)); - + this.progress = parseFloat(parseFloat(`${this.frame / duration * 100}`).toFixed(2)); if (updateTimeCounter === 20) { updateTimeCounter = 0; - _this3.positionPretty = toPrettyTimeFormat(_this3.frame); + this.positionPretty = toPrettyTimeFormat(this.frame); } } - - (_this3.timeFrameBuckets[_this3.frame] || []).forEach(function (event) { + (this.timeFrameBuckets[this.frame] || []).forEach(event => { // remember when we last painted a frame - _this3.lastFramePainted = _this3.frame; + this.lastFramePainted = this.frame; replayEvent(event); }); - - if (_this3.actualSkipPausesEnabled && _this3.frame - _this3.lastFramePainted > 1800) { + if (this.actualSkipPausesEnabled && this.frame - this.lastFramePainted > 1800) { // after 1.8 seconds of not painting anything, move forward to next action - var keys = Object.keys(_this3.timeFrameBuckets).map(function (k) { - return parseInt(k, 10); - }); - keys = keys.sort(function (a, b) { - return a - b; - }); - var nextFrameKey = keys.find(function (key) { - return key > _this3.frame; - }); - var hasNextFrame = !!nextFrameKey; - + let keys = Object.keys(this.timeFrameBuckets).map(k => parseInt(k, 10)); + keys = keys.sort((a, b) => a - b); + const nextFrameKey = keys.find(key => key > this.frame); + const hasNextFrame = !!nextFrameKey; if (nextFrameKey) { - var isMoreThan1SecInFuture = nextFrameKey - _this3.frame > 1000; - + const isMoreThan1SecInFuture = nextFrameKey - this.frame > 1000; if (isMoreThan1SecInFuture) { // we set the pointer foward to the next frame printable // we only move forward if we can save at least one second. // we set the cursor to shortly before the next action. - _this3.frame = nextFrameKey - 20 * FRAME_STEP; + this.frame = nextFrameKey - 20 * FRAME_STEP; } - } // if no frame found, skip to the end of the recording - - + } + // if no frame found, skip to the end of the recording if (!hasNextFrame) { - var _isMoreThan1SecInFuture = duration - _this3.frame > 1000; - - if (_isMoreThan1SecInFuture) { + const isMoreThan1SecInFuture = duration - this.frame > 1000; + if (isMoreThan1SecInFuture) { // we don't set it to very end to still have something to play - _this3.frame = duration - 20 * FRAME_STEP; + this.frame = duration - 20 * FRAME_STEP; } } } - - _this3.frame += FRAME_STEP; + this.frame += FRAME_STEP; } }; - - this.videoPlayerInterval = setInterval(function () { - for (var k = 1; k <= _this3.actualReplaySpeed; k += 1) { + this.videoPlayerInterval = setInterval(() => { + for (let k = 1; k <= this.actualReplaySpeed; k += 1) { drawFrames(); } }, FRAME_STEP); }, - initViewport: function initViewport() { + initViewport() { this.replayHeight = SessionRecordingVisvue_type_script_lang_ts_$(window).height() - 48 - SessionRecordingVisvue_type_script_lang_ts_$('.sessionRecording .sessionRecordingHead').outerHeight(true) - SessionRecordingVisvue_type_script_lang_ts_$('.sessionRecordingPlayer .controls').outerHeight(true); this.replayWidth = SessionRecordingVisvue_type_script_lang_ts_$(window).width() - 48; - var viewportwpx = intVal(this.recording.viewport_w_px); - var viewporthpx = intVal(this.recording.viewport_h_px); - var minReplayWidth = 400; - + const viewportwpx = intVal(this.recording.viewport_w_px); + const viewporthpx = intVal(this.recording.viewport_h_px); + const minReplayWidth = 400; if (this.replayWidth < minReplayWidth && viewportwpx > minReplayWidth) { this.replayWidth = minReplayWidth; } - - var minReplayHeight = 400; - + const minReplayHeight = 400; if (this.replayHeight < minReplayHeight && viewporthpx > minReplayHeight) { this.replayHeight = minReplayHeight; } - - var widthScale = 1; - var heightScale = 1; - + let widthScale = 1; + let heightScale = 1; if (viewportwpx > this.replayWidth) { - widthScale = parseFloat(parseFloat("".concat(this.replayWidth / viewportwpx)).toFixed(4)); + widthScale = parseFloat(parseFloat(`${this.replayWidth / viewportwpx}`).toFixed(4)); } - if (viewporthpx > this.replayHeight) { - heightScale = parseFloat(parseFloat("".concat(this.replayHeight / viewporthpx)).toFixed(4)); + heightScale = parseFloat(parseFloat(`${this.replayHeight / viewporthpx}`).toFixed(4)); } - this.replayScale = Math.min(widthScale, heightScale); this.replayMarginLeft = (this.replayWidth - this.replayScale * viewportwpx) / 2; }, - setViewportResolution: function setViewportResolution(widthPx, heightPx) { - this.recording.viewport_w_px = parseInt("".concat(widthPx), 10); - this.recording.viewport_h_px = parseInt("".concat(heightPx), 10); + setViewportResolution(widthPx, heightPx) { + this.recording.viewport_w_px = parseInt(`${widthPx}`, 10); + this.recording.viewport_h_px = parseInt(`${heightPx}`, 10); SessionRecordingVisvue_type_script_lang_ts_$('.recordingWidth').text(widthPx); SessionRecordingVisvue_type_script_lang_ts_$('.recordingHeight').text(heightPx); this.initViewport(); }, - increaseReplaySpeed: function increaseReplaySpeed() { + increaseReplaySpeed() { if (this.actualReplaySpeed === 1) { this.actualReplaySpeed = 2; } else if (this.actualReplaySpeed === 2) { @@ -3088,10 +2785,9 @@ function toPrettyTimeFormat(milliseconds) { } else { this.actualReplaySpeed = 1; } - this.updateSettings(); }, - updateSettings: function updateSettings() { + updateSettings() { external_CoreHome_["AjaxHelper"].fetch({ module: 'HeatmapSessionRecording', action: 'saveSessionRecordingSettings', @@ -3102,53 +2798,49 @@ function toPrettyTimeFormat(milliseconds) { format: 'html' }); }, - toggleAutoPlay: function toggleAutoPlay() { + toggleAutoPlay() { this.actualAutoPlayEnabled = !this.actualAutoPlayEnabled; this.updateSettings(); }, - toggleSkipPauses: function toggleSkipPauses() { + toggleSkipPauses() { this.actualSkipPausesEnabled = !this.actualSkipPausesEnabled; this.updateSettings(); }, - loadNewRecording: function loadNewRecording(idLogHsr) { + loadNewRecording(idLogHsr) { if (idLogHsr) { this.isPlaying = false; external_CoreHome_["MatomoUrl"].updateUrl(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { - idLogHsr: parseInt("".concat(idLogHsr), 10), + idLogHsr: parseInt(`${idLogHsr}`, 10), updated: external_CoreHome_["MatomoUrl"].urlParsed.value.updated ? parseInt(external_CoreHome_["MatomoUrl"].urlParsed.value.updated, 10) + 1 : 1 })); } }, - jumpRelative: function jumpRelative(numberSeconds, forward) { - var framesToJump = numberSeconds * 1000; - var newPosition; - + jumpRelative(numberSeconds, forward) { + const framesToJump = numberSeconds * 1000; + let newPosition; if (forward) { newPosition = this.frame + framesToJump; - if (newPosition > this.recording.duration) { newPosition = intVal(this.recording.duration) - FRAME_STEP; } } else { newPosition = this.frame - framesToJump; - if (newPosition < 0) { newPosition = 0; } } - this.seek(newPosition); }, - replay: function replay() { + replay() { this.isFinished = false; this.lastFramePainted = 0; this.seek(0); this.play(); }, - pause: function pause() { + pause() { this.isPlaying = false; }, - togglePlay: function togglePlay() { + togglePlay() { if (this.isFinished) { this.replay(); } else if (this.isPlaying) { @@ -3157,24 +2849,24 @@ function toPrettyTimeFormat(milliseconds) { this.play(); } }, - seekEvent: function seekEvent(event) { - var offset = SessionRecordingVisvue_type_script_lang_ts_$(event.currentTarget).offset(); - var selectedPosition = event.pageX - offset.left; - var fullWidth = this.replayWidth; - var seekPercentage = selectedPosition / fullWidth; - var seekPositionTime = intVal(this.recording.duration) * seekPercentage; + seekEvent(event) { + const offset = SessionRecordingVisvue_type_script_lang_ts_$(event.currentTarget).offset(); + const selectedPosition = event.pageX - offset.left; + const fullWidth = this.replayWidth; + const seekPercentage = selectedPosition / fullWidth; + const seekPositionTime = intVal(this.recording.duration) * seekPercentage; this.seek(seekPositionTime); }, - play: function play() { + play() { this.isPlaying = true; } }, computed: { - durationPretty: function durationPretty() { + durationPretty() { return toPrettyTimeFormat(intVal(this.recording.duration)); }, - embedUrl: function embedUrl() { - return "?".concat(external_CoreHome_["MatomoUrl"].stringify({ + embedUrl() { + return `?${external_CoreHome_["MatomoUrl"].stringify({ module: 'HeatmapSessionRecording', action: 'embedPage', idSite: this.recording.idSite, @@ -3184,89 +2876,78 @@ function toPrettyTimeFormat(milliseconds) { // token_auth there, we should send nothing. In this case, Matomo.token_auth will still // be set, so we can't check that variable here. token_auth: external_CoreHome_["MatomoUrl"].urlParsed.value.token_auth || undefined - })); + })}`; }, - skipPreviousButtonTitle: function skipPreviousButtonTitle() { + skipPreviousButtonTitle() { return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_PlayerPageViewPrevious', this.previousRecordingInfo || '', 'P'); }, - skipPausesEnabledText: function skipPausesEnabledText() { + skipPausesEnabledText() { if (this.actualSkipPausesEnabled) { return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_disable'); } - return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_enable'); }, - autoplayEnabledText: function autoplayEnabledText() { + autoplayEnabledText() { if (this.actualAutoPlayEnabled) { return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_disable'); } - return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_enable'); }, - recordingEvents: function recordingEvents() { + recordingEvents() { if (!this.recording) { return []; } - - return this.recording.events.map(function (theEvent) { - var eventType = getEventTypeId(theEvent); - var text = theEvent.text; - + return this.recording.events.map(theEvent => { + const eventType = getEventTypeId(theEvent); + let { + text + } = theEvent; if ((eventType === EVENT_TYPE_INITIAL_DOM || eventType === EVENT_TYPE_MUTATION) && typeof text === 'string') { text = JSON.parse(text); } - return Object.assign(Object.assign({}, theEvent), {}, { - text: text + text }); }); }, - initialMutation: function initialMutation() { - var initialEvent = this.recordingEvents.find(function (e) { - var eventType = getEventTypeId(e); - var isMutation = eventType === EVENT_TYPE_INITIAL_DOM || eventType === EVENT_TYPE_MUTATION; - var isInitialMutation = isMutation && (eventType === EVENT_TYPE_INITIAL_DOM || !e.time_since_load || e.time_since_load === '0'); + initialMutation() { + const initialEvent = this.recordingEvents.find(e => { + const eventType = getEventTypeId(e); + const isMutation = eventType === EVENT_TYPE_INITIAL_DOM || eventType === EVENT_TYPE_MUTATION; + const isInitialMutation = isMutation && (eventType === EVENT_TYPE_INITIAL_DOM || !e.time_since_load || e.time_since_load === '0'); return isInitialMutation; }); return initialEvent; }, - timeFrameBuckets: function timeFrameBuckets() { - var _this4 = this; - - var result = {}; - this.recordingEvents.forEach(function (event) { - if (event === _this4.initialMutation) { + timeFrameBuckets() { + const result = {}; + this.recordingEvents.forEach(event => { + if (event === this.initialMutation) { return; } - - var bucket = Math.round(intVal(event.time_since_load) / FRAME_STEP) * FRAME_STEP; + const bucket = Math.round(intVal(event.time_since_load) / FRAME_STEP) * FRAME_STEP; result[bucket] = result[bucket] || []; result[bucket].push(event); }); return result; }, - clues: function clues() { - var _this5 = this; - - var result = []; - this.recordingEvents.forEach(function (event) { - if (event === _this5.initialMutation) { + clues() { + const result = []; + this.recordingEvents.forEach(event => { + if (event === this.initialMutation) { return; } - - var eventTypeId = getEventTypeId(event); - var eventType = EVENT_TYPE_TO_NAME[eventTypeId] || ''; - var eventTitle = EVENT_TYPE_TO_TITLE[eventTypeId] || ''; - + const eventTypeId = getEventTypeId(event); + const eventType = EVENT_TYPE_TO_NAME[eventTypeId] || ''; + const eventTitle = EVENT_TYPE_TO_TITLE[eventTypeId] || ''; if (eventType) { if ((event.time_since_load === 0 || event.time_since_load === '0') && eventType === 'moveEvent') { // this is the initial mouse position and we ignore it in the clues since we cannot // draw a line to it return; } - result.push({ - left: parseFloat("".concat(intVal(event.time_since_load) / intVal(_this5.recording.duration) * 100)).toFixed(2), + left: parseFloat(`${intVal(event.time_since_load) / intVal(this.recording.duration) * 100}`).toFixed(2), type: eventType, title: eventTitle }); @@ -3285,32 +2966,27 @@ function toPrettyTimeFormat(milliseconds) { SessionRecordingVisvue_type_script_lang_ts.render = SessionRecordingVisvue_type_template_id_6f77b61e_render /* harmony default export */ var SessionRecordingVis = (SessionRecordingVisvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HsrTargetTest/HsrTargetTest.vue?vue&type=template&id=6eb3a085 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HsrTargetTest/HsrTargetTest.vue?vue&type=template&id=6eb3a085 -var HsrTargetTestvue_type_template_id_6eb3a085_hoisted_1 = { +const HsrTargetTestvue_type_template_id_6eb3a085_hoisted_1 = { class: "form-group hsrTargetTest" }; -var HsrTargetTestvue_type_template_id_6eb3a085_hoisted_2 = { +const HsrTargetTestvue_type_template_id_6eb3a085_hoisted_2 = { class: "loadingPiwik loadingMatchingSteps" }; - -var HsrTargetTestvue_type_template_id_6eb3a085_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const HsrTargetTestvue_type_template_id_6eb3a085_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif", alt: "" }, null, -1); - -var HsrTargetTestvue_type_template_id_6eb3a085_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { +const HsrTargetTestvue_type_template_id_6eb3a085_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { id: "hsrTargetValidationError" }, null, -1); - function HsrTargetTestvue_type_template_id_6eb3a085_render(_ctx, _cache, $props, $setup, $data, $options) { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HsrTargetTestvue_type_template_id_6eb3a085_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("label", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_TargetPageTestTitle')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_TargetPageTestLabel')), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { type: "text", id: "urltargettest", placeholder: "http://www.example.com/", - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { - return _ctx.url = $event; - }), + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.url = $event), class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ 'invalid': _ctx.url && !_ctx.matches && _ctx.isValid }) @@ -3324,20 +3000,18 @@ function HsrTargetTestvue_type_template_id_6eb3a085_render(_ctx, _cache, $props, } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HsrTargetTest/HsrTargetTest.vue?vue&type=template&id=6eb3a085 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HsrTargetTest/HsrTargetTest.vue?vue&type=script&lang=ts - +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HsrTargetTest/HsrTargetTest.vue?vue&type=script&lang=ts function isValidUrl(url) { return url.indexOf('://') > 3; } - /* harmony default export */ var HsrTargetTestvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { includedTargets: Array }, - data: function data() { + data() { return { url: '', matches: false, @@ -3345,88 +3019,75 @@ function isValidUrl(url) { }; }, watch: { - isValid: function isValid(newVal) { + isValid(newVal) { if (!newVal) { this.matches = false; } }, - includedTargets: function includedTargets() { + includedTargets() { this.runTest(); }, - url: function url() { + url() { this.runTest(); } }, - setup: function setup() { + setup() { return { testUrlMatchPages: oneAtATime('HeatmapSessionRecording.testUrlMatchPages', { errorElement: '#hsrTargetValidationError' }) }; }, - created: function created() { + created() { // we wait for 200ms before actually sending a request as user might be still typing this.runTest = Object(external_CoreHome_["debounce"])(this.runTest, 200); }, methods: { - checkIsMatchingUrl: function checkIsMatchingUrl() { - var _this = this; - + checkIsMatchingUrl() { if (!this.isValid) { return; } - - var url = this.targetUrl; - var included = this.filteredIncludedTargets; - + const url = this.targetUrl; + const included = this.filteredIncludedTargets; if (!(included !== null && included !== void 0 && included.length)) { return; } - this.isLoadingTestMatchPage = true; this.testUrlMatchPages({ - url: url + url }, { matchPageRules: included - }).then(function (response) { + }).then(response => { var _this$filteredInclude; - - if (!((_this$filteredInclude = _this.filteredIncludedTargets) !== null && _this$filteredInclude !== void 0 && _this$filteredInclude.length) || (response === null || response === void 0 ? void 0 : response.url) !== _this.targetUrl) { + if (!((_this$filteredInclude = this.filteredIncludedTargets) !== null && _this$filteredInclude !== void 0 && _this$filteredInclude.length) || (response === null || response === void 0 ? void 0 : response.url) !== this.targetUrl) { return; } - - _this.matches = response.matches; - }).finally(function () { - _this.isLoadingTestMatchPage = false; + this.matches = response.matches; + }).finally(() => { + this.isLoadingTestMatchPage = false; }); }, - runTest: function runTest() { + runTest() { if (!this.isValid) { return; } - this.checkIsMatchingUrl(); } }, computed: { - targetUrl: function targetUrl() { + targetUrl() { return (this.url || '').trim(); }, - isValid: function isValid() { + isValid() { return this.targetUrl && isValidUrl(this.targetUrl); }, - filteredIncludedTargets: function filteredIncludedTargets() { + filteredIncludedTargets() { if (!this.includedTargets) { return undefined; } - - return this.includedTargets.filter(function (target) { - return (target === null || target === void 0 ? void 0 : target.value) || (target === null || target === void 0 ? void 0 : target.type) === 'any'; - }).map(function (target) { - return Object.assign(Object.assign({}, target), {}, { - value: target.value ? target.value.trim() : '' - }); - }); + return this.includedTargets.filter(target => (target === null || target === void 0 ? void 0 : target.value) || (target === null || target === void 0 ? void 0 : target.type) === 'any').map(target => Object.assign(Object.assign({}, target), {}, { + value: target.value ? target.value.trim() : '' + })); } } })); @@ -3439,30 +3100,29 @@ function isValidUrl(url) { HsrTargetTestvue_type_script_lang_ts.render = HsrTargetTestvue_type_template_id_6eb3a085_render /* harmony default export */ var HsrTargetTest = (HsrTargetTestvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HsrUrlTarget/HsrUrlTarget.vue?vue&type=template&id=4c1d8b92 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HsrUrlTarget/HsrUrlTarget.vue?vue&type=template&id=4c1d8b92 -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_1 = { +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_1 = { style: { "width": "100%" } }; -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_2 = { +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_2 = { name: "targetAttribute" }; -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_3 = { +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_3 = { name: "targetType" }; -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_4 = { +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_4 = { name: "targetValue" }; -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_5 = { +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_5 = { name: "targetValue2" }; -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_6 = ["title"]; -var HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_7 = ["title"]; +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_6 = ["title"]; +const HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_7 = ["title"]; function HsrUrlTargetvue_type_template_id_4c1d8b92_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); - + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["form-group hsrUrltarget valign-wrapper", { 'disabled': _ctx.disableIfNoValue && !_ctx.modelValue.value @@ -3471,11 +3131,9 @@ function HsrUrlTargetvue_type_template_id_4c1d8b92_render(_ctx, _cache, $props, uicontrol: "select", name: "targetAttribute", "model-value": _ctx.modelValue.attribute, - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { - return _ctx.$emit('update:modelValue', Object.assign(Object.assign({}, _ctx.modelValue), {}, { - attribute: $event - })); - }), + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.$emit('update:modelValue', Object.assign(Object.assign({}, _ctx.modelValue), {}, { + attribute: $event + }))), title: _ctx.translate('HeatmapSessionRecording_Rule'), options: _ctx.targetAttributes, "full-width": true @@ -3483,7 +3141,7 @@ function HsrUrlTargetvue_type_template_id_4c1d8b92_render(_ctx, _cache, $props, uicontrol: "select", name: "targetType", "model-value": _ctx.pattern_type, - "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => { _ctx.onTypeChange($event); }), options: _ctx.targetOptions[_ctx.modelValue.attribute], @@ -3491,52 +3149,37 @@ function HsrUrlTargetvue_type_template_id_4c1d8b92_render(_ctx, _cache, $props, }, null, 8, ["model-value", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "text", name: "targetValue", - placeholder: "eg. ".concat(_ctx.targetExamples[_ctx.modelValue.attribute]), + placeholder: `eg. ${_ctx.targetExamples[_ctx.modelValue.attribute]}`, "model-value": _ctx.modelValue.value, - "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) { - return _ctx.$emit('update:modelValue', Object.assign(Object.assign({}, _ctx.modelValue), {}, { - value: $event.trim() - })); - }), + "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.$emit('update:modelValue', Object.assign(Object.assign({}, _ctx.modelValue), {}, { + value: $event.trim() + }))), maxlength: 500, "full-width": true }, null, 8, ["placeholder", "model-value"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.pattern_type !== 'any']])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { uicontrol: "text", name: "targetValue2", "model-value": _ctx.modelValue.value2, - "onUpdate:modelValue": _cache[3] || (_cache[3] = function ($event) { - return _ctx.$emit('update:modelValue', Object.assign(Object.assign({}, _ctx.modelValue), {}, { - value2: $event.trim() - })); - }), + "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => _ctx.$emit('update:modelValue', Object.assign(Object.assign({}, _ctx.modelValue), {}, { + value2: $event.trim() + }))), maxlength: 500, "full-width": true, placeholder: _ctx.translate('HeatmapSessionRecording_UrlParameterValueToMatchPlaceholder') }, null, 8, ["model-value", "placeholder"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.modelValue.attribute === 'urlparam' && _ctx.pattern_type && _ctx.pattern_type !== 'exists' && _ctx.pattern_type !== 'not_exists']])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "icon-plus valign", title: _ctx.translate('General_Add'), - onClick: _cache[4] || (_cache[4] = function ($event) { - return _ctx.$emit('addUrl'); - }) + onClick: _cache[4] || (_cache[4] = $event => _ctx.$emit('addUrl')) }, null, 8, HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_6), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.showAddUrl]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "icon-minus valign", title: _ctx.translate('General_Remove'), - onClick: _cache[5] || (_cache[5] = function ($event) { - return _ctx.$emit('removeUrl'); - }) + onClick: _cache[5] || (_cache[5] = $event => _ctx.$emit('removeUrl')) }, null, 8, HsrUrlTargetvue_type_template_id_4c1d8b92_hoisted_7), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.canBeRemoved]])], 2); } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HsrUrlTarget/HsrUrlTarget.vue?vue&type=template&id=4c1d8b92 // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HsrUrlTarget/AvailableTargetPageRules.store.ts -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function AvailableTargetPageRules_store_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; } - +function _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; } /** * Copyright (C) InnoCraft Ltd - All rights reserved. * @@ -3553,53 +3196,31 @@ function AvailableTargetPageRules_store_defineProperty(obj, key, value) { if (ke */ - -var AvailableTargetPageRules_store_AvailableTargetPageRulesStore = /*#__PURE__*/function () { - function AvailableTargetPageRulesStore() { - var _this = this; - - _classCallCheck(this, AvailableTargetPageRulesStore); - - AvailableTargetPageRules_store_defineProperty(this, "privateState", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ +class AvailableTargetPageRules_store_AvailableTargetPageRulesStore { + constructor() { + _defineProperty(this, "privateState", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ rules: [] })); - - AvailableTargetPageRules_store_defineProperty(this, "state", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(_this.privateState); - })); - - AvailableTargetPageRules_store_defineProperty(this, "rules", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { - return _this.state.value.rules; - })); - - AvailableTargetPageRules_store_defineProperty(this, "initPromise", null); + _defineProperty(this, "state", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(() => Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(this.privateState))); + _defineProperty(this, "rules", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(() => this.state.value.rules)); + _defineProperty(this, "initPromise", null); } - - _createClass(AvailableTargetPageRulesStore, [{ - key: "init", - value: function init() { - var _this2 = this; - - if (this.initPromise) { - return this.initPromise; - } - - this.initPromise = external_CoreHome_["AjaxHelper"].fetch({ - method: 'HeatmapSessionRecording.getAvailableTargetPageRules', - filter_limit: '-1' - }).then(function (response) { - _this2.privateState.rules = response; - return _this2.rules.value; - }); + init() { + if (this.initPromise) { return this.initPromise; } - }]); - - return AvailableTargetPageRulesStore; -}(); - + this.initPromise = external_CoreHome_["AjaxHelper"].fetch({ + method: 'HeatmapSessionRecording.getAvailableTargetPageRules', + filter_limit: '-1' + }).then(response => { + this.privateState.rules = response; + return this.rules.value; + }); + return this.initPromise; + } +} /* harmony default export */ var AvailableTargetPageRules_store = (new AvailableTargetPageRules_store_AvailableTargetPageRulesStore()); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HsrUrlTarget/HsrUrlTarget.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HsrUrlTarget/HsrUrlTarget.vue?vue&type=script&lang=ts @@ -3619,93 +3240,77 @@ var AvailableTargetPageRules_store_AvailableTargetPageRulesStore = /*#__PURE__*/ Field: external_CorePluginsAdmin_["Field"] }, emits: ['addUrl', 'removeUrl', 'update:modelValue'], - created: function created() { + created() { AvailableTargetPageRules_store.init(); }, watch: { - modelValue: function modelValue(newValue) { - var _this = this; - + modelValue(newValue) { if (!newValue.attribute) { return; } - - var types = this.targetOptions[newValue.attribute]; - var found = types.find(function (t) { - return t.key === _this.pattern_type; - }); - + const types = this.targetOptions[newValue.attribute]; + const found = types.find(t => t.key === this.pattern_type); if (!found && types[0]) { this.onTypeChange(types[0].key); } } }, computed: { - pattern_type: function pattern_type() { - var result = this.modelValue.type; - + pattern_type() { + let result = this.modelValue.type; if (this.modelValue.inverted && this.modelValue.inverted !== '0') { - result = "not_".concat(this.modelValue.type); + result = `not_${this.modelValue.type}`; } - return result; }, - targetAttributes: function targetAttributes() { - return AvailableTargetPageRules_store.rules.value.map(function (r) { - return { - key: r.value, - value: r.name - }; - }); + targetAttributes() { + return AvailableTargetPageRules_store.rules.value.map(r => ({ + key: r.value, + value: r.name + })); }, - targetOptions: function targetOptions() { - var _this2 = this; - - var result = {}; - AvailableTargetPageRules_store.rules.value.forEach(function (r) { + targetOptions() { + const result = {}; + AvailableTargetPageRules_store.rules.value.forEach(r => { result[r.value] = []; - - if (_this2.allowAny && r.value === 'url') { + if (this.allowAny && r.value === 'url') { result[r.value].push({ value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_TargetTypeIsAny'), key: 'any' }); } - - r.types.forEach(function (type) { + r.types.forEach(type => { result[r.value].push({ value: type.name, key: type.value }); result[r.value].push({ value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_TargetTypeIsNot', type.name), - key: "not_".concat(type.value) + key: `not_${type.value}` }); }); }); return result; }, - targetExamples: function targetExamples() { - var result = {}; - AvailableTargetPageRules_store.rules.value.forEach(function (r) { + targetExamples() { + const result = {}; + AvailableTargetPageRules_store.rules.value.forEach(r => { result[r.value] = r.example; }); return result; } }, methods: { - onTypeChange: function onTypeChange(newType) { - var inverted = 0; - var type = newType; - + onTypeChange(newType) { + let inverted = 0; + let type = newType; if (newType.indexOf('not_') === 0) { type = newType.substring('not_'.length); inverted = 1; } - this.$emit('update:modelValue', Object.assign(Object.assign({}, this.modelValue), {}, { - type: type, - inverted: inverted + type, + inverted })); } } @@ -3719,249 +3324,207 @@ var AvailableTargetPageRules_store_AvailableTargetPageRulesStore = /*#__PURE__*/ HsrUrlTargetvue_type_script_lang_ts.render = HsrUrlTargetvue_type_template_id_4c1d8b92_render /* harmony default export */ var HsrUrlTarget = (HsrUrlTargetvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Edit.vue?vue&type=template&id=635b8e28 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Edit.vue?vue&type=template&id=635b8e28 -var Editvue_type_template_id_635b8e28_hoisted_1 = { +const Editvue_type_template_id_635b8e28_hoisted_1 = { class: "loadingPiwik" }; - -var Editvue_type_template_id_635b8e28_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const Editvue_type_template_id_635b8e28_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); - -var Editvue_type_template_id_635b8e28_hoisted_3 = { +const Editvue_type_template_id_635b8e28_hoisted_3 = { class: "loadingPiwik" }; - -var Editvue_type_template_id_635b8e28_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const Editvue_type_template_id_635b8e28_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); - -var Editvue_type_template_id_635b8e28_hoisted_5 = { +const Editvue_type_template_id_635b8e28_hoisted_5 = { name: "name" }; -var Editvue_type_template_id_635b8e28_hoisted_6 = { +const Editvue_type_template_id_635b8e28_hoisted_6 = { name: "sampleLimit" }; -var Editvue_type_template_id_635b8e28_hoisted_7 = { +const Editvue_type_template_id_635b8e28_hoisted_7 = { class: "form-group row" }; -var Editvue_type_template_id_635b8e28_hoisted_8 = { +const Editvue_type_template_id_635b8e28_hoisted_8 = { class: "col s12" }; -var Editvue_type_template_id_635b8e28_hoisted_9 = { +const Editvue_type_template_id_635b8e28_hoisted_9 = { class: "col s12 m6", style: { "padding-left": "0" } }; - -var Editvue_type_template_id_635b8e28_hoisted_10 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("hr", null, null, -1); - -var Editvue_type_template_id_635b8e28_hoisted_11 = { +const Editvue_type_template_id_635b8e28_hoisted_10 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("hr", null, null, -1); +const Editvue_type_template_id_635b8e28_hoisted_11 = { class: "col s12 m6" }; -var Editvue_type_template_id_635b8e28_hoisted_12 = { +const Editvue_type_template_id_635b8e28_hoisted_12 = { class: "form-help" }; -var Editvue_type_template_id_635b8e28_hoisted_13 = { +const Editvue_type_template_id_635b8e28_hoisted_13 = { class: "inline-help" }; -var Editvue_type_template_id_635b8e28_hoisted_14 = { +const Editvue_type_template_id_635b8e28_hoisted_14 = { name: "sampleRate" }; -var Editvue_type_template_id_635b8e28_hoisted_15 = { +const Editvue_type_template_id_635b8e28_hoisted_15 = { name: "excludedElements" }; -var Editvue_type_template_id_635b8e28_hoisted_16 = { +const Editvue_type_template_id_635b8e28_hoisted_16 = { name: "screenshotUrl" }; -var Editvue_type_template_id_635b8e28_hoisted_17 = { +const Editvue_type_template_id_635b8e28_hoisted_17 = { name: "breakpointMobile" }; -var Editvue_type_template_id_635b8e28_hoisted_18 = { +const Editvue_type_template_id_635b8e28_hoisted_18 = { name: "breakpointTablet" }; -var Editvue_type_template_id_635b8e28_hoisted_19 = { +const Editvue_type_template_id_635b8e28_hoisted_19 = { name: "trackManually" }; -var Editvue_type_template_id_635b8e28_hoisted_20 = ["innerHTML"]; -var Editvue_type_template_id_635b8e28_hoisted_21 = { +const Editvue_type_template_id_635b8e28_hoisted_20 = ["innerHTML"]; +const Editvue_type_template_id_635b8e28_hoisted_21 = { class: "entityCancel" }; function Editvue_type_template_id_635b8e28_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); - - var _component_HsrUrlTarget = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrUrlTarget"); - - var _component_HsrTargetTest = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrTargetTest"); - - var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); - - var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); - + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _component_HsrUrlTarget = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrUrlTarget"); + const _component_HsrTargetTest = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrTargetTest"); + const _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContentBlock, { class: "editHsr", "content-title": _ctx.contentTitle }, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_635b8e28_hoisted_1, [Editvue_type_template_id_635b8e28_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_635b8e28_hoisted_3, [Editvue_type_template_id_635b8e28_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { - onSubmit: _cache[12] || (_cache[12] = function ($event) { - return _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr(); - }) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "name", - "model-value": _ctx.siteHsr.name, - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { - _ctx.siteHsr.name = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('General_Name'), - maxlength: 50, - placeholder: _ctx.translate('HeatmapSessionRecording_FieldNamePlaceholder'), - "inline-help": _ctx.translate('HeatmapSessionRecording_HeatmapNameHelp') - }, null, 8, ["model-value", "title", "placeholder", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "sampleLimit", - "model-value": _ctx.siteHsr.sample_limit, - "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { - _ctx.siteHsr.sample_limit = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_HeatmapSampleLimit'), - options: _ctx.sampleLimits, - "inline-help": _ctx.translate('HeatmapSessionRecording_HeatmapSampleLimitHelp') - }, null, 8, ["model-value", "title", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_TargetPage')) + ":", 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_9, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.siteHsr.match_page_rules, function (url, index) { - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { - class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])("matchPageRules ".concat(index, " multiple")), - key: index - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrUrlTarget, { - "model-value": url, - "onUpdate:modelValue": function onUpdateModelValue($event) { - return _ctx.setMatchPageRule($event, index); - }, - onAddUrl: _cache[2] || (_cache[2] = function ($event) { - return _ctx.addMatchPageRule(); - }), - onRemoveUrl: function onRemoveUrl($event) { - return _ctx.removeMatchPageRule(index); - }, - onAnyChange: _cache[3] || (_cache[3] = function ($event) { - return _ctx.setValueHasChanged(); - }), - "allow-any": false, - "disable-if-no-value": index > 0, - "can-be-removed": index > 0, - "show-add-url": true - }, null, 8, ["model-value", "onUpdate:modelValue", "onRemoveUrl", "disable-if-no-value", "can-be-removed"])]), Editvue_type_template_id_635b8e28_hoisted_10], 2); - }), 128))]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_635b8e28_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_FieldIncludedTargetsHelp')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrTargetTest, { - "included-targets": _ctx.siteHsr.match_page_rules - }, null, 8, ["included-targets"])])])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "sampleRate", - "model-value": _ctx.siteHsr.sample_rate, - "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) { - _ctx.siteHsr.sample_rate = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_SampleRate'), - options: _ctx.sampleRates, - introduction: _ctx.translate('HeatmapSessionRecording_AdvancedOptions'), - "inline-help": _ctx.translate('HeatmapSessionRecording_HeatmapSampleRateHelp') - }, null, 8, ["model-value", "title", "options", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "excludedElements", - "model-value": _ctx.siteHsr.excluded_elements, - "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) { - _ctx.siteHsr.excluded_elements = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_ExcludedElements'), - maxlength: 1000, - "inline-help": _ctx.translate('HeatmapSessionRecording_ExcludedElementsHelp') - }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "screenshotUrl", - "model-value": _ctx.siteHsr.screenshot_url, - "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { - _ctx.siteHsr.screenshot_url = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_ScreenshotUrl'), - maxlength: 300, - disabled: !!_ctx.siteHsr.page_treemirror, - "inline-help": _ctx.translate('HeatmapSessionRecording_ScreenshotUrlHelp') - }, null, 8, ["model-value", "title", "disabled", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "breakpointMobile", - "model-value": _ctx.siteHsr.breakpoint_mobile, - "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) { - _ctx.siteHsr.breakpoint_mobile = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_BreakpointX', _ctx.translate('General_Mobile')), - maxlength: 4, - "inline-help": _ctx.breakpointMobileInlineHelp - }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "breakpointTablet", - "model-value": _ctx.siteHsr.breakpoint_tablet, - "onUpdate:modelValue": _cache[8] || (_cache[8] = function ($event) { - _ctx.siteHsr.breakpoint_tablet = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_BreakpointX', _ctx.translate('DevicesDetection_Tablet')), - maxlength: 4, - "inline-help": _ctx.breakpointGeneralHelp - }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "checkbox", - name: "capture_manually", - title: _ctx.translate('HeatmapSessionRecording_CaptureDomTitle'), - "inline-help": _ctx.captureDomInlineHelp, - "model-value": _ctx.siteHsr.capture_manually, - "onUpdate:modelValue": _cache[9] || (_cache[9] = function ($event) { - _ctx.siteHsr.capture_manually = $event; - - _ctx.setValueHasChanged(); - }) - }, null, 8, ["title", "inline-help", "model-value"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { - innerHTML: _ctx.$sanitize(_ctx.personalInformationNote) - }, null, 8, Editvue_type_template_id_635b8e28_hoisted_20), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { - class: "createButton", - onConfirm: _cache[10] || (_cache[10] = function ($event) { - return _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr(); - }), - disabled: _ctx.isUpdating || !_ctx.isDirty, - saving: _ctx.isUpdating, - value: _ctx.saveButtonText - }, null, 8, ["disabled", "saving", "value"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_21, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - onClick: _cache[11] || (_cache[11] = function ($event) { - return _ctx.cancel(); - }) - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Cancel')), 1)])])], 32)]; - }), + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_635b8e28_hoisted_1, [Editvue_type_template_id_635b8e28_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_635b8e28_hoisted_3, [Editvue_type_template_id_635b8e28_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + onSubmit: _cache[12] || (_cache[12] = $event => _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr()) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "name", + "model-value": _ctx.siteHsr.name, + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => { + _ctx.siteHsr.name = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('General_Name'), + maxlength: 50, + placeholder: _ctx.translate('HeatmapSessionRecording_FieldNamePlaceholder'), + "inline-help": _ctx.translate('HeatmapSessionRecording_HeatmapNameHelp') + }, null, 8, ["model-value", "title", "placeholder", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "sampleLimit", + "model-value": _ctx.siteHsr.sample_limit, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => { + _ctx.siteHsr.sample_limit = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_HeatmapSampleLimit'), + options: _ctx.sampleLimits, + "inline-help": _ctx.translate('HeatmapSessionRecording_HeatmapSampleLimitHelp') + }, null, 8, ["model-value", "title", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_TargetPage')) + ":", 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_9, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.siteHsr.match_page_rules, (url, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`matchPageRules ${index} multiple`), + key: index + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrUrlTarget, { + "model-value": url, + "onUpdate:modelValue": $event => _ctx.setMatchPageRule($event, index), + onAddUrl: _cache[2] || (_cache[2] = $event => _ctx.addMatchPageRule()), + onRemoveUrl: $event => _ctx.removeMatchPageRule(index), + onAnyChange: _cache[3] || (_cache[3] = $event => _ctx.setValueHasChanged()), + "allow-any": false, + "disable-if-no-value": index > 0, + "can-be-removed": index > 0, + "show-add-url": true + }, null, 8, ["model-value", "onUpdate:modelValue", "onRemoveUrl", "disable-if-no-value", "can-be-removed"])]), Editvue_type_template_id_635b8e28_hoisted_10], 2); + }), 128))]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_635b8e28_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_FieldIncludedTargetsHelp')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrTargetTest, { + "included-targets": _ctx.siteHsr.match_page_rules + }, null, 8, ["included-targets"])])])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "sampleRate", + "model-value": _ctx.siteHsr.sample_rate, + "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => { + _ctx.siteHsr.sample_rate = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_SampleRate'), + options: _ctx.sampleRates, + introduction: _ctx.translate('HeatmapSessionRecording_AdvancedOptions'), + "inline-help": _ctx.translate('HeatmapSessionRecording_HeatmapSampleRateHelp') + }, null, 8, ["model-value", "title", "options", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "excludedElements", + "model-value": _ctx.siteHsr.excluded_elements, + "onUpdate:modelValue": _cache[5] || (_cache[5] = $event => { + _ctx.siteHsr.excluded_elements = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_ExcludedElements'), + maxlength: 1000, + "inline-help": _ctx.translate('HeatmapSessionRecording_ExcludedElementsHelp') + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "screenshotUrl", + "model-value": _ctx.siteHsr.screenshot_url, + "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => { + _ctx.siteHsr.screenshot_url = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_ScreenshotUrl'), + maxlength: 300, + disabled: !!_ctx.siteHsr.page_treemirror, + "inline-help": _ctx.translate('HeatmapSessionRecording_ScreenshotUrlHelp') + }, null, 8, ["model-value", "title", "disabled", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "breakpointMobile", + "model-value": _ctx.siteHsr.breakpoint_mobile, + "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => { + _ctx.siteHsr.breakpoint_mobile = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_BreakpointX', _ctx.translate('General_Mobile')), + maxlength: 4, + "inline-help": _ctx.breakpointMobileInlineHelp + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "breakpointTablet", + "model-value": _ctx.siteHsr.breakpoint_tablet, + "onUpdate:modelValue": _cache[8] || (_cache[8] = $event => { + _ctx.siteHsr.breakpoint_tablet = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_BreakpointX', _ctx.translate('DevicesDetection_Tablet')), + maxlength: 4, + "inline-help": _ctx.breakpointGeneralHelp + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "capture_manually", + title: _ctx.translate('HeatmapSessionRecording_CaptureDomTitle'), + "inline-help": _ctx.captureDomInlineHelp, + "model-value": _ctx.siteHsr.capture_manually, + "onUpdate:modelValue": _cache[9] || (_cache[9] = $event => { + _ctx.siteHsr.capture_manually = $event; + _ctx.setValueHasChanged(); + }) + }, null, 8, ["title", "inline-help", "model-value"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.personalInformationNote) + }, null, 8, Editvue_type_template_id_635b8e28_hoisted_20), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + class: "createButton", + onConfirm: _cache[10] || (_cache[10] = $event => _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr()), + disabled: _ctx.isUpdating || !_ctx.isDirty, + saving: _ctx.isUpdating, + value: _ctx.saveButtonText + }, null, 8, ["disabled", "saving", "value"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_635b8e28_hoisted_21, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + onClick: _cache[11] || (_cache[11] = $event => _ctx.cancel()) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Cancel')), 1)])])], 32)]), _: 1 }, 8, ["content-title"]); } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Edit.vue?vue&type=template&id=635b8e28 // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HsrStore/HsrStore.store.ts -function HsrStore_store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function HsrStore_store_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function HsrStore_store_createClass(Constructor, protoProps, staticProps) { if (protoProps) HsrStore_store_defineProperties(Constructor.prototype, protoProps); if (staticProps) HsrStore_store_defineProperties(Constructor, staticProps); return Constructor; } - function HsrStore_store_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; } - /** * Copyright (C) InnoCraft Ltd - All rights reserved. * @@ -3978,254 +3541,168 @@ function HsrStore_store_defineProperty(obj, key, value) { if (key in obj) { Obje */ - -var HsrStore_store_HsrStore = /*#__PURE__*/function () { - // used just for the adapter - function HsrStore(context) { - var _this = this; - - HsrStore_store_classCallCheck(this, HsrStore); - +class HsrStore_store_HsrStore { + constructor(context) { HsrStore_store_defineProperty(this, "context", void 0); - HsrStore_store_defineProperty(this, "privateState", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["reactive"])({ allHsrs: [], isLoading: false, isUpdating: false, filterStatus: '' })); - - HsrStore_store_defineProperty(this, "state", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(_this.privateState); - })); - - HsrStore_store_defineProperty(this, "hsrs", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { - if (!_this.privateState.filterStatus) { - return _this.state.value.allHsrs; + HsrStore_store_defineProperty(this, "state", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(() => Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])(this.privateState))); + HsrStore_store_defineProperty(this, "hsrs", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(() => { + if (!this.privateState.filterStatus) { + return this.state.value.allHsrs; } - - return _this.state.value.allHsrs.filter(function (hsr) { - return hsr.status === _this.privateState.filterStatus; - }); - })); - - HsrStore_store_defineProperty(this, "hsrsCloned", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(function () { - return Object(external_CoreHome_["clone"])(_this.hsrs.value); + return this.state.value.allHsrs.filter(hsr => hsr.status === this.privateState.filterStatus); })); - + // used just for the adapter + HsrStore_store_defineProperty(this, "hsrsCloned", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["computed"])(() => Object(external_CoreHome_["clone"])(this.hsrs.value))); HsrStore_store_defineProperty(this, "statusOptions", Object(external_commonjs_vue_commonjs2_vue_root_Vue_["readonly"])([{ - key: '', - value: Object(external_CoreHome_["translate"])('General_All') - }, { - key: 'active', - value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_StatusActive') - }, { - key: 'ended', - value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_StatusEnded') - }, { - key: 'paused', - value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_StatusPaused') - }])); - - HsrStore_store_defineProperty(this, "fetchPromises", {}); - - this.context = context; - } - - HsrStore_store_createClass(HsrStore, [{ - key: "setFilterStatus", - value: function setFilterStatus(status) { - this.privateState.filterStatus = status; - } - }, { - key: "reload", - value: function reload() { - this.privateState.allHsrs = []; - this.fetchPromises = {}; - return this.fetchHsrs(); - } - }, { - key: "filterRules", - value: function filterRules(rules) { - return rules.filter(function (target) { - return !!target && (target.value || target.type === 'any'); - }); - } - }, { - key: "getApiMethodInContext", - value: function getApiMethodInContext(apiMethod) { - return "".concat(apiMethod).concat(this.context); - } - }, { - key: "fetchHsrs", - value: function fetchHsrs() { - var _this2 = this; - - var method = 'HeatmapSessionRecording.getHeatmaps'; - - if (this.context === 'SessionRecording') { - method = 'HeatmapSessionRecording.getSessionRecordings'; - } - - var params = { - method: method, - filter_limit: '-1' - }; - - if (!this.fetchPromises[method]) { - this.fetchPromises[method] = external_CoreHome_["AjaxHelper"].fetch(params); - } - - this.privateState.isLoading = true; - this.privateState.allHsrs = []; - return this.fetchPromises[method].then(function (hsrs) { - _this2.privateState.allHsrs = hsrs; - return _this2.state.value.allHsrs; - }).finally(function () { - _this2.privateState.isLoading = false; - }); - } - }, { - key: "findHsr", - value: function findHsr(idSiteHsr) { - var _this3 = this; - - // before going through an API request we first try to find it in loaded hsrs - var found = this.state.value.allHsrs.find(function (hsr) { - return hsr.idsitehsr === idSiteHsr; - }); - - if (found) { - return Promise.resolve(found); - } // otherwise we fetch it via API - - - this.privateState.isLoading = true; - return external_CoreHome_["AjaxHelper"].fetch({ - idSiteHsr: idSiteHsr, - method: this.getApiMethodInContext('HeatmapSessionRecording.get'), - filter_limit: '-1' - }).finally(function () { - _this3.privateState.isLoading = false; - }); - } - }, { - key: "deleteHsr", - value: function deleteHsr(idSiteHsr) { - var _this4 = this; - - this.privateState.isUpdating = true; - this.privateState.allHsrs = []; - return external_CoreHome_["AjaxHelper"].fetch({ - idSiteHsr: idSiteHsr, - method: this.getApiMethodInContext('HeatmapSessionRecording.delete') - }, { - withTokenInUrl: true - }).then(function () { - return { - type: 'success' - }; - }).catch(function (error) { - return { - type: 'error', - message: error.message || error - }; - }).finally(function () { - _this4.privateState.isUpdating = false; - }); + key: '', + value: Object(external_CoreHome_["translate"])('General_All') + }, { + key: 'active', + value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_StatusActive') + }, { + key: 'ended', + value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_StatusEnded') + }, { + key: 'paused', + value: Object(external_CoreHome_["translate"])('HeatmapSessionRecording_StatusPaused') + }])); + HsrStore_store_defineProperty(this, "fetchPromises", {}); + this.context = context; + } + setFilterStatus(status) { + this.privateState.filterStatus = status; + } + reload() { + this.privateState.allHsrs = []; + this.fetchPromises = {}; + return this.fetchHsrs(); + } + filterRules(rules) { + return rules.filter(target => !!target && (target.value || target.type === 'any')); + } + getApiMethodInContext(apiMethod) { + return `${apiMethod}${this.context}`; + } + fetchHsrs() { + let method = 'HeatmapSessionRecording.getHeatmaps'; + if (this.context === 'SessionRecording') { + method = 'HeatmapSessionRecording.getSessionRecordings'; } - }, { - key: "completeHsr", - value: function completeHsr(idSiteHsr) { - var _this5 = this; - - this.privateState.isUpdating = true; - this.privateState.allHsrs = []; - return external_CoreHome_["AjaxHelper"].fetch({ - idSiteHsr: idSiteHsr, - method: this.getApiMethodInContext('HeatmapSessionRecording.end') - }, { - withTokenInUrl: true - }).then(function () { - return { - type: 'success' - }; - }).catch(function (error) { - return { - type: 'error', - message: error.message || error - }; - }).finally(function () { - _this5.privateState.isUpdating = false; - }); + const params = { + method, + filter_limit: '-1' + }; + if (!this.fetchPromises[method]) { + this.fetchPromises[method] = external_CoreHome_["AjaxHelper"].fetch(params); } - }, { - key: "createOrUpdateHsr", - value: function createOrUpdateHsr(hsr, method) { - var _this6 = this; - - var params = { - idSiteHsr: hsr.idsitehsr, - sampleLimit: hsr.sample_limit, - sampleRate: hsr.sample_rate, - excludedElements: hsr.excluded_elements ? hsr.excluded_elements.trim() : undefined, - screenshotUrl: hsr.screenshot_url ? hsr.screenshot_url.trim() : undefined, - breakpointMobile: hsr.breakpoint_mobile, - breakpointTablet: hsr.breakpoint_tablet, - minSessionTime: hsr.min_session_time, - requiresActivity: hsr.requires_activity ? 1 : 0, - captureKeystrokes: hsr.capture_keystrokes ? 1 : 0, - captureDomManually: hsr.capture_manually ? 1 : 0, - method: method, - name: hsr.name.trim() - }; - var postParams = { - matchPageRules: this.filterRules(hsr.match_page_rules) - }; - this.privateState.isUpdating = true; - return external_CoreHome_["AjaxHelper"].post(params, postParams, { - withTokenInUrl: true - }).then(function (response) { - return { - type: 'success', - response: response - }; - }).catch(function (error) { - return { - type: 'error', - message: error.message || error - }; - }).finally(function () { - _this6.privateState.isUpdating = false; - }); + this.privateState.isLoading = true; + this.privateState.allHsrs = []; + return this.fetchPromises[method].then(hsrs => { + this.privateState.allHsrs = hsrs; + return this.state.value.allHsrs; + }).finally(() => { + this.privateState.isLoading = false; + }); + } + findHsr(idSiteHsr) { + // before going through an API request we first try to find it in loaded hsrs + const found = this.state.value.allHsrs.find(hsr => hsr.idsitehsr === idSiteHsr); + if (found) { + return Promise.resolve(found); } - }]); - - return HsrStore; -}(); - -var HeatmapStore = new HsrStore_store_HsrStore('Heatmap'); -var SessionRecordingStore = new HsrStore_store_HsrStore('SessionRecording'); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Edit.vue?vue&type=script&lang=ts -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || Editvue_type_script_lang_ts_unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function Editvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Editvue_type_script_lang_ts_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Editvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Editvue_type_script_lang_ts_arrayLikeToArray(arr); } - -function Editvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - + // otherwise we fetch it via API + this.privateState.isLoading = true; + return external_CoreHome_["AjaxHelper"].fetch({ + idSiteHsr, + method: this.getApiMethodInContext('HeatmapSessionRecording.get'), + filter_limit: '-1' + }).finally(() => { + this.privateState.isLoading = false; + }); + } + deleteHsr(idSiteHsr) { + this.privateState.isUpdating = true; + this.privateState.allHsrs = []; + return external_CoreHome_["AjaxHelper"].fetch({ + idSiteHsr, + method: this.getApiMethodInContext('HeatmapSessionRecording.delete') + }, { + withTokenInUrl: true + }).then(() => ({ + type: 'success' + })).catch(error => ({ + type: 'error', + message: error.message || error + })).finally(() => { + this.privateState.isUpdating = false; + }); + } + completeHsr(idSiteHsr) { + this.privateState.isUpdating = true; + this.privateState.allHsrs = []; + return external_CoreHome_["AjaxHelper"].fetch({ + idSiteHsr, + method: this.getApiMethodInContext('HeatmapSessionRecording.end') + }, { + withTokenInUrl: true + }).then(() => ({ + type: 'success' + })).catch(error => ({ + type: 'error', + message: error.message || error + })).finally(() => { + this.privateState.isUpdating = false; + }); + } + createOrUpdateHsr(hsr, method) { + const params = { + idSiteHsr: hsr.idsitehsr, + sampleLimit: hsr.sample_limit, + sampleRate: hsr.sample_rate, + excludedElements: hsr.excluded_elements ? hsr.excluded_elements.trim() : undefined, + screenshotUrl: hsr.screenshot_url ? hsr.screenshot_url.trim() : undefined, + breakpointMobile: hsr.breakpoint_mobile, + breakpointTablet: hsr.breakpoint_tablet, + minSessionTime: hsr.min_session_time, + requiresActivity: hsr.requires_activity ? 1 : 0, + captureKeystrokes: hsr.capture_keystrokes ? 1 : 0, + captureDomManually: hsr.capture_manually ? 1 : 0, + method, + name: hsr.name.trim() + }; + const postParams = { + matchPageRules: this.filterRules(hsr.match_page_rules) + }; + this.privateState.isUpdating = true; + return external_CoreHome_["AjaxHelper"].post(params, postParams, { + withTokenInUrl: true + }).then(response => ({ + type: 'success', + response + })).catch(error => ({ + type: 'error', + message: error.message || error + })).finally(() => { + this.privateState.isUpdating = false; + }); + } +} +const HeatmapStore = new HsrStore_store_HsrStore('Heatmap'); +const SessionRecordingStore = new HsrStore_store_HsrStore('SessionRecording'); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Edit.vue?vue&type=script&lang=ts -var notificationId = 'hsrmanagement'; +const notificationId = 'hsrmanagement'; /* harmony default export */ var Editvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { idSiteHsr: Number, @@ -4239,69 +3716,63 @@ var notificationId = 'hsrmanagement'; HsrTargetTest: HsrTargetTest, SaveButton: external_CorePluginsAdmin_["SaveButton"] }, - data: function data() { + data() { return { isDirty: false, showAdvancedView: false, siteHsr: {} }; }, - created: function created() { + created() { this.init(); }, watch: { - idSiteHsr: function idSiteHsr(newValue) { + idSiteHsr(newValue) { if (newValue === null) { return; } - this.init(); } }, methods: { - removeAnyHsrNotification: function removeAnyHsrNotification() { + removeAnyHsrNotification() { external_CoreHome_["NotificationsStore"].remove(notificationId); external_CoreHome_["NotificationsStore"].remove('ajaxHelper'); }, - showNotification: function showNotification(message, context) { - var instanceId = external_CoreHome_["NotificationsStore"].show({ - message: message, - context: context, + showNotification(message, context) { + const instanceId = external_CoreHome_["NotificationsStore"].show({ + message, + context, id: notificationId, type: 'transient' }); - setTimeout(function () { + setTimeout(() => { external_CoreHome_["NotificationsStore"].scrollToNotification(instanceId); }, 200); }, - showErrorFieldNotProvidedNotification: function showErrorFieldNotProvidedNotification(title) { - var message = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ErrorXNotProvided', [title]); + showErrorFieldNotProvidedNotification(title) { + const message = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ErrorXNotProvided', [title]); this.showNotification(message, 'error'); }, - init: function init() { - var _this = this; - - var idSiteHsr = this.idSiteHsr; + init() { + const { + idSiteHsr + } = this; this.siteHsr = {}; this.showAdvancedView = false; external_CoreHome_["Matomo"].helper.lazyScrollToContent(); - if (this.edit && idSiteHsr) { - HeatmapStore.findHsr(idSiteHsr).then(function (siteHsr) { + HeatmapStore.findHsr(idSiteHsr).then(siteHsr => { if (!siteHsr) { return; } - - _this.siteHsr = Object(external_CoreHome_["clone"])(siteHsr); - _this.siteHsr.sample_rate = "".concat(_this.siteHsr.sample_rate); - - _this.addInitialMatchPageRule(); - - _this.isDirty = false; + this.siteHsr = Object(external_CoreHome_["clone"])(siteHsr); + this.siteHsr.sample_rate = `${this.siteHsr.sample_rate}`; + this.addInitialMatchPageRule(); + this.isDirty = false; }); return; } - if (this.create) { this.siteHsr = { idSite: external_CoreHome_["Matomo"].idSite, @@ -4313,13 +3784,11 @@ var notificationId = 'hsrmanagement'; capture_manually: 0 }; this.isDirty = false; - var hashParams = external_CoreHome_["MatomoUrl"].hashParsed.value; - + const hashParams = external_CoreHome_["MatomoUrl"].hashParsed.value; if (hashParams.name) { this.siteHsr.name = hashParams.name; this.isDirty = true; } - if (hashParams.matchPageRules) { try { this.siteHsr.match_page_rules = JSON.parse(hashParams.matchPageRules); @@ -4332,30 +3801,24 @@ var notificationId = 'hsrmanagement'; } } }, - addInitialMatchPageRule: function addInitialMatchPageRule() { + addInitialMatchPageRule() { var _this$siteHsr$match_p; - if (!this.siteHsr) { return; } - if ((_this$siteHsr$match_p = this.siteHsr.match_page_rules) !== null && _this$siteHsr$match_p !== void 0 && _this$siteHsr$match_p.length) { return; } - this.addMatchPageRule(); }, - addMatchPageRule: function addMatchPageRule() { + addMatchPageRule() { var _this$siteHsr$match_p2; - if (!this.siteHsr) { return; } - if (!((_this$siteHsr$match_p2 = this.siteHsr.match_page_rules) !== null && _this$siteHsr$match_p2 !== void 0 && _this$siteHsr$match_p2.length)) { this.siteHsr.match_page_rules = []; } - this.siteHsr.match_page_rules.push({ attribute: 'url', type: 'equals_simple', @@ -4364,154 +3827,134 @@ var notificationId = 'hsrmanagement'; }); this.isDirty = true; }, - removeMatchPageRule: function removeMatchPageRule(index) { + removeMatchPageRule(index) { if (this.siteHsr && index > -1) { - this.siteHsr.match_page_rules = _toConsumableArray(this.siteHsr.match_page_rules); + this.siteHsr.match_page_rules = [...this.siteHsr.match_page_rules]; this.siteHsr.match_page_rules.splice(index, 1); this.isDirty = true; } }, - cancel: function cancel() { - var newParams = Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value); + cancel() { + const newParams = Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value); delete newParams.idSiteHsr; external_CoreHome_["MatomoUrl"].updateHash(newParams); }, - createHsr: function createHsr() { - var _this2 = this; - + createHsr() { this.removeAnyHsrNotification(); - if (!this.checkRequiredFieldsAreSet()) { return; } - - HeatmapStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.addHeatmap').then(function (response) { + HeatmapStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.addHeatmap').then(response => { if (!response || response.type === 'error' || !response.response) { return; } - - _this2.isDirty = false; - var idSiteHsr = response.response.value; - HeatmapStore.reload().then(function () { + this.isDirty = false; + const idSiteHsr = response.response.value; + HeatmapStore.reload().then(() => { if (external_CoreHome_["Matomo"].helper.isReportingPage()) { external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); } - external_CoreHome_["MatomoUrl"].updateHash(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { - idSiteHsr: idSiteHsr + idSiteHsr })); - setTimeout(function () { - _this2.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapCreated'), response.type); + setTimeout(() => { + this.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapCreated'), response.type); }, 200); }); }); }, - setValueHasChanged: function setValueHasChanged() { + setValueHasChanged() { this.isDirty = true; }, - updateHsr: function updateHsr() { - var _this3 = this; - + updateHsr() { this.removeAnyHsrNotification(); - if (!this.checkRequiredFieldsAreSet()) { return; } - - HeatmapStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.updateHeatmap').then(function (response) { + HeatmapStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.updateHeatmap').then(response => { if (response.type === 'error') { return; } - - _this3.isDirty = false; - _this3.siteHsr = {}; - HeatmapStore.reload().then(function () { - _this3.init(); + this.isDirty = false; + this.siteHsr = {}; + HeatmapStore.reload().then(() => { + this.init(); }); - - _this3.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapUpdated'), response.type); + this.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapUpdated'), response.type); }); }, - checkRequiredFieldsAreSet: function checkRequiredFieldsAreSet() { + checkRequiredFieldsAreSet() { var _this$siteHsr$match_p3; - if (!this.siteHsr.name) { - var title = Object(external_CoreHome_["translate"])('General_Name'); + const title = Object(external_CoreHome_["translate"])('General_Name'); this.showErrorFieldNotProvidedNotification(title); return false; } - if (!((_this$siteHsr$match_p3 = this.siteHsr.match_page_rules) !== null && _this$siteHsr$match_p3 !== void 0 && _this$siteHsr$match_p3.length) || !HeatmapStore.filterRules(this.siteHsr.match_page_rules).length) { - var _title = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ErrorPageRuleRequired'); - - this.showNotification(_title, 'error'); + const title = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ErrorPageRuleRequired'); + this.showNotification(title, 'error'); return false; } - return true; }, - setMatchPageRule: function setMatchPageRule(rule, index) { - this.siteHsr.match_page_rules = _toConsumableArray(this.siteHsr.match_page_rules); + setMatchPageRule(rule, index) { + this.siteHsr.match_page_rules = [...this.siteHsr.match_page_rules]; this.siteHsr.match_page_rules[index] = rule; } }, computed: { - sampleLimits: function sampleLimits() { - return [1000, 2000, 5000].map(function (v) { - return { - key: "".concat(v), - value: v - }; - }); + sampleLimits() { + return [1000, 2000, 5000].map(v => ({ + key: `${v}`, + value: v + })); }, - sampleRates: function sampleRates() { - var values = [0.1, 0.5, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100]; - return values.map(function (v) { - return { - key: v.toFixed(1), - value: "".concat(v, "%") - }; - }); + sampleRates() { + const values = [0.1, 0.5, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100]; + return values.map(v => ({ + key: v.toFixed(1), + value: `${v}%` + })); }, - create: function create() { + create() { return !this.idSiteHsr; }, - edit: function edit() { + edit() { return !this.create; }, - editTitle: function editTitle() { - var token = this.create ? 'HeatmapSessionRecording_CreateNewHeatmap' : 'HeatmapSessionRecording_EditHeatmapX'; + editTitle() { + const token = this.create ? 'HeatmapSessionRecording_CreateNewHeatmap' : 'HeatmapSessionRecording_EditHeatmapX'; return token; }, - contentTitle: function contentTitle() { - return Object(external_CoreHome_["translate"])(this.editTitle, this.siteHsr.name ? "\"".concat(this.siteHsr.name, "\"") : ''); + contentTitle() { + return Object(external_CoreHome_["translate"])(this.editTitle, this.siteHsr.name ? `"${this.siteHsr.name}"` : ''); }, - isLoading: function isLoading() { + isLoading() { return HeatmapStore.state.value.isLoading; }, - isUpdating: function isUpdating() { + isUpdating() { return HeatmapStore.state.value.isUpdating; }, - breakpointMobileInlineHelp: function breakpointMobileInlineHelp() { - var help1 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelp'); - var help2 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelpManage'); - return "".concat(help1, " ").concat(help2); + breakpointMobileInlineHelp() { + const help1 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelp'); + const help2 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelpManage'); + return `${help1} ${help2}`; }, - breakpointGeneralHelp: function breakpointGeneralHelp() { - var help1 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelp'); - var help2 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelpManage'); - return "".concat(help1, " ").concat(help2); + breakpointGeneralHelp() { + const help1 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelp'); + const help2 = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_BreakpointGeneralHelpManage'); + return `${help1} ${help2}`; }, - captureDomInlineHelp: function captureDomInlineHelp() { - var id = this.idSiteHsr ? this.idSiteHsr : '{idHeatmap}'; - var command = "

_paq.push(['HeatmapSessionRecording::captureInitialDom', ".concat(id, "])"); + captureDomInlineHelp() { + const id = this.idSiteHsr ? this.idSiteHsr : '{idHeatmap}'; + const command = `

_paq.push(['HeatmapSessionRecording::captureInitialDom', ${id}])`; return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_CaptureDomInlineHelp', command, '

', ''); }, - personalInformationNote: function personalInformationNote() { - var url = 'https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website'; - return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_PersonalInformationNote', Object(external_CoreHome_["translate"])('HeatmapSessionRecording_Heatmap'), '', '', ""), ''); + personalInformationNote() { + const url = 'https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website'; + return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_PersonalInformationNote', Object(external_CoreHome_["translate"])('HeatmapSessionRecording_Heatmap'), '', '', ``, ''); }, - saveButtonText: function saveButtonText() { + saveButtonText() { return this.edit ? Object(external_CoreHome_["translate"])('CoreUpdater_UpdateTitle') : Object(external_CoreHome_["translate"])('HeatmapSessionRecording_CreateNewHeatmap'); } } @@ -4525,268 +3968,285 @@ var notificationId = 'hsrmanagement'; Editvue_type_script_lang_ts.render = Editvue_type_template_id_635b8e28_render /* harmony default export */ var Edit = (Editvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/List.vue?vue&type=template&id=669edce3 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/List.vue?vue&type=template&id=886570ca -var Listvue_type_template_id_669edce3_hoisted_1 = { +const Listvue_type_template_id_886570ca_hoisted_1 = { class: "heatmapList" }; -var Listvue_type_template_id_669edce3_hoisted_2 = { +const Listvue_type_template_id_886570ca_hoisted_2 = { class: "filterStatus" }; -var Listvue_type_template_id_669edce3_hoisted_3 = { +const Listvue_type_template_id_886570ca_hoisted_3 = { class: "hsrSearchFilter", style: { "margin-left": "3.5px" } }; -var Listvue_type_template_id_669edce3_hoisted_4 = { +const Listvue_type_template_id_886570ca_hoisted_4 = { class: "index" }; -var Listvue_type_template_id_669edce3_hoisted_5 = { +const Listvue_type_template_id_886570ca_hoisted_5 = { class: "name" }; -var Listvue_type_template_id_669edce3_hoisted_6 = { +const Listvue_type_template_id_886570ca_hoisted_6 = { class: "creationDate" }; -var Listvue_type_template_id_669edce3_hoisted_7 = { +const Listvue_type_template_id_886570ca_hoisted_7 = { class: "sampleLimit" }; -var Listvue_type_template_id_669edce3_hoisted_8 = { +const Listvue_type_template_id_886570ca_hoisted_8 = { class: "status" }; -var Listvue_type_template_id_669edce3_hoisted_9 = { +const Listvue_type_template_id_886570ca_hoisted_9 = { class: "action" }; -var Listvue_type_template_id_669edce3_hoisted_10 = { +const Listvue_type_template_id_886570ca_hoisted_10 = { colspan: "7" }; -var Listvue_type_template_id_669edce3_hoisted_11 = { +const Listvue_type_template_id_886570ca_hoisted_11 = { class: "loadingPiwik" }; - -var Listvue_type_template_id_669edce3_hoisted_12 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const Listvue_type_template_id_886570ca_hoisted_12 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); - -var Listvue_type_template_id_669edce3_hoisted_13 = { +const Listvue_type_template_id_886570ca_hoisted_13 = { colspan: "7" }; -var Listvue_type_template_id_669edce3_hoisted_14 = ["id"]; -var Listvue_type_template_id_669edce3_hoisted_15 = { +const Listvue_type_template_id_886570ca_hoisted_14 = ["id"]; +const Listvue_type_template_id_886570ca_hoisted_15 = { class: "index" }; -var Listvue_type_template_id_669edce3_hoisted_16 = { +const Listvue_type_template_id_886570ca_hoisted_16 = { class: "name" }; -var Listvue_type_template_id_669edce3_hoisted_17 = { +const Listvue_type_template_id_886570ca_hoisted_17 = { class: "creationDate" }; -var Listvue_type_template_id_669edce3_hoisted_18 = { +const Listvue_type_template_id_886570ca_hoisted_18 = { class: "sampleLimit" }; -var Listvue_type_template_id_669edce3_hoisted_19 = { +const Listvue_type_template_id_886570ca_hoisted_19 = { key: 0, class: "status status-paused" }; -var Listvue_type_template_id_669edce3_hoisted_20 = ["title"]; -var Listvue_type_template_id_669edce3_hoisted_21 = { +const Listvue_type_template_id_886570ca_hoisted_20 = ["title"]; +const Listvue_type_template_id_886570ca_hoisted_21 = { key: 1, class: "status" }; -var Listvue_type_template_id_669edce3_hoisted_22 = { - class: "action" -}; -var Listvue_type_template_id_669edce3_hoisted_23 = ["title", "onClick"]; -var Listvue_type_template_id_669edce3_hoisted_24 = ["title", "onClick"]; -var Listvue_type_template_id_669edce3_hoisted_25 = ["title", "href"]; -var Listvue_type_template_id_669edce3_hoisted_26 = ["title", "onClick"]; -var Listvue_type_template_id_669edce3_hoisted_27 = { +const Listvue_type_template_id_886570ca_hoisted_22 = ["title", "onClick"]; +const Listvue_type_template_id_886570ca_hoisted_23 = ["title", "onClick"]; +const Listvue_type_template_id_886570ca_hoisted_24 = ["title", "href"]; +const Listvue_type_template_id_886570ca_hoisted_25 = ["title", "onClick"]; +const Listvue_type_template_id_886570ca_hoisted_26 = { class: "tableActionBar" }; - -var Listvue_type_template_id_669edce3_hoisted_28 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const Listvue_type_template_id_886570ca_hoisted_27 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "icon-add" }, null, -1); - -var Listvue_type_template_id_669edce3_hoisted_29 = { +const Listvue_type_template_id_886570ca_hoisted_28 = { class: "ui-confirm", id: "confirmDeleteHeatmap", ref: "confirmDeleteHeatmap" }; -var Listvue_type_template_id_669edce3_hoisted_30 = ["value"]; -var Listvue_type_template_id_669edce3_hoisted_31 = ["value"]; -var Listvue_type_template_id_669edce3_hoisted_32 = { +const Listvue_type_template_id_886570ca_hoisted_29 = ["value"]; +const Listvue_type_template_id_886570ca_hoisted_30 = ["value"]; +const Listvue_type_template_id_886570ca_hoisted_31 = { class: "ui-confirm", id: "confirmEndHeatmap", ref: "confirmEndHeatmap" }; -var Listvue_type_template_id_669edce3_hoisted_33 = ["value"]; -var Listvue_type_template_id_669edce3_hoisted_34 = ["value"]; -function Listvue_type_template_id_669edce3_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); - - var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); - - var _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); - - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Listvue_type_template_id_669edce3_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { +const Listvue_type_template_id_886570ca_hoisted_32 = ["value"]; +const Listvue_type_template_id_886570ca_hoisted_33 = ["value"]; +function Listvue_type_template_id_886570ca_render(_ctx, _cache, $props, $setup, $data, $options) { + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _component_EntityDuplicatorAction = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("EntityDuplicatorAction"); + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + const _component_EntityDuplicatorModal = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("EntityDuplicatorModal"); + const _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_886570ca_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { "content-title": _ctx.translate('HeatmapSessionRecording_ManageHeatmaps') }, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_HeatmapUsageBenefits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_669edce3_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "filterStatus", - "model-value": _ctx.filterStatus, - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { - _ctx.setFilterStatus($event); - }), - title: _ctx.translate('HeatmapSessionRecording_Filter'), - "full-width": true, - options: _ctx.statusOptions - }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_669edce3_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "hsrSearch", - title: _ctx.translate('General_Search'), - modelValue: _ctx.searchFilter, - "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { - return _ctx.searchFilter = $event; - }), - "full-width": true - }, null, 8, ["title", "modelValue"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hsrs.length > 0]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_669edce3_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Id')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_669edce3_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_669edce3_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreationDate')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_669edce3_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_SampleLimit')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_669edce3_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CorePluginsAdmin_Status')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_669edce3_hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Listvue_type_template_id_669edce3_hoisted_11, [Listvue_type_template_id_669edce3_hoisted_12, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_NoHeatmapsFound')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isLoading && _ctx.hsrs.length === 0]]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.sortedHsrs, function (hsr) { - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { - id: "hsr".concat(hsr.idsitehsr), - class: "hsrs", - key: hsr.idsitehsr - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.idsitehsr), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_17, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.created_date_pretty), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_18, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.sample_limit), 1), hsr.status === 'paused' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_669edce3_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { - class: "icon icon-help", - title: _ctx.pauseReason - }, null, 8, Listvue_type_template_id_669edce3_hoisted_20)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_669edce3_hoisted_21, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)), 1)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_669edce3_hoisted_22, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "table-action icon-edit", - title: _ctx.translate('HeatmapSessionRecording_EditX', _ctx.translate('HeatmapSessionRecording_Heatmap')), - onClick: function onClick($event) { - return _ctx.editHsr(hsr.idsitehsr); - } - }, null, 8, Listvue_type_template_id_669edce3_hoisted_23), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - a: "", - class: "table-action stopRecording icon-drop-crossed", - title: _ctx.translate('HeatmapSessionRecording_StopX', _ctx.translate('HeatmapSessionRecording_Heatmap')), - onClick: function onClick($event) { - return _ctx.completeHsr(hsr); - } - }, null, 8, Listvue_type_template_id_669edce3_hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], hsr.status !== 'ended']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - target: "_blank", - class: "table-action icon-show", - title: _ctx.translate('HeatmapSessionRecording_ViewReport'), - href: _ctx.getViewReportLink(hsr) - }, null, 8, Listvue_type_template_id_669edce3_hoisted_25), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "table-action icon-delete", - title: _ctx.translate('HeatmapSessionRecording_DeleteX', _ctx.translate('HeatmapSessionRecording_Heatmap')), - onClick: function onClick($event) { - return _ctx.deleteHsr(hsr); - } - }, null, 8, Listvue_type_template_id_669edce3_hoisted_26)])], 8, Listvue_type_template_id_669edce3_hoisted_14); - }), 128))])], 512), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_669edce3_hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "createNewHsr", - value: "", - onClick: _cache[2] || (_cache[2] = function ($event) { - return _ctx.createHsr(); + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_HeatmapUsageBenefits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_886570ca_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "filterStatus", + "model-value": _ctx.filterStatus, + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => { + _ctx.setFilterStatus($event); + }), + title: _ctx.translate('HeatmapSessionRecording_Filter'), + "full-width": true, + options: _ctx.statusOptions + }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_886570ca_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "hsrSearch", + title: _ctx.translate('General_Search'), + modelValue: _ctx.searchFilter, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.searchFilter = $event), + "full-width": true + }, null, 8, ["title", "modelValue"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hsrs.length > 0]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_886570ca_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Id')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_886570ca_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_886570ca_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreationDate')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_886570ca_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_SampleLimit')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_886570ca_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CorePluginsAdmin_Status')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_886570ca_hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_886570ca_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Listvue_type_template_id_886570ca_hoisted_11, [Listvue_type_template_id_886570ca_hoisted_12, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_886570ca_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_NoHeatmapsFound')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isLoading && _ctx.hsrs.length === 0]]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.sortedHsrs, hsr => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + id: `hsr${hsr.idsitehsr}`, + class: "hsrs", + key: hsr.idsitehsr + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_886570ca_hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.idsitehsr), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_886570ca_hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_886570ca_hoisted_17, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.created_date_pretty), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_886570ca_hoisted_18, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.sample_limit), 1), hsr.status === 'paused' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_886570ca_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon icon-help", + title: _ctx.pauseReason + }, null, 8, Listvue_type_template_id_886570ca_hoisted_20)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_886570ca_hoisted_21, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)), 1)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ + 'action': true, + 'duplicate-available': _ctx.isEntityDuplicatorAvailable }) - }, [Listvue_type_template_id_669edce3_hoisted_28, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreateNewHeatmap')), 1)])])]; - }), + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-edit", + title: _ctx.translate('HeatmapSessionRecording_EditX', _ctx.translate('HeatmapSessionRecording_Heatmap')), + onClick: $event => _ctx.editHsr(hsr.idsitehsr) + }, null, 8, Listvue_type_template_id_886570ca_hoisted_22), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action stopRecording icon-drop-crossed", + title: _ctx.translate('HeatmapSessionRecording_StopX', _ctx.translate('HeatmapSessionRecording_Heatmap')), + onClick: $event => _ctx.completeHsr(hsr) + }, null, 8, Listvue_type_template_id_886570ca_hoisted_23), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], hsr.status !== 'ended']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + target: "_blank", + class: "table-action icon-show", + title: _ctx.translate('HeatmapSessionRecording_ViewReport'), + href: _ctx.getViewReportLink(hsr) + }, null, 8, Listvue_type_template_id_886570ca_hoisted_24), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-delete", + title: _ctx.translate('HeatmapSessionRecording_DeleteX', _ctx.translate('HeatmapSessionRecording_Heatmap')), + onClick: $event => _ctx.deleteHsr(hsr) + }, null, 8, Listvue_type_template_id_886570ca_hoisted_25), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_EntityDuplicatorAction, { + actionFormData: { + idSiteHsr: hsr.idsitehsr + }, + modalStore: _ctx.entityDuplicatorStore, + isActionVisible: _ctx.showDuplicatorAction, + isActionEnabled: _ctx.enableDuplicatorAction, + tooltipTextOverrideDisabled: _ctx.translate('HeatmapSessionRecording_QuotaReachedForX', _ctx.translate('HeatmapSessionRecording_Heatmap'), _ctx.translate('HeatmapSessionRecording_Heatmaps')), + extraClasses: ['heatmap-duplicate-action', `hsr-${hsr.idsitehsr}`] + }, null, 8, ["actionFormData", "modalStore", "isActionVisible", "isActionEnabled", "tooltipTextOverrideDisabled", "extraClasses"])], 2)], 8, Listvue_type_template_id_886570ca_hoisted_14); + }), 128))])])), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_886570ca_hoisted_26, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "createNewHsr", + value: "", + onClick: _cache[2] || (_cache[2] = $event => _ctx.createHsr()) + }, [Listvue_type_template_id_886570ca_hoisted_27, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreateNewHeatmap')), 1)])])]), _: 1 - }, 8, ["content-title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_669edce3_hoisted_29, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeleteHeatmapConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, 8, ["content-title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_886570ca_hoisted_28, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeleteHeatmapConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", type: "button", value: _ctx.translate('General_Yes') - }, null, 8, Listvue_type_template_id_669edce3_hoisted_30), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, Listvue_type_template_id_886570ca_hoisted_29), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "no", type: "button", value: _ctx.translate('General_No') - }, null, 8, Listvue_type_template_id_669edce3_hoisted_31)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_669edce3_hoisted_32, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_EndHeatmapConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, Listvue_type_template_id_886570ca_hoisted_30)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_886570ca_hoisted_31, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_EndHeatmapConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", type: "button", value: _ctx.translate('General_Yes') - }, null, 8, Listvue_type_template_id_669edce3_hoisted_33), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }, null, 8, Listvue_type_template_id_886570ca_hoisted_32), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "no", type: "button", value: _ctx.translate('General_No') - }, null, 8, Listvue_type_template_id_669edce3_hoisted_34)], 512)]); + }, null, 8, Listvue_type_template_id_886570ca_hoisted_33)], 512)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_EntityDuplicatorModal, { + modalStore: _ctx.entityDuplicatorStore + }, null, 8, ["modalStore"])], 64); } -// CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/List.vue?vue&type=template&id=669edce3 - -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/List.vue?vue&type=script&lang=ts -function Listvue_type_script_lang_ts_toConsumableArray(arr) { return Listvue_type_script_lang_ts_arrayWithoutHoles(arr) || Listvue_type_script_lang_ts_iterableToArray(arr) || Listvue_type_script_lang_ts_unsupportedIterableToArray(arr) || Listvue_type_script_lang_ts_nonIterableSpread(); } - -function Listvue_type_script_lang_ts_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function Listvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return Listvue_type_script_lang_ts_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Listvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } - -function Listvue_type_script_lang_ts_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function Listvue_type_script_lang_ts_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return Listvue_type_script_lang_ts_arrayLikeToArray(arr); } - -function Listvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +// CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/List.vue?vue&type=template&id=886570ca +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/List.vue?vue&type=script&lang=ts +// Load these separately in case the version of core doesn't have the components yet +const EntityDuplicatorModal = Object(external_CoreHome_["useExternalPluginComponent"])('CoreHome', 'EntityDuplicatorModal'); +const EntityDuplicatorAction = Object(external_CoreHome_["useExternalPluginComponent"])('CoreHome', 'EntityDuplicatorAction'); +// Load the class similar to useExternalPluginComponent, but for something other than a component +let EntityDuplicatorStore = undefined; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +Object(external_CoreHome_["importPluginUmd"])('CoreHome').then(module => { + EntityDuplicatorStore = module === null || module === void 0 ? void 0 : module.EntityDuplicatorStore; +}); /* harmony default export */ var Listvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { pauseReason: String }, components: { ContentBlock: external_CoreHome_["ContentBlock"], - Field: external_CorePluginsAdmin_["Field"] + Field: external_CorePluginsAdmin_["Field"], + EntityDuplicatorModal, + EntityDuplicatorAction }, directives: { ContentTable: external_CoreHome_["ContentTable"] }, - data: function data() { + data() { return { - searchFilter: '' + searchFilter: '', + showDuplicatorAction: true, + enableDuplicatorAction: false, + entityDuplicatorStore: typeof EntityDuplicatorStore !== 'undefined' ? EntityDuplicatorStore.buildStoreInstance('HeatmapSessionRecording_Heatmap', { + method: 'HeatmapSessionRecording.duplicateHeatmap', + requiredFields: ['idSite', 'idDestinationSites', 'idSiteHsr'] + }) : undefined }; }, - created: function created() { + created() { HeatmapStore.setFilterStatus(''); HeatmapStore.fetchHsrs(); }, + mounted() { + // Check whether adding heatmaps is allowed. It will disable the action if it isn't + this.checkIsAddingHeatmapAllowed(); + // If the adapter is defined, cast it to the expected type and override any necessary methods. + if (this.entityDuplicatorStore) { + const adapter = this.entityDuplicatorStore.adapter; + adapter.onSuccessCallback = response => new Promise(resolve => { + var _response$additionalD, _response$additionalD2, _response$additionalD3; + // Check if reloading is even necessary. If the current site isn't a destination skip reload + const idSite = (_response$additionalD = response.additionalData) === null || _response$additionalD === void 0 ? void 0 : _response$additionalD.idSite; + if ((_response$additionalD2 = response.additionalData) !== null && _response$additionalD2 !== void 0 && _response$additionalD2.idSite && Array.isArray((_response$additionalD3 = response.additionalData) === null || _response$additionalD3 === void 0 ? void 0 : _response$additionalD3.idDestinationSites) && !response.additionalData.idDestinationSites.some(id => +id === +idSite)) { + return resolve(); + } + return HeatmapStore.reload().then(() => resolve()); + }); + } + }, methods: { - createHsr: function createHsr() { + createHsr() { this.editHsr(0); }, - editHsr: function editHsr(idSiteHsr) { + editHsr(idSiteHsr) { external_CoreHome_["MatomoUrl"].updateHash(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { - idSiteHsr: idSiteHsr + idSiteHsr })); }, - deleteHsr: function deleteHsr(hsr) { + deleteHsr(hsr) { external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmap, { - yes: function yes() { - HeatmapStore.deleteHsr(hsr.idsitehsr).then(function () { + yes: () => { + HeatmapStore.deleteHsr(hsr.idsitehsr).then(() => { HeatmapStore.reload(); external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); }); } }); }, - completeHsr: function completeHsr(hsr) { + completeHsr(hsr) { external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmEndHeatmap, { - yes: function yes() { - HeatmapStore.completeHsr(hsr.idsitehsr).then(function () { + yes: () => { + HeatmapStore.completeHsr(hsr.idsitehsr).then(() => { HeatmapStore.reload(); }); } }); }, - setFilterStatus: function setFilterStatus(filter) { + setFilterStatus(filter) { HeatmapStore.setFilterStatus(filter); }, - ucfirst: function ucfirst(s) { - return "".concat(s[0].toUpperCase()).concat(s.substr(1)); + ucfirst(s) { + return `${s[0].toUpperCase()}${s.substr(1)}`; }, - getViewReportLink: function getViewReportLink(hsr) { - return "?".concat(external_CoreHome_["MatomoUrl"].stringify({ + getViewReportLink(hsr) { + return `?${external_CoreHome_["MatomoUrl"].stringify({ module: 'Widgetize', action: 'iframe', moduleToWidgetize: 'HeatmapSessionRecording', @@ -4795,41 +4255,46 @@ function Listvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == nul idSite: hsr.idsite, period: 'day', date: 'yesterday' - })); + })}`; + }, + checkIsAddingHeatmapAllowed() { + // Post event so that Billing, etc. can indicate whether adding another heatmap is allowed + const parameters = { + isAllowed: true + }; + external_CoreHome_["Matomo"].postEvent('HeatmapSessionRecording.initAddHeatmap', parameters); + this.enableDuplicatorAction = parameters && parameters.isAllowed === true; + return !this.enableDuplicatorAction; } }, computed: { - filterStatus: function filterStatus() { + filterStatus() { return HeatmapStore.state.value.filterStatus; }, - statusOptions: function statusOptions() { + statusOptions() { return HeatmapStore.statusOptions; }, - hsrs: function hsrs() { + hsrs() { return HeatmapStore.hsrs.value; }, - isLoading: function isLoading() { + isLoading() { return HeatmapStore.state.value.isLoading; }, - isUpdating: function isUpdating() { + isUpdating() { return HeatmapStore.state.value.isUpdating; }, - sortedHsrs: function sortedHsrs() { - var _this = this; - + sortedHsrs() { // look through string properties of heatmaps for values that have searchFilter in them // (mimics angularjs filter() filter) - var result = Listvue_type_script_lang_ts_toConsumableArray(this.hsrs).filter(function (h) { - return Object.keys(h).some(function (propName) { - var entity = h; - return typeof entity[propName] === 'string' && entity[propName].indexOf(_this.searchFilter) !== -1; - }); - }); - - result.sort(function (lhs, rhs) { - return rhs.idsitehsr - lhs.idsitehsr; - }); + const result = [...this.hsrs].filter(h => Object.keys(h).some(propName => { + const entity = h; + return typeof entity[propName] === 'string' && entity[propName].indexOf(this.searchFilter) !== -1; + })); + result.sort((lhs, rhs) => rhs.idsitehsr - lhs.idsitehsr); return result; + }, + isEntityDuplicatorAvailable() { + return typeof EntityDuplicatorStore !== 'undefined'; } } })); @@ -4839,28 +4304,25 @@ function Listvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == nul -Listvue_type_script_lang_ts.render = Listvue_type_template_id_669edce3_render +Listvue_type_script_lang_ts.render = Listvue_type_template_id_886570ca_render /* harmony default export */ var List = (Listvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Manage.vue?vue&type=template&id=56c7eaa3 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Manage.vue?vue&type=template&id=56c7eaa3 -var Managevue_type_template_id_56c7eaa3_hoisted_1 = { +const Managevue_type_template_id_56c7eaa3_hoisted_1 = { class: "manageHsr", ref: "root" }; -var Managevue_type_template_id_56c7eaa3_hoisted_2 = { +const Managevue_type_template_id_56c7eaa3_hoisted_2 = { key: 0 }; -var Managevue_type_template_id_56c7eaa3_hoisted_3 = { +const Managevue_type_template_id_56c7eaa3_hoisted_3 = { key: 1 }; function Managevue_type_template_id_56c7eaa3_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_MatomoJsNotWritableAlert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoJsNotWritableAlert"); - - var _component_HeatmapList = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HeatmapList"); - - var _component_HeatmapEdit = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HeatmapEdit"); - + const _component_MatomoJsNotWritableAlert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoJsNotWritableAlert"); + const _component_HeatmapList = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HeatmapList"); + const _component_HeatmapEdit = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HeatmapEdit"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, [!_ctx.editMode ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_MatomoJsNotWritableAlert, { key: 0, "is-matomo-js-writable": _ctx.isMatomoJsWritable, @@ -4875,9 +4337,9 @@ function Managevue_type_template_id_56c7eaa3_render(_ctx, _cache, $props, $setup } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Manage.vue?vue&type=template&id=56c7eaa3 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue?vue&type=template&id=3eefb154 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue?vue&type=template&id=3eefb154 -var MatomoJsNotWritableAlertvue_type_template_id_3eefb154_hoisted_1 = ["innerHTML"]; +const MatomoJsNotWritableAlertvue_type_template_id_3eefb154_hoisted_1 = ["innerHTML"]; function MatomoJsNotWritableAlertvue_type_template_id_3eefb154_render(_ctx, _cache, $props, $setup, $data, $options) { return !_ctx.isMatomoJsWritable ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { key: 0, @@ -4887,7 +4349,7 @@ function MatomoJsNotWritableAlertvue_type_template_id_3eefb154_render(_ctx, _cac } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue?vue&type=template&id=3eefb154 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue?vue&type=script&lang=ts /* harmony default export */ var MatomoJsNotWritableAlertvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ @@ -4902,7 +4364,7 @@ function MatomoJsNotWritableAlertvue_type_template_id_3eefb154_render(_ctx, _cac } }, methods: { - getJsNotWritableErrorMessage: function getJsNotWritableErrorMessage() { + getJsNotWritableErrorMessage() { return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_MatomoJSNotWritableErrorMessage', this.recordingType, '', ''); } } @@ -4916,14 +4378,15 @@ function MatomoJsNotWritableAlertvue_type_template_id_3eefb154_render(_ctx, _cac MatomoJsNotWritableAlertvue_type_script_lang_ts.render = MatomoJsNotWritableAlertvue_type_template_id_3eefb154_render /* harmony default export */ var MatomoJsNotWritableAlert = (MatomoJsNotWritableAlertvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Manage.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageHeatmap/Manage.vue?vue&type=script&lang=ts -var Managevue_type_script_lang_ts_window = window, - Managevue_type_script_lang_ts_$ = Managevue_type_script_lang_ts_window.$; +const { + $: Managevue_type_script_lang_ts_$ +} = window; /* harmony default export */ var Managevue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { breakpointMobile: Number, @@ -4934,7 +4397,7 @@ var Managevue_type_script_lang_ts_window = window, required: true } }, - data: function data() { + data() { return { editMode: false, idSiteHsr: null @@ -4946,48 +4409,41 @@ var Managevue_type_script_lang_ts_window = window, HeatmapEdit: Edit }, watch: { - editMode: function editMode() { + editMode() { // when changing edit modes, the tooltip can sometimes get stuck on the screen Managevue_type_script_lang_ts_$('.ui-tooltip').remove(); } }, - created: function created() { - var _this = this; - + created() { // doing this in a watch because we don't want to post an event in a computed property - Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(function () { - return external_CoreHome_["MatomoUrl"].hashParsed.value.idSiteHsr; - }, function (idSiteHsr) { - _this.initState(idSiteHsr); + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(() => external_CoreHome_["MatomoUrl"].hashParsed.value.idSiteHsr, idSiteHsr => { + this.initState(idSiteHsr); }); this.initState(external_CoreHome_["MatomoUrl"].hashParsed.value.idSiteHsr); }, methods: { - removeAnyHsrNotification: function removeAnyHsrNotification() { + removeAnyHsrNotification() { external_CoreHome_["NotificationsStore"].remove('hsrmanagement'); }, - initState: function initState(idSiteHsr) { + initState(idSiteHsr) { if (idSiteHsr) { if (idSiteHsr === '0') { - var parameters = { + const parameters = { isAllowed: true }; external_CoreHome_["Matomo"].postEvent('HeatmapSessionRecording.initAddHeatmap', parameters); - if (parameters && !parameters.isAllowed) { this.editMode = false; this.idSiteHsr = null; return; } } - this.editMode = true; this.idSiteHsr = parseInt(idSiteHsr, 10); } else { this.editMode = false; this.idSiteHsr = null; } - this.removeAnyHsrNotification(); } } @@ -5001,235 +4457,188 @@ var Managevue_type_script_lang_ts_window = window, Managevue_type_script_lang_ts.render = Managevue_type_template_id_56c7eaa3_render /* harmony default export */ var Manage = (Managevue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Edit.vue?vue&type=template&id=56c3e386 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Edit.vue?vue&type=template&id=56c3e386 -var Editvue_type_template_id_56c3e386_hoisted_1 = { +const Editvue_type_template_id_56c3e386_hoisted_1 = { class: "loadingPiwik" }; - -var Editvue_type_template_id_56c3e386_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const Editvue_type_template_id_56c3e386_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); - -var Editvue_type_template_id_56c3e386_hoisted_3 = { +const Editvue_type_template_id_56c3e386_hoisted_3 = { class: "loadingPiwik" }; - -var Editvue_type_template_id_56c3e386_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const Editvue_type_template_id_56c3e386_hoisted_4 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); - -var Editvue_type_template_id_56c3e386_hoisted_5 = { +const Editvue_type_template_id_56c3e386_hoisted_5 = { name: "name" }; -var Editvue_type_template_id_56c3e386_hoisted_6 = { +const Editvue_type_template_id_56c3e386_hoisted_6 = { name: "sampleLimit" }; -var Editvue_type_template_id_56c3e386_hoisted_7 = { +const Editvue_type_template_id_56c3e386_hoisted_7 = { class: "form-group row" }; -var Editvue_type_template_id_56c3e386_hoisted_8 = { +const Editvue_type_template_id_56c3e386_hoisted_8 = { class: "col s12" }; -var Editvue_type_template_id_56c3e386_hoisted_9 = { +const Editvue_type_template_id_56c3e386_hoisted_9 = { class: "col s12 m6", style: { "padding-left": "0" } }; - -var Editvue_type_template_id_56c3e386_hoisted_10 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("hr", null, null, -1); - -var Editvue_type_template_id_56c3e386_hoisted_11 = { +const Editvue_type_template_id_56c3e386_hoisted_10 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("hr", null, null, -1); +const Editvue_type_template_id_56c3e386_hoisted_11 = { class: "col s12 m6" }; -var Editvue_type_template_id_56c3e386_hoisted_12 = { +const Editvue_type_template_id_56c3e386_hoisted_12 = { class: "form-help" }; -var Editvue_type_template_id_56c3e386_hoisted_13 = { +const Editvue_type_template_id_56c3e386_hoisted_13 = { class: "inline-help" }; -var Editvue_type_template_id_56c3e386_hoisted_14 = { +const Editvue_type_template_id_56c3e386_hoisted_14 = { name: "sampleRate" }; -var Editvue_type_template_id_56c3e386_hoisted_15 = { +const Editvue_type_template_id_56c3e386_hoisted_15 = { name: "minSessionTime" }; -var Editvue_type_template_id_56c3e386_hoisted_16 = { +const Editvue_type_template_id_56c3e386_hoisted_16 = { name: "requiresActivity" }; -var Editvue_type_template_id_56c3e386_hoisted_17 = { +const Editvue_type_template_id_56c3e386_hoisted_17 = { class: "inline-help-node" }; -var Editvue_type_template_id_56c3e386_hoisted_18 = ["innerHTML"]; -var Editvue_type_template_id_56c3e386_hoisted_19 = ["innerHTML"]; -var Editvue_type_template_id_56c3e386_hoisted_20 = { +const Editvue_type_template_id_56c3e386_hoisted_18 = ["innerHTML"]; +const Editvue_type_template_id_56c3e386_hoisted_19 = ["innerHTML"]; +const Editvue_type_template_id_56c3e386_hoisted_20 = { class: "entityCancel" }; function Editvue_type_template_id_56c3e386_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); - - var _component_HsrUrlTarget = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrUrlTarget"); - - var _component_HsrTargetTest = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrTargetTest"); - - var _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); - - var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); - + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _component_HsrUrlTarget = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrUrlTarget"); + const _component_HsrTargetTest = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HsrTargetTest"); + const _component_SaveButton = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SaveButton"); + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_ContentBlock, { class: "editHsr", "content-title": _ctx.contentTitle }, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_56c3e386_hoisted_1, [Editvue_type_template_id_56c3e386_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_56c3e386_hoisted_3, [Editvue_type_template_id_56c3e386_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { - onSubmit: _cache[10] || (_cache[10] = function ($event) { - return _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr(); - }) - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "name", - "model-value": _ctx.siteHsr.name, - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { - _ctx.siteHsr.name = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('General_Name'), - maxlength: 50, - placeholder: _ctx.translate('HeatmapSessionRecording_FieldNamePlaceholder'), - "inline-help": _ctx.translate('HeatmapSessionRecording_SessionNameHelp') - }, null, 8, ["model-value", "title", "placeholder", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "sampleLimit", - "model-value": _ctx.siteHsr.sample_limit, - "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { - _ctx.siteHsr.sample_limit = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_SessionSampleLimit'), - options: _ctx.sampleLimits, - "inline-help": _ctx.translate('HeatmapSessionRecording_SessionSampleLimitHelp') - }, null, 8, ["model-value", "title", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_TargetPages')) + ":", 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_9, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.siteHsr.match_page_rules, function (url, index) { - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { - class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])("matchPageRules ".concat(index, " multiple")), - key: index - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrUrlTarget, { - "model-value": url, - "onUpdate:modelValue": function onUpdateModelValue($event) { - return _ctx.setMatchPageRule($event, index); - }, - onAddUrl: _cache[2] || (_cache[2] = function ($event) { - return _ctx.addMatchPageRule(); - }), - onRemoveUrl: function onRemoveUrl($event) { - return _ctx.removeMatchPageRule(index); - }, - onAnyChange: _cache[3] || (_cache[3] = function ($event) { - return _ctx.setValueHasChanged(); - }), - "allow-any": true, - "disable-if-no-value": index > 0, - "can-be-removed": index > 0, - "show-add-url": true - }, null, 8, ["model-value", "onUpdate:modelValue", "onRemoveUrl", "disable-if-no-value", "can-be-removed"])]), Editvue_type_template_id_56c3e386_hoisted_10], 2); - }), 128))]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_56c3e386_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_FieldIncludedTargetsHelpSessions')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrTargetTest, { - "included-targets": _ctx.siteHsr.match_page_rules - }, null, 8, ["included-targets"])])])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "sampleRate", - "model-value": _ctx.siteHsr.sample_rate, - "onUpdate:modelValue": _cache[4] || (_cache[4] = function ($event) { - _ctx.siteHsr.sample_rate = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_SampleRate'), - options: _ctx.sampleRates, - introduction: _ctx.translate('HeatmapSessionRecording_AdvancedOptions'), - "inline-help": _ctx.translate('HeatmapSessionRecording_SessionSampleRateHelp') - }, null, 8, ["model-value", "title", "options", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "minSessionTime", - "model-value": _ctx.siteHsr.min_session_time, - "onUpdate:modelValue": _cache[5] || (_cache[5] = function ($event) { - _ctx.siteHsr.min_session_time = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_MinSessionTime'), - options: _ctx.minSessionTimes, - "inline-help": _ctx.translate('HeatmapSessionRecording_MinSessionTimeHelp') - }, null, 8, ["model-value", "title", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "checkbox", - name: "requiresActivity", - "model-value": _ctx.siteHsr.requires_activity, - "onUpdate:modelValue": _cache[6] || (_cache[6] = function ($event) { - _ctx.siteHsr.requires_activity = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_RequiresActivity'), - "inline-help": _ctx.translate('HeatmapSessionRecording_RequiresActivityHelp') - }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "checkbox", - name: "captureKeystrokes", - "model-value": _ctx.siteHsr.capture_keystrokes, - "onUpdate:modelValue": _cache[7] || (_cache[7] = function ($event) { - _ctx.siteHsr.capture_keystrokes = $event; - - _ctx.setValueHasChanged(); - }), - title: _ctx.translate('HeatmapSessionRecording_CaptureKeystrokes') - }, { - "inline-help": Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { - innerHTML: _ctx.$sanitize(_ctx.captureKeystrokesHelp) - }, null, 8, Editvue_type_template_id_56c3e386_hoisted_18)])]; - }), - _: 1 - }, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { - innerHTML: _ctx.$sanitize(_ctx.personalInformationNote) - }, null, 8, Editvue_type_template_id_56c3e386_hoisted_19), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { - class: "createButton", - onConfirm: _cache[8] || (_cache[8] = function ($event) { - return _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr(); - }), - disabled: _ctx.isUpdating || !_ctx.isDirty, - saving: _ctx.isUpdating, - value: _ctx.saveButtonText - }, null, 8, ["disabled", "saving", "value"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_20, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - onClick: _cache[9] || (_cache[9] = function ($event) { - return _ctx.cancel(); - }) - }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Cancel')), 1)])])], 32)]; - }), + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_56c3e386_hoisted_1, [Editvue_type_template_id_56c3e386_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_56c3e386_hoisted_3, [Editvue_type_template_id_56c3e386_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_UpdatingData')), 1)])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + onSubmit: _cache[10] || (_cache[10] = $event => _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr()) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "name", + "model-value": _ctx.siteHsr.name, + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => { + _ctx.siteHsr.name = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('General_Name'), + maxlength: 50, + placeholder: _ctx.translate('HeatmapSessionRecording_FieldNamePlaceholder'), + "inline-help": _ctx.translate('HeatmapSessionRecording_SessionNameHelp') + }, null, 8, ["model-value", "title", "placeholder", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "sampleLimit", + "model-value": _ctx.siteHsr.sample_limit, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => { + _ctx.siteHsr.sample_limit = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_SessionSampleLimit'), + options: _ctx.sampleLimits, + "inline-help": _ctx.translate('HeatmapSessionRecording_SessionSampleLimitHelp') + }, null, 8, ["model-value", "title", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_TargetPages')) + ":", 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_9, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.siteHsr.match_page_rules, (url, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`matchPageRules ${index} multiple`), + key: index + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrUrlTarget, { + "model-value": url, + "onUpdate:modelValue": $event => _ctx.setMatchPageRule($event, index), + onAddUrl: _cache[2] || (_cache[2] = $event => _ctx.addMatchPageRule()), + onRemoveUrl: $event => _ctx.removeMatchPageRule(index), + onAnyChange: _cache[3] || (_cache[3] = $event => _ctx.setValueHasChanged()), + "allow-any": true, + "disable-if-no-value": index > 0, + "can-be-removed": index > 0, + "show-add-url": true + }, null, 8, ["model-value", "onUpdate:modelValue", "onRemoveUrl", "disable-if-no-value", "can-be-removed"])]), Editvue_type_template_id_56c3e386_hoisted_10], 2); + }), 128))]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_11, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_12, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Editvue_type_template_id_56c3e386_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_FieldIncludedTargetsHelpSessions')) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HsrTargetTest, { + "included-targets": _ctx.siteHsr.match_page_rules + }, null, 8, ["included-targets"])])])])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "sampleRate", + "model-value": _ctx.siteHsr.sample_rate, + "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => { + _ctx.siteHsr.sample_rate = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_SampleRate'), + options: _ctx.sampleRates, + introduction: _ctx.translate('HeatmapSessionRecording_AdvancedOptions'), + "inline-help": _ctx.translate('HeatmapSessionRecording_SessionSampleRateHelp') + }, null, 8, ["model-value", "title", "options", "introduction", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "minSessionTime", + "model-value": _ctx.siteHsr.min_session_time, + "onUpdate:modelValue": _cache[5] || (_cache[5] = $event => { + _ctx.siteHsr.min_session_time = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_MinSessionTime'), + options: _ctx.minSessionTimes, + "inline-help": _ctx.translate('HeatmapSessionRecording_MinSessionTimeHelp') + }, null, 8, ["model-value", "title", "options", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "requiresActivity", + "model-value": _ctx.siteHsr.requires_activity, + "onUpdate:modelValue": _cache[6] || (_cache[6] = $event => { + _ctx.siteHsr.requires_activity = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_RequiresActivity'), + "inline-help": _ctx.translate('HeatmapSessionRecording_RequiresActivityHelp') + }, null, 8, ["model-value", "title", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + name: "captureKeystrokes", + "model-value": _ctx.siteHsr.capture_keystrokes, + "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => { + _ctx.siteHsr.capture_keystrokes = $event; + _ctx.setValueHasChanged(); + }), + title: _ctx.translate('HeatmapSessionRecording_CaptureKeystrokes') + }, { + "inline-help": Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.$sanitize(_ctx.captureKeystrokesHelp) + }, null, 8, Editvue_type_template_id_56c3e386_hoisted_18)])]), + _: 1 + }, 8, ["model-value", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.personalInformationNote) + }, null, 8, Editvue_type_template_id_56c3e386_hoisted_19), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_SaveButton, { + class: "createButton", + onConfirm: _cache[8] || (_cache[8] = $event => _ctx.edit ? _ctx.updateHsr() : _ctx.createHsr()), + disabled: _ctx.isUpdating || !_ctx.isDirty, + saving: _ctx.isUpdating, + value: _ctx.saveButtonText + }, null, 8, ["disabled", "saving", "value"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Editvue_type_template_id_56c3e386_hoisted_20, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + onClick: _cache[9] || (_cache[9] = $event => _ctx.cancel()) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Cancel')), 1)])])], 32)]), _: 1 }, 8, ["content-title"]); } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Edit.vue?vue&type=template&id=56c3e386 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Edit.vue?vue&type=script&lang=ts -function Editvue_type_script_lang_ts_toConsumableArray(arr) { return Editvue_type_script_lang_ts_arrayWithoutHoles(arr) || Editvue_type_script_lang_ts_iterableToArray(arr) || ManageSessionRecording_Editvue_type_script_lang_ts_unsupportedIterableToArray(arr) || Editvue_type_script_lang_ts_nonIterableSpread(); } - -function Editvue_type_script_lang_ts_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function ManageSessionRecording_Editvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ManageSessionRecording_Editvue_type_script_lang_ts_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ManageSessionRecording_Editvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } - -function Editvue_type_script_lang_ts_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function Editvue_type_script_lang_ts_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return ManageSessionRecording_Editvue_type_script_lang_ts_arrayLikeToArray(arr); } - -function ManageSessionRecording_Editvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Edit.vue?vue&type=script&lang=ts -var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; +const Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; /* harmony default export */ var ManageSessionRecording_Editvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ props: { idSiteHsr: Number @@ -5241,7 +4650,7 @@ var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; HsrTargetTest: HsrTargetTest, SaveButton: external_CorePluginsAdmin_["SaveButton"] }, - data: function data() { + data() { return { isDirty: false, showAdvancedView: false, @@ -5249,74 +4658,64 @@ var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; siteHsr: {} }; }, - created: function created() { - var _this = this; - + created() { external_CoreHome_["AjaxHelper"].fetch({ method: 'HeatmapSessionRecording.getAvailableSessionRecordingSampleLimits' - }).then(function (sampleLimits) { - _this.sampleLimits = (sampleLimits || []).map(function (l) { - return { - key: "".concat(l), - value: l - }; - }); + }).then(sampleLimits => { + this.sampleLimits = (sampleLimits || []).map(l => ({ + key: `${l}`, + value: l + })); }); this.init(); }, watch: { - idSiteHsr: function idSiteHsr(newValue) { + idSiteHsr(newValue) { if (newValue === null) { return; } - this.init(); } }, methods: { - removeAnyHsrNotification: function removeAnyHsrNotification() { + removeAnyHsrNotification() { external_CoreHome_["NotificationsStore"].remove(Editvue_type_script_lang_ts_notificationId); external_CoreHome_["NotificationsStore"].remove('ajaxHelper'); }, - showNotification: function showNotification(message, context) { - var instanceId = external_CoreHome_["NotificationsStore"].show({ - message: message, - context: context, + showNotification(message, context) { + const instanceId = external_CoreHome_["NotificationsStore"].show({ + message, + context, id: Editvue_type_script_lang_ts_notificationId, type: 'transient' }); - setTimeout(function () { + setTimeout(() => { external_CoreHome_["NotificationsStore"].scrollToNotification(instanceId); }, 200); }, - showErrorFieldNotProvidedNotification: function showErrorFieldNotProvidedNotification(title) { - var message = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ErrorXNotProvided', [title]); + showErrorFieldNotProvidedNotification(title) { + const message = Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ErrorXNotProvided', [title]); this.showNotification(message, 'error'); }, - init: function init() { - var _this2 = this; - - var idSiteHsr = this.idSiteHsr; + init() { + const { + idSiteHsr + } = this; this.siteHsr = {}; this.showAdvancedView = false; external_CoreHome_["Matomo"].helper.lazyScrollToContent(); - if (this.edit && idSiteHsr) { - SessionRecordingStore.findHsr(idSiteHsr).then(function (siteHsr) { + SessionRecordingStore.findHsr(idSiteHsr).then(siteHsr => { if (!siteHsr) { return; } - - _this2.siteHsr = Object(external_CoreHome_["clone"])(siteHsr); - _this2.siteHsr.sample_rate = "".concat(_this2.siteHsr.sample_rate); - - _this2.addInitialMatchPageRule(); - - _this2.isDirty = false; + this.siteHsr = Object(external_CoreHome_["clone"])(siteHsr); + this.siteHsr.sample_rate = `${this.siteHsr.sample_rate}`; + this.addInitialMatchPageRule(); + this.isDirty = false; }); return; } - if (this.create) { this.siteHsr = { idSite: external_CoreHome_["Matomo"].idSite, @@ -5331,17 +4730,14 @@ var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; this.isDirty = false; } }, - addInitialMatchPageRule: function addInitialMatchPageRule() { + addInitialMatchPageRule() { var _this$siteHsr$match_p; - if (!this.siteHsr) { return; } - if ((_this$siteHsr$match_p = this.siteHsr.match_page_rules) !== null && _this$siteHsr$match_p !== void 0 && _this$siteHsr$match_p.length) { return; } - this.siteHsr.match_page_rules = [{ attribute: 'url', type: 'any', @@ -5349,17 +4745,14 @@ var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; inverted: 0 }]; }, - addMatchPageRule: function addMatchPageRule() { + addMatchPageRule() { var _this$siteHsr$match_p2; - if (!this.siteHsr) { return; } - if (!((_this$siteHsr$match_p2 = this.siteHsr.match_page_rules) !== null && _this$siteHsr$match_p2 !== void 0 && _this$siteHsr$match_p2.length)) { this.siteHsr.match_page_rules = []; } - this.siteHsr.match_page_rules.push({ attribute: 'url', type: 'equals_simple', @@ -5368,143 +4761,123 @@ var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; }); this.isDirty = true; }, - removeMatchPageRule: function removeMatchPageRule(index) { + removeMatchPageRule(index) { if (this.siteHsr && index > -1) { - this.siteHsr.match_page_rules = Editvue_type_script_lang_ts_toConsumableArray(this.siteHsr.match_page_rules); + this.siteHsr.match_page_rules = [...this.siteHsr.match_page_rules]; this.siteHsr.match_page_rules.splice(index, 1); this.isDirty = true; } }, - cancel: function cancel() { - var newParams = Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value); + cancel() { + const newParams = Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value); delete newParams.idSiteHsr; external_CoreHome_["MatomoUrl"].updateHash(newParams); }, - createHsr: function createHsr() { - var _this3 = this; - + createHsr() { this.removeAnyHsrNotification(); - if (!this.checkRequiredFieldsAreSet()) { return; } - - SessionRecordingStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.addSessionRecording').then(function (response) { + SessionRecordingStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.addSessionRecording').then(response => { if (!response || response.type === 'error' || !response.response) { return; } - - _this3.isDirty = false; - var idSiteHsr = response.response.value; - SessionRecordingStore.reload().then(function () { + this.isDirty = false; + const idSiteHsr = response.response.value; + SessionRecordingStore.reload().then(() => { if (external_CoreHome_["Matomo"].helper.isReportingPage()) { external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); } - external_CoreHome_["MatomoUrl"].updateHash(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { - idSiteHsr: idSiteHsr + idSiteHsr })); - setTimeout(function () { - _this3.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_SessionRecordingCreated'), response.type); + setTimeout(() => { + this.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_SessionRecordingCreated'), response.type); }, 200); }); }); }, - setValueHasChanged: function setValueHasChanged() { + setValueHasChanged() { this.isDirty = true; }, - updateHsr: function updateHsr() { - var _this4 = this; - + updateHsr() { this.removeAnyHsrNotification(); - if (!this.checkRequiredFieldsAreSet()) { return; } - - SessionRecordingStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.updateSessionRecording').then(function (response) { + SessionRecordingStore.createOrUpdateHsr(this.siteHsr, 'HeatmapSessionRecording.updateSessionRecording').then(response => { if (response.type === 'error') { return; } - - _this4.isDirty = false; - _this4.siteHsr = {}; - SessionRecordingStore.reload().then(function () { - _this4.init(); + this.isDirty = false; + this.siteHsr = {}; + SessionRecordingStore.reload().then(() => { + this.init(); }); - - _this4.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_SessionRecordingUpdated'), response.type); + this.showNotification(Object(external_CoreHome_["translate"])('HeatmapSessionRecording_SessionRecordingUpdated'), response.type); }); }, - checkRequiredFieldsAreSet: function checkRequiredFieldsAreSet() { + checkRequiredFieldsAreSet() { var _this$siteHsr$match_p3; - if (!this.siteHsr.name) { - var title = this.translate('General_Name'); + const title = this.translate('General_Name'); this.showErrorFieldNotProvidedNotification(title); return false; } - if (!((_this$siteHsr$match_p3 = this.siteHsr.match_page_rules) !== null && _this$siteHsr$match_p3 !== void 0 && _this$siteHsr$match_p3.length) || !SessionRecordingStore.filterRules(this.siteHsr.match_page_rules).length) { - var _title = this.translate('HeatmapSessionRecording_ErrorPageRuleRequired'); - - this.showNotification(_title, 'error'); + const title = this.translate('HeatmapSessionRecording_ErrorPageRuleRequired'); + this.showNotification(title, 'error'); return false; } - return true; }, - setMatchPageRule: function setMatchPageRule(rule, index) { - this.siteHsr.match_page_rules = Editvue_type_script_lang_ts_toConsumableArray(this.siteHsr.match_page_rules); + setMatchPageRule(rule, index) { + this.siteHsr.match_page_rules = [...this.siteHsr.match_page_rules]; this.siteHsr.match_page_rules[index] = rule; } }, computed: { - minSessionTimes: function minSessionTimes() { - return [0, 5, 10, 15, 20, 30, 45, 60, 90, 120].map(function (v) { - return { - key: "".concat(v), - value: "".concat(v, " seconds") - }; - }); + minSessionTimes() { + return [0, 5, 10, 15, 20, 30, 45, 60, 90, 120].map(v => ({ + key: `${v}`, + value: `${v} seconds` + })); }, - sampleRates: function sampleRates() { - var rates = [0.1, 0.5, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100]; - return rates.map(function (v) { - return { - key: "".concat(v.toFixed(1)), - value: "".concat(v, "%") - }; - }); + sampleRates() { + const rates = [0.1, 0.5, 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 30, 40, 50, 60, 70, 80, 90, 100]; + return rates.map(v => ({ + key: `${v.toFixed(1)}`, + value: `${v}%` + })); }, - create: function create() { + create() { return !this.idSiteHsr; }, - edit: function edit() { + edit() { return !this.create; }, - editTitle: function editTitle() { - var token = this.create ? 'HeatmapSessionRecording_CreateNewSessionRecording' : 'HeatmapSessionRecording_EditSessionRecordingX'; + editTitle() { + const token = this.create ? 'HeatmapSessionRecording_CreateNewSessionRecording' : 'HeatmapSessionRecording_EditSessionRecordingX'; return token; }, - contentTitle: function contentTitle() { - return Object(external_CoreHome_["translate"])(this.editTitle, this.siteHsr.name ? "\"".concat(this.siteHsr.name, "\"") : ''); + contentTitle() { + return Object(external_CoreHome_["translate"])(this.editTitle, this.siteHsr.name ? `"${this.siteHsr.name}"` : ''); }, - isLoading: function isLoading() { + isLoading() { return HeatmapStore.state.value.isLoading; }, - isUpdating: function isUpdating() { + isUpdating() { return HeatmapStore.state.value.isUpdating; }, - captureKeystrokesHelp: function captureKeystrokesHelp() { - var link = 'https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-keystrokes-in-form-fields'; - return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_CaptureKeystrokesHelp', ""), ''); + captureKeystrokesHelp() { + const link = 'https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-keystrokes-in-form-fields'; + return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_CaptureKeystrokesHelp', ``, ''); }, - personalInformationNote: function personalInformationNote() { - var link = 'https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website'; - return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_PersonalInformationNote', Object(external_CoreHome_["translate"])('HeatmapSessionRecording_SessionRecording'), '', '', ""), ''); + personalInformationNote() { + const link = 'https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website'; + return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_PersonalInformationNote', Object(external_CoreHome_["translate"])('HeatmapSessionRecording_SessionRecording'), '', '', ``, ''); }, - saveButtonText: function saveButtonText() { + saveButtonText() { return this.edit ? Object(external_CoreHome_["translate"])('CoreUpdater_UpdateTitle') : Object(external_CoreHome_["translate"])('HeatmapSessionRecording_CreateNewSessionRecording'); } } @@ -5518,171 +4891,152 @@ var Editvue_type_script_lang_ts_notificationId = 'hsrmanagement'; ManageSessionRecording_Editvue_type_script_lang_ts.render = Editvue_type_template_id_56c3e386_render /* harmony default export */ var ManageSessionRecording_Edit = (ManageSessionRecording_Editvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/List.vue?vue&type=template&id=09d6f8c4 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/List.vue?vue&type=template&id=09d6f8c4 -var Listvue_type_template_id_09d6f8c4_hoisted_1 = { +const Listvue_type_template_id_09d6f8c4_hoisted_1 = { class: "sessionRecordingList" }; -var Listvue_type_template_id_09d6f8c4_hoisted_2 = { +const Listvue_type_template_id_09d6f8c4_hoisted_2 = { class: "filterStatus" }; -var Listvue_type_template_id_09d6f8c4_hoisted_3 = { +const Listvue_type_template_id_09d6f8c4_hoisted_3 = { class: "hsrSearchFilter", style: { "margin-left": "3.5px" } }; -var Listvue_type_template_id_09d6f8c4_hoisted_4 = { +const Listvue_type_template_id_09d6f8c4_hoisted_4 = { class: "index" }; -var Listvue_type_template_id_09d6f8c4_hoisted_5 = { +const Listvue_type_template_id_09d6f8c4_hoisted_5 = { class: "name" }; -var Listvue_type_template_id_09d6f8c4_hoisted_6 = { +const Listvue_type_template_id_09d6f8c4_hoisted_6 = { class: "creationDate" }; -var Listvue_type_template_id_09d6f8c4_hoisted_7 = { +const Listvue_type_template_id_09d6f8c4_hoisted_7 = { class: "sampleLimit" }; -var Listvue_type_template_id_09d6f8c4_hoisted_8 = { +const Listvue_type_template_id_09d6f8c4_hoisted_8 = { class: "status" }; -var Listvue_type_template_id_09d6f8c4_hoisted_9 = { +const Listvue_type_template_id_09d6f8c4_hoisted_9 = { class: "action" }; -var Listvue_type_template_id_09d6f8c4_hoisted_10 = { +const Listvue_type_template_id_09d6f8c4_hoisted_10 = { colspan: "7" }; -var Listvue_type_template_id_09d6f8c4_hoisted_11 = { +const Listvue_type_template_id_09d6f8c4_hoisted_11 = { class: "loadingPiwik" }; - -var Listvue_type_template_id_09d6f8c4_hoisted_12 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { +const Listvue_type_template_id_09d6f8c4_hoisted_12 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { src: "plugins/Morpheus/images/loading-blue.gif" }, null, -1); - -var Listvue_type_template_id_09d6f8c4_hoisted_13 = { +const Listvue_type_template_id_09d6f8c4_hoisted_13 = { colspan: "7" }; -var Listvue_type_template_id_09d6f8c4_hoisted_14 = ["id"]; -var Listvue_type_template_id_09d6f8c4_hoisted_15 = { +const Listvue_type_template_id_09d6f8c4_hoisted_14 = ["id"]; +const Listvue_type_template_id_09d6f8c4_hoisted_15 = { class: "index" }; -var Listvue_type_template_id_09d6f8c4_hoisted_16 = { +const Listvue_type_template_id_09d6f8c4_hoisted_16 = { class: "name" }; -var Listvue_type_template_id_09d6f8c4_hoisted_17 = { +const Listvue_type_template_id_09d6f8c4_hoisted_17 = { class: "creationDate" }; -var Listvue_type_template_id_09d6f8c4_hoisted_18 = { +const Listvue_type_template_id_09d6f8c4_hoisted_18 = { class: "sampleLimit" }; -var Listvue_type_template_id_09d6f8c4_hoisted_19 = { +const Listvue_type_template_id_09d6f8c4_hoisted_19 = { key: 0, class: "status status-paused" }; -var Listvue_type_template_id_09d6f8c4_hoisted_20 = ["title"]; -var Listvue_type_template_id_09d6f8c4_hoisted_21 = { +const Listvue_type_template_id_09d6f8c4_hoisted_20 = ["title"]; +const Listvue_type_template_id_09d6f8c4_hoisted_21 = { key: 1, class: "status" }; -var Listvue_type_template_id_09d6f8c4_hoisted_22 = { +const Listvue_type_template_id_09d6f8c4_hoisted_22 = { class: "action" }; -var Listvue_type_template_id_09d6f8c4_hoisted_23 = ["title", "onClick"]; -var Listvue_type_template_id_09d6f8c4_hoisted_24 = ["title", "onClick"]; -var Listvue_type_template_id_09d6f8c4_hoisted_25 = ["title", "href"]; -var Listvue_type_template_id_09d6f8c4_hoisted_26 = ["title", "onClick"]; -var Listvue_type_template_id_09d6f8c4_hoisted_27 = { +const Listvue_type_template_id_09d6f8c4_hoisted_23 = ["title", "onClick"]; +const Listvue_type_template_id_09d6f8c4_hoisted_24 = ["title", "onClick"]; +const Listvue_type_template_id_09d6f8c4_hoisted_25 = ["title", "href"]; +const Listvue_type_template_id_09d6f8c4_hoisted_26 = ["title", "onClick"]; +const Listvue_type_template_id_09d6f8c4_hoisted_27 = { class: "tableActionBar" }; - -var Listvue_type_template_id_09d6f8c4_hoisted_28 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { +const Listvue_type_template_id_09d6f8c4_hoisted_28 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { class: "icon-add" }, null, -1); - -var Listvue_type_template_id_09d6f8c4_hoisted_29 = { +const Listvue_type_template_id_09d6f8c4_hoisted_29 = { class: "ui-confirm", ref: "confirmDeleteSessionRecording" }; -var Listvue_type_template_id_09d6f8c4_hoisted_30 = ["value"]; -var Listvue_type_template_id_09d6f8c4_hoisted_31 = ["value"]; -var Listvue_type_template_id_09d6f8c4_hoisted_32 = { +const Listvue_type_template_id_09d6f8c4_hoisted_30 = ["value"]; +const Listvue_type_template_id_09d6f8c4_hoisted_31 = ["value"]; +const Listvue_type_template_id_09d6f8c4_hoisted_32 = { class: "ui-confirm", ref: "confirmEndSessionRecording" }; -var Listvue_type_template_id_09d6f8c4_hoisted_33 = ["value"]; -var Listvue_type_template_id_09d6f8c4_hoisted_34 = ["value"]; +const Listvue_type_template_id_09d6f8c4_hoisted_33 = ["value"]; +const Listvue_type_template_id_09d6f8c4_hoisted_34 = ["value"]; function Listvue_type_template_id_09d6f8c4_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); - - var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); - - var _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); - + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + const _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Listvue_type_template_id_09d6f8c4_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { "content-title": _ctx.translate('HeatmapSessionRecording_ManageSessionRecordings') }, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_SessionRecordingsUsageBenefits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "select", - name: "filterStatus", - "model-value": _ctx.filterStatus, - "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { - _ctx.setFilterStatus($event); - }), - title: _ctx.translate('HeatmapSessionRecording_Filter'), - "full-width": true, - options: _ctx.statusOptions - }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { - uicontrol: "text", - name: "hsrSearch", - title: _ctx.translate('General_Search'), - modelValue: _ctx.searchFilter, - "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { - return _ctx.searchFilter = $event; - }), - "full-width": true - }, null, 8, ["title", "modelValue"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hsrs.length > 0]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Id')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreationDate')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_SampleLimit')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CorePluginsAdmin_Status')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Listvue_type_template_id_09d6f8c4_hoisted_11, [Listvue_type_template_id_09d6f8c4_hoisted_12, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_NoSessionRecordingsFound')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isLoading && _ctx.hsrs.length == 0]]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.sortedHsrs, function (hsr) { - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { - id: "hsr".concat(hsr.idsitehsr), - class: "hsrs", - key: hsr.idsitehsr - }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.idsitehsr), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_17, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.created_date_pretty), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_18, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.sample_limit), 1), hsr.status === 'paused' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_09d6f8c4_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { - class: "icon icon-help", - title: _ctx.pauseReason - }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_20)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_09d6f8c4_hoisted_21, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)), 1)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_22, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "table-action icon-edit", - title: _ctx.translate('HeatmapSessionRecording_EditX', _ctx.translate('HeatmapSessionRecording_SessionRecording')), - onClick: function onClick($event) { - return _ctx.editHsr(hsr.idsitehsr); - } - }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_23), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "table-action stopRecording icon-drop-crossed", - title: _ctx.translate('HeatmapSessionRecording_StopX', _ctx.translate('HeatmapSessionRecording_SessionRecording')), - onClick: function onClick($event) { - return _ctx.completeHsr(hsr); - } - }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], hsr.status !== 'ended']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "table-action icon-show", - title: _ctx.translate('HeatmapSessionRecording_ViewReport'), - href: _ctx.getViewReportLink(hsr), - target: "_blank" - }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_25), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "table-action icon-delete", - title: _ctx.translate('HeatmapSessionRecording_DeleteX', _ctx.translate('HeatmapSessionRecording_SessionRecording')), - onClick: function onClick($event) { - return _ctx.deleteHsr(hsr); - } - }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_26)])], 8, Listvue_type_template_id_09d6f8c4_hoisted_14); - }), 128))])], 512), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { - class: "createNewHsr", - value: "", - onClick: _cache[2] || (_cache[2] = function ($event) { - return _ctx.createHsr(); - }) - }, [Listvue_type_template_id_09d6f8c4_hoisted_28, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreateNewSessionRecording')), 1)])])]; - }), + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_SessionRecordingsUsageBenefits')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "filterStatus", + "model-value": _ctx.filterStatus, + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => { + _ctx.setFilterStatus($event); + }), + title: _ctx.translate('HeatmapSessionRecording_Filter'), + "full-width": true, + options: _ctx.statusOptions + }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "hsrSearch", + title: _ctx.translate('General_Search'), + modelValue: _ctx.searchFilter, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.searchFilter = $event), + "full-width": true + }, null, 8, ["title", "modelValue"]), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.hsrs.length > 0]])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_4, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Id')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Name')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreationDate')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_SampleLimit')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CorePluginsAdmin_Status')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", Listvue_type_template_id_09d6f8c4_hoisted_9, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Actions')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", Listvue_type_template_id_09d6f8c4_hoisted_11, [Listvue_type_template_id_09d6f8c4_hoisted_12, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_LoadingData')), 1)])])], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isLoading || _ctx.isUpdating]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_13, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_NoSessionRecordingsFound')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isLoading && _ctx.hsrs.length == 0]]), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.sortedHsrs, hsr => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + id: `hsr${hsr.idsitehsr}`, + class: "hsrs", + key: hsr.idsitehsr + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.idsitehsr), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_17, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.created_date_pretty), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_18, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(hsr.sample_limit), 1), hsr.status === 'paused' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_09d6f8c4_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon icon-help", + title: _ctx.pauseReason + }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_20)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("td", Listvue_type_template_id_09d6f8c4_hoisted_21, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.ucfirst(hsr.status)), 1)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Listvue_type_template_id_09d6f8c4_hoisted_22, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-edit", + title: _ctx.translate('HeatmapSessionRecording_EditX', _ctx.translate('HeatmapSessionRecording_SessionRecording')), + onClick: $event => _ctx.editHsr(hsr.idsitehsr) + }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_23), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action stopRecording icon-drop-crossed", + title: _ctx.translate('HeatmapSessionRecording_StopX', _ctx.translate('HeatmapSessionRecording_SessionRecording')), + onClick: $event => _ctx.completeHsr(hsr) + }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_24), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], hsr.status !== 'ended']]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-show", + title: _ctx.translate('HeatmapSessionRecording_ViewReport'), + href: _ctx.getViewReportLink(hsr), + target: "_blank" + }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_25), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "table-action icon-delete", + title: _ctx.translate('HeatmapSessionRecording_DeleteX', _ctx.translate('HeatmapSessionRecording_SessionRecording')), + onClick: $event => _ctx.deleteHsr(hsr) + }, null, 8, Listvue_type_template_id_09d6f8c4_hoisted_26)])], 8, Listvue_type_template_id_09d6f8c4_hoisted_14); + }), 128))])])), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_27, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + class: "createNewHsr", + value: "", + onClick: _cache[2] || (_cache[2] = $event => _ctx.createHsr()) + }, [Listvue_type_template_id_09d6f8c4_hoisted_28, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_CreateNewSessionRecording')), 1)])])]), _: 1 }, 8, ["content-title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Listvue_type_template_id_09d6f8c4_hoisted_29, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_DeleteSessionRecordingConfirm')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "yes", @@ -5704,19 +5058,7 @@ function Listvue_type_template_id_09d6f8c4_render(_ctx, _cache, $props, $setup, } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/List.vue?vue&type=template&id=09d6f8c4 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/List.vue?vue&type=script&lang=ts -function ManageSessionRecording_Listvue_type_script_lang_ts_toConsumableArray(arr) { return ManageSessionRecording_Listvue_type_script_lang_ts_arrayWithoutHoles(arr) || ManageSessionRecording_Listvue_type_script_lang_ts_iterableToArray(arr) || ManageSessionRecording_Listvue_type_script_lang_ts_unsupportedIterableToArray(arr) || ManageSessionRecording_Listvue_type_script_lang_ts_nonIterableSpread(); } - -function ManageSessionRecording_Listvue_type_script_lang_ts_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function ManageSessionRecording_Listvue_type_script_lang_ts_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return ManageSessionRecording_Listvue_type_script_lang_ts_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return ManageSessionRecording_Listvue_type_script_lang_ts_arrayLikeToArray(o, minLen); } - -function ManageSessionRecording_Listvue_type_script_lang_ts_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function ManageSessionRecording_Listvue_type_script_lang_ts_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return ManageSessionRecording_Listvue_type_script_lang_ts_arrayLikeToArray(arr); } - -function ManageSessionRecording_Listvue_type_script_lang_ts_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/List.vue?vue&type=script&lang=ts @@ -5732,96 +5074,89 @@ function ManageSessionRecording_Listvue_type_script_lang_ts_arrayLikeToArray(arr directives: { ContentTable: external_CoreHome_["ContentTable"] }, - data: function data() { + data() { return { searchFilter: '' }; }, - created: function created() { + created() { SessionRecordingStore.setFilterStatus(''); SessionRecordingStore.fetchHsrs(); }, methods: { - createHsr: function createHsr() { + createHsr() { this.editHsr(0); }, - editHsr: function editHsr(idSiteHsr) { + editHsr(idSiteHsr) { external_CoreHome_["MatomoUrl"].updateHash(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { - idSiteHsr: idSiteHsr + idSiteHsr })); }, - deleteHsr: function deleteHsr(hsr) { + deleteHsr(hsr) { external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteSessionRecording, { - yes: function yes() { - SessionRecordingStore.deleteHsr(hsr.idsitehsr).then(function () { + yes: () => { + SessionRecordingStore.deleteHsr(hsr.idsitehsr).then(() => { SessionRecordingStore.reload(); external_CoreHome_["Matomo"].postEvent('updateReportingMenu'); }); } }); }, - completeHsr: function completeHsr(hsr) { + completeHsr(hsr) { external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmEndSessionRecording, { - yes: function yes() { - SessionRecordingStore.completeHsr(hsr.idsitehsr).then(function () { + yes: () => { + SessionRecordingStore.completeHsr(hsr.idsitehsr).then(() => { SessionRecordingStore.reload(); }); } }); }, - setFilterStatus: function setFilterStatus(filter) { + setFilterStatus(filter) { SessionRecordingStore.setFilterStatus(filter); }, - ucfirst: function ucfirst(s) { - return "".concat(s[0].toUpperCase()).concat(s.substr(1)); + ucfirst(s) { + return `${s[0].toUpperCase()}${s.substr(1)}`; }, - getViewReportLink: function getViewReportLink(hsr) { - return "?".concat(external_CoreHome_["MatomoUrl"].stringify({ + getViewReportLink(hsr) { + return `?${external_CoreHome_["MatomoUrl"].stringify({ module: 'CoreHome', action: 'index', idSite: hsr.idsite, period: 'day', date: 'yesterday' - }), "#?").concat(external_CoreHome_["MatomoUrl"].stringify({ + })}#?${external_CoreHome_["MatomoUrl"].stringify({ category: 'HeatmapSessionRecording_SessionRecordings', idSite: hsr.idsite, period: 'day', date: 'yesterday', subcategory: hsr.idsitehsr - })); + })}`; } }, computed: { - filterStatus: function filterStatus() { + filterStatus() { return SessionRecordingStore.state.value.filterStatus; }, - statusOptions: function statusOptions() { + statusOptions() { return SessionRecordingStore.statusOptions; }, - hsrs: function hsrs() { + hsrs() { return SessionRecordingStore.hsrs.value; }, - isLoading: function isLoading() { + isLoading() { return SessionRecordingStore.state.value.isLoading; }, - isUpdating: function isUpdating() { + isUpdating() { return SessionRecordingStore.state.value.isUpdating; }, - sortedHsrs: function sortedHsrs() { - var _this = this; - + sortedHsrs() { // look through string properties of heatmaps for values that have searchFilter in them // (mimics angularjs filter() filter) - var result = ManageSessionRecording_Listvue_type_script_lang_ts_toConsumableArray(this.hsrs).filter(function (h) { - return Object.keys(h).some(function (propName) { - var entity = h; - return typeof entity[propName] === 'string' && entity[propName].indexOf(_this.searchFilter) !== -1; - }); - }); - - result.sort(function (lhs, rhs) { - return rhs.idsitehsr - lhs.idsitehsr; - }); + const result = [...this.hsrs].filter(h => Object.keys(h).some(propName => { + const entity = h; + return typeof entity[propName] === 'string' && entity[propName].indexOf(this.searchFilter) !== -1; + })); + result.sort((lhs, rhs) => rhs.idsitehsr - lhs.idsitehsr); return result; } } @@ -5835,18 +5170,15 @@ function ManageSessionRecording_Listvue_type_script_lang_ts_arrayLikeToArray(arr ManageSessionRecording_Listvue_type_script_lang_ts.render = Listvue_type_template_id_09d6f8c4_render /* harmony default export */ var ManageSessionRecording_List = (ManageSessionRecording_Listvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Manage.vue?vue&type=template&id=4a6cf182 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Manage.vue?vue&type=template&id=4a6cf182 -var Managevue_type_template_id_4a6cf182_hoisted_1 = { +const Managevue_type_template_id_4a6cf182_hoisted_1 = { class: "manageHsr" }; function Managevue_type_template_id_4a6cf182_render(_ctx, _cache, $props, $setup, $data, $options) { - var _component_MatomoJsNotWritableAlert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoJsNotWritableAlert"); - - var _component_SessionRecordingList = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SessionRecordingList"); - - var _component_SessionRecordingEdit = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SessionRecordingEdit"); - + const _component_MatomoJsNotWritableAlert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoJsNotWritableAlert"); + const _component_SessionRecordingList = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SessionRecordingList"); + const _component_SessionRecordingEdit = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("SessionRecordingEdit"); return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, [!_ctx.editMode ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_MatomoJsNotWritableAlert, { key: 0, "is-matomo-js-writable": _ctx.isMatomoJsWritable, @@ -5859,7 +5191,7 @@ function Managevue_type_template_id_4a6cf182_render(_ctx, _cache, $props, $setup } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Manage.vue?vue&type=template&id=4a6cf182 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Manage.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ManageSessionRecording/Manage.vue?vue&type=script&lang=ts @@ -5873,7 +5205,7 @@ function Managevue_type_template_id_4a6cf182_render(_ctx, _cache, $props, $setup required: true } }, - data: function data() { + data() { return { editMode: false, idSiteHsr: null @@ -5884,43 +5216,36 @@ function Managevue_type_template_id_4a6cf182_render(_ctx, _cache, $props, $setup SessionRecordingEdit: ManageSessionRecording_Edit, SessionRecordingList: ManageSessionRecording_List }, - created: function created() { - var _this = this; - + created() { // doing this in a watch because we don't want to post an event in a computed property - Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(function () { - return external_CoreHome_["MatomoUrl"].hashParsed.value.idSiteHsr; - }, function (idSiteHsr) { - _this.initState(idSiteHsr); + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["watch"])(() => external_CoreHome_["MatomoUrl"].hashParsed.value.idSiteHsr, idSiteHsr => { + this.initState(idSiteHsr); }); this.initState(external_CoreHome_["MatomoUrl"].hashParsed.value.idSiteHsr); }, methods: { - removeAnyHsrNotification: function removeAnyHsrNotification() { + removeAnyHsrNotification() { external_CoreHome_["NotificationsStore"].remove('hsrmanagement'); }, - initState: function initState(idSiteHsr) { + initState(idSiteHsr) { if (idSiteHsr) { if (idSiteHsr === '0') { - var parameters = { + const parameters = { isAllowed: true }; external_CoreHome_["Matomo"].postEvent('HeatmapSessionRecording.initAddSessionRecording', parameters); - if (parameters && !parameters.isAllowed) { this.editMode = false; this.idSiteHsr = null; return; } } - this.editMode = true; this.idSiteHsr = parseInt(idSiteHsr, 10); } else { this.editMode = false; this.idSiteHsr = null; } - this.removeAnyHsrNotification(); } } @@ -5934,36 +5259,30 @@ function Managevue_type_template_id_4a6cf182_render(_ctx, _cache, $props, $setup ManageSessionRecording_Managevue_type_script_lang_ts.render = Managevue_type_template_id_4a6cf182_render /* harmony default export */ var ManageSessionRecording_Manage = (ManageSessionRecording_Managevue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ListOfPageviews/ListOfPageviews.vue?vue&type=template&id=fe86de22 +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ListOfPageviews/ListOfPageviews.vue?vue&type=template&id=fe86de22 -var ListOfPageviewsvue_type_template_id_fe86de22_hoisted_1 = { +const ListOfPageviewsvue_type_template_id_fe86de22_hoisted_1 = { class: "ui-confirm", id: "listOfPageviews" }; - -var ListOfPageviewsvue_type_template_id_fe86de22_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); - -var ListOfPageviewsvue_type_template_id_fe86de22_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); - -var ListOfPageviewsvue_type_template_id_fe86de22_hoisted_4 = ["onClick"]; -var ListOfPageviewsvue_type_template_id_fe86de22_hoisted_5 = ["title"]; -var ListOfPageviewsvue_type_template_id_fe86de22_hoisted_6 = ["value"]; +const ListOfPageviewsvue_type_template_id_fe86de22_hoisted_2 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const ListOfPageviewsvue_type_template_id_fe86de22_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const ListOfPageviewsvue_type_template_id_fe86de22_hoisted_4 = ["onClick"]; +const ListOfPageviewsvue_type_template_id_fe86de22_hoisted_5 = ["title"]; +const ListOfPageviewsvue_type_template_id_fe86de22_hoisted_6 = ["value"]; function ListOfPageviewsvue_type_template_id_fe86de22_render(_ctx, _cache, $props, $setup, $data, $options) { - var _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); - - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", ListOfPageviewsvue_type_template_id_fe86de22_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_PageviewsInVisit')), 1), ListOfPageviewsvue_type_template_id_fe86de22_hoisted_2, ListOfPageviewsvue_type_template_id_fe86de22_hoisted_3, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ColumnTime')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_TimeOnPage')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Goals_URL')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.pageviews, function (pageview) { + const _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", ListOfPageviewsvue_type_template_id_fe86de22_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_PageviewsInVisit')), 1), ListOfPageviewsvue_type_template_id_fe86de22_hoisted_2, ListOfPageviewsvue_type_template_id_fe86de22_hoisted_3, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("table", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_ColumnTime')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_TimeOnPage')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Goals_URL')), 1)])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.pageviews, pageview => { return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { key: pageview.idloghsr, class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ inactive: pageview.idloghsr !== _ctx.idLogHsr }), - onClick: function onClick($event) { - return _ctx.onClickPageView(pageview); - } + onClick: $event => _ctx.onClickPageView(pageview) }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(pageview.server_time_pretty), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(pageview.time_on_page_pretty), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { title: pageview.label }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])((pageview.label || '').substr(0, 50)), 9, ListOfPageviewsvue_type_template_id_fe86de22_hoisted_5)], 10, ListOfPageviewsvue_type_template_id_fe86de22_hoisted_4); - }), 128))])], 512), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + }), 128))])])), [[_directive_content_table]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { role: "close", type: "button", value: _ctx.translate('General_Close') @@ -5971,7 +5290,7 @@ function ListOfPageviewsvue_type_template_id_fe86de22_render(_ctx, _cache, $prop } // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/ListOfPageviews/ListOfPageviews.vue?vue&type=template&id=fe86de22 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/ListOfPageviews/ListOfPageviews.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/ListOfPageviews/ListOfPageviews.vue?vue&type=script&lang=ts /* harmony default export */ var ListOfPageviewsvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ @@ -5989,11 +5308,10 @@ function ListOfPageviewsvue_type_template_id_fe86de22_render(_ctx, _cache, $prop ContentTable: external_CoreHome_["ContentTable"] }, methods: { - onClickPageView: function onClickPageView(pageview) { + onClickPageView(pageview) { if (pageview.idloghsr === this.idLogHsr) { return; } - external_CoreHome_["MatomoUrl"].updateUrl(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { idLogHsr: pageview.idloghsr }), external_CoreHome_["MatomoUrl"].hashParsed.value.length ? Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].hashParsed.value), {}, { @@ -6011,53 +5329,47 @@ function ListOfPageviewsvue_type_template_id_fe86de22_render(_ctx, _cache, $prop ListOfPageviewsvue_type_script_lang_ts.render = ListOfPageviewsvue_type_template_id_fe86de22_render /* harmony default export */ var ListOfPageviews = (ListOfPageviewsvue_type_script_lang_ts); -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVisPage.vue?vue&type=template&id=84a1572c +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVisPage.vue?vue&type=template&id=7f5f8230 -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_1 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_1 = { class: "heatmap-vis-title" }; -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_2 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_2 = { key: 0, class: "alert alert-info heatmap-country-alert" }; -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_3 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_3 = { key: 1 }; -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_4 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_4 = { key: 2 }; -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_5 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_5 = ["innerHTML"]; +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_6 = { class: "alert alert-info" }; -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_6 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_7 = { key: 3 }; -var HeatmapVisPagevue_type_template_id_84a1572c_hoisted_7 = { +const HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_8 = { class: "alert alert-info" }; -function HeatmapVisPagevue_type_template_id_84a1572c_render(_ctx, _cache, $props, $setup, $data, $options) { +function HeatmapVisPagevue_type_template_id_7f5f8230_render(_ctx, _cache, $props, $setup, $data, $options) { var _ctx$heatmapMetadata; - - var _component_EnrichedHeadline = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("EnrichedHeadline"); - - var _component_MatomoJsNotWritableAlert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoJsNotWritableAlert"); - - var _component_HeatmapVis = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HeatmapVis"); - - var _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); - - return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_EnrichedHeadline, { + const _component_EnrichedHeadline = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("EnrichedHeadline"); + const _component_MatomoJsNotWritableAlert = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("MatomoJsNotWritableAlert"); + const _component_HeatmapVis = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("HeatmapVis"); + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_EnrichedHeadline, { "edit-url": _ctx.editUrl, "inline-help": _ctx.inlineHelp }, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_HeatmapX', "\"".concat(_ctx.heatmap.name, "\""))), 1)]; - }), + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_HeatmapX', `"${_ctx.heatmap.name}"`)), 1)]), _: 1 }, 8, ["edit-url", "inline-help"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_MatomoJsNotWritableAlert, { "is-matomo-js-writable": _ctx.isMatomoJsWritable, "recording-type": _ctx.translate('HeatmapSessionRecording_Heatmaps') - }, null, 8, ["is-matomo-js-writable", "recording-type"]), _ctx.includedCountries ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_HeatmapInfoTrackVisitsFromCountries', _ctx.includedCountries)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.heatmap.page_treemirror ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HeatmapVis, { + }, null, 8, ["is-matomo-js-writable", "recording-type"]), _ctx.includedCountries ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('HeatmapSessionRecording_HeatmapInfoTrackVisitsFromCountries', _ctx.includedCountries)), 1)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.heatmap.page_treemirror ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_HeatmapVis, { "created-date": _ctx.createdDate, "excluded-elements": _ctx.heatmap.excluded_elements, "num-samples": _ctx.heatmapMetadata, @@ -6073,21 +5385,19 @@ function HeatmapVisPagevue_type_template_id_84a1572c_render(_ctx, _cache, $props "is-active": _ctx.isActive, "desktop-preview-size": _ctx.desktopPreviewSize, "iframe-resolutions-values": _ctx.iframeResolutions - }, null, 8, ["created-date", "excluded-elements", "num-samples", "url", "heatmap-date", "heatmap-period", "offset-accuracy", "breakpoint-tablet", "breakpoint-mobile", "heatmap-types", "device-types", "id-site-hsr", "is-active", "desktop-preview-size", "iframe-resolutions-values"])])) : !((_ctx$heatmapMetadata = _ctx.heatmapMetadata) !== null && _ctx$heatmapMetadata !== void 0 && _ctx$heatmapMetadata.nb_samples_device_all) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, null, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate(_ctx.noDataMessageKey)), 1)]; - }), + }, null, 8, ["created-date", "excluded-elements", "num-samples", "url", "heatmap-date", "heatmap-period", "offset-accuracy", "breakpoint-tablet", "breakpoint-mobile", "heatmap-types", "device-types", "id-site-hsr", "is-active", "desktop-preview-size", "iframe-resolutions-values"])])) : !((_ctx$heatmapMetadata = _ctx.heatmapMetadata) !== null && _ctx$heatmapMetadata !== void 0 && _ctx$heatmapMetadata.nb_samples_device_all) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.recordedSamplesTroubleShoot) + }, null, 8, HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_5), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, null, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate(_ctx.noDataMessageKey)), 1)]), _: 1 - })])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, null, { - default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { - return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", HeatmapVisPagevue_type_template_id_84a1572c_hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.noHeatmapScreenshotRecordedYetText), 1)]; - }), + })])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, null, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", HeatmapVisPagevue_type_template_id_7f5f8230_hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.noHeatmapScreenshotRecordedYetText), 1)]), _: 1 })]))]); } -// CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVisPage.vue?vue&type=template&id=84a1572c +// CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVisPage.vue?vue&type=template&id=7f5f8230 -// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVisPage.vue?vue&type=script&lang=ts +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/HeatmapSessionRecording/vue/src/HeatmapVis/HeatmapVisPage.vue?vue&type=script&lang=ts @@ -6167,11 +5477,15 @@ function HeatmapVisPagevue_type_template_id_84a1572c_render(_ctx, _cache, $props EnrichedHeadline: external_CoreHome_["EnrichedHeadline"] }, computed: { - noHeatmapScreenshotRecordedYetText: function noHeatmapScreenshotRecordedYetText() { + noHeatmapScreenshotRecordedYetText() { return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_NoHeatmapScreenshotRecordedYet', this.heatmapMetadata.nb_samples_device_all, Object(external_CoreHome_["translate"])('HeatmapSessionRecording_ScreenshotUrl')); + }, + recordedSamplesTroubleShoot() { + const linkString = Object(external_CoreHome_["externalLink"])('https://matomo.org/faq/heatmap-session-recording/troubleshooting-heatmaps/'); + return Object(external_CoreHome_["translate"])('HeatmapSessionRecording_HeatmapTroubleshoot', linkString, ''); } }, - created: function created() { + created() { // We want the selector hidden for heatmaps. external_CoreHome_["Matomo"].postEvent('hidePeriodSelector'); } @@ -6182,7 +5496,7 @@ function HeatmapVisPagevue_type_template_id_84a1572c_render(_ctx, _cache, $props -HeatmapVisPagevue_type_script_lang_ts.render = HeatmapVisPagevue_type_template_id_84a1572c_render +HeatmapVisPagevue_type_script_lang_ts.render = HeatmapVisPagevue_type_template_id_7f5f8230_render /* harmony default export */ var HeatmapVisPage = (HeatmapVisPagevue_type_script_lang_ts); // CONCATENATED MODULE: ./plugins/HeatmapSessionRecording/vue/src/index.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.6/vue/dist/HeatmapSessionRecording.umd.min.js b/files/plugin-HeatmapSessionRecording-5.2.6/vue/dist/HeatmapSessionRecording.umd.min.js new file mode 100644 index 0000000..33940dc --- /dev/null +++ b/files/plugin-HeatmapSessionRecording-5.2.6/vue/dist/HeatmapSessionRecording.umd.min.js @@ -0,0 +1,73 @@ +(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["HeatmapSessionRecording"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["HeatmapSessionRecording"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,a){return function(e){var t={};function a(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,a),n.l=!0,n.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(i,n,function(t){return e[t]}.bind(null,n));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="plugins/HeatmapSessionRecording/vue/dist/",a(a.s="fae3")}({"19dc":function(t,a){t.exports=e},"246e":function(e,t,a){var i,n;(function(s,r,o){e.exports?e.exports=o():(i=o,n="function"===typeof i?i.call(t,a,t,e):i,void 0===n||(e.exports=n))})(0,0,(function(){var e={defaultRadius:40,defaultRenderer:"canvas2d",defaultGradient:{.25:"rgb(0,0,255)",.55:"rgb(0,255,0)",.85:"yellow",1:"rgb(255,0,0)"},defaultMaxOpacity:1,defaultMinOpacity:0,defaultBlur:.85,defaultXField:"x",defaultYField:"y",defaultValueField:"value",plugins:{}},t=function(){var t=function(e){this._coordinator={},this._data=[],this._radi=[],this._min=10,this._max=1,this._xField=e["xField"]||e.defaultXField,this._yField=e["yField"]||e.defaultYField,this._valueField=e["valueField"]||e.defaultValueField,e["radius"]&&(this._cfgRadius=e["radius"])},a=e.defaultRadius;return t.prototype={_organiseData:function(e,t){var i=e[this._xField],n=e[this._yField],s=this._radi,r=this._data,o=this._max,l=this._min,c=e[this._valueField]||1,d=e.radius||this._cfgRadius||a;r[i]||(r[i]=[],s[i]=[]),r[i][n]?r[i][n]+=c:(r[i][n]=c,s[i][n]=d);var m=r[i][n];return m>o?(t?this.setDataMax(m):this._max=m,!1):m0){var e=arguments[0],t=e.length;while(t--)this.addData.call(this,e[t])}else{var a=this._organiseData(arguments[0],!0);a&&(0===this._data.length&&(this._min=this._max=a.value),this._coordinator.emit("renderpartial",{min:this._min,max:this._max,data:[a]}))}return this},setData:function(e){var t=e.data,a=t.length;this._data=[],this._radi=[];for(var i=0;i0&&(this._drawAlpha(e),this._colorize())},renderAll:function(e){this._clear(),e.data.length>0&&(this._drawAlpha(a(e)),this._colorize())},_updateGradient:function(t){this._palette=e(t)},updateConfig:function(e){e["gradient"]&&this._updateGradient(e),this._setStyles(e)},setDimensions:function(e,t){this._width=e,this._height=t,this.canvas.width=this.shadowCanvas.width=e,this.canvas.height=this.shadowCanvas.height=t},_clear:function(){this.shadowCtx.clearRect(0,0,this._width,this._height),this.ctx.clearRect(0,0,this._width,this._height)},_setStyles:function(e){this._blur=0==e.blur?0:e.blur||e.defaultBlur,e.backgroundColor&&(this.canvas.style.backgroundColor=e.backgroundColor),this._width=this.canvas.width=this.shadowCanvas.width=e.width||this._width,this._height=this.canvas.height=this.shadowCanvas.height=e.height||this._height,this._opacity=255*(e.opacity||0),this._maxOpacity=255*(e.maxOpacity||e.defaultMaxOpacity),this._minOpacity=255*(e.minOpacity||e.defaultMinOpacity),this._useGradientOpacity=!!e.useGradientOpacity},_drawAlpha:function(e){var a=this._min=e.min,i=this._max=e.max,n=(e=e.data||[],e.length),s=1-this._blur;while(n--){var r,o=e[n],l=o.x,c=o.y,d=o.radius,m=Math.min(o.value,i),p=l-d,u=c-d,h=this.shadowCtx;this._templates[d]?r=this._templates[d]:this._templates[d]=r=t(d,s);var g=(m-a)/(i-a);h.globalAlpha=g<.01?.01:g,h.drawImage(r,p,u),pthis._renderBoundaries[2]&&(this._renderBoundaries[2]=p+2*d),u+2*d>this._renderBoundaries[3]&&(this._renderBoundaries[3]=u+2*d)}},_colorize:function(){var e=this._renderBoundaries[0],t=this._renderBoundaries[1],a=this._renderBoundaries[2]-e,i=this._renderBoundaries[3]-t,n=this._width,s=this._height,r=this._opacity,o=this._maxOpacity,l=this._minOpacity,c=this._useGradientOpacity;e<0&&(e=0),t<0&&(t=0),e+a>n&&(a=n-e),t+i>s&&(i=s-t);for(var d=this.shadowCtx.getImageData(e,t,a,i),m=d.data,p=m.length,u=this._palette,h=3;h0?r:b>0,t},getDataURL:function(){return this.canvas.toDataURL()}},i}(),i=function(){var t=!1;return"canvas2d"===e["defaultRenderer"]&&(t=a),t}(),n={merge:function(){for(var e={},t=arguments.length,a=0;a(Object(s["openBlock"])(),Object(s["createElementBlock"])("span",{class:Object(s["normalizeClass"])(["btn-flat",{visActive:t.key===e.heatmapType,["heatmapType"+t.key]:!0}]),onClick:a=>e.changeHeatmapType(t.key),key:t.key},Object(s["toDisplayString"])(t.name),11,d))),128)),Object(s["createElementVNode"])("h4",m,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_DeviceType")),1),(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.deviceTypesWithSamples,t=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("span",{class:Object(s["normalizeClass"])(["btn-flat",{visActive:t.key===e.deviceType,["deviceType"+t.key]:!0}]),title:t.tooltip,onClick:a=>e.changeDeviceType(t.key),key:t.key},[Object(s["createElementVNode"])("img",{height:"15",src:t.logo,alt:`${e.translate("DevicesDetection_Device")} ${t.name}`},null,8,u),Object(s["createTextVNode"])(),Object(s["createElementVNode"])("span",h,Object(s["toDisplayString"])(t.numSamples),1)],10,p))),128)),Object(s["createElementVNode"])("div",g,[Object(s["createElementVNode"])("h4",null,Object(s["toDisplayString"])(e.translate("Installation_Legend")),1),Object(s["createElementVNode"])("div",b,[v,Object(s["createElementVNode"])("img",{class:"gradient",alt:"gradient",src:e.gradientImgData},null,8,O),j])]),Object(s["createElementVNode"])("div",f,[Object(s["createElementVNode"])("span",{style:{"margin-left":"2.5rem","margin-right":"13.5px"},textContent:Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_Width"))},null,8,y),Object(s["createVNode"])(P,{uicontrol:"select",name:"iframewidth","model-value":e.customIframeWidth,"onUpdate:modelValue":t[0]||(t[0]=t=>{e.customIframeWidth=t,e.changeIframeWidth(e.customIframeWidth,!0)}),options:e.iframeWidthOptions},null,8,["model-value","options"])])]),Object(s["createElementVNode"])("div",S,[Object(s["createElementVNode"])("div",H,[Object(s["createElementVNode"])("div",_,null,512),E]),Object(s["withDirectives"])(Object(s["createElementVNode"])("div",{class:"hsrLoadingOuter",style:Object(s["normalizeStyle"])([{height:"400px"},{width:e.iframeWidth+"px"}])},[V,Object(s["createElementVNode"])("div",N,[Object(s["createElementVNode"])("div",R,Object(s["toDisplayString"])(e.translate("General_Loading")),1)])],4),[[s["vShow"],e.isLoading]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("div",{class:"aboveFoldLine",title:e.translate("HeatmapSessionRecording_AvgAboveFoldDescription"),style:Object(s["normalizeStyle"])({width:e.iframeWidth+"px",top:e.avgFold+"px"})},[Object(s["createElementVNode"])("div",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_AvgAboveFoldTitle",e.avgFold)),1)],12,w),[[s["vShow"],e.avgFold]]),e.embedUrl?(Object(s["openBlock"])(),Object(s["createElementBlock"])("iframe",{key:0,id:"recordingPlayer",ref:"recordingPlayer",sandbox:"allow-scripts allow-same-origin",referrerpolicy:"no-referrer",onLoad:t[1]||(t[1]=t=>e.onLoaded()),height:"400",src:e.embedUrl,width:e.iframeWidth},null,40,k)):Object(s["createCommentVNode"])("",!0)],512),Object(s["withDirectives"])(Object(s["createElementVNode"])("div",x,[Object(s["createVNode"])(A,{style:{display:"block !important"},loading:e.isLoading,onClick:t[2]||(t[2]=t=>e.deleteScreenshot()),value:e.translate("HeatmapSessionRecording_DeleteScreenshot")},null,8,["loading","value"])],512),[[s["vShow"],e.showDeleteScreenshot]]),Object(s["createElementVNode"])("div",C,[Object(s["createElementVNode"])("h2",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteHeatmapScreenshotConfirm")),1),Object(s["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,D),Object(s["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,T)],512),Object(s["createVNode"])(B,{ref:"tooltip","click-count":e.clickCount,"click-rate":e.clickRate,"is-moves":1===e.heatmapType},null,8,["click-count","click-rate","is-moves"])])}var P=a("246e"),A=a.n(P),B=a("19dc"),U=a("a5a2"); +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ +function F(e){return e&&e.contentWindow?e.contentWindow:e&&e.contentDocument&&e.contentDocument.defaultView?e.contentDocument.defaultView:void 0} +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */function L(e,t){let a=null;return(i,n)=>(a&&(a.abort(),a=null),a=new AbortController,B["AjaxHelper"].post(Object.assign(Object.assign({},i),{},{method:e}),n,Object.assign(Object.assign({},t),{},{abortController:a})).finally(()=>{a=null}))}const I={class:"tooltip-item"},W={class:"tooltip-label"},q={class:"tooltip-value"},z={class:"tooltip-item"},$={class:"tooltip-label"},G={class:"tooltip-value"};function J(e,t,a,i,n,r){return Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{ref:"tooltipRef",class:"tooltip",style:Object(s["normalizeStyle"])(e.tooltipStyle)},[Object(s["createElementVNode"])("div",I,[Object(s["createElementVNode"])("span",W,Object(s["toDisplayString"])(e.getClickCountTranslation),1),Object(s["createElementVNode"])("span",q,Object(s["toDisplayString"])(e.getClickCount),1)]),Object(s["createElementVNode"])("div",z,[Object(s["createElementVNode"])("span",$,Object(s["toDisplayString"])(e.getClickRateTranslation),1),Object(s["createElementVNode"])("span",G,Object(s["toDisplayString"])(e.getClickRate),1)])],4)),[[s["vShow"],e.visible]])}var X=Object(s["defineComponent"])({props:{clickCount:{type:Number,required:!0},clickRate:{type:Number,required:!0},isMoves:{type:Boolean,required:!1,default:!1}},setup(){const e=Object(s["reactive"])({visible:!1,position:{top:0,left:0}}),t=Object(s["ref"])(null),a=Object(s["computed"])(()=>({top:e.position.top+"px",left:e.position.left+"px",position:"absolute",zIndex:1e3}));function i(a){const i=window.scrollY||document.documentElement.scrollTop,n=window.scrollX||document.documentElement.scrollLeft;e.position.top=a.clientY+i+10,e.position.left=a.clientX+n+10,e.visible=!0,Object(s["nextTick"])(()=>{const s=t.value;if(s){const{innerWidth:t,innerHeight:r}=window,o=s.getBoundingClientRect();o.right>t&&(e.position.left=a.clientX+n-o.width-10),o.bottom>r&&(e.position.top=a.clientY+i-o.height-10);const l=s.getBoundingClientRect();l.left<0&&(e.position.left=n+10),l.top<0&&(e.position.top=i+10)}})}function n(){e.visible=!1}return Object.assign(Object.assign({},Object(s["toRefs"])(e)),{},{tooltipRef:t,show:i,hide:n,tooltipStyle:a,translate:B["translate"]})},computed:{getClickCount(){return B["NumberFormatter"].formatNumber(this.clickCount)},getClickRate(){return B["NumberFormatter"].formatPercent(this.clickRate)},getClickCountTranslation(){const e=this.isMoves?"HeatmapSessionRecording_Moves":"HeatmapSessionRecording_Clicks";return Object(B["translate"])(e)},getClickRateTranslation(){const e=this.isMoves?"HeatmapSessionRecording_MoveRate":"HeatmapSessionRecording_ClickRate";return Object(B["translate"])(e)}}});X.render=J;var Y=X;const{$:K}=window,Q=1,Z=2,ee=3;let te=32e3;const ae=String(window.navigator.userAgent).toLowerCase();function ie(e,t,a){const i=K(e);i.css("height","400px");const n=a.getIframeHeight();i.css("height",n+"px"),K(t).css("height",n+"px").css("width",i.width()+"px").empty();const s=Math.ceil(n/te);for(let r=1;r<=s;r+=1){let e=te;r===s&&(e=n%te),K(t).append(`
`),K(t).find("#heatmap"+r).css({height:e+"px"})}return s}function ne(e,t,a,i){const n=K(t);n.css("height","400px");const s=a.getIframeHeight();n.css("height",s+"px");const r=1e3,o=s/r,l=i.reduce((e,t)=>e+parseInt(t.value,10),0),c=[];let d=0,m=null,p=100,u=0;function h(e,t,a,i,n){return i+(e-t)/(a-t)*(n-i)}function g(e,t,a){if(t===a||!t&&!a)return[255,255,0];const i=h(e,t,a,0,255),n=(a-t)/5;return i>204?[255,h(e,a-n,a,255,0),0]:i>153?[h(e,a-2*n,a-n,0,255),255,0]:i>102?[0,255,h(e,a-3*n,a-2*n,255,0)]:i>51?[0,h(e,a-4*n,a-3*n,0,255),255]:[h(e,t,a-4*n,255,0),0,255]}if(i.forEach(e=>{const t=parseInt(e.value,10),a=parseInt(e.label,10),i=Math.round(a*o);m&&m.position===i?d+=t:(0!==l&&(p=(l-d)/l*100),d+=t,m={percentageValue:10*parseFloat(p.toFixed(1)),position:u,percent:p.toFixed(1)},c.push(m)),u=i}),c.length){const e=c.some(e=>0===e.position);e||c.unshift({percent:"100.0",percentageValue:1e3,position:0})}else c.push({percent:"0",percentageValue:0,position:0});let b=0;const v=1e3;c&&c.length&&c[0]&&(b=c[c.length-1].percentageValue);const O=n.width();let j=null;for(let f=0;f`)}K(".scrollHeatmapLeaf",e).tooltip({track:!0,items:"*",tooltipClass:"heatmapTooltip",show:!1,hide:!1}),K(".legend-area .min").text((b/10).toFixed(1)+"%"),K(".legend-area .max").text((v/10).toFixed(1)+"%")}function se(e,t,a,i){const n=ie(e,t,a),s=document.createElement("canvas");s.width=100,s.height=10;const r=document.querySelector(".legend-area .min"),o=document.querySelector(".legend-area .max"),l=document.querySelector(".legend-area .gradient"),c=s.getContext("2d");let d={};function m(e){if(r.innerHTML=""+e.min,o.innerHTML=""+e.max,e.gradient&&e.gradient!==d){d=e.gradient;const t=c.createLinearGradient(0,0,100,1);Object.keys(d).forEach(e=>{t.addColorStop(parseFloat(e),d[e])}),c.fillStyle=t,c.fillRect(0,0,100,10),l.src=s.toDataURL()}}const p=[];for(let u=1;u<=n;u+=1){const e={min:i.min,max:i.max,data:[]},t={container:document.getElementById("heatmap"+u),radius:10,maxOpacity:.5,minOpacity:0,blur:.75};if(1===u&&(t.onExtremaChange=m),i&&i.data&&i.data.length>=2e4?t.radius=8:i&&i.data&&i.data.length>=2e3&&(t.radius=9),1===n)e.data=i.data;else{const t=(u-1)*te,a=t+te-1;i.data.forEach(i=>{if(i.y>=t&&i.y<=a){const a=Object.assign(Object.assign({},i),{},{y:i.y-t});e.data.push(a)}})}const a=A.a.create(t);a.setData(e),p.push(a)}return p}ae.match(/(iPod|iPhone|iPad|Android|IEMobile|Windows Phone)/i)?te=2e3:(ae.indexOf("msie ")>0||ae.indexOf("trident/")>0||ae.indexOf("edge")>0)&&(te=8e3);var re=Object(s["defineComponent"])({props:{idSiteHsr:{type:Number,required:!0},deviceTypes:{type:Array,required:!0},heatmapTypes:{type:Array,required:!0},breakpointMobile:{type:Number,required:!0},breakpointTablet:{type:Number,required:!0},offsetAccuracy:{type:Number,required:!0},heatmapPeriod:{type:String,required:!0},heatmapDate:{type:String,required:!0},url:{type:String,required:!0},isActive:Boolean,numSamples:{type:Object,required:!0},excludedElements:{type:String,required:!0},createdDate:{type:String,required:!0},desktopPreviewSize:{type:Number,required:!0},iframeResolutionsValues:{type:Object,required:!0}},components:{Field:U["Field"],SaveButton:U["SaveButton"],Tooltip:Y},data(){return{isLoading:!1,iframeWidth:this.desktopPreviewSize,customIframeWidth:this.desktopPreviewSize,avgFold:0,heatmapType:this.heatmapTypes[0].key,deviceType:this.deviceTypes[0].key,iframeResolutions:this.iframeResolutionsValues,actualNumSamples:this.numSamples,dataCoordinates:[],currentElement:null,totalClicks:0,tooltipShowTimeoutId:null,clickCount:0,clickRate:0}},setup(e){const t=Object(s["ref"])(null);let a=null;const i=new Promise(e=>{a=e});let n=null;const r=t=>(n||(n=F(t).recordingFrame,n.excludeElements(e.excludedElements),n.addClass("html","piwikHeatmap"),n.addClass("html","matomoHeatmap"),n.addWorkaroundForSharepointHeatmaps()),n),o=Object(s["ref"])(null),l=(e,t,a,i)=>{o.value=se(e,t,a,i)};return{iframeLoadedPromise:i,onLoaded:a,getRecordedHeatmap:L("HeatmapSessionRecording.getRecordedHeatmap"),getRecordedHeatmapMetadata:L("HeatmapSessionRecording.getRecordedHeatmapMetadata"),getRecordingIframe:r,heatmapInstances:o,renderHeatmap:l,tooltip:t}},created(){-1===this.iframeResolutions.indexOf(this.breakpointMobile)&&this.iframeResolutions.push(this.breakpointMobile),-1===this.iframeResolutions.indexOf(this.breakpointTablet)&&this.iframeResolutions.push(this.breakpointTablet),this.iframeResolutions=this.iframeResolutions.sort((e,t)=>e-t),this.fetchHeatmap(),B["Matomo"].postEvent("hidePeriodSelector")},watch:{isLoading(){if(!0===this.isLoading)return;const e=window.document.getElementById("heatmapContainer");e&&(e.addEventListener("mouseleave",e=>{this.tooltipShowTimeoutId&&(clearTimeout(this.tooltipShowTimeoutId),this.tooltipShowTimeoutId=null),this.currentElement=null,this.handleTooltip(e,0,0,"hide");const t=window.document.getElementById("highlightDiv");t&&(t.hidden=!0)}),e.addEventListener("mousemove",e=>{this.handleMouseMove(e)}))}},beforeUnmount(){this.removeScrollHeatmap()},methods:{removeScrollHeatmap(){const e=this.$refs.iframeRecordingContainer;K(e).find(".scrollHeatmapLeaf").remove()},deleteScreenshot(){B["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmapScreenshot,{yes:()=>{this.isLoading=!0,B["AjaxHelper"].fetch({method:"HeatmapSessionRecording.deleteHeatmapScreenshot",idSiteHsr:this.idSiteHsr}).then(()=>{this.isLoading=!1,window.location.reload()})}})},fetchHeatmap(){if(this.removeScrollHeatmap(),this.heatmapInstances){const e=this.heatmapInstances;e.forEach(e=>{e.setData({max:1,min:0,data:[]})})}this.isLoading=!0,this.avgFold=0;const e=B["MatomoUrl"].parsed.value.segment?decodeURIComponent(B["MatomoUrl"].parsed.value.segment):void 0,t={idSiteHsr:this.idSiteHsr,heatmapType:this.heatmapType,deviceType:this.deviceType,period:this.heatmapPeriod,date:this.heatmapDate,filter_limit:-1,segment:e},a=this.getRecordedHeatmap(t),i=this.getRecordedHeatmapMetadata(t);Promise.all([a,i,this.iframeLoadedPromise]).then(e=>{const t=this.$refs.recordingPlayer,a=this.getRecordingIframe(t);ie(this.$refs.recordingPlayer,this.$refs.heatmapContainer,a),this.removeScrollHeatmap();const i=e[0],n=e[1];if(Array.isArray(n)&&n[0]?[this.actualNumSamples]=n:this.actualNumSamples=n,this.isLoading=!1,this.isScrollHeatmapType)ne(this.$refs.iframeRecordingContainer,t,a,i);else{var s;const e={min:0,max:0,data:[]};for(let t=0;t{null!==e&&void 0!==e&&e.value&&parseInt(e.value,10)>1&&(t+=1)}),t/e.data.length>=.1&&e.data.length>120?e.max=2:e.max=1}else{const t=10,a={};if(e.data.forEach(i=>{if(!i||!i.value)return;let n=parseInt(i.value,10);n>e.max&&(e.max=n),n>t&&(n=t);const s=""+n;s in a?a[s]+=1:a[s]=0}),e.max>t){let i=0;for(let n=t;n>1;n-=1){const t=""+n;if(t in a&&(i+=a[t]),i/e.data.length>=.2){e.max=n;break}}if(e.max>t){e.max=5;for(let t=5;t>0;t-=1){const i=""+t;if(i in a){e.max=t;break}}}}}if(this.renderHeatmap(this.$refs.recordingPlayer,this.$refs.heatmapContainer,a,e),null!==(s=this.actualNumSamples)&&void 0!==s&&s["avg_fold_device_"+this.deviceType]){const e=this.actualNumSamples["avg_fold_device_"+this.deviceType],t=a.getIframeHeight();t&&(this.avgFold=parseInt(""+e/100*t,10))}}}).finally(()=>{this.isLoading=!1})},changeDeviceType(e){this.deviceType=e,this.deviceType===Q?this.changeIframeWidth(this.desktopPreviewSize,!1):this.deviceType===Z?this.changeIframeWidth(this.breakpointTablet||960,!1):this.deviceType===ee&&this.changeIframeWidth(this.breakpointMobile||600,!1)},changeIframeWidth(e,t){this.iframeWidth=e,this.customIframeWidth=this.iframeWidth,this.totalClicks=0,this.dataCoordinates=[],this.fetchHeatmap(),t&&B["Matomo"].helper.lazyScrollToContent()},changeHeatmapType(e){this.heatmapType=e,this.totalClicks=0,this.clickCount=0,this.clickRate=0,this.dataCoordinates=[],this.fetchHeatmap()},handleMouseMove(e){const t=window.document.getElementById("highlightDiv");if(!t)return;this.tooltipShowTimeoutId&&(clearTimeout(this.tooltipShowTimeoutId),this.tooltipShowTimeoutId=null,this.currentElement=null),t.hidden||this.handleTooltip(e,0,0,"move");const a=this.lookUpRecordedElementAtEventLocation(e);if(!a||a===this.currentElement)return;this.handleTooltip(e,0,0,"hide"),t.hidden=!0;const i=a.getBoundingClientRect();let n=0;this.dataCoordinates.forEach(e=>{e.yi.bottom||e.xi.right||(n+=parseInt(e.value,10))}),this.tooltipShowTimeoutId=setTimeout(()=>{this.currentElement=a,t.hidden=!1;const i=this.totalClicks?Math.round(n/this.totalClicks*1e4)/100:0,s=a.getBoundingClientRect();t.style.top=s.top+"px",t.style.left=s.left+"px",t.style.width=s.width+"px",t.style.height=s.height+"px",this.handleTooltip(e,n,i,"show"),this.tooltipShowTimeoutId=null},100)},lookUpRecordedElementAtEventLocation(e){const t=e.target;if(!t)return null;const a=window.document.getElementById("recordingPlayer");if(!a)return null;const i=a.contentWindow?a.contentWindow.document:a.contentDocument;if(!i)return null;const n=t.getBoundingClientRect();return i.elementFromPoint(e.clientX-n.left,e.clientY-n.top)},handleTooltip(e,t,a,i){this.tooltip&&("show"===i?(this.clickCount=t,this.clickRate=a,this.tooltip.show(e)):"move"===i?this.tooltip.show(e):this.tooltip.hide())}},computed:{isScrollHeatmapType(){return 3===this.heatmapType},tokenAuth(){return B["MatomoUrl"].parsed.value.token_auth},embedUrl(){return"?"+B["MatomoUrl"].stringify({module:"HeatmapSessionRecording",action:"embedPage",idSite:B["Matomo"].idSite,idSiteHsr:this.idSiteHsr,token_auth:this.tokenAuth||void 0})},iframeWidthOptions(){return this.iframeResolutions.map(e=>({key:e,value:e+"px"}))},recordedSamplesSince(){const e=Object(B["translate"])("HeatmapSessionRecording_HeatmapXRecordedSamplesSince",`${this.actualNumSamples.nb_samples_device_all}`,this.createdDate),t=Object(B["externalLink"])("https://matomo.org/faq/heatmap-session-recording/troubleshooting-heatmaps/"),a=Object(B["translate"])("HeatmapSessionRecording_HeatmapTroubleshoot",t,"");return`${e} ${a}`},deviceTypesWithSamples(){return this.deviceTypes.map(e=>{let t;t=this.actualNumSamples["nb_samples_device_"+e.key]?this.actualNumSamples["nb_samples_device_"+e.key]:0;const a=Object(B["translate"])("HeatmapSessionRecording_XSamples",`${e.name} - ${t}`);return Object.assign(Object.assign({},e),{},{numSamples:t,tooltip:a})})},hasWriteAccess(){return!(null===B["Matomo"]||void 0===B["Matomo"]||!B["Matomo"].heatmapWriteAccess)},showDeleteScreenshot(){return this.isActive&&this.hasWriteAccess},gradientImgData(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAKCAYAAABCHPt+AAAAnklEQVRYR+2WQQqDQBAES5wB/f8/Y05RcMWwSu6JIT0Dm4WlH1DUdHew7/z6WYFhhnGRpnlhAEaQpi/ADbh/np0MiBhGhW+2ymFU+DZfg1EhaoB4jCFuMYYcQKZrXwPEVvm5Og0pcYakBvI35G1jNIZ4jCHexxjSpz9ZFUjAynLbpOvqteaODkm9sloz5JF+ZTVmSAWSu9Qb65AvgDwBQoLgVDlWfAQAAAAASUVORK5CYII="}}});re.render=M;var oe=re;const le={class:"sessionRecordingPlayer"},ce={class:"controls"},de={class:"playerActions"},me=["title"],pe=["title"],ue=["title"],he=["title"],ge=["title"],be=["title"],ve=["title"],Oe=["title"],je={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},fe=Object(s["createElementVNode"])("path",{d:"M480 576.5v-321h-64.5v129h-63v-129h-64.5v192h127.5v129h64.5zM607.5 127.999c34.5 0\n 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z"},null,-1),ye=[fe],Se={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},He=Object(s["createElementVNode"])("path",{d:"M448.5 576.5v-321h-129v64.5h64.5v256.5h64.5zM607.5 127.999c34.5 0 64.5 30 64.5\n 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5 0-64.5-30-64.5-64.5v-447c0-34.5\n 30-64.5 64.5-64.5h447z"},null,-1),_e=[He],Ee={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},Ve=Object(s["createElementVNode"])("path",{d:"M480 384.5v-64.5c0-36-30-64.5-64.5-64.5h-127.5v64.5h127.5v64.5h-63c-34.5 0-64.5\n 27-64.5 63v129h192v-64.5h-127.5v-64.5h63c34.5 0 64.5-27 64.5-63zM607.5 127.999c34.5\n 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447z"},null,-1),Ne=[Ve],Re={version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},we=Object(s["createElementVNode"])("path",{d:"M480 320v-64.5h-127.5c-34.5 0-64.5 28.5-64.5 64.5v192c0 36 30 64.5 64.5\n 64.5h63c34.5 0 64.5-28.5 64.5-64.5v-64.5c0-36-30-63-64.5-63h-63v-64.5h127.5zM607.5\n 127.999c34.5 0 64.5 30 64.5 64.5v447c0 34.5-30 64.5-64.5 64.5h-447c-34.5\n 0-64.5-30-64.5-64.5v-447c0-34.5 30-64.5 64.5-64.5h447zM352.5 512v-64.5h63v64.5h-63z"},null,-1),ke=[we],xe=["title"],Ce=Object(s["createElementVNode"])("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 768 768"},[Object(s["createElementVNode"])("path",{d:"M223.5 415.5h111l-64.5-63h-46.5v63zM72 72l624 624-42 40.5-88.5-90c-51 36-114\n 57-181.5 57-177 0-319.5-142.5-319.5-319.5 0-67.5 21-130.5 57-181.5l-90-88.5zM544.5\n 352.5h-111l-231-231c51-36 114-57 181.5-57 177 0 319.5 142.5 319.5 319.5 0 67.5-21\n 130.5-57 181.5l-148.5-150h46.5v-63z"})],-1),De=[Ce],Te=["title"],Me=Object(s["createElementVNode"])("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"22",height:"22",viewBox:"0 0 768 768"},[Object(s["createElementVNode"])("path",{d:"M544.5 609v-129h63v192h-384v96l-127.5-127.5 127.5-127.5v96h321zM223.5\n 288v129h-63v-192h384v-96l127.5 127.5-127.5 127.5v-96h-321z"})],-1),Pe=[Me],Ae={class:"duration"},Be={class:"playerHelp"},Ue=Object(s["createElementVNode"])("span",{class:"clickEvent"},null,-1),Fe=Object(s["createElementVNode"])("span",{class:"moveEvent"},null,-1),Le=Object(s["createElementVNode"])("span",{class:"scrollEvent"},null,-1),Ie=Object(s["createElementVNode"])("span",{class:"resizeEvent"},null,-1),We=Object(s["createElementVNode"])("span",{class:"formChange"},null,-1),qe=Object(s["createElementVNode"])("span",{class:"mutationEvent"},null,-1),ze=Object(s["createElementVNode"])("br",{style:{clear:"right"}},null,-1),$e=["title"],Ge=Object(s["createElementVNode"])("br",null,null,-1),Je=Object(s["createElementVNode"])("div",{class:"loadingUnderlay"},null,-1),Xe={class:"valign-wrapper loadingInner"},Ye={class:"loadingContent"},Ke=["src","width","height"];function Qe(e,t,a,i,n,r){return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",le,[Object(s["createElementVNode"])("div",ce,[Object(s["createElementVNode"])("span",de,[Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"playerAction icon-skip-previous",title:e.skipPreviousButtonTitle,onClick:t[0]||(t[0]=t=>e.loadNewRecording(e.previousRecordingId))},null,8,me),[[s["vShow"],e.previousRecordingId]]),Object(s["createElementVNode"])("span",{class:"playerAction icon-fast-rewind",title:e.translate("HeatmapSessionRecording_PlayerRewindFast",10,"J"),onClick:t[1]||(t[1]=t=>e.jumpRelative(10,!1))},null,8,pe),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"playerAction icon-play",title:e.translate("HeatmapSessionRecording_PlayerPlay","K"),onClick:t[2]||(t[2]=t=>e.play())},null,8,ue),[[s["vShow"],!e.isPlaying&&!e.isFinished]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"playerAction icon-replay",title:e.translate("HeatmapSessionRecording_PlayerReplay","K"),onClick:t[3]||(t[3]=t=>e.replay())},null,8,he),[[s["vShow"],!e.isPlaying&&e.isFinished]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"playerAction icon-pause",title:e.translate("HeatmapSessionRecording_PlayerPause","K"),onClick:t[4]||(t[4]=t=>e.pause())},null,8,ge),[[s["vShow"],e.isPlaying]]),Object(s["createElementVNode"])("span",{class:"playerAction icon-fast-forward",title:e.translate("HeatmapSessionRecording_PlayerForwardFast",10,"L"),onClick:t[5]||(t[5]=t=>e.jumpRelative(10,!0))},null,8,be),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"playerAction icon-skip-next",title:e.translate("HeatmapSessionRecording_PlayerPageViewNext",e.nextRecordingInfo,"N"),onClick:t[6]||(t[6]=t=>e.loadNewRecording(e.nextRecordingId))},null,8,ve),[[s["vShow"],e.nextRecordingId]]),Object(s["createElementVNode"])("span",{class:"changeReplaySpeed",title:e.translate("HeatmapSessionRecording_ChangeReplaySpeed","S"),onClick:t[7]||(t[7]=t=>e.increaseReplaySpeed())},[Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("svg",je,ye,512)),[[s["vShow"],4===e.actualReplaySpeed]]),Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("svg",Se,_e,512)),[[s["vShow"],1===e.actualReplaySpeed]]),Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("svg",Ee,Ne,512)),[[s["vShow"],2===e.actualReplaySpeed]]),Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("svg",Re,ke,512)),[[s["vShow"],6===e.actualReplaySpeed]])],8,Oe),Object(s["createElementVNode"])("span",{class:Object(s["normalizeClass"])(["toggleSkipPause",{active:e.actualSkipPausesEnabled}]),title:e.translate("HeatmapSessionRecording_ClickToSkipPauses",e.skipPausesEnabledText,"B"),onClick:t[8]||(t[8]=t=>e.toggleSkipPauses())},De,10,xe),Object(s["createElementVNode"])("span",{class:Object(s["normalizeClass"])(["toggleAutoPlay",{active:e.actualAutoPlayEnabled}]),title:e.translate("HeatmapSessionRecording_AutoPlayNextPageview",e.autoplayEnabledText,"A"),onClick:t[9]||(t[9]=t=>e.toggleAutoPlay())},Pe,10,Te),Object(s["createElementVNode"])("span",Ae,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_PlayerDurationXofY",e.positionPretty,e.durationPretty)),1)]),Object(s["createElementVNode"])("div",Be,[Object(s["createElementVNode"])("ul",null,[Object(s["createElementVNode"])("li",null,[Ue,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityClick")),1)]),Object(s["createElementVNode"])("li",null,[Fe,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityMove")),1)]),Object(s["createElementVNode"])("li",null,[Le,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityScroll")),1)]),Object(s["createElementVNode"])("li",null,[Ie,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityResize")),1)]),Object(s["createElementVNode"])("li",null,[We,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityFormChange")),1)]),Object(s["createElementVNode"])("li",null,[qe,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ActivityPageChange")),1)])])]),ze]),Object(s["createElementVNode"])("div",{class:"timelineOuter",onClick:t[10]||(t[10]=t=>e.seekEvent(t)),style:Object(s["normalizeStyle"])({width:e.replayWidth+"px"})},[Object(s["createElementVNode"])("div",{class:"timelineInner",style:Object(s["normalizeStyle"])({width:e.progress+"%"})},null,4),(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.clues,(e,t)=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{title:e.title,class:Object(s["normalizeClass"])(e.type),style:Object(s["normalizeStyle"])({left:e.left+"%"}),key:t},null,14,$e))),128))],4),Ge,Object(s["withDirectives"])(Object(s["createElementVNode"])("div",{class:"hsrLoadingOuter",style:Object(s["normalizeStyle"])({width:e.replayWidth+"px",height:e.replayHeight+"px"})},[Je,Object(s["createElementVNode"])("div",Xe,[Object(s["createElementVNode"])("div",Ye,Object(s["toDisplayString"])(e.translate("General_Loading")),1)])],4),[[s["vShow"],e.isLoading]]),Object(s["createElementVNode"])("div",{class:"replayContainerOuter",onClick:t[12]||(t[12]=t=>e.togglePlay()),style:Object(s["normalizeStyle"])({height:e.replayHeight+"px",width:e.replayWidth+"px"})},[Object(s["createElementVNode"])("div",{class:"replayContainerInner",style:Object(s["normalizeStyle"])([{"transform-origin":"0 0"},{transform:`scale(${e.replayScale})`,"margin-left":e.replayMarginLeft+"px"}])},[e.embedUrl?(Object(s["openBlock"])(),Object(s["createElementBlock"])("iframe",{key:0,id:"recordingPlayer",ref:"recordingPlayer",onLoad:t[11]||(t[11]=t=>e.onLoaded()),scrolling:"no",sandbox:"allow-scripts allow-same-origin",referrerpolicy:"no-referrer",src:e.embedUrl,width:e.recording.viewport_w_px,height:e.recording.viewport_h_px},null,40,Ke)):Object(s["createCommentVNode"])("",!0)],4)],4)])}const Ze=20,et=1,tt=2,at=3,it=4,nt=5,st=6,rt=9,ot=10,lt=12,ct={[tt]:"clickEvent",[et]:"moveEvent",[at]:"scrollEvent",[lt]:"scrollEvent",[it]:"resizeEvent",[rt]:"formChange",[ot]:"formChange",[nt]:"mutationEvent",[st]:"mutationEvent"},dt={[tt]:Object(B["translate"])("HeatmapSessionRecording_ActivityClick"),[et]:Object(B["translate"])("HeatmapSessionRecording_ActivityMove"),[at]:Object(B["translate"])("HeatmapSessionRecording_ActivityScroll"),[lt]:Object(B["translate"])("HeatmapSessionRecording_ActivityScroll"),[it]:Object(B["translate"])("HeatmapSessionRecording_ActivityResize"),[rt]:Object(B["translate"])("HeatmapSessionRecording_ActivityFormChange"),[ot]:Object(B["translate"])("HeatmapSessionRecording_ActivityFormChange"),[nt]:Object(B["translate"])("HeatmapSessionRecording_ActivityPageChange"),[st]:Object(B["translate"])("HeatmapSessionRecording_ActivityPageChange")},mt='\n
\n \n \n \n
\n',{$:pt,Mousetrap:ut}=window;function ht(e){return"number"===typeof e?e:parseInt(e,10)}function gt(e){if(null!==e&&void 0!==e&&e.event_type)return ht(e.event_type)}function bt(e){const t=Math.floor(e/1e3);let a=Math.floor(t/60),i=t%60;return a<10&&(a="0"+a),i<10&&(i="0"+i),`${a}:${i}`}var vt=Object(s["defineComponent"])({props:{offsetAccuracy:{type:Number,required:!0},scrollAccuracy:{type:Number,required:!0},autoPlayEnabled:Boolean,skipPausesEnabled:Boolean,replaySpeed:{type:Number,default:1}},data(){return{isPlaying:!1,progress:0,isFinished:!1,isLoading:!0,seekTimeout:null,lastFramePainted:0,recording:JSON.parse(JSON.stringify(window.sessionRecordingData)),positionPretty:"00:00",previousRecordingId:null,previousRecordingInfo:null,nextRecordingId:null,nextRecordingInfo:null,frame:0,hasFoundPrevious:!1,hasFoundNext:!1,videoPlayerInterval:null,lastCanvasCoordinates:!1,actualAutoPlayEnabled:!!this.autoPlayEnabled,replayWidth:0,replayHeight:0,replayScale:0,replayMarginLeft:0,seek:e=>e,actualSkipPausesEnabled:!!this.skipPausesEnabled,actualReplaySpeed:this.replaySpeed}},setup(){const e=Object(s["ref"])(!1);let t=null;const a=new Promise(a=>{t=a,e.value=!0}),i=()=>{setTimeout(()=>{t("loaded")},500)};return{iframeLoadedPromise:a,onLoaded:i,iframeLoaded:e}},created(){this.recording.duration=ht(this.recording.duration),this.recording.pageviews.forEach(e=>{e&&e.idloghsr&&(""+e.idloghsr===""+this.recording.idLogHsr?this.hasFoundPrevious=!0:this.hasFoundPrevious?this.hasFoundNext||(this.hasFoundNext=!0,this.nextRecordingId=e.idloghsr,this.nextRecordingInfo=[e.label,e.server_time_pretty,e.time_on_page_pretty].join(" - ")):(this.previousRecordingId=e.idloghsr,this.previousRecordingInfo=[e.label,e.server_time_pretty,e.time_on_page_pretty].join(" - ")))})},mounted(){ut.bind(["space","k"],()=>{this.togglePlay()}),ut.bind("0",()=>{this.isFinished&&this.replay()}),ut.bind("p",()=>{this.loadNewRecording(this.previousRecordingId)}),ut.bind("n",()=>{this.loadNewRecording(this.nextRecordingId)}),ut.bind("s",()=>{this.increaseReplaySpeed()}),ut.bind("a",()=>{this.toggleAutoPlay()}),ut.bind("b",()=>{this.toggleSkipPauses()}),ut.bind("left",()=>{const e=5,t=!1;this.jumpRelative(e,t)}),ut.bind("right",()=>{const e=5,t=!0;this.jumpRelative(e,t)}),ut.bind("j",()=>{const e=10,t=!1;this.jumpRelative(e,t)}),ut.bind("l",()=>{const e=10,t=!0;this.jumpRelative(e,t)}),this.initViewport(),pt(window).on("resize",()=>this.initViewport()),this.iframeLoadedPromise.then(()=>{this.initPlayer()}),window.addEventListener("beforeunload",()=>{this.isPlaying=!1,this.videoPlayerInterval&&(clearInterval(this.videoPlayerInterval),this.videoPlayerInterval=null)})},methods:{initPlayer(){const e=this.$refs.recordingPlayer,t=F(e).recordingFrame;if(!t||!t.isSupportedBrowser())return;t.addClass("html","piwikSessionRecording"),t.addClass("html","matomoSessionRecording");let a=null;const i=(e,i)=>{a&&a.css({left:e.x-8+"px",top:e.y-8+"px"}),this.lastCanvasCoordinates&&(t.drawLine(this.lastCanvasCoordinates.x,this.lastCanvasCoordinates.y,e.x,e.y,i),this.lastCanvasCoordinates=e)},n=(e,n)=>{if(!this.lastCanvasCoordinates||!a)return void t.scrollTo(e,n);const s=t.getScrollTop(),r=t.getScrollLeft();t.scrollTo(e,n);const o=n-s,l=e-r;let c=l+this.lastCanvasCoordinates.x,d=o+this.lastCanvasCoordinates.y;c<=0&&(c=0),d<=0&&(d=0),i({x:c,y:d},"blue")},s=(e,t,a)=>{null!==e&&void 0!==e&&e.scrollTo?e.scrollTo(t,a):(e.scrollLeft=t,e.scrollTop=a)};let r=null;const o=e=>{const{isPlaying:a}=this;this.isPlaying=!1;const i=gt(e);let o=null;if(i===et)e.selector&&(o=t.getCoordinatesInFrame(e.selector,e.x,e.y,this.offsetAccuracy,!1),o&&r(o));else if(i===tt)e.selector&&(o=t.getCoordinatesInFrame(e.selector,e.x,e.y,this.offsetAccuracy,!1),o&&(r(o),t.drawCircle(o.x,o.y,"#ff9407")));else if(i===st)e.text&&t.applyMutation(e.text);else if(i===at){const a=t.getIframeHeight(),i=t.getIframeWidth(),s=parseInt(""+a/this.scrollAccuracy*ht(e.y),10),r=parseInt(""+i/this.scrollAccuracy*ht(e.x),10);n(r,s)}else if(i===lt){if(e.selector){const a=t.findElement(e.selector);if(a&&a.length&&a[0]){const t=Math.max(a[0].scrollHeight,a[0].offsetHeight,a.height(),0),i=Math.max(a[0].scrollWidth,a[0].offsetWidth,a.width(),0);if(t&&i){const n=parseInt(""+t/this.scrollAccuracy*ht(e.y),10),r=parseInt(""+i/this.scrollAccuracy*ht(e.x),10);s(a[0],r,n)}}}}else if(i===it)this.setViewportResolution(e.x,e.y);else if(i===rt){if(e.selector){const a=t.findElement(e.selector);if(a.length){const t=a.attr("type");t&&"file"===(""+t).toLowerCase()||a.val(e.text).change()}}}else if(i===ot&&e.selector){const a=t.findElement(e.selector);a.is("input")?a.prop("checked",1===e.text||"1"===e.text):a.is("select")&&a.val(e.text).change()}this.isPlaying=a};r=e=>{const n=()=>{const e=t.getIframeWidth(),a=t.getIframeHeight();t.makeSvg(e,a);for(let t=0;t<=this.frame;t+=Ze){if(!this.timeFrameBuckets[t])return;this.timeFrameBuckets[t].forEach(e=>{const a=gt(e);a!==et&&a!==at&&a!==lt&&a!==tt||(this.lastFramePainted=t,o(e))})}},s=t.getIframeWindow();if(!this.lastCanvasCoordinates){const i=t.getIframeHeight(),r=t.getIframeWidth();return t.appendContent(mt),a=t.findElement(".mousePointer"),t.makeSvg(r,i),s.removeEventListener("resize",n,!1),s.addEventListener("resize",n,!1),this.lastCanvasCoordinates=e,void a.css({left:e.x-8+"px",top:e.y-8+"px"})}let r=t.getScrollTop();const l=t.getScrollLeft();(e.y>r+ht(this.recording.viewport_h_px)||e.yl+ht(this.recording.viewport_w_px)||e.x{if(!this.iframeLoaded)return;this.isLoading=!0;let a=this.frame;const i=e=>{for(let t=e;t<=this.frame;t+=Ze)(this.timeFrameBuckets[t]||[]).forEach(e=>{this.lastFramePainted=t,o(e)})};this.isFinished=!1,this.frame=e-e%Ze,this.progress=parseFloat(parseFloat(""+this.frame/ht(this.recording.duration)*100).toFixed(2)),this.positionPretty=bt(this.frame),a>this.frame?(a=0,this.lastCanvasCoordinates=!1,this.initialMutation&&t.initialMutation(this.initialMutation.text),t.scrollTo(0,0),this.setViewportResolution(window.sessionRecordingData.viewport_w_px,window.sessionRecordingData.viewport_h_px),this.seekTimeout&&(clearTimeout(this.seekTimeout),this.seekTimeout=null),(e=>{this.seekTimeout=setTimeout(()=>{i(e),this.isLoading=!1},1050)})(a)):(this.seekTimeout&&(clearTimeout(this.seekTimeout),this.seekTimeout=null),i(a),this.isLoading=!1)},this.isLoading=!1,this.isPlaying=!0;let l=0;const c=()=>{if(this.isPlaying&&!this.isLoading){l+=1;const e=ht(this.recording.duration);if(this.frame>=e?(this.isPlaying=!1,this.progress=100,this.isFinished=!0,this.positionPretty=this.durationPretty,this.actualAutoPlayEnabled&&this.nextRecordingId&&this.loadNewRecording(this.nextRecordingId)):(this.progress=parseFloat(parseFloat(""+this.frame/e*100).toFixed(2)),20===l&&(l=0,this.positionPretty=bt(this.frame))),(this.timeFrameBuckets[this.frame]||[]).forEach(e=>{this.lastFramePainted=this.frame,o(e)}),this.actualSkipPausesEnabled&&this.frame-this.lastFramePainted>1800){let t=Object.keys(this.timeFrameBuckets).map(e=>parseInt(e,10));t=t.sort((e,t)=>e-t);const a=t.find(e=>e>this.frame),i=!!a;if(a){const e=a-this.frame>1e3;e&&(this.frame=a-20*Ze)}if(!i){const t=e-this.frame>1e3;t&&(this.frame=e-20*Ze)}}this.frame+=Ze}};this.videoPlayerInterval=setInterval(()=>{for(let e=1;e<=this.actualReplaySpeed;e+=1)c()},Ze)},initViewport(){this.replayHeight=pt(window).height()-48-pt(".sessionRecording .sessionRecordingHead").outerHeight(!0)-pt(".sessionRecordingPlayer .controls").outerHeight(!0),this.replayWidth=pt(window).width()-48;const e=ht(this.recording.viewport_w_px),t=ht(this.recording.viewport_h_px),a=400;this.replayWidtha&&(this.replayWidth=a);const i=400;this.replayHeighti&&(this.replayHeight=i);let n=1,s=1;e>this.replayWidth&&(n=parseFloat(parseFloat(""+this.replayWidth/e).toFixed(4))),t>this.replayHeight&&(s=parseFloat(parseFloat(""+this.replayHeight/t).toFixed(4))),this.replayScale=Math.min(n,s),this.replayMarginLeft=(this.replayWidth-this.replayScale*e)/2},setViewportResolution(e,t){this.recording.viewport_w_px=parseInt(""+e,10),this.recording.viewport_h_px=parseInt(""+t,10),pt(".recordingWidth").text(e),pt(".recordingHeight").text(t),this.initViewport()},increaseReplaySpeed(){1===this.actualReplaySpeed?this.actualReplaySpeed=2:2===this.actualReplaySpeed?this.actualReplaySpeed=4:4===this.actualReplaySpeed?this.actualReplaySpeed=6:this.actualReplaySpeed=1,this.updateSettings()},updateSettings(){B["AjaxHelper"].fetch({module:"HeatmapSessionRecording",action:"saveSessionRecordingSettings",autoplay:this.actualAutoPlayEnabled?1:0,skippauses:this.actualSkipPausesEnabled?1:0,replayspeed:this.actualReplaySpeed},{format:"html"})},toggleAutoPlay(){this.actualAutoPlayEnabled=!this.actualAutoPlayEnabled,this.updateSettings()},toggleSkipPauses(){this.actualSkipPausesEnabled=!this.actualSkipPausesEnabled,this.updateSettings()},loadNewRecording(e){e&&(this.isPlaying=!1,B["MatomoUrl"].updateUrl(Object.assign(Object.assign({},B["MatomoUrl"].urlParsed.value),{},{idLogHsr:parseInt(""+e,10),updated:B["MatomoUrl"].urlParsed.value.updated?parseInt(B["MatomoUrl"].urlParsed.value.updated,10)+1:1})))},jumpRelative(e,t){const a=1e3*e;let i;t?(i=this.frame+a,i>this.recording.duration&&(i=ht(this.recording.duration)-Ze)):(i=this.frame-a,i<0&&(i=0)),this.seek(i)},replay(){this.isFinished=!1,this.lastFramePainted=0,this.seek(0),this.play()},pause(){this.isPlaying=!1},togglePlay(){this.isFinished?this.replay():this.isPlaying?this.pause():this.play()},seekEvent(e){const t=pt(e.currentTarget).offset(),a=e.pageX-t.left,i=this.replayWidth,n=a/i,s=ht(this.recording.duration)*n;this.seek(s)},play(){this.isPlaying=!0}},computed:{durationPretty(){return bt(ht(this.recording.duration))},embedUrl(){return"?"+B["MatomoUrl"].stringify({module:"HeatmapSessionRecording",action:"embedPage",idSite:this.recording.idSite,idLogHsr:this.recording.idLogHsr,idSiteHsr:this.recording.idSiteHsr,token_auth:B["MatomoUrl"].urlParsed.value.token_auth||void 0})},skipPreviousButtonTitle(){return Object(B["translate"])("HeatmapSessionRecording_PlayerPageViewPrevious",this.previousRecordingInfo||"","P")},skipPausesEnabledText(){return this.actualSkipPausesEnabled?Object(B["translate"])("HeatmapSessionRecording_disable"):Object(B["translate"])("HeatmapSessionRecording_enable")},autoplayEnabledText(){return this.actualAutoPlayEnabled?Object(B["translate"])("HeatmapSessionRecording_disable"):Object(B["translate"])("HeatmapSessionRecording_enable")},recordingEvents(){return this.recording?this.recording.events.map(e=>{const t=gt(e);let{text:a}=e;return t!==nt&&t!==st||"string"!==typeof a||(a=JSON.parse(a)),Object.assign(Object.assign({},e),{},{text:a})}):[]},initialMutation(){const e=this.recordingEvents.find(e=>{const t=gt(e),a=t===nt||t===st,i=a&&(t===nt||!e.time_since_load||"0"===e.time_since_load);return i});return e},timeFrameBuckets(){const e={};return this.recordingEvents.forEach(t=>{if(t===this.initialMutation)return;const a=Math.round(ht(t.time_since_load)/Ze)*Ze;e[a]=e[a]||[],e[a].push(t)}),e},clues(){const e=[];return this.recordingEvents.forEach(t=>{if(t===this.initialMutation)return;const a=gt(t),i=ct[a]||"",n=dt[a]||"";if(i){if((0===t.time_since_load||"0"===t.time_since_load)&&"moveEvent"===i)return;e.push({left:parseFloat(""+ht(t.time_since_load)/ht(this.recording.duration)*100).toFixed(2),type:i,title:n})}}),e}}});vt.render=Qe;var Ot=vt;const jt={class:"form-group hsrTargetTest"},ft={class:"loadingPiwik loadingMatchingSteps"},yt=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif",alt:""},null,-1),St=Object(s["createElementVNode"])("div",{id:"hsrTargetValidationError"},null,-1);function Ht(e,t,a,i,n,r){return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",jt,[Object(s["createElementVNode"])("label",null,[Object(s["createElementVNode"])("strong",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestTitle"))+":",1),Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestLabel")),1)]),Object(s["withDirectives"])(Object(s["createElementVNode"])("input",{type:"text",id:"urltargettest",placeholder:"http://www.example.com/","onUpdate:modelValue":t[0]||(t[0]=t=>e.url=t),class:Object(s["normalizeClass"])({invalid:e.url&&!e.matches&&e.isValid})},null,2),[[s["vModelText"],e.url]]),Object(s["createElementVNode"])("div",null,[Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"testInfo"},Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestErrorInvalidUrl")),513),[[s["vShow"],e.url&&!e.isValid]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"testInfo matches"},Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestUrlMatches")),513),[[s["vShow"],e.url&&e.matches&&e.isValid]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"testInfo notMatches"},Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPageTestUrlNotMatches")),513),[[s["vShow"],e.url&&!e.matches&&e.isValid]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",ft,[yt,Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.translate("General_LoadingData")),1)],512),[[s["vShow"],e.isLoadingTestMatchPage]])]),St])}function _t(e){return e.indexOf("://")>3}var Et=Object(s["defineComponent"])({props:{includedTargets:Array},data(){return{url:"",matches:!1,isLoadingTestMatchPage:!1}},watch:{isValid(e){e||(this.matches=!1)},includedTargets(){this.runTest()},url(){this.runTest()}},setup(){return{testUrlMatchPages:L("HeatmapSessionRecording.testUrlMatchPages",{errorElement:"#hsrTargetValidationError"})}},created(){this.runTest=Object(B["debounce"])(this.runTest,200)},methods:{checkIsMatchingUrl(){if(!this.isValid)return;const e=this.targetUrl,t=this.filteredIncludedTargets;null!==t&&void 0!==t&&t.length&&(this.isLoadingTestMatchPage=!0,this.testUrlMatchPages({url:e},{matchPageRules:t}).then(e=>{var t;null!==(t=this.filteredIncludedTargets)&&void 0!==t&&t.length&&(null===e||void 0===e?void 0:e.url)===this.targetUrl&&(this.matches=e.matches)}).finally(()=>{this.isLoadingTestMatchPage=!1}))},runTest(){this.isValid&&this.checkIsMatchingUrl()}},computed:{targetUrl(){return(this.url||"").trim()},isValid(){return this.targetUrl&&_t(this.targetUrl)},filteredIncludedTargets(){if(this.includedTargets)return this.includedTargets.filter(e=>(null===e||void 0===e?void 0:e.value)||"any"===(null===e||void 0===e?void 0:e.type)).map(e=>Object.assign(Object.assign({},e),{},{value:e.value?e.value.trim():""}))}}});Et.render=Ht;var Vt=Et;const Nt={style:{width:"100%"}},Rt={name:"targetAttribute"},wt={name:"targetType"},kt={name:"targetValue"},xt={name:"targetValue2"},Ct=["title"],Dt=["title"];function Tt(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("Field");return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{class:Object(s["normalizeClass"])(["form-group hsrUrltarget valign-wrapper",{disabled:e.disableIfNoValue&&!e.modelValue.value}])},[Object(s["createElementVNode"])("div",Nt,[Object(s["createElementVNode"])("div",Rt,[Object(s["createVNode"])(o,{uicontrol:"select",name:"targetAttribute","model-value":e.modelValue.attribute,"onUpdate:modelValue":t[0]||(t[0]=t=>e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{attribute:t}))),title:e.translate("HeatmapSessionRecording_Rule"),options:e.targetAttributes,"full-width":!0},null,8,["model-value","title","options"])]),Object(s["createElementVNode"])("div",wt,[Object(s["createVNode"])(o,{uicontrol:"select",name:"targetType","model-value":e.pattern_type,"onUpdate:modelValue":t[1]||(t[1]=t=>{e.onTypeChange(t)}),options:e.targetOptions[e.modelValue.attribute],"full-width":!0},null,8,["model-value","options"])]),Object(s["createElementVNode"])("div",kt,[Object(s["withDirectives"])(Object(s["createVNode"])(o,{uicontrol:"text",name:"targetValue",placeholder:"eg. "+e.targetExamples[e.modelValue.attribute],"model-value":e.modelValue.value,"onUpdate:modelValue":t[2]||(t[2]=t=>e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value:t.trim()}))),maxlength:500,"full-width":!0},null,8,["placeholder","model-value"]),[[s["vShow"],"any"!==e.pattern_type]])]),Object(s["createElementVNode"])("div",xt,[Object(s["withDirectives"])(Object(s["createVNode"])(o,{uicontrol:"text",name:"targetValue2","model-value":e.modelValue.value2,"onUpdate:modelValue":t[3]||(t[3]=t=>e.$emit("update:modelValue",Object.assign(Object.assign({},e.modelValue),{},{value2:t.trim()}))),maxlength:500,"full-width":!0,placeholder:e.translate("HeatmapSessionRecording_UrlParameterValueToMatchPlaceholder")},null,8,["model-value","placeholder"]),[[s["vShow"],"urlparam"===e.modelValue.attribute&&e.pattern_type&&"exists"!==e.pattern_type&&"not_exists"!==e.pattern_type]])])]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"icon-plus valign",title:e.translate("General_Add"),onClick:t[4]||(t[4]=t=>e.$emit("addUrl"))},null,8,Ct),[[s["vShow"],e.showAddUrl]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("span",{class:"icon-minus valign",title:e.translate("General_Remove"),onClick:t[5]||(t[5]=t=>e.$emit("removeUrl"))},null,8,Dt),[[s["vShow"],e.canBeRemoved]])],2)}function Mt(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e} +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */class Pt{constructor(){Mt(this,"privateState",Object(s["reactive"])({rules:[]})),Mt(this,"state",Object(s["computed"])(()=>Object(s["readonly"])(this.privateState))),Mt(this,"rules",Object(s["computed"])(()=>this.state.value.rules)),Mt(this,"initPromise",null)}init(){return this.initPromise||(this.initPromise=B["AjaxHelper"].fetch({method:"HeatmapSessionRecording.getAvailableTargetPageRules",filter_limit:"-1"}).then(e=>(this.privateState.rules=e,this.rules.value))),this.initPromise}}var At=new Pt,Bt=Object(s["defineComponent"])({props:{modelValue:{type:Object,required:!0},canBeRemoved:Boolean,disableIfNoValue:Boolean,allowAny:Boolean,showAddUrl:Boolean},components:{Field:U["Field"]},emits:["addUrl","removeUrl","update:modelValue"],created(){At.init()},watch:{modelValue(e){if(!e.attribute)return;const t=this.targetOptions[e.attribute],a=t.find(e=>e.key===this.pattern_type);!a&&t[0]&&this.onTypeChange(t[0].key)}},computed:{pattern_type(){let e=this.modelValue.type;return this.modelValue.inverted&&"0"!==this.modelValue.inverted&&(e="not_"+this.modelValue.type),e},targetAttributes(){return At.rules.value.map(e=>({key:e.value,value:e.name}))},targetOptions(){const e={};return At.rules.value.forEach(t=>{e[t.value]=[],this.allowAny&&"url"===t.value&&e[t.value].push({value:Object(B["translate"])("HeatmapSessionRecording_TargetTypeIsAny"),key:"any"}),t.types.forEach(a=>{e[t.value].push({value:a.name,key:a.value}),e[t.value].push({value:Object(B["translate"])("HeatmapSessionRecording_TargetTypeIsNot",a.name),key:"not_"+a.value})})}),e},targetExamples(){const e={};return At.rules.value.forEach(t=>{e[t.value]=t.example}),e}},methods:{onTypeChange(e){let t=0,a=e;0===e.indexOf("not_")&&(a=e.substring("not_".length),t=1),this.$emit("update:modelValue",Object.assign(Object.assign({},this.modelValue),{},{type:a,inverted:t}))}}});Bt.render=Tt;var Ut=Bt;const Ft={class:"loadingPiwik"},Lt=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),It={class:"loadingPiwik"},Wt=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),qt={name:"name"},zt={name:"sampleLimit"},$t={class:"form-group row"},Gt={class:"col s12"},Jt={class:"col s12 m6",style:{"padding-left":"0"}},Xt=Object(s["createElementVNode"])("hr",null,null,-1),Yt={class:"col s12 m6"},Kt={class:"form-help"},Qt={class:"inline-help"},Zt={name:"sampleRate"},ea={name:"excludedElements"},ta={name:"screenshotUrl"},aa={name:"breakpointMobile"},ia={name:"breakpointTablet"},na={name:"trackManually"},sa=["innerHTML"],ra={class:"entityCancel"};function oa(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("Field"),l=Object(s["resolveComponent"])("HsrUrlTarget"),c=Object(s["resolveComponent"])("HsrTargetTest"),d=Object(s["resolveComponent"])("SaveButton"),m=Object(s["resolveComponent"])("ContentBlock");return Object(s["openBlock"])(),Object(s["createBlock"])(m,{class:"editHsr","content-title":e.contentTitle},{default:Object(s["withCtx"])(()=>[Object(s["withDirectives"])(Object(s["createElementVNode"])("p",null,[Object(s["createElementVNode"])("span",Ft,[Lt,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[s["vShow"],e.isLoading]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("p",null,[Object(s["createElementVNode"])("span",It,[Wt,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_UpdatingData")),1)])],512),[[s["vShow"],e.isUpdating]]),Object(s["createElementVNode"])("form",{onSubmit:t[12]||(t[12]=t=>e.edit?e.updateHsr():e.createHsr())},[Object(s["createElementVNode"])("div",null,[Object(s["createElementVNode"])("div",qt,[Object(s["createVNode"])(o,{uicontrol:"text",name:"name","model-value":e.siteHsr.name,"onUpdate:modelValue":t[0]||(t[0]=t=>{e.siteHsr.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,placeholder:e.translate("HeatmapSessionRecording_FieldNamePlaceholder"),"inline-help":e.translate("HeatmapSessionRecording_HeatmapNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(s["createElementVNode"])("div",zt,[Object(s["createVNode"])(o,{uicontrol:"select",name:"sampleLimit","model-value":e.siteHsr.sample_limit,"onUpdate:modelValue":t[1]||(t[1]=t=>{e.siteHsr.sample_limit=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_HeatmapSampleLimit"),options:e.sampleLimits,"inline-help":e.translate("HeatmapSessionRecording_HeatmapSampleLimitHelp")},null,8,["model-value","title","options","inline-help"])]),Object(s["createElementVNode"])("div",$t,[Object(s["createElementVNode"])("div",Gt,[Object(s["createElementVNode"])("h3",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPage"))+":",1)]),Object(s["createElementVNode"])("div",Jt,[(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.siteHsr.match_page_rules,(a,i)=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{class:Object(s["normalizeClass"])(`matchPageRules ${i} multiple`),key:i},[Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(l,{"model-value":a,"onUpdate:modelValue":t=>e.setMatchPageRule(t,i),onAddUrl:t[2]||(t[2]=t=>e.addMatchPageRule()),onRemoveUrl:t=>e.removeMatchPageRule(i),onAnyChange:t[3]||(t[3]=t=>e.setValueHasChanged()),"allow-any":!1,"disable-if-no-value":i>0,"can-be-removed":i>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"])]),Xt],2))),128))]),Object(s["createElementVNode"])("div",Yt,[Object(s["createElementVNode"])("div",Kt,[Object(s["createElementVNode"])("span",Qt,[Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_FieldIncludedTargetsHelp"))+" ",1),Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(c,{"included-targets":e.siteHsr.match_page_rules},null,8,["included-targets"])])])])])]),Object(s["createElementVNode"])("div",Zt,[Object(s["createVNode"])(o,{uicontrol:"select",name:"sampleRate","model-value":e.siteHsr.sample_rate,"onUpdate:modelValue":t[4]||(t[4]=t=>{e.siteHsr.sample_rate=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SampleRate"),options:e.sampleRates,introduction:e.translate("HeatmapSessionRecording_AdvancedOptions"),"inline-help":e.translate("HeatmapSessionRecording_HeatmapSampleRateHelp")},null,8,["model-value","title","options","introduction","inline-help"])]),Object(s["createElementVNode"])("div",ea,[Object(s["createVNode"])(o,{uicontrol:"text",name:"excludedElements","model-value":e.siteHsr.excluded_elements,"onUpdate:modelValue":t[5]||(t[5]=t=>{e.siteHsr.excluded_elements=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_ExcludedElements"),maxlength:1e3,"inline-help":e.translate("HeatmapSessionRecording_ExcludedElementsHelp")},null,8,["model-value","title","inline-help"])]),Object(s["createElementVNode"])("div",ta,[Object(s["createVNode"])(o,{uicontrol:"text",name:"screenshotUrl","model-value":e.siteHsr.screenshot_url,"onUpdate:modelValue":t[6]||(t[6]=t=>{e.siteHsr.screenshot_url=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_ScreenshotUrl"),maxlength:300,disabled:!!e.siteHsr.page_treemirror,"inline-help":e.translate("HeatmapSessionRecording_ScreenshotUrlHelp")},null,8,["model-value","title","disabled","inline-help"])]),Object(s["createElementVNode"])("div",aa,[Object(s["createVNode"])(o,{uicontrol:"text",name:"breakpointMobile","model-value":e.siteHsr.breakpoint_mobile,"onUpdate:modelValue":t[7]||(t[7]=t=>{e.siteHsr.breakpoint_mobile=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_BreakpointX",e.translate("General_Mobile")),maxlength:4,"inline-help":e.breakpointMobileInlineHelp},null,8,["model-value","title","inline-help"])]),Object(s["createElementVNode"])("div",ia,[Object(s["createVNode"])(o,{uicontrol:"text",name:"breakpointTablet","model-value":e.siteHsr.breakpoint_tablet,"onUpdate:modelValue":t[8]||(t[8]=t=>{e.siteHsr.breakpoint_tablet=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_BreakpointX",e.translate("DevicesDetection_Tablet")),maxlength:4,"inline-help":e.breakpointGeneralHelp},null,8,["model-value","title","inline-help"])]),Object(s["createElementVNode"])("div",na,[Object(s["createVNode"])(o,{uicontrol:"checkbox",name:"capture_manually",title:e.translate("HeatmapSessionRecording_CaptureDomTitle"),"inline-help":e.captureDomInlineHelp,"model-value":e.siteHsr.capture_manually,"onUpdate:modelValue":t[9]||(t[9]=t=>{e.siteHsr.capture_manually=t,e.setValueHasChanged()})},null,8,["title","inline-help","model-value"])]),Object(s["createElementVNode"])("p",{innerHTML:e.$sanitize(e.personalInformationNote)},null,8,sa),Object(s["createVNode"])(d,{class:"createButton",onConfirm:t[10]||(t[10]=t=>e.edit?e.updateHsr():e.createHsr()),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),Object(s["createElementVNode"])("div",ra,[Object(s["createElementVNode"])("a",{onClick:t[11]||(t[11]=t=>e.cancel())},Object(s["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]),_:1},8,["content-title"])}function la(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e} +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */class ca{constructor(e){la(this,"context",void 0),la(this,"privateState",Object(s["reactive"])({allHsrs:[],isLoading:!1,isUpdating:!1,filterStatus:""})),la(this,"state",Object(s["computed"])(()=>Object(s["readonly"])(this.privateState))),la(this,"hsrs",Object(s["computed"])(()=>this.privateState.filterStatus?this.state.value.allHsrs.filter(e=>e.status===this.privateState.filterStatus):this.state.value.allHsrs)),la(this,"hsrsCloned",Object(s["computed"])(()=>Object(B["clone"])(this.hsrs.value))),la(this,"statusOptions",Object(s["readonly"])([{key:"",value:Object(B["translate"])("General_All")},{key:"active",value:Object(B["translate"])("HeatmapSessionRecording_StatusActive")},{key:"ended",value:Object(B["translate"])("HeatmapSessionRecording_StatusEnded")},{key:"paused",value:Object(B["translate"])("HeatmapSessionRecording_StatusPaused")}])),la(this,"fetchPromises",{}),this.context=e}setFilterStatus(e){this.privateState.filterStatus=e}reload(){return this.privateState.allHsrs=[],this.fetchPromises={},this.fetchHsrs()}filterRules(e){return e.filter(e=>!!e&&(e.value||"any"===e.type))}getApiMethodInContext(e){return`${e}${this.context}`}fetchHsrs(){let e="HeatmapSessionRecording.getHeatmaps";"SessionRecording"===this.context&&(e="HeatmapSessionRecording.getSessionRecordings");const t={method:e,filter_limit:"-1"};return this.fetchPromises[e]||(this.fetchPromises[e]=B["AjaxHelper"].fetch(t)),this.privateState.isLoading=!0,this.privateState.allHsrs=[],this.fetchPromises[e].then(e=>(this.privateState.allHsrs=e,this.state.value.allHsrs)).finally(()=>{this.privateState.isLoading=!1})}findHsr(e){const t=this.state.value.allHsrs.find(t=>t.idsitehsr===e);return t?Promise.resolve(t):(this.privateState.isLoading=!0,B["AjaxHelper"].fetch({idSiteHsr:e,method:this.getApiMethodInContext("HeatmapSessionRecording.get"),filter_limit:"-1"}).finally(()=>{this.privateState.isLoading=!1}))}deleteHsr(e){return this.privateState.isUpdating=!0,this.privateState.allHsrs=[],B["AjaxHelper"].fetch({idSiteHsr:e,method:this.getApiMethodInContext("HeatmapSessionRecording.delete")},{withTokenInUrl:!0}).then(()=>({type:"success"})).catch(e=>({type:"error",message:e.message||e})).finally(()=>{this.privateState.isUpdating=!1})}completeHsr(e){return this.privateState.isUpdating=!0,this.privateState.allHsrs=[],B["AjaxHelper"].fetch({idSiteHsr:e,method:this.getApiMethodInContext("HeatmapSessionRecording.end")},{withTokenInUrl:!0}).then(()=>({type:"success"})).catch(e=>({type:"error",message:e.message||e})).finally(()=>{this.privateState.isUpdating=!1})}createOrUpdateHsr(e,t){const a={idSiteHsr:e.idsitehsr,sampleLimit:e.sample_limit,sampleRate:e.sample_rate,excludedElements:e.excluded_elements?e.excluded_elements.trim():void 0,screenshotUrl:e.screenshot_url?e.screenshot_url.trim():void 0,breakpointMobile:e.breakpoint_mobile,breakpointTablet:e.breakpoint_tablet,minSessionTime:e.min_session_time,requiresActivity:e.requires_activity?1:0,captureKeystrokes:e.capture_keystrokes?1:0,captureDomManually:e.capture_manually?1:0,method:t,name:e.name.trim()},i={matchPageRules:this.filterRules(e.match_page_rules)};return this.privateState.isUpdating=!0,B["AjaxHelper"].post(a,i,{withTokenInUrl:!0}).then(e=>({type:"success",response:e})).catch(e=>({type:"error",message:e.message||e})).finally(()=>{this.privateState.isUpdating=!1})}}const da=new ca("Heatmap"),ma=new ca("SessionRecording"),pa="hsrmanagement";var ua=Object(s["defineComponent"])({props:{idSiteHsr:Number,breakpointMobile:Number,breakpointTablet:Number},components:{ContentBlock:B["ContentBlock"],Field:U["Field"],HsrUrlTarget:Ut,HsrTargetTest:Vt,SaveButton:U["SaveButton"]},data(){return{isDirty:!1,showAdvancedView:!1,siteHsr:{}}},created(){this.init()},watch:{idSiteHsr(e){null!==e&&this.init()}},methods:{removeAnyHsrNotification(){B["NotificationsStore"].remove(pa),B["NotificationsStore"].remove("ajaxHelper")},showNotification(e,t){const a=B["NotificationsStore"].show({message:e,context:t,id:pa,type:"transient"});setTimeout(()=>{B["NotificationsStore"].scrollToNotification(a)},200)},showErrorFieldNotProvidedNotification(e){const t=Object(B["translate"])("HeatmapSessionRecording_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init(){const{idSiteHsr:e}=this;if(this.siteHsr={},this.showAdvancedView=!1,B["Matomo"].helper.lazyScrollToContent(),this.edit&&e)da.findHsr(e).then(e=>{e&&(this.siteHsr=Object(B["clone"])(e),this.siteHsr.sample_rate=""+this.siteHsr.sample_rate,this.addInitialMatchPageRule(),this.isDirty=!1)});else if(this.create){this.siteHsr={idSite:B["Matomo"].idSite,name:"",sample_rate:"10.0",sample_limit:1e3,breakpoint_mobile:this.breakpointMobile,breakpoint_tablet:this.breakpointTablet,capture_manually:0},this.isDirty=!1;const e=B["MatomoUrl"].hashParsed.value;if(e.name&&(this.siteHsr.name=e.name,this.isDirty=!0),e.matchPageRules)try{this.siteHsr.match_page_rules=JSON.parse(e.matchPageRules),this.isDirty=!0}catch(t){console.log("warning: could not parse matchPageRules query param, expected JSON")}else this.addInitialMatchPageRule()}},addInitialMatchPageRule(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||this.addMatchPageRule())},addMatchPageRule(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||(this.siteHsr.match_page_rules=[]),this.siteHsr.match_page_rules.push({attribute:"url",type:"equals_simple",value:"",inverted:0}),this.isDirty=!0)},removeMatchPageRule(e){this.siteHsr&&e>-1&&(this.siteHsr.match_page_rules=[...this.siteHsr.match_page_rules],this.siteHsr.match_page_rules.splice(e,1),this.isDirty=!0)},cancel(){const e=Object.assign({},B["MatomoUrl"].hashParsed.value);delete e.idSiteHsr,B["MatomoUrl"].updateHash(e)},createHsr(){this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&da.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.addHeatmap").then(e=>{if(!e||"error"===e.type||!e.response)return;this.isDirty=!1;const t=e.response.value;da.reload().then(()=>{B["Matomo"].helper.isReportingPage()&&B["Matomo"].postEvent("updateReportingMenu"),B["MatomoUrl"].updateHash(Object.assign(Object.assign({},B["MatomoUrl"].hashParsed.value),{},{idSiteHsr:t})),setTimeout(()=>{this.showNotification(Object(B["translate"])("HeatmapSessionRecording_HeatmapCreated"),e.type)},200)})})},setValueHasChanged(){this.isDirty=!0},updateHsr(){this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&da.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.updateHeatmap").then(e=>{"error"!==e.type&&(this.isDirty=!1,this.siteHsr={},da.reload().then(()=>{this.init()}),this.showNotification(Object(B["translate"])("HeatmapSessionRecording_HeatmapUpdated"),e.type))})},checkRequiredFieldsAreSet(){var e;if(!this.siteHsr.name){const e=Object(B["translate"])("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}if(null===(e=this.siteHsr.match_page_rules)||void 0===e||!e.length||!da.filterRules(this.siteHsr.match_page_rules).length){const e=Object(B["translate"])("HeatmapSessionRecording_ErrorPageRuleRequired");return this.showNotification(e,"error"),!1}return!0},setMatchPageRule(e,t){this.siteHsr.match_page_rules=[...this.siteHsr.match_page_rules],this.siteHsr.match_page_rules[t]=e}},computed:{sampleLimits(){return[1e3,2e3,5e3].map(e=>({key:""+e,value:e}))},sampleRates(){const e=[.1,.5,1,2,3,4,5,6,8,10,15,20,30,40,50,60,70,80,90,100];return e.map(e=>({key:e.toFixed(1),value:e+"%"}))},create(){return!this.idSiteHsr},edit(){return!this.create},editTitle(){const e=this.create?"HeatmapSessionRecording_CreateNewHeatmap":"HeatmapSessionRecording_EditHeatmapX";return e},contentTitle(){return Object(B["translate"])(this.editTitle,this.siteHsr.name?`"${this.siteHsr.name}"`:"")},isLoading(){return da.state.value.isLoading},isUpdating(){return da.state.value.isUpdating},breakpointMobileInlineHelp(){const e=Object(B["translate"])("HeatmapSessionRecording_BreakpointGeneralHelp"),t=Object(B["translate"])("HeatmapSessionRecording_BreakpointGeneralHelpManage");return`${e} ${t}`},breakpointGeneralHelp(){const e=Object(B["translate"])("HeatmapSessionRecording_BreakpointGeneralHelp"),t=Object(B["translate"])("HeatmapSessionRecording_BreakpointGeneralHelpManage");return`${e} ${t}`},captureDomInlineHelp(){const e=this.idSiteHsr?this.idSiteHsr:"{idHeatmap}",t=`

_paq.push(['HeatmapSessionRecording::captureInitialDom', ${e}])`;return Object(B["translate"])("HeatmapSessionRecording_CaptureDomInlineHelp",t,"

","")},personalInformationNote(){const e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website";return Object(B["translate"])("HeatmapSessionRecording_PersonalInformationNote",Object(B["translate"])("HeatmapSessionRecording_Heatmap"),"","",``,"")},saveButtonText(){return this.edit?Object(B["translate"])("CoreUpdater_UpdateTitle"):Object(B["translate"])("HeatmapSessionRecording_CreateNewHeatmap")}}});ua.render=oa;var ha=ua;const ga={class:"heatmapList"},ba={class:"filterStatus"},va={class:"hsrSearchFilter",style:{"margin-left":"3.5px"}},Oa={class:"index"},ja={class:"name"},fa={class:"creationDate"},ya={class:"sampleLimit"},Sa={class:"status"},Ha={class:"action"},_a={colspan:"7"},Ea={class:"loadingPiwik"},Va=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Na={colspan:"7"},Ra=["id"],wa={class:"index"},ka={class:"name"},xa={class:"creationDate"},Ca={class:"sampleLimit"},Da={key:0,class:"status status-paused"},Ta=["title"],Ma={key:1,class:"status"},Pa=["title","onClick"],Aa=["title","onClick"],Ba=["title","href"],Ua=["title","onClick"],Fa={class:"tableActionBar"},La=Object(s["createElementVNode"])("span",{class:"icon-add"},null,-1),Ia={class:"ui-confirm",id:"confirmDeleteHeatmap",ref:"confirmDeleteHeatmap"},Wa=["value"],qa=["value"],za={class:"ui-confirm",id:"confirmEndHeatmap",ref:"confirmEndHeatmap"},$a=["value"],Ga=["value"];function Ja(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("Field"),l=Object(s["resolveComponent"])("EntityDuplicatorAction"),c=Object(s["resolveComponent"])("ContentBlock"),d=Object(s["resolveComponent"])("EntityDuplicatorModal"),m=Object(s["resolveDirective"])("content-table");return Object(s["openBlock"])(),Object(s["createElementBlock"])(s["Fragment"],null,[Object(s["createElementVNode"])("div",ga,[Object(s["createVNode"])(c,{"content-title":e.translate("HeatmapSessionRecording_ManageHeatmaps")},{default:Object(s["withCtx"])(()=>[Object(s["createElementVNode"])("p",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapUsageBenefits")),1),Object(s["createElementVNode"])("div",null,[Object(s["createElementVNode"])("div",ba,[Object(s["createVNode"])(o,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=t=>{e.setFilterStatus(t)}),title:e.translate("HeatmapSessionRecording_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(s["createElementVNode"])("div",va,[Object(s["withDirectives"])(Object(s["createVNode"])(o,{uicontrol:"text",name:"hsrSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=t=>e.searchFilter=t),"full-width":!0},null,8,["title","modelValue"]),[[s["vShow"],e.hsrs.length>0]])])]),Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("table",null,[Object(s["createElementVNode"])("thead",null,[Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("th",Oa,Object(s["toDisplayString"])(e.translate("General_Id")),1),Object(s["createElementVNode"])("th",ja,Object(s["toDisplayString"])(e.translate("General_Name")),1),Object(s["createElementVNode"])("th",fa,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_CreationDate")),1),Object(s["createElementVNode"])("th",ya,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_SampleLimit")),1),Object(s["createElementVNode"])("th",Sa,Object(s["toDisplayString"])(e.translate("CorePluginsAdmin_Status")),1),Object(s["createElementVNode"])("th",Ha,Object(s["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(s["createElementVNode"])("tbody",null,[Object(s["withDirectives"])(Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("td",_a,[Object(s["createElementVNode"])("span",Ea,[Va,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[s["vShow"],e.isLoading||e.isUpdating]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("td",Na,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_NoHeatmapsFound")),1)],512),[[s["vShow"],!e.isLoading&&0===e.hsrs.length]]),(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.sortedHsrs,t=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("tr",{id:"hsr"+t.idsitehsr,class:"hsrs",key:t.idsitehsr},[Object(s["createElementVNode"])("td",wa,Object(s["toDisplayString"])(t.idsitehsr),1),Object(s["createElementVNode"])("td",ka,Object(s["toDisplayString"])(t.name),1),Object(s["createElementVNode"])("td",xa,Object(s["toDisplayString"])(t.created_date_pretty),1),Object(s["createElementVNode"])("td",Ca,Object(s["toDisplayString"])(t.sample_limit),1),"paused"===t.status?(Object(s["openBlock"])(),Object(s["createElementBlock"])("td",Da,[Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.ucfirst(t.status))+" ",1),Object(s["createElementVNode"])("span",{class:"icon icon-help",title:e.pauseReason},null,8,Ta)])):(Object(s["openBlock"])(),Object(s["createElementBlock"])("td",Ma,Object(s["toDisplayString"])(e.ucfirst(t.status)),1)),Object(s["createElementVNode"])("td",{class:Object(s["normalizeClass"])({action:!0,"duplicate-available":e.isEntityDuplicatorAvailable})},[Object(s["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("HeatmapSessionRecording_EditX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:a=>e.editHsr(t.idsitehsr)},null,8,Pa),Object(s["withDirectives"])(Object(s["createElementVNode"])("a",{class:"table-action stopRecording icon-drop-crossed",title:e.translate("HeatmapSessionRecording_StopX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:a=>e.completeHsr(t)},null,8,Aa),[[s["vShow"],"ended"!==t.status]]),Object(s["createElementVNode"])("a",{target:"_blank",class:"table-action icon-show",title:e.translate("HeatmapSessionRecording_ViewReport"),href:e.getViewReportLink(t)},null,8,Ba),Object(s["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("HeatmapSessionRecording_DeleteX",e.translate("HeatmapSessionRecording_Heatmap")),onClick:a=>e.deleteHsr(t)},null,8,Ua),Object(s["createVNode"])(l,{actionFormData:{idSiteHsr:t.idsitehsr},modalStore:e.entityDuplicatorStore,isActionVisible:e.showDuplicatorAction,isActionEnabled:e.enableDuplicatorAction,tooltipTextOverrideDisabled:e.translate("HeatmapSessionRecording_QuotaReachedForX",e.translate("HeatmapSessionRecording_Heatmap"),e.translate("HeatmapSessionRecording_Heatmaps")),extraClasses:["heatmap-duplicate-action","hsr-"+t.idsitehsr]},null,8,["actionFormData","modalStore","isActionVisible","isActionEnabled","tooltipTextOverrideDisabled","extraClasses"])],2)],8,Ra))),128))])])),[[m]]),Object(s["createElementVNode"])("div",Fa,[Object(s["createElementVNode"])("a",{class:"createNewHsr",value:"",onClick:t[2]||(t[2]=t=>e.createHsr())},[La,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_CreateNewHeatmap")),1)])])]),_:1},8,["content-title"]),Object(s["createElementVNode"])("div",Ia,[Object(s["createElementVNode"])("h2",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteHeatmapConfirm")),1),Object(s["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Wa),Object(s["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,qa)],512),Object(s["createElementVNode"])("div",za,[Object(s["createElementVNode"])("h2",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_EndHeatmapConfirm")),1),Object(s["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,$a),Object(s["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Ga)],512)]),Object(s["createVNode"])(d,{modalStore:e.entityDuplicatorStore},null,8,["modalStore"])],64)}const Xa=Object(B["useExternalPluginComponent"])("CoreHome","EntityDuplicatorModal"),Ya=Object(B["useExternalPluginComponent"])("CoreHome","EntityDuplicatorAction");let Ka=void 0;Object(B["importPluginUmd"])("CoreHome").then(e=>{Ka=null===e||void 0===e?void 0:e.EntityDuplicatorStore});var Qa=Object(s["defineComponent"])({props:{pauseReason:String},components:{ContentBlock:B["ContentBlock"],Field:U["Field"],EntityDuplicatorModal:Xa,EntityDuplicatorAction:Ya},directives:{ContentTable:B["ContentTable"]},data(){return{searchFilter:"",showDuplicatorAction:!0,enableDuplicatorAction:!1,entityDuplicatorStore:"undefined"!==typeof Ka?Ka.buildStoreInstance("HeatmapSessionRecording_Heatmap",{method:"HeatmapSessionRecording.duplicateHeatmap",requiredFields:["idSite","idDestinationSites","idSiteHsr"]}):void 0}},created(){da.setFilterStatus(""),da.fetchHsrs()},mounted(){if(this.checkIsAddingHeatmapAllowed(),this.entityDuplicatorStore){const e=this.entityDuplicatorStore.adapter;e.onSuccessCallback=e=>new Promise(t=>{var a,i,n;const s=null===(a=e.additionalData)||void 0===a?void 0:a.idSite;return null!==(i=e.additionalData)&&void 0!==i&&i.idSite&&Array.isArray(null===(n=e.additionalData)||void 0===n?void 0:n.idDestinationSites)&&!e.additionalData.idDestinationSites.some(e=>+e===+s)?t():da.reload().then(()=>t())})}},methods:{createHsr(){this.editHsr(0)},editHsr(e){B["MatomoUrl"].updateHash(Object.assign(Object.assign({},B["MatomoUrl"].hashParsed.value),{},{idSiteHsr:e}))},deleteHsr(e){B["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteHeatmap,{yes:()=>{da.deleteHsr(e.idsitehsr).then(()=>{da.reload(),B["Matomo"].postEvent("updateReportingMenu")})}})},completeHsr(e){B["Matomo"].helper.modalConfirm(this.$refs.confirmEndHeatmap,{yes:()=>{da.completeHsr(e.idsitehsr).then(()=>{da.reload()})}})},setFilterStatus(e){da.setFilterStatus(e)},ucfirst(e){return`${e[0].toUpperCase()}${e.substr(1)}`},getViewReportLink(e){return"?"+B["MatomoUrl"].stringify({module:"Widgetize",action:"iframe",moduleToWidgetize:"HeatmapSessionRecording",actionToWidgetize:"showHeatmap",idSiteHsr:e.idsitehsr,idSite:e.idsite,period:"day",date:"yesterday"})},checkIsAddingHeatmapAllowed(){const e={isAllowed:!0};return B["Matomo"].postEvent("HeatmapSessionRecording.initAddHeatmap",e),this.enableDuplicatorAction=e&&!0===e.isAllowed,!this.enableDuplicatorAction}},computed:{filterStatus(){return da.state.value.filterStatus},statusOptions(){return da.statusOptions},hsrs(){return da.hsrs.value},isLoading(){return da.state.value.isLoading},isUpdating(){return da.state.value.isUpdating},sortedHsrs(){const e=[...this.hsrs].filter(e=>Object.keys(e).some(t=>{const a=e;return"string"===typeof a[t]&&-1!==a[t].indexOf(this.searchFilter)}));return e.sort((e,t)=>t.idsitehsr-e.idsitehsr),e},isEntityDuplicatorAvailable(){return"undefined"!==typeof Ka}}});Qa.render=Ja;var Za=Qa;const ei={class:"manageHsr",ref:"root"},ti={key:0},ai={key:1};function ii(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("MatomoJsNotWritableAlert"),l=Object(s["resolveComponent"])("HeatmapList"),c=Object(s["resolveComponent"])("HeatmapEdit");return Object(s["openBlock"])(),Object(s["createElementBlock"])(s["Fragment"],null,[e.editMode?Object(s["createCommentVNode"])("",!0):(Object(s["openBlock"])(),Object(s["createBlock"])(o,{key:0,"is-matomo-js-writable":e.isMatomoJsWritable,"recording-type":e.translate("HeatmapSessionRecording_Heatmaps")},null,8,["is-matomo-js-writable","recording-type"])),Object(s["createElementVNode"])("div",ei,[e.editMode?Object(s["createCommentVNode"])("",!0):(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",ti,[Object(s["createVNode"])(l,{"pause-reason":e.pauseReason},null,8,["pause-reason"])])),e.editMode?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",ai,[Object(s["createVNode"])(c,{"breakpoint-mobile":e.breakpointMobile,"breakpoint-tablet":e.breakpointTablet,"id-site-hsr":e.idSiteHsr},null,8,["breakpoint-mobile","breakpoint-tablet","id-site-hsr"])])):Object(s["createCommentVNode"])("",!0)],512)],64)}const ni=["innerHTML"];function si(e,t,a,i,n,r){return e.isMatomoJsWritable?Object(s["createCommentVNode"])("",!0):(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{key:0,class:"alert alert-warning",innerHTML:e.getJsNotWritableErrorMessage()},null,8,ni))}var ri=Object(s["defineComponent"])({props:{recordingType:{type:String,required:!0},isMatomoJsWritable:{type:Boolean,required:!0}},methods:{getJsNotWritableErrorMessage(){return Object(B["translate"])("HeatmapSessionRecording_MatomoJSNotWritableErrorMessage",this.recordingType,'',"")}}});ri.render=si;var oi=ri;const{$:li}=window;var ci=Object(s["defineComponent"])({props:{breakpointMobile:Number,breakpointTablet:Number,pauseReason:String,isMatomoJsWritable:{type:Boolean,required:!0}},data(){return{editMode:!1,idSiteHsr:null}},components:{MatomoJsNotWritableAlert:oi,HeatmapList:Za,HeatmapEdit:ha},watch:{editMode(){li(".ui-tooltip").remove()}},created(){Object(s["watch"])(()=>B["MatomoUrl"].hashParsed.value.idSiteHsr,e=>{this.initState(e)}),this.initState(B["MatomoUrl"].hashParsed.value.idSiteHsr)},methods:{removeAnyHsrNotification(){B["NotificationsStore"].remove("hsrmanagement")},initState(e){if(e){if("0"===e){const e={isAllowed:!0};if(B["Matomo"].postEvent("HeatmapSessionRecording.initAddHeatmap",e),e&&!e.isAllowed)return this.editMode=!1,void(this.idSiteHsr=null)}this.editMode=!0,this.idSiteHsr=parseInt(e,10)}else this.editMode=!1,this.idSiteHsr=null;this.removeAnyHsrNotification()}}});ci.render=ii;var di=ci;const mi={class:"loadingPiwik"},pi=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),ui={class:"loadingPiwik"},hi=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),gi={name:"name"},bi={name:"sampleLimit"},vi={class:"form-group row"},Oi={class:"col s12"},ji={class:"col s12 m6",style:{"padding-left":"0"}},fi=Object(s["createElementVNode"])("hr",null,null,-1),yi={class:"col s12 m6"},Si={class:"form-help"},Hi={class:"inline-help"},_i={name:"sampleRate"},Ei={name:"minSessionTime"},Vi={name:"requiresActivity"},Ni={class:"inline-help-node"},Ri=["innerHTML"],wi=["innerHTML"],ki={class:"entityCancel"};function xi(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("Field"),l=Object(s["resolveComponent"])("HsrUrlTarget"),c=Object(s["resolveComponent"])("HsrTargetTest"),d=Object(s["resolveComponent"])("SaveButton"),m=Object(s["resolveComponent"])("ContentBlock");return Object(s["openBlock"])(),Object(s["createBlock"])(m,{class:"editHsr","content-title":e.contentTitle},{default:Object(s["withCtx"])(()=>[Object(s["withDirectives"])(Object(s["createElementVNode"])("p",null,[Object(s["createElementVNode"])("span",mi,[pi,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("General_LoadingData")),1)])],512),[[s["vShow"],e.isLoading]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("p",null,[Object(s["createElementVNode"])("span",ui,[hi,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_UpdatingData")),1)])],512),[[s["vShow"],e.isUpdating]]),Object(s["createElementVNode"])("form",{onSubmit:t[10]||(t[10]=t=>e.edit?e.updateHsr():e.createHsr())},[Object(s["createElementVNode"])("div",null,[Object(s["createElementVNode"])("div",gi,[Object(s["createVNode"])(o,{uicontrol:"text",name:"name","model-value":e.siteHsr.name,"onUpdate:modelValue":t[0]||(t[0]=t=>{e.siteHsr.name=t,e.setValueHasChanged()}),title:e.translate("General_Name"),maxlength:50,placeholder:e.translate("HeatmapSessionRecording_FieldNamePlaceholder"),"inline-help":e.translate("HeatmapSessionRecording_SessionNameHelp")},null,8,["model-value","title","placeholder","inline-help"])]),Object(s["createElementVNode"])("div",bi,[Object(s["createVNode"])(o,{uicontrol:"select",name:"sampleLimit","model-value":e.siteHsr.sample_limit,"onUpdate:modelValue":t[1]||(t[1]=t=>{e.siteHsr.sample_limit=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SessionSampleLimit"),options:e.sampleLimits,"inline-help":e.translate("HeatmapSessionRecording_SessionSampleLimitHelp")},null,8,["model-value","title","options","inline-help"])]),Object(s["createElementVNode"])("div",vi,[Object(s["createElementVNode"])("div",Oi,[Object(s["createElementVNode"])("h3",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_TargetPages"))+":",1)]),Object(s["createElementVNode"])("div",ji,[(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.siteHsr.match_page_rules,(a,i)=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",{class:Object(s["normalizeClass"])(`matchPageRules ${i} multiple`),key:i},[Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(l,{"model-value":a,"onUpdate:modelValue":t=>e.setMatchPageRule(t,i),onAddUrl:t[2]||(t[2]=t=>e.addMatchPageRule()),onRemoveUrl:t=>e.removeMatchPageRule(i),onAnyChange:t[3]||(t[3]=t=>e.setValueHasChanged()),"allow-any":!0,"disable-if-no-value":i>0,"can-be-removed":i>0,"show-add-url":!0},null,8,["model-value","onUpdate:modelValue","onRemoveUrl","disable-if-no-value","can-be-removed"])]),fi],2))),128))]),Object(s["createElementVNode"])("div",yi,[Object(s["createElementVNode"])("div",Si,[Object(s["createElementVNode"])("span",Hi,[Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_FieldIncludedTargetsHelpSessions"))+" ",1),Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(c,{"included-targets":e.siteHsr.match_page_rules},null,8,["included-targets"])])])])])]),Object(s["createElementVNode"])("div",_i,[Object(s["createVNode"])(o,{uicontrol:"select",name:"sampleRate","model-value":e.siteHsr.sample_rate,"onUpdate:modelValue":t[4]||(t[4]=t=>{e.siteHsr.sample_rate=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_SampleRate"),options:e.sampleRates,introduction:e.translate("HeatmapSessionRecording_AdvancedOptions"),"inline-help":e.translate("HeatmapSessionRecording_SessionSampleRateHelp")},null,8,["model-value","title","options","introduction","inline-help"])]),Object(s["createElementVNode"])("div",Ei,[Object(s["createVNode"])(o,{uicontrol:"select",name:"minSessionTime","model-value":e.siteHsr.min_session_time,"onUpdate:modelValue":t[5]||(t[5]=t=>{e.siteHsr.min_session_time=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_MinSessionTime"),options:e.minSessionTimes,"inline-help":e.translate("HeatmapSessionRecording_MinSessionTimeHelp")},null,8,["model-value","title","options","inline-help"])]),Object(s["createElementVNode"])("div",Vi,[Object(s["createVNode"])(o,{uicontrol:"checkbox",name:"requiresActivity","model-value":e.siteHsr.requires_activity,"onUpdate:modelValue":t[6]||(t[6]=t=>{e.siteHsr.requires_activity=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_RequiresActivity"),"inline-help":e.translate("HeatmapSessionRecording_RequiresActivityHelp")},null,8,["model-value","title","inline-help"])]),Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(o,{uicontrol:"checkbox",name:"captureKeystrokes","model-value":e.siteHsr.capture_keystrokes,"onUpdate:modelValue":t[7]||(t[7]=t=>{e.siteHsr.capture_keystrokes=t,e.setValueHasChanged()}),title:e.translate("HeatmapSessionRecording_CaptureKeystrokes")},{"inline-help":Object(s["withCtx"])(()=>[Object(s["createElementVNode"])("div",Ni,[Object(s["createElementVNode"])("span",{innerHTML:e.$sanitize(e.captureKeystrokesHelp)},null,8,Ri)])]),_:1},8,["model-value","title"])]),Object(s["createElementVNode"])("p",{innerHTML:e.$sanitize(e.personalInformationNote)},null,8,wi),Object(s["createVNode"])(d,{class:"createButton",onConfirm:t[8]||(t[8]=t=>e.edit?e.updateHsr():e.createHsr()),disabled:e.isUpdating||!e.isDirty,saving:e.isUpdating,value:e.saveButtonText},null,8,["disabled","saving","value"]),Object(s["createElementVNode"])("div",ki,[Object(s["createElementVNode"])("a",{onClick:t[9]||(t[9]=t=>e.cancel())},Object(s["toDisplayString"])(e.translate("General_Cancel")),1)])])],32)]),_:1},8,["content-title"])}const Ci="hsrmanagement";var Di=Object(s["defineComponent"])({props:{idSiteHsr:Number},components:{ContentBlock:B["ContentBlock"],Field:U["Field"],HsrUrlTarget:Ut,HsrTargetTest:Vt,SaveButton:U["SaveButton"]},data(){return{isDirty:!1,showAdvancedView:!1,sampleLimits:[],siteHsr:{}}},created(){B["AjaxHelper"].fetch({method:"HeatmapSessionRecording.getAvailableSessionRecordingSampleLimits"}).then(e=>{this.sampleLimits=(e||[]).map(e=>({key:""+e,value:e}))}),this.init()},watch:{idSiteHsr(e){null!==e&&this.init()}},methods:{removeAnyHsrNotification(){B["NotificationsStore"].remove(Ci),B["NotificationsStore"].remove("ajaxHelper")},showNotification(e,t){const a=B["NotificationsStore"].show({message:e,context:t,id:Ci,type:"transient"});setTimeout(()=>{B["NotificationsStore"].scrollToNotification(a)},200)},showErrorFieldNotProvidedNotification(e){const t=Object(B["translate"])("HeatmapSessionRecording_ErrorXNotProvided",[e]);this.showNotification(t,"error")},init(){const{idSiteHsr:e}=this;this.siteHsr={},this.showAdvancedView=!1,B["Matomo"].helper.lazyScrollToContent(),this.edit&&e?ma.findHsr(e).then(e=>{e&&(this.siteHsr=Object(B["clone"])(e),this.siteHsr.sample_rate=""+this.siteHsr.sample_rate,this.addInitialMatchPageRule(),this.isDirty=!1)}):this.create&&(this.siteHsr={idSite:B["Matomo"].idSite,name:"",sample_rate:"10.0",sample_limit:250,min_session_time:0,requires_activity:!0,capture_keystrokes:!1},this.addInitialMatchPageRule(),this.isDirty=!1)},addInitialMatchPageRule(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||(this.siteHsr.match_page_rules=[{attribute:"url",type:"any",value:"",inverted:0}]))},addMatchPageRule(){var e;this.siteHsr&&(null!==(e=this.siteHsr.match_page_rules)&&void 0!==e&&e.length||(this.siteHsr.match_page_rules=[]),this.siteHsr.match_page_rules.push({attribute:"url",type:"equals_simple",value:"",inverted:0}),this.isDirty=!0)},removeMatchPageRule(e){this.siteHsr&&e>-1&&(this.siteHsr.match_page_rules=[...this.siteHsr.match_page_rules],this.siteHsr.match_page_rules.splice(e,1),this.isDirty=!0)},cancel(){const e=Object.assign({},B["MatomoUrl"].hashParsed.value);delete e.idSiteHsr,B["MatomoUrl"].updateHash(e)},createHsr(){this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&ma.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.addSessionRecording").then(e=>{if(!e||"error"===e.type||!e.response)return;this.isDirty=!1;const t=e.response.value;ma.reload().then(()=>{B["Matomo"].helper.isReportingPage()&&B["Matomo"].postEvent("updateReportingMenu"),B["MatomoUrl"].updateHash(Object.assign(Object.assign({},B["MatomoUrl"].hashParsed.value),{},{idSiteHsr:t})),setTimeout(()=>{this.showNotification(Object(B["translate"])("HeatmapSessionRecording_SessionRecordingCreated"),e.type)},200)})})},setValueHasChanged(){this.isDirty=!0},updateHsr(){this.removeAnyHsrNotification(),this.checkRequiredFieldsAreSet()&&ma.createOrUpdateHsr(this.siteHsr,"HeatmapSessionRecording.updateSessionRecording").then(e=>{"error"!==e.type&&(this.isDirty=!1,this.siteHsr={},ma.reload().then(()=>{this.init()}),this.showNotification(Object(B["translate"])("HeatmapSessionRecording_SessionRecordingUpdated"),e.type))})},checkRequiredFieldsAreSet(){var e;if(!this.siteHsr.name){const e=this.translate("General_Name");return this.showErrorFieldNotProvidedNotification(e),!1}if(null===(e=this.siteHsr.match_page_rules)||void 0===e||!e.length||!ma.filterRules(this.siteHsr.match_page_rules).length){const e=this.translate("HeatmapSessionRecording_ErrorPageRuleRequired");return this.showNotification(e,"error"),!1}return!0},setMatchPageRule(e,t){this.siteHsr.match_page_rules=[...this.siteHsr.match_page_rules],this.siteHsr.match_page_rules[t]=e}},computed:{minSessionTimes(){return[0,5,10,15,20,30,45,60,90,120].map(e=>({key:""+e,value:e+" seconds"}))},sampleRates(){const e=[.1,.5,1,2,3,4,5,6,8,10,15,20,30,40,50,60,70,80,90,100];return e.map(e=>({key:""+e.toFixed(1),value:e+"%"}))},create(){return!this.idSiteHsr},edit(){return!this.create},editTitle(){const e=this.create?"HeatmapSessionRecording_CreateNewSessionRecording":"HeatmapSessionRecording_EditSessionRecordingX";return e},contentTitle(){return Object(B["translate"])(this.editTitle,this.siteHsr.name?`"${this.siteHsr.name}"`:"")},isLoading(){return da.state.value.isLoading},isUpdating(){return da.state.value.isUpdating},captureKeystrokesHelp(){const e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-keystrokes-in-form-fields";return Object(B["translate"])("HeatmapSessionRecording_CaptureKeystrokesHelp",``,"")},personalInformationNote(){const e="https://developer.matomo.org/guides/heatmap-session-recording/setup#masking-content-on-your-website";return Object(B["translate"])("HeatmapSessionRecording_PersonalInformationNote",Object(B["translate"])("HeatmapSessionRecording_SessionRecording"),"","",``,"")},saveButtonText(){return this.edit?Object(B["translate"])("CoreUpdater_UpdateTitle"):Object(B["translate"])("HeatmapSessionRecording_CreateNewSessionRecording")}}});Di.render=xi;var Ti=Di;const Mi={class:"sessionRecordingList"},Pi={class:"filterStatus"},Ai={class:"hsrSearchFilter",style:{"margin-left":"3.5px"}},Bi={class:"index"},Ui={class:"name"},Fi={class:"creationDate"},Li={class:"sampleLimit"},Ii={class:"status"},Wi={class:"action"},qi={colspan:"7"},zi={class:"loadingPiwik"},$i=Object(s["createElementVNode"])("img",{src:"plugins/Morpheus/images/loading-blue.gif"},null,-1),Gi={colspan:"7"},Ji=["id"],Xi={class:"index"},Yi={class:"name"},Ki={class:"creationDate"},Qi={class:"sampleLimit"},Zi={key:0,class:"status status-paused"},en=["title"],tn={key:1,class:"status"},an={class:"action"},nn=["title","onClick"],sn=["title","onClick"],rn=["title","href"],on=["title","onClick"],ln={class:"tableActionBar"},cn=Object(s["createElementVNode"])("span",{class:"icon-add"},null,-1),dn={class:"ui-confirm",ref:"confirmDeleteSessionRecording"},mn=["value"],pn=["value"],un={class:"ui-confirm",ref:"confirmEndSessionRecording"},hn=["value"],gn=["value"];function bn(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("Field"),l=Object(s["resolveComponent"])("ContentBlock"),c=Object(s["resolveDirective"])("content-table");return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Mi,[Object(s["createVNode"])(l,{"content-title":e.translate("HeatmapSessionRecording_ManageSessionRecordings")},{default:Object(s["withCtx"])(()=>[Object(s["createElementVNode"])("p",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_SessionRecordingsUsageBenefits")),1),Object(s["createElementVNode"])("div",null,[Object(s["createElementVNode"])("div",Pi,[Object(s["createVNode"])(o,{uicontrol:"select",name:"filterStatus","model-value":e.filterStatus,"onUpdate:modelValue":t[0]||(t[0]=t=>{e.setFilterStatus(t)}),title:e.translate("HeatmapSessionRecording_Filter"),"full-width":!0,options:e.statusOptions},null,8,["model-value","title","options"])]),Object(s["createElementVNode"])("div",Ai,[Object(s["withDirectives"])(Object(s["createVNode"])(o,{uicontrol:"text",name:"hsrSearch",title:e.translate("General_Search"),modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=t=>e.searchFilter=t),"full-width":!0},null,8,["title","modelValue"]),[[s["vShow"],e.hsrs.length>0]])])]),Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("table",null,[Object(s["createElementVNode"])("thead",null,[Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("th",Bi,Object(s["toDisplayString"])(e.translate("General_Id")),1),Object(s["createElementVNode"])("th",Ui,Object(s["toDisplayString"])(e.translate("General_Name")),1),Object(s["createElementVNode"])("th",Fi,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_CreationDate")),1),Object(s["createElementVNode"])("th",Li,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_SampleLimit")),1),Object(s["createElementVNode"])("th",Ii,Object(s["toDisplayString"])(e.translate("CorePluginsAdmin_Status")),1),Object(s["createElementVNode"])("th",Wi,Object(s["toDisplayString"])(e.translate("General_Actions")),1)])]),Object(s["createElementVNode"])("tbody",null,[Object(s["withDirectives"])(Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("td",qi,[Object(s["createElementVNode"])("span",zi,[$i,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("General_LoadingData")),1)])])],512),[[s["vShow"],e.isLoading||e.isUpdating]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("td",Gi,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_NoSessionRecordingsFound")),1)],512),[[s["vShow"],!e.isLoading&&0==e.hsrs.length]]),(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.sortedHsrs,t=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("tr",{id:"hsr"+t.idsitehsr,class:"hsrs",key:t.idsitehsr},[Object(s["createElementVNode"])("td",Xi,Object(s["toDisplayString"])(t.idsitehsr),1),Object(s["createElementVNode"])("td",Yi,Object(s["toDisplayString"])(t.name),1),Object(s["createElementVNode"])("td",Ki,Object(s["toDisplayString"])(t.created_date_pretty),1),Object(s["createElementVNode"])("td",Qi,Object(s["toDisplayString"])(t.sample_limit),1),"paused"===t.status?(Object(s["openBlock"])(),Object(s["createElementBlock"])("td",Zi,[Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.ucfirst(t.status))+" ",1),Object(s["createElementVNode"])("span",{class:"icon icon-help",title:e.pauseReason},null,8,en)])):(Object(s["openBlock"])(),Object(s["createElementBlock"])("td",tn,Object(s["toDisplayString"])(e.ucfirst(t.status)),1)),Object(s["createElementVNode"])("td",an,[Object(s["createElementVNode"])("a",{class:"table-action icon-edit",title:e.translate("HeatmapSessionRecording_EditX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:a=>e.editHsr(t.idsitehsr)},null,8,nn),Object(s["withDirectives"])(Object(s["createElementVNode"])("a",{class:"table-action stopRecording icon-drop-crossed",title:e.translate("HeatmapSessionRecording_StopX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:a=>e.completeHsr(t)},null,8,sn),[[s["vShow"],"ended"!==t.status]]),Object(s["createElementVNode"])("a",{class:"table-action icon-show",title:e.translate("HeatmapSessionRecording_ViewReport"),href:e.getViewReportLink(t),target:"_blank"},null,8,rn),Object(s["createElementVNode"])("a",{class:"table-action icon-delete",title:e.translate("HeatmapSessionRecording_DeleteX",e.translate("HeatmapSessionRecording_SessionRecording")),onClick:a=>e.deleteHsr(t)},null,8,on)])],8,Ji))),128))])])),[[c]]),Object(s["createElementVNode"])("div",ln,[Object(s["createElementVNode"])("a",{class:"createNewHsr",value:"",onClick:t[2]||(t[2]=t=>e.createHsr())},[cn,Object(s["createTextVNode"])(" "+Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_CreateNewSessionRecording")),1)])])]),_:1},8,["content-title"]),Object(s["createElementVNode"])("div",dn,[Object(s["createElementVNode"])("h2",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_DeleteSessionRecordingConfirm")),1),Object(s["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,mn),Object(s["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,pn)],512),Object(s["createElementVNode"])("div",un,[Object(s["createElementVNode"])("h2",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_EndSessionRecordingConfirm")),1),Object(s["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,hn),Object(s["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,gn)],512)])}var vn=Object(s["defineComponent"])({props:{pauseReason:String},components:{ContentBlock:B["ContentBlock"],Field:U["Field"]},directives:{ContentTable:B["ContentTable"]},data(){return{searchFilter:""}},created(){ma.setFilterStatus(""),ma.fetchHsrs()},methods:{createHsr(){this.editHsr(0)},editHsr(e){B["MatomoUrl"].updateHash(Object.assign(Object.assign({},B["MatomoUrl"].hashParsed.value),{},{idSiteHsr:e}))},deleteHsr(e){B["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteSessionRecording,{yes:()=>{ma.deleteHsr(e.idsitehsr).then(()=>{ma.reload(),B["Matomo"].postEvent("updateReportingMenu")})}})},completeHsr(e){B["Matomo"].helper.modalConfirm(this.$refs.confirmEndSessionRecording,{yes:()=>{ma.completeHsr(e.idsitehsr).then(()=>{ma.reload()})}})},setFilterStatus(e){ma.setFilterStatus(e)},ucfirst(e){return`${e[0].toUpperCase()}${e.substr(1)}`},getViewReportLink(e){return`?${B["MatomoUrl"].stringify({module:"CoreHome",action:"index",idSite:e.idsite,period:"day",date:"yesterday"})}#?${B["MatomoUrl"].stringify({category:"HeatmapSessionRecording_SessionRecordings",idSite:e.idsite,period:"day",date:"yesterday",subcategory:e.idsitehsr})}`}},computed:{filterStatus(){return ma.state.value.filterStatus},statusOptions(){return ma.statusOptions},hsrs(){return ma.hsrs.value},isLoading(){return ma.state.value.isLoading},isUpdating(){return ma.state.value.isUpdating},sortedHsrs(){const e=[...this.hsrs].filter(e=>Object.keys(e).some(t=>{const a=e;return"string"===typeof a[t]&&-1!==a[t].indexOf(this.searchFilter)}));return e.sort((e,t)=>t.idsitehsr-e.idsitehsr),e}}});vn.render=bn;var On=vn;const jn={class:"manageHsr"};function fn(e,t,a,i,n,r){const o=Object(s["resolveComponent"])("MatomoJsNotWritableAlert"),l=Object(s["resolveComponent"])("SessionRecordingList"),c=Object(s["resolveComponent"])("SessionRecordingEdit");return Object(s["openBlock"])(),Object(s["createElementBlock"])(s["Fragment"],null,[e.editMode?Object(s["createCommentVNode"])("",!0):(Object(s["openBlock"])(),Object(s["createBlock"])(o,{key:0,"is-matomo-js-writable":e.isMatomoJsWritable,"recording-type":e.translate("HeatmapSessionRecording_SessionRecordings")},null,8,["is-matomo-js-writable","recording-type"])),Object(s["createElementVNode"])("div",jn,[Object(s["withDirectives"])(Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(l,{"pause-reason":e.pauseReason},null,8,["pause-reason"])],512),[[s["vShow"],!e.editMode]]),Object(s["withDirectives"])(Object(s["createElementVNode"])("div",null,[Object(s["createVNode"])(c,{"id-site-hsr":e.idSiteHsr},null,8,["id-site-hsr"])],512),[[s["vShow"],e.editMode]])])],64)}var yn=Object(s["defineComponent"])({props:{pauseReason:String,isMatomoJsWritable:{type:Boolean,required:!0}},data(){return{editMode:!1,idSiteHsr:null}},components:{MatomoJsNotWritableAlert:oi,SessionRecordingEdit:Ti,SessionRecordingList:On},created(){Object(s["watch"])(()=>B["MatomoUrl"].hashParsed.value.idSiteHsr,e=>{this.initState(e)}),this.initState(B["MatomoUrl"].hashParsed.value.idSiteHsr)},methods:{removeAnyHsrNotification(){B["NotificationsStore"].remove("hsrmanagement")},initState(e){if(e){if("0"===e){const e={isAllowed:!0};if(B["Matomo"].postEvent("HeatmapSessionRecording.initAddSessionRecording",e),e&&!e.isAllowed)return this.editMode=!1,void(this.idSiteHsr=null)}this.editMode=!0,this.idSiteHsr=parseInt(e,10)}else this.editMode=!1,this.idSiteHsr=null;this.removeAnyHsrNotification()}}});yn.render=fn;var Sn=yn;const Hn={class:"ui-confirm",id:"listOfPageviews"},_n=Object(s["createElementVNode"])("br",null,null,-1),En=Object(s["createElementVNode"])("br",null,null,-1),Vn=["onClick"],Nn=["title"],Rn=["value"];function wn(e,t,a,i,n,r){const o=Object(s["resolveDirective"])("content-table");return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Hn,[Object(s["createElementVNode"])("h2",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_PageviewsInVisit")),1),_n,En,Object(s["withDirectives"])((Object(s["openBlock"])(),Object(s["createElementBlock"])("table",null,[Object(s["createElementVNode"])("thead",null,[Object(s["createElementVNode"])("tr",null,[Object(s["createElementVNode"])("th",null,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_ColumnTime")),1),Object(s["createElementVNode"])("th",null,Object(s["toDisplayString"])(e.translate("General_TimeOnPage")),1),Object(s["createElementVNode"])("th",null,Object(s["toDisplayString"])(e.translate("Goals_URL")),1)])]),Object(s["createElementVNode"])("tbody",null,[(Object(s["openBlock"])(!0),Object(s["createElementBlock"])(s["Fragment"],null,Object(s["renderList"])(e.pageviews,t=>(Object(s["openBlock"])(),Object(s["createElementBlock"])("tr",{key:t.idloghsr,class:Object(s["normalizeClass"])({inactive:t.idloghsr!==e.idLogHsr}),onClick:a=>e.onClickPageView(t)},[Object(s["createElementVNode"])("td",null,Object(s["toDisplayString"])(t.server_time_pretty),1),Object(s["createElementVNode"])("td",null,Object(s["toDisplayString"])(t.time_on_page_pretty),1),Object(s["createElementVNode"])("td",{title:t.label},Object(s["toDisplayString"])((t.label||"").substr(0,50)),9,Nn)],10,Vn))),128))])])),[[o]]),Object(s["createElementVNode"])("input",{role:"close",type:"button",value:e.translate("General_Close")},null,8,Rn)])}var kn=Object(s["defineComponent"])({props:{pageviews:{type:Array,required:!0},idLogHsr:{type:Number,required:!0}},directives:{ContentTable:B["ContentTable"]},methods:{onClickPageView(e){e.idloghsr!==this.idLogHsr&&B["MatomoUrl"].updateUrl(Object.assign(Object.assign({},B["MatomoUrl"].urlParsed.value),{},{idLogHsr:e.idloghsr}),B["MatomoUrl"].hashParsed.value.length?Object.assign(Object.assign({},B["MatomoUrl"].hashParsed.value),{},{idLogHsr:e.idloghsr}):void 0)}}});kn.render=wn;var xn=kn;const Cn={class:"heatmap-vis-title"},Dn={key:0,class:"alert alert-info heatmap-country-alert"},Tn={key:1},Mn={key:2},Pn=["innerHTML"],An={class:"alert alert-info"},Bn={key:3},Un={class:"alert alert-info"};function Fn(e,t,a,i,n,r){var o;const l=Object(s["resolveComponent"])("EnrichedHeadline"),c=Object(s["resolveComponent"])("MatomoJsNotWritableAlert"),d=Object(s["resolveComponent"])("HeatmapVis"),m=Object(s["resolveComponent"])("ContentBlock");return Object(s["openBlock"])(),Object(s["createElementBlock"])("div",null,[Object(s["createElementVNode"])("h2",Cn,[Object(s["createVNode"])(l,{"edit-url":e.editUrl,"inline-help":e.inlineHelp},{default:Object(s["withCtx"])(()=>[Object(s["createTextVNode"])(Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapX",`"${e.heatmap.name}"`)),1)]),_:1},8,["edit-url","inline-help"])]),Object(s["createVNode"])(c,{"is-matomo-js-writable":e.isMatomoJsWritable,"recording-type":e.translate("HeatmapSessionRecording_Heatmaps")},null,8,["is-matomo-js-writable","recording-type"]),e.includedCountries?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Dn,Object(s["toDisplayString"])(e.translate("HeatmapSessionRecording_HeatmapInfoTrackVisitsFromCountries",e.includedCountries)),1)):Object(s["createCommentVNode"])("",!0),e.heatmap.page_treemirror?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Tn,[Object(s["createVNode"])(d,{"created-date":e.createdDate,"excluded-elements":e.heatmap.excluded_elements,"num-samples":e.heatmapMetadata,url:e.heatmap.screenshot_url,"heatmap-date":e.heatmapDate,"heatmap-period":e.heatmapPeriod,"offset-accuracy":e.offsetAccuracy,"breakpoint-tablet":e.heatmap.breakpoint_tablet,"breakpoint-mobile":e.heatmap.breakpoint_mobile,"heatmap-types":e.heatmapTypes,"device-types":e.deviceTypes,"id-site-hsr":e.idSiteHsr,"is-active":e.isActive,"desktop-preview-size":e.desktopPreviewSize,"iframe-resolutions-values":e.iframeResolutions},null,8,["created-date","excluded-elements","num-samples","url","heatmap-date","heatmap-period","offset-accuracy","breakpoint-tablet","breakpoint-mobile","heatmap-types","device-types","id-site-hsr","is-active","desktop-preview-size","iframe-resolutions-values"])])):null!==(o=e.heatmapMetadata)&&void 0!==o&&o.nb_samples_device_all?(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Bn,[Object(s["createVNode"])(m,null,{default:Object(s["withCtx"])(()=>[Object(s["createElementVNode"])("div",Un,Object(s["toDisplayString"])(e.noHeatmapScreenshotRecordedYetText),1)]),_:1})])):(Object(s["openBlock"])(),Object(s["createElementBlock"])("div",Mn,[Object(s["createElementVNode"])("p",{innerHTML:e.$sanitize(e.recordedSamplesTroubleShoot)},null,8,Pn),Object(s["createVNode"])(m,null,{default:Object(s["withCtx"])(()=>[Object(s["createElementVNode"])("div",An,Object(s["toDisplayString"])(e.translate(e.noDataMessageKey)),1)]),_:1})]))])}var Ln=Object(s["defineComponent"])({props:{idSiteHsr:{type:Number,required:!0},heatmap:{type:Object,required:!0},heatmapMetadata:{type:Object,required:!0},deviceTypes:{type:Array,required:!0},heatmapTypes:{type:Array,required:!0},offsetAccuracy:{type:Number,required:!0},heatmapPeriod:{type:String,required:!0},heatmapDate:{type:String,required:!0},isActive:Boolean,createdDate:{type:String,required:!0},editUrl:{type:String,required:!0},inlineHelp:{type:String,required:!0},includedCountries:{type:String,required:!0},desktopPreviewSize:{type:Number,required:!0},iframeResolutions:{type:Object,required:!0},noDataMessageKey:{type:String,required:!0},isMatomoJsWritable:{type:Boolean,required:!0}},components:{MatomoJsNotWritableAlert:oi,ContentBlock:B["ContentBlock"],HeatmapVis:oe,EnrichedHeadline:B["EnrichedHeadline"]},computed:{noHeatmapScreenshotRecordedYetText(){return Object(B["translate"])("HeatmapSessionRecording_NoHeatmapScreenshotRecordedYet",this.heatmapMetadata.nb_samples_device_all,Object(B["translate"])("HeatmapSessionRecording_ScreenshotUrl"))},recordedSamplesTroubleShoot(){const e=Object(B["externalLink"])("https://matomo.org/faq/heatmap-session-recording/troubleshooting-heatmaps/");return Object(B["translate"])("HeatmapSessionRecording_HeatmapTroubleshoot",e,"")}},created(){B["Matomo"].postEvent("hidePeriodSelector")}});Ln.render=Fn;var In=Ln; +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */}})})); +//# sourceMappingURL=HeatmapSessionRecording.umd.min.js.map \ No newline at end of file diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/dist/umd.metadata.json b/files/plugin-HeatmapSessionRecording-5.2.6/vue/dist/umd.metadata.json similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/dist/umd.metadata.json rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/dist/umd.metadata.json diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVis.less b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVis.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVis.less rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVis.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVis.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVis.vue similarity index 99% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVis.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVis.vue index 37682f9..c184f59 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVis.vue +++ b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVis.vue @@ -1058,7 +1058,7 @@ export default defineComponent({ `${this.actualNumSamples.nb_samples_device_all}`, this.createdDate, ); - const linkString = externalLink('https://matomo.org/subcategory/troubleshoot-7/'); + const linkString = externalLink('https://matomo.org/faq/heatmap-session-recording/troubleshooting-heatmaps/'); const string2 = translate( 'HeatmapSessionRecording_HeatmapTroubleshoot', linkString, diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVisPage.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVisPage.vue similarity index 92% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVisPage.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVisPage.vue index 6df2287..b22ddb6 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HeatmapVis/HeatmapVisPage.vue +++ b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HeatmapVis/HeatmapVisPage.vue @@ -54,6 +54,8 @@ >
+

+

{{ translate(noDataMessageKey) }} @@ -77,6 +79,7 @@ import { EnrichedHeadline, Matomo, translate, + externalLink, } from 'CoreHome'; import HeatmapVis from './HeatmapVis.vue'; import { HeatmapMetadata } from '../types'; @@ -164,6 +167,14 @@ export default defineComponent({ translate('HeatmapSessionRecording_ScreenshotUrl'), ); }, + recordedSamplesTroubleShoot() { + const linkString = externalLink('https://matomo.org/faq/heatmap-session-recording/troubleshooting-heatmaps/'); + return translate( + 'HeatmapSessionRecording_HeatmapTroubleshoot', + linkString, + '', + ); + }, }, created() { // We want the selector hidden for heatmaps. diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrStore/HsrStore.store.ts b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrStore/HsrStore.store.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrStore/HsrStore.store.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrStore/HsrStore.store.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrTargetTest/HsrTargetTest.less b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrTargetTest/HsrTargetTest.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrTargetTest/HsrTargetTest.less rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrTargetTest/HsrTargetTest.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrTargetTest/HsrTargetTest.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrTargetTest/HsrTargetTest.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrTargetTest/HsrTargetTest.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrTargetTest/HsrTargetTest.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrUrlTarget/AvailableTargetPageRules.store.ts b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrUrlTarget/AvailableTargetPageRules.store.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrUrlTarget/AvailableTargetPageRules.store.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrUrlTarget/AvailableTargetPageRules.store.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrUrlTarget/HsrUrlTarget.less b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrUrlTarget/HsrUrlTarget.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrUrlTarget/HsrUrlTarget.less rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrUrlTarget/HsrUrlTarget.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrUrlTarget/HsrUrlTarget.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrUrlTarget/HsrUrlTarget.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/HsrUrlTarget/HsrUrlTarget.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/HsrUrlTarget/HsrUrlTarget.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ListOfPageviews/ListOfPageviews.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ListOfPageviews/ListOfPageviews.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ListOfPageviews/ListOfPageviews.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ListOfPageviews/ListOfPageviews.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/Edit.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/Edit.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/Edit.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/Edit.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/List.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/List.vue similarity index 68% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/List.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/List.vue index e7c54ee..9e3eb89 100644 --- a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/List.vue +++ b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/List.vue @@ -79,7 +79,10 @@ {{ ucfirst(hsr.status) }} {{ ucfirst(hsr.status) }} - + + @@ -159,6 +173,10 @@ />
+ + diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/Manage.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/Manage.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageHeatmap/Manage.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageHeatmap/Manage.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageSessionRecording/Edit.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageSessionRecording/Edit.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageSessionRecording/Edit.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageSessionRecording/Edit.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageSessionRecording/List.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageSessionRecording/List.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageSessionRecording/List.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageSessionRecording/List.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageSessionRecording/Manage.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageSessionRecording/Manage.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/ManageSessionRecording/Manage.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/ManageSessionRecording/Manage.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/MatomoJsNotWritable/MatomoJsNotWritableAlert.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/SessionRecordingVis/SessionRecordingVis.less b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/SessionRecordingVis/SessionRecordingVis.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/SessionRecordingVis/SessionRecordingVis.less rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/SessionRecordingVis/SessionRecordingVis.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/SessionRecordingVis/SessionRecordingVis.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/SessionRecordingVis/SessionRecordingVis.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/SessionRecordingVis/SessionRecordingVis.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/SessionRecordingVis/SessionRecordingVis.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/Tooltip/Tooltip.less b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/Tooltip/Tooltip.less similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/Tooltip/Tooltip.less rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/Tooltip/Tooltip.less diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/Tooltip/Tooltip.vue b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/Tooltip/Tooltip.vue similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/Tooltip/Tooltip.vue rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/Tooltip/Tooltip.vue diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/getIframeWindow.ts b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/getIframeWindow.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/getIframeWindow.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/getIframeWindow.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/index.ts b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/index.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/index.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/index.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/oneAtATime.ts b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/oneAtATime.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/oneAtATime.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/oneAtATime.ts diff --git a/files/plugin-HeatmapSessionRecording-5.2.3/vue/src/types.ts b/files/plugin-HeatmapSessionRecording-5.2.6/vue/src/types.ts similarity index 100% rename from files/plugin-HeatmapSessionRecording-5.2.3/vue/src/types.ts rename to files/plugin-HeatmapSessionRecording-5.2.6/vue/src/types.ts diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/API.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/API.php new file mode 100644 index 0000000..9c00f9b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/API.php @@ -0,0 +1,410 @@ +SearchEngineKeywordsPerformance API lets you download all your SEO search keywords from Google, + * Bing & Yahoo and Yandex, as well as getting a detailed overview of how search robots crawl your websites and any + * error they may encounter. + *

+ * 1) download all your search keywords as they were searched on Google, Bing & Yahoo and Yandex. This includes Google + * Images, Google Videos and Google News. This lets you view all keywords normally hidden from view behind "keyword not defined". + * With this plugin you can view them all! + *

+ * 2) download all crawling overview stats and metrics from Bring and Yahoo and Google. Many metrics are available such + * as: Crawled pages, Crawl errors, Connection timeouts, HTTP-Status Code 301 (Permanently moved), HTTP-Status Code + * 400-499 (Request errors), All other HTTP-Status Codes, Total pages in index, Robots.txt exclusion, DNS failures, + * HTTP-Status Code 200-299, HTTP-Status Code 301 (Temporarily moved), HTTP-Status Code 500-599 (Internal server + * errors), Malware infected sites, Total inbound links. + * + * @package Piwik\Plugins\SearchEngineKeywordsPerformance + */ +class API extends \Piwik\Plugin\API +{ + /** + * Returns Keyword data used on any search + * Combines imported search keywords with those returned by Referrers plugin + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywords($idSite, $period, $date) + { + $keywordsDataTable = $this->getKeywordsImported($idSite, $period, $date); + $keywordsDataTable->deleteColumns([\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::POSITION, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::CTR]); + $keywordsDataTable->filter('ColumnCallbackDeleteRow', [\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS, function ($clicks) { + return $clicks === 0; + }]); + $keywordsDataTable->filter('ReplaceColumnNames', [[\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS => 'nb_visits']]); + $setting = new \Piwik\Plugins\SearchEngineKeywordsPerformance\MeasurableSettings($idSite); + $googleEnabled = !empty($setting->googleSearchConsoleUrl) && $setting->googleSearchConsoleUrl->getValue(); + $bingEnabled = !empty($setting->bingSiteUrl) && $setting->bingSiteUrl->getValue(); + $referrersApi = new \Piwik\Plugins\Referrers\API(); + $referrersKeywords = $referrersApi->getSearchEngines($idSite, $period, $date, \false, \true); + if ($keywordsDataTable instanceof DataTable\Map) { + $referrerTables = $referrersKeywords->getDataTables(); + foreach ($keywordsDataTable->getDataTables() as $label => $table) { + if (!empty($referrerTables[$label])) { + $this->combineKeywordReports($table, $referrerTables[$label], $googleEnabled, $bingEnabled, $period); + } + } + } else { + $this->combineKeywordReports($keywordsDataTable, $referrersKeywords, $googleEnabled, $bingEnabled, $period); + } + return $keywordsDataTable; + } + private function combineKeywordReports(DataTable $keywordsDataTable, DataTable $referrersKeywords, $googleEnabled, $bingEnabled, $period) + { + foreach ($referrersKeywords->getRowsWithoutSummaryRow() as $searchEngineRow) { + $label = $searchEngineRow->getColumn('label'); + if (strpos($label, 'Google') !== \false && $googleEnabled) { + continue; + } + if (strpos($label, 'Bing') !== \false && $bingEnabled && $period !== 'day') { + continue; + } + if (strpos($label, 'Yahoo') !== \false && $bingEnabled && $period !== 'day') { + continue; + } + $keywordsTable = $searchEngineRow->getSubtable(); + if (empty($keywordsTable) || !$keywordsTable->getRowsCount()) { + continue; + } + foreach ($keywordsTable->getRowsWithoutSummaryRow() as $keywordRow) { + if ($keywordRow->getColumn('label') == \Piwik\Plugins\Referrers\API::LABEL_KEYWORD_NOT_DEFINED) { + continue; + } + $keywordsDataTable->addRow(new DataTable\Row([DataTable\Row::COLUMNS => ['label' => $keywordRow->getColumn('label'), 'nb_visits' => $keywordRow->getColumn(\Piwik\Metrics::INDEX_NB_VISITS)]])); + } + } + $keywordsDataTable->filter('GroupBy', ['label']); + $keywordsDataTable->filter('ReplaceSummaryRowLabel'); + } + /** + * Returns Keyword data used on any imported search engine + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsImported($idSite, $period, $date) + { + $googleWebKwds = $this->getKeywordsGoogleWeb($idSite, $period, $date); + $googleImgKwds = $this->getKeywordsGoogleImage($idSite, $period, $date); + $googleVidKwds = $this->getKeywordsGoogleVideo($idSite, $period, $date); + $googleNwsKwds = $this->getKeywordsGoogleNews($idSite, $period, $date); + $bingKeywords = $this->getKeywordsBing($idSite, $period, $date); + $yandexKeywords = $this->getKeywordsYandex($idSite, $period, $date); + return $this->combineDataTables([$googleWebKwds, $googleImgKwds, $googleVidKwds, $googleNwsKwds, $bingKeywords, $yandexKeywords]); + } + /** + * Returns Keyword data used on Google + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsGoogle($idSite, $period, $date) + { + $googleWebKwds = $this->getKeywordsGoogleWeb($idSite, $period, $date); + $googleImgKwds = $this->getKeywordsGoogleImage($idSite, $period, $date); + $googleVidKwds = $this->getKeywordsGoogleVideo($idSite, $period, $date); + $googleNwsKwds = $this->getKeywordsGoogleNews($idSite, $period, $date); + return $this->combineDataTables([$googleWebKwds, $googleImgKwds, $googleVidKwds, $googleNwsKwds]); + } + /** + * Returns a DataTable with the given datatables combined + * + * @param DataTable[]|DataTable\Map[] $dataTablesToCombine + * + * @return DataTable|DataTable\Map + */ + protected function combineDataTables(array $dataTablesToCombine) + { + if (reset($dataTablesToCombine) instanceof DataTable\Map) { + $dataTable = new DataTable\Map(); + $dataTables = []; + foreach ($dataTablesToCombine as $dataTableMap) { + /** @var DataTable\Map $dataTableMap */ + $tables = $dataTableMap->getDataTables(); + foreach ($tables as $label => $table) { + if (empty($dataTables[$label])) { + $dataTables[$label] = new DataTable(); + $dataTables[$label]->setAllTableMetadata($table->getAllTableMetadata()); + $dataTables[$label]->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::getColumnsAggregationOperations()); + } + $dataTables[$label]->addDataTable($table); + } + } + foreach ($dataTables as $label => $table) { + $dataTable->addTable($table, $label); + } + } else { + $dataTable = new DataTable(); + $dataTable->setAllTableMetadata(reset($dataTablesToCombine)->getAllTableMetadata()); + $dataTable->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::getColumnsAggregationOperations()); + foreach ($dataTablesToCombine as $table) { + $dataTable->addDataTable($table); + } + } + return $dataTable; + } + /** + * Returns Bing keyword data used on search + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsBing($idSite, $period, $date) + { + if (!Bing::getInstance()->isSupportedPeriod($date, $period)) { + if (Period::isMultiplePeriod($date, $period)) { + return new DataTable\Map(); + } + return new DataTable(); + } + if (!SearchEngineKeywordsPerformance::isReportEnabled('Bing')) { + return SearchEngineKeywordsPerformance::commonEmptyDataTable($period, $date); + } + $dataTable = $this->getDataTable(BingRecordBuilder::KEYWORDS_BING_RECORD_NAME, $idSite, $period, $date); + return $dataTable; + } + /** + * Returns Yandex keyword data used on search + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsYandex($idSite, $period, $date) + { + if (!SearchEngineKeywordsPerformance::isReportEnabled('Yandex')) { + return SearchEngineKeywordsPerformance::commonEmptyDataTable($period, $date); + } + $dataTable = $this->getDataTable(YandexRecordBuilders::KEYWORDS_YANDEX_RECORD_NAME, $idSite, $period, $date); + return $dataTable; + } + /** + * Returns Google keyword data used on Web search + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsGoogleWeb($idSite, $period, $date) + { + if (!SearchEngineKeywordsPerformance::isReportEnabled('Google', 'web')) { + return SearchEngineKeywordsPerformance::commonEmptyDataTable($period, $date); + } + $dataTable = $this->getDataTable(GoogleRecordBuilder::KEYWORDS_GOOGLE_WEB_RECORD_NAME, $idSite, $period, $date); + return $dataTable; + } + /** + * Returns Google keyword data used on Image search + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsGoogleImage($idSite, $period, $date) + { + if (!SearchEngineKeywordsPerformance::isReportEnabled('Google', 'image')) { + return SearchEngineKeywordsPerformance::commonEmptyDataTable($period, $date); + } + $dataTable = $this->getDataTable(GoogleRecordBuilder::KEYWORDS_GOOGLE_IMAGE_RECORD_NAME, $idSite, $period, $date); + return $dataTable; + } + /** + * Returns Google keyword data used on Video search + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsGoogleVideo($idSite, $period, $date) + { + if (!SearchEngineKeywordsPerformance::isReportEnabled('Google', 'video')) { + return SearchEngineKeywordsPerformance::commonEmptyDataTable($period, $date); + } + $dataTable = $this->getDataTable(GoogleRecordBuilder::KEYWORDS_GOOGLE_VIDEO_RECORD_NAME, $idSite, $period, $date); + return $dataTable; + } + /** + * Returns Google keyword data used on News search + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getKeywordsGoogleNews($idSite, $period, $date) + { + if (!SearchEngineKeywordsPerformance::isReportEnabled('Google', 'news')) { + return SearchEngineKeywordsPerformance::commonEmptyDataTable($period, $date); + } + $dataTable = $this->getDataTable(GoogleRecordBuilder::KEYWORDS_GOOGLE_NEWS_RECORD_NAME, $idSite, $period, $date); + return $dataTable; + } + /** + * Returns crawling metrics for Bing + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getCrawlingOverviewBing($idSite, $period, $date) + { + Piwik::checkUserHasViewAccess($idSite); + $archive = Archive::build($idSite, $period, $date); + $dataTable = $archive->getDataTableFromNumeric([ + BingRecordBuilder::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_IN_INDEX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_IN_LINKS_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_MALWARE_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_ERRORS_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_DNS_FAILURE_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_TIMEOUT_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_2XX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_301_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_302_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_4XX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_5XX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_OTHER_CODES_RECORD_NAME + ]); + return $dataTable; + } + /** + * Returns crawling metrics for Yandex + * + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + public function getCrawlingOverviewYandex($idSite, $period, $date) + { + Piwik::checkUserHasViewAccess($idSite); + $archive = Archive::build($idSite, $period, $date); + $dataTable = $archive->getDataTableFromNumeric([ + YandexRecordBuilders::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_IN_INDEX_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_CODE_2XX_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_CODE_3XX_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_CODE_4XX_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_CODE_5XX_RECORD_NAME, + YandexRecordBuilders::CRAWLSTATS_ERRORS_RECORD_NAME + ]); + return $dataTable; + } + /** + * Returns list of pages that had an error while crawling for Bing + * + * Note: This methods returns data imported lately. It does not support any historical reports + * + * @param $idSite + * + * @return DataTable + */ + public function getCrawlingErrorExamplesBing($idSite) + { + Piwik::checkUserHasViewAccess($idSite); + $dataTable = new DataTable(); + $settings = new \Piwik\Plugins\SearchEngineKeywordsPerformance\MeasurableSettings($idSite); + $bingSiteSetting = $settings->bingSiteUrl; + if (empty($bingSiteSetting) || empty($bingSiteSetting->getValue())) { + return $dataTable; + } + list($apiKey, $bingSiteUrl) = explode('##', $bingSiteSetting->getValue()); + $model = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Model\Bing(); + $data = $model->getCrawlErrors($bingSiteUrl); + if (empty($data)) { + return $dataTable; + } + $dataTable->addRowsFromSerializedArray($data); + $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'url')); + $dataTable->filter('ColumnCallbackReplace', array('label', function ($val) use ($bingSiteUrl) { + return preg_replace('|https?://[^/]*/|i', '', $val); + })); + return $dataTable; + } + /** + * Returns datatable for the requested archive + * + * @param string $name name of the archive to use + * @param string|int|array $idSite A single ID (eg, `'1'`), multiple IDs (eg, `'1,2,3'` or `array(1, 2, 3)`), + * or `'all'`. + * @param string $period 'day', `'week'`, `'month'`, `'year'` or `'range'` + * @param Date|string $date 'YYYY-MM-DD', magic keywords (ie, 'today'; {@link Date::factory()} + * or date range (ie, 'YYYY-MM-DD,YYYY-MM-DD'). + * @return DataTable|DataTable\Map + */ + private function getDataTable($name, $idSite, $period, $date) + { + Piwik::checkUserHasViewAccess($idSite); + $archive = Archive::build($idSite, $period, $date, $segment = \false); + $dataTable = $archive->getDataTable($name); + $dataTable->queueFilter('ReplaceSummaryRowLabel'); + return $dataTable; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Activity/AccountAdded.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Activity/AccountAdded.php new file mode 100644 index 0000000..245770b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Activity/AccountAdded.php @@ -0,0 +1,46 @@ + All channels > Channel type* + * *Acquisition > All channels > Referrers* + * *Acquisition > Search Engines* +* Show related reports for reports showing imported keywords to show originally tracked keywords instead +* Translations for German and Albanian + +__3.3.2__ +* Fix sorting for keyword tables +* Improved compatibility with Roll-Up Reporting plugin +* Translation updates + +__3.3.1__ +* Ensure at least one keyword type is configured for Google imports +* Deprecated Property Set and Android App imports +* Improve sorting of keyword reports by adding a secondary sort column +* Added proper handling for new Domain properties on Google Search Console + +__3.3.0__ +* Fixed bug with incorrect numbers for reports including day stats for Bing +* Improved validation of uploaded Google client configs +* Updated dependencies +* Deprecated Google Crawl Errors reports (due to Google API deprecation). + Old reports will still be available, but no new data can be imported after end of March '19. + New installs won't show those reports at all. +* Translation updates + +__3.2.7__ +* Fixed notice occurring if search import is force enabled + +__3.2.6__ +* Allow force enabling crawling error reports. +* Improve handling of Google import (avoid importing property set data since it does not exist) + +__3.2.5__ +* Security improvements +* Theme updates + +__3.2.4__ +* Improve handling of Bing Crawl Errors (fixes a notice while import) +* Improve Google import handling of empty results +* Security improvements +* UI improvements +* Translations for Polish + +__3.2.3__ +* Various code improvements +* Translations for Chinese (Taiwan) and Italian + +__3.2.0__ +* Changes the _Combined Keywords_ report to also include keywords reported by Referrers.getKeywords +* Adds new reports _Combined imported keywords_ (which is what the combined keywords was before) +* Replaces Referrers.getKeywords reports in order to change name and show it as related report +* Move all reports to the Search Engines & Keywords category (showing Search Engines last) + +__3.1.0__ +* New crawl errors reports und Pages > crawl errors showing pages having crawl issues on Google and Bing/Yahoo! + +__3.0.10__ +* Improved error handling +* Row evolution for combined keywords reports +* Fixed error when generating scheduled reports with evolution charts + +__3.0.9__ +* Renamed Piwik to Matomo + +__3.0.8__ +* Possibility to show keyword position as float instead of integer + +__3.0.7__ +* Added commands to trigger import using console command +* Various UI/UX improvements + +__3.0.6__ +* Now uses Piwik proxy config if defined + +__3.0__ +* Possibility to import keyords & crawl stats from Google Search Console +* Setting per website if web, image and/or video keywords should be imported +* Possibility to import keywords & crawl stats from Bing/Yahoo! Webmaster API diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Categories/CrawlingOverviewSubcategory.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Categories/CrawlingOverviewSubcategory.php new file mode 100644 index 0000000..df098d4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Categories/CrawlingOverviewSubcategory.php @@ -0,0 +1,31 @@ +' . Piwik::translate('SearchEngineKeywordsPerformance_CrawlingOverview1') . '

'; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Categories/SearchKeywordsSubcategory.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Categories/SearchKeywordsSubcategory.php new file mode 100644 index 0000000..a60d2ec --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Categories/SearchKeywordsSubcategory.php @@ -0,0 +1,26 @@ +configuration = $configuration; + } + /** + * Returns configured client api keys + * + * @return array + */ + public function getAccounts() + { + return $this->configuration->getAccounts(); + } + /** + * Removes client api key + * + * @param string $apiKey + * @return boolean + */ + public function removeAccount( + #[\SensitiveParameter] + $apiKey + ) { + $this->configuration->removeAccount($apiKey); + Piwik::postEvent( + 'SearchEngineKeywordsPerformance.AccountRemoved', + [['provider' => \Piwik\Plugins\SearchEngineKeywordsPerformance\Provider\Bing::getInstance()->getName(), 'account' => substr($apiKey, 0, 5) . '*****' . substr($apiKey, -5, 5)]] + ); + return \true; + } + /** + * Adds a client api key + * + * @param $apiKey + * @param $username + * @return boolean + */ + public function addAccount( + #[\SensitiveParameter] + $apiKey, + $username + ) { + $this->configuration->addAccount($apiKey, $username); + Piwik::postEvent('SearchEngineKeywordsPerformance.AccountAdded', [['provider' => \Piwik\Plugins\SearchEngineKeywordsPerformance\Provider\Bing::getInstance()->getName(), 'account' => substr($apiKey, 0, 5) . '*****' . substr($apiKey, -5, 5)]]); + return \true; + } + /** + * Returns if client is configured + * + * @return bool + */ + public function isConfigured() + { + return count($this->getAccounts()) > 0; + } + /** + * Checks if API key can be used to query the API + * + * @param $apiKey + * @return bool + * @throws \Exception + */ + public function testConfiguration( + #[\SensitiveParameter] + $apiKey + ) { + $data = $this->sendAPIRequest($apiKey, 'GetUserSites'); + if (empty($data)) { + throw new \Exception('Unknown error'); + } + return \true; + } + /** + * Returns the urls, keyword data is available for (in connected google account) + * + * @param $apiKey + * + * @return array + */ + public function getAvailableUrls( + #[\SensitiveParameter] + $apiKey, + $removeUrlsWithoutAccess = \true + ) { + try { + $data = $this->sendAPIRequest($apiKey, 'GetUserSites'); + } catch (\Exception $e) { + return []; + } + if (empty($data) || !is_array($data['d'])) { + return []; + } + $urls = []; + foreach ($data['d'] as $item) { + if (!$removeUrlsWithoutAccess || $item['IsVerified']) { + $urls[$item['Url']] = $item['IsVerified']; + } + } + return $urls; + } + /** + * Returns search anyalytics data from Bing API + * + * @param string $apiKey + * @param string $url + * @return array + */ + public function getSearchAnalyticsData( + #[\SensitiveParameter] + $apiKey, + $url + ) { + $keywordDataSets = $this->sendAPIRequest($apiKey, 'GetQueryStats', ['siteUrl' => $url]); + $keywords = []; + if (empty($keywordDataSets['d']) || !is_array($keywordDataSets['d'])) { + return []; + } + foreach ($keywordDataSets['d'] as $keywordDataSet) { + $timestamp = substr($keywordDataSet['Date'], 6, 10); + $date = date('Y-m-d', $timestamp); + if (!isset($keywords[$date])) { + $keywords[$date] = []; + } + $keywords[$date][] = ['keyword' => $keywordDataSet['Query'], 'clicks' => $keywordDataSet['Clicks'], 'impressions' => $keywordDataSet['Impressions'], 'position' => $keywordDataSet['AvgImpressionPosition']]; + } + return $keywords; + } + /** + * Returns crawl statistics from Bing API + * + * @param string $apiKey + * @param string $url + * @return array + */ + public function getCrawlStats( + #[\SensitiveParameter] + $apiKey, + $url + ) { + $crawlStatsDataSets = $this->sendAPIRequest($apiKey, 'GetCrawlStats', ['siteUrl' => $url]); + $crawlStats = []; + if (empty($crawlStatsDataSets) || !is_array($crawlStatsDataSets['d'])) { + return []; + } + foreach ($crawlStatsDataSets['d'] as $crawlStatsDataSet) { + $timestamp = substr($crawlStatsDataSet['Date'], 6, 10); + $date = date('Y-m-d', $timestamp); + unset($crawlStatsDataSet['Date']); + $crawlStats[$date] = $crawlStatsDataSet; + } + return $crawlStats; + } + /** + * Returns urls with crawl issues from Bing API + * + * @param string $apiKey + * @param string $url + * @return array + */ + public function getUrlWithCrawlIssues( + #[\SensitiveParameter] + $apiKey, + $url + ) { + $crawlErrorsDataSets = $this->sendAPIRequest($apiKey, 'GetCrawlIssues', ['siteUrl' => $url]); + $crawlErrors = []; + if (empty($crawlErrorsDataSets) || !is_array($crawlErrorsDataSets['d'])) { + return []; + } + $crawlIssueMapping = [1 => 'Code301', 2 => 'Code302', 4 => 'Code4xx', 8 => 'Code5xx', 16 => 'BlockedByRobotsTxt', 32 => 'ContainsMalware', 64 => 'ImportantUrlBlockedByRobotsTxt']; + foreach ($crawlErrorsDataSets['d'] as $crawlStatsDataSet) { + $issues = $crawlStatsDataSet['Issues']; + $messages = []; + foreach ($crawlIssueMapping as $code => $message) { + if ($issues & $code) { + $messages[] = $message; + } + } + $crawlStatsDataSet['Issues'] = implode(',', $messages); + $crawlErrors[] = $crawlStatsDataSet; + } + return $crawlErrors; + } + /** + * Executes a API-Request to Bing with the given parameters + * + * @param string $apiKey + * @param string $method + * @param array $params + * @return mixed + * @throws InvalidCredentialsException + * @throws \Exception + */ + protected function sendAPIRequest( + #[\SensitiveParameter] + $apiKey, + $method, + $params = [] + ) { + $params['apikey'] = $apiKey; + $this->throwIfThrottled($apiKey); + $url = $this->baseAPIUrl . $method . '?' . Http::buildQuery($params); + $retries = 0; + while ($retries < 5) { + try { + $additionalHeaders = ['X-Forwarded-For: ' . (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] . ',' : '') . IP::getIpFromHeader()]; + $response = Http::sendHttpRequestBy(Http::getTransportMethod(), $url, 2000, null, null, null, 0, false, false, false, false, 'GET', null, null, null, $additionalHeaders); + $response = json_decode($response, \true); + } catch (\Exception $e) { + if ($retries < 4) { + $retries++; + usleep($retries * 500); + continue; + } + throw $e; + } + if (!empty($response['ErrorCode'])) { + $isThrottledHost = strpos($response['Message'], 'ThrottleHost') !== \false || $response['ErrorCode'] == self::API_ERROR_THROTTLE_HOST; + $isThrottledUser = strpos($response['Message'], 'ThrottleUser') !== \false || $response['ErrorCode'] == self::API_ERROR_THROTTLE_USER; + $isThrottledIp = strpos($response['Message'], 'ThrottleIP') !== false; + $isThrottled = $isThrottledHost || $isThrottledUser || $isThrottledIp; + $isUnknownError = $response['ErrorCode'] === self::API_ERROR_UNKNOWN; + // we retry each request up to 5 times, if the error is unknown or the connection was throttled + if (($isThrottled || $isUnknownError) && $retries < 4) { + $retries++; + usleep($retries * 500); + continue; + } + // if connection is still throttled after retrying, we block additional requests for some time + if ($isThrottled) { + Option::set($this->getThrottleOptionKey($apiKey), Date::getNowTimestamp()); + $this->throwIfThrottled($apiKey, $response['ErrorCode']); + } + if ($isUnknownError) { + throw new UnknownAPIException($response['Message'], $response['ErrorCode']); + } + $authenticationError = strpos($response['Message'], 'NotAuthorized') !== \false + || strpos($response['Message'], 'InvalidApiKey') !== \false + || in_array($response['ErrorCode'], [self::API_ERROR_NOT_AUTHORIZED, self::API_ERROR_INVALID_API_KEY]); + if ($authenticationError) { + throw new InvalidCredentialsException($response['Message'], $response['ErrorCode']); + } + throw new \Exception($response['Message'], $response['ErrorCode']); + } + return $response; + } + return null; + } + protected function getThrottleOptionKey( + #[\SensitiveParameter] + $apiKey + ) { + return sprintf(self::OPTION_NAME_THROTTLE_TIME, md5($apiKey)); + } + public function throwIfThrottled( + #[\SensitiveParameter] + $apiKey, + $errorCode = null + ) { + $throttleTime = Option::get($this->getThrottleOptionKey($apiKey)); + if (empty($throttleTime)) { + return; + } + try { + $throttleDate = Date::factory((int) $throttleTime); + } catch (\Exception $e) { + return; + } + if (Date::now()->subHour(self::THROTTLE_BREAK_HOURS)->isEarlier($throttleDate)) { + $errorCode = !empty($errorCode) ? $errorCode : self::API_ERROR_THROTTLE_USER; + throw new RateLimitApiException('API requests temporarily throttled till ' . $throttleDate->addHour(self::THROTTLE_BREAK_HOURS)->getDatetime(), $errorCode); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/BaseConfiguration.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/BaseConfiguration.php new file mode 100644 index 0000000..af01cc9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/BaseConfiguration.php @@ -0,0 +1,49 @@ +accounts)) { + $accounts = Option::get(self::CLIENT_CONFIG_OPTION_NAME); + $accounts = @json_decode($accounts, \true); + if (is_array($accounts)) { + $this->accounts = $accounts; + } + } + return $this->accounts; + } + /** + * Adds new account + * + * @param $apiKey + * @param $username + */ + public function addAccount( + #[\SensitiveParameter] + $apiKey, + $username + ) { + $currentAccounts = (array) $this->getAccounts(); + if (array_key_exists($apiKey, $currentAccounts)) { + return; + } + $currentAccounts[$apiKey] = ['apiKey' => $apiKey, 'username' => $username, 'created' => time()]; + $this->setAccounts($currentAccounts); + } + /** + * Removes account with given API-Key + * + * @param $apiKey + */ + public function removeAccount( + #[\SensitiveParameter] + $apiKey + ) { + $currentAccounts = (array) $this->getAccounts(); + $this->checkPermissionToRemoveAccount($apiKey, $currentAccounts); + unset($currentAccounts[$apiKey]); + $this->setAccounts($currentAccounts); + } + protected function setAccounts($newAccounts) + { + $accounts = json_encode($newAccounts); + Option::set(self::CLIENT_CONFIG_OPTION_NAME, $accounts); + $this->accounts = []; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/Google.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/Google.php new file mode 100644 index 0000000..f98383e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/Google.php @@ -0,0 +1,178 @@ +accounts)) { + $accounts = Option::get(self::OAUTH_CONFIG_OPTION_NAME); + $accounts = @json_decode($accounts, \true); + if (is_array($accounts) && !empty($accounts)) { + $this->accounts = $accounts; + } + } + return $this->accounts; + } + /** + * adds new account data + * + * @param string $id + * @param array $accountData + * @param string $username + */ + public function addAccount($id, $accountData, $username) + { + $currentAccounts = (array) $this->getAccounts(); + $id = (string) $id; + if (array_key_exists($id, $currentAccounts)) { + return; + } + $currentAccounts[$id] = ['config' => $accountData, 'username' => $username, 'created' => time()]; + $this->setAccounts($currentAccounts); + } + /** + * removes account data + * + * @param string $id + */ + public function removeAccount($id) + { + $currentAccounts = (array) $this->getAccounts(); + $id = (string) $id; + $this->checkPermissionToRemoveAccount($id, $currentAccounts); + unset($currentAccounts[$id]); + $this->setAccounts($currentAccounts); + } + protected function setAccounts($newAccounts) + { + $accounts = json_encode($newAccounts); + Option::set(self::OAUTH_CONFIG_OPTION_NAME, $accounts); + $this->accounts = $newAccounts; + } + /** + * Returns the access token for the given account id + * + * @param string $accountId + * @return mixed|null + */ + public function getAccessToken($accountId) + { + $accounts = $this->getAccounts(); + if (array_key_exists($accountId, $accounts)) { + return $accounts[$accountId]['config']['accessToken']; + } + return null; + } + /** + * Returns the user info for the given account id + * + * @param string $accountId + * @return mixed|null + */ + public function getUserInfo($accountId) + { + $accounts = $this->getAccounts(); + if (array_key_exists($accountId, $accounts)) { + return $accounts[$accountId]['config']['userInfo']; + } + return null; + } + /** + * Returns stored client config + * + * @return mixed|null + */ + public function getClientConfig() + { + if (empty($this->clientConfig)) { + $config = Common::unsanitizeInputValue(Option::get(self::CLIENT_CONFIG_OPTION_NAME)); + if (!empty($config) && ($config = @json_decode($config, \true))) { + $this->clientConfig = $config; + } + } + return $this->clientConfig; + } + /** + * Sets client config to be used for querying google api + * + * NOTE: Check for valid config should be done before + * + * @param string $config json encoded client config + */ + public function setClientConfig($config) + { + Option::set(self::CLIENT_CONFIG_OPTION_NAME, $config); + } + /** + * Delete the Google client config option so that the customer will be prompted to upload a new one or use the Cloud + * config. + * + * @return void + */ + public function deleteClientConfig(): void + { + Option::delete(self::CLIENT_CONFIG_OPTION_NAME); + } + /** + * Returns path to client config file that is used for automatic import + * + * @return string + */ + protected function getConfigurationFilename() + { + return dirname(dirname(dirname(__FILE__))) . \DIRECTORY_SEPARATOR . 'client_secrets.json'; + } + /** + * Imports client config from shipped config file if available + * + * @return bool + */ + public function importShippedClientConfigIfAvailable() + { + $configFile = $this->getConfigurationFilename(); + if (!file_exists($configFile)) { + return \false; + } + $config = file_get_contents($configFile); + if ($decoded = @json_decode($config, \true)) { + $this->setClientConfig($config); + return \true; + } + return \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/Yandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/Yandex.php new file mode 100644 index 0000000..c5881ef --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Configuration/Yandex.php @@ -0,0 +1,130 @@ +accounts)) { + $accounts = Option::get(self::OAUTH_CONFIG_OPTION_NAME); + $accounts = @json_decode($accounts, \true); + if (is_array($accounts) && !empty($accounts)) { + $this->accounts = $accounts; + } + } + return $this->accounts; + } + /** + * adds new account data + * + * @param string $id + * @param array $accountData + * @param string $username + */ + public function addAccount($id, $accountData, $username) + { + $currentAccounts = (array) $this->getAccounts(); + $currentAccounts[$id] = ['config' => $accountData, 'username' => $username, 'created' => time()]; + $this->setAccounts($currentAccounts); + } + /** + * removes account data + * + * @param string $id + */ + public function removeAccount($id) + { + $currentAccounts = (array) $this->getAccounts(); + $this->checkPermissionToRemoveAccount($id, $currentAccounts); + unset($currentAccounts[$id]); + $this->setAccounts($currentAccounts); + } + protected function setAccounts($newAccounts) + { + $accounts = json_encode($newAccounts); + Option::set(self::OAUTH_CONFIG_OPTION_NAME, $accounts); + $this->accounts = []; + } + /** + * Returns the access token for the given account id + * + * @param string $accountId + * @return mixed|null + */ + public function getAccessToken($accountId) + { + $accounts = $this->getAccounts(); + if (array_key_exists($accountId, $accounts)) { + return $accounts[$accountId]['config']['accessToken']; + } + return null; + } + /** + * Returns the user info for the given account id + * + * @param string $accountId + * @return mixed|null + */ + public function getUserInfo($accountId) + { + $accounts = $this->getAccounts(); + if (array_key_exists($accountId, $accounts)) { + return $accounts[$accountId]['config']['userInfo']; + } + return null; + } + /** + * Returns stored client config + * + * @return mixed|null + */ + public function getClientConfig() + { + if (empty($this->clientConfig)) { + $config = Common::unsanitizeInputValue(Option::get(self::CLIENT_CONFIG_OPTION_NAME)); + if (!empty($config) && ($config = @json_decode($config, \true))) { + $this->clientConfig = $config; + } + } + return $this->clientConfig; + } + /** + * Sets client config to be used for querying yandex api + * + * NOTE: Check for valid config should be done before + * + * @param string $config json encoded client config + */ + public function setClientConfig($clientId, $clientSecret) + { + $config = ['id' => $clientId, 'secret' => $clientSecret, 'date' => time()]; + Option::set(self::CLIENT_CONFIG_OPTION_NAME, json_encode($config)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Google.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Google.php new file mode 100644 index 0000000..cf732c5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Google.php @@ -0,0 +1,503 @@ +configuration = $configuration; + } + /** + * @return \Google\Client + */ + protected function getGoogleClient() + { + $googleClient = StaticContainer::get('SearchEngineKeywordsPerformance.Google.googleClient'); + $proxyHost = Config::getInstance()->proxy['host']; + if ($proxyHost) { + $proxyPort = Config::getInstance()->proxy['port']; + $proxyUser = Config::getInstance()->proxy['username']; + $proxyPassword = Config::getInstance()->proxy['password']; + if ($proxyUser) { + $proxy = sprintf('http://%s:%s@%s:%s', $proxyUser, $proxyPassword, $proxyHost, $proxyPort); + } else { + $proxy = sprintf('http://%s:%s', $proxyHost, $proxyPort); + } + $httpClient = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Client(['proxy' => $proxy, 'exceptions' => \false, 'base_uri' => \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Client::API_BASE_PATH]); + $googleClient->setHttpClient($httpClient); + } + return $googleClient; + } + /** + * Passes through a direct call to the \Google\Client class + * + * @param string $method + * @param array $params + * @return mixed + * @throws MissingClientConfigException + * @throws MissingOAuthConfigException + */ + public function __call($method, $params = []) + { + return call_user_func_array([$this->getConfiguredClient('', \true), $method], $params); + } + /** + * Process the given auth code to gain access and refresh token from google api + * + * @param string $authCode + * @throws MissingClientConfigException + */ + public function processAuthCode( + #[\SensitiveParameter] + $authCode + ) { + try { + $client = $this->getConfiguredClient(''); + } catch (MissingOAuthConfigException $e) { + // ignore missing oauth config + } + $accessToken = $client->fetchAccessTokenWithAuthCode($authCode); + $userInfo = $this->getUserInfoByAccessToken($accessToken); + $id = $userInfo->getId(); + $this->addAccount($id, $accessToken, Piwik::getCurrentUserLogin()); + Piwik::postEvent('SearchEngineKeywordsPerformance.AccountAdded', [['provider' => \Piwik\Plugins\SearchEngineKeywordsPerformance\Provider\Google::getInstance()->getName(), 'account' => $userInfo->getName()]]); + } + /** + * Sets the client configuration + * + * @param $config + * @return boolean + */ + public function setClientConfig($config) + { + try { + $client = $this->getGoogleClient(); + $configArray = @json_decode($config, \true); + $this->configureClient($client, $configArray); + } catch (\Exception $e) { + return \false; + } + $this->configuration->setClientConfig($config); + Piwik::postEvent('SearchEngineKeywordsPerformance.GoogleClientConfigChanged'); + return \true; + } + /** + * Delete the Google client config option so that the customer will be prompted to upload a new one or use the Cloud + * config. + * + * @return void + */ + public function deleteClientConfig(): void + { + $this->configuration->deleteClientConfig(); + Piwik::postEvent('SearchEngineKeywordsPerformance.GoogleClientConfigChanged'); + } + /** + * @param \Google\Client $client + * @param array $config + * + * @throws MissingClientConfigException + */ + protected function configureClient($client, $config) + { + try { + @$client->setAuthConfig($config); + } catch (\Exception $e) { + throw new MissingClientConfigException(); + } + // no client config available + if (!$client->getClientId() || !$client->getClientSecret()) { + throw new MissingClientConfigException(); + } + } + /** + * Returns configured client api keys + * + * @return array + */ + public function getAccounts() + { + return $this->configuration->getAccounts(); + } + /** + * Removes client api key + * + * @param $id + * @return bool + */ + public function removeAccount($id) + { + $userInfo = $this->getUserInfo($id); + $this->configuration->removeAccount($id); + Piwik::postEvent('SearchEngineKeywordsPerformance.AccountRemoved', [['provider' => \Piwik\Plugins\SearchEngineKeywordsPerformance\Provider\Google::getInstance()->getName(), 'account' => $userInfo['name']]]); + return \true; + } + /** + * Adds a client api key + * + * @param $id + * @param $config + * @param $username + * @return boolean + */ + public function addAccount( + $id, + #[\SensitiveParameter] + $accessToken, + $username + ) { + $userInfo = $this->getUserInfoByAccessToken($accessToken); + $config = ['userInfo' => ['picture' => $userInfo->picture, 'name' => $userInfo->name], 'accessToken' => $accessToken]; + $this->configuration->addAccount($id, $config, $username); + return \true; + } + /** + * Returns if client is configured + * + * @return bool + */ + public function isConfigured() + { + return $this->configuration->getClientConfig() && count($this->configuration->getAccounts()) > 0; + } + /** + * Returns configured \Google\Client object + * + * @param string $accessToken + * @param bool $ignoreMissingConfigs + * @return \Google\Client + * @throws MissingClientConfigException + * @throws MissingOAuthConfigException + */ + public function getConfiguredClient( + #[\SensitiveParameter] + $accessToken, + $ignoreMissingConfigs = \false + ) { + $client = $this->getGoogleClient(); + try { + $this->configure($client, $accessToken); + } catch (\Exception $e) { + if (!$ignoreMissingConfigs) { + throw $e; + } + } + return $client; + } + /** + * Returns the Auth Url (including the given state param) + * + * @param $state + * @return string + * @throws MissingClientConfigException + * @throws MissingOAuthConfigException + */ + public function createAuthUrl($state) + { + $client = $this->getConfiguredClient('', \true); + $client->setState($state); + $client->setPrompt('consent'); + return $client->createAuthUrl(); + } + /** + * Loads configuration and sets common configuration for \Google\Client + * + * @param \Google\Client $client + * @param string $accessToken + * @throws MissingOAuthConfigException + * @throws MissingClientConfigException + */ + protected function configure( + $client, + #[\SensitiveParameter] + $accessToken + ) { + // import shipped client config if available + if (!$this->configuration->getClientConfig()) { + $this->configuration->importShippedClientConfigIfAvailable(); + } + $clientConfig = $this->configuration->getClientConfig(); + $this->configureClient($client, $clientConfig); + // Copied this bit about the redirect_uris from the GA Importer Authorization class + //since there ie no host defined when running via console it results in error, but we don't need to set any URI when running console commands so can be ignored + $expectedUri = Url::getCurrentUrlWithoutQueryString() . '?module=SearchEngineKeywordsPerformance&action=processAuthCode'; + if ( + !empty($clientConfig['web']['redirect_uris']) && + !Common::isRunningConsoleCommand() && + !PluginsArchiver::isArchivingProcessActive() && + !$this->isMiscCron() && + stripos($expectedUri, 'unknown/_/console?') === false // To handle case where we are unable to determine the correct URI + ) { + $uri = $this->getValidUri($clientConfig['web']['redirect_uris']); + if (empty($uri)) { + throw new \Exception(Piwik::translate('SearchEngineKeywordsPerformance_InvalidRedirectUriInClientConfiguration', [$expectedUri])); + } + $client->setRedirectUri($uri); + } + try { + $client->setAccessToken($accessToken); + } catch (\Exception $e) { + throw new MissingOAuthConfigException($e->getMessage()); + } + } + public function getUserInfo($accountId) + { + return $this->configuration->getUserInfo($accountId); + } + protected function getUserInfoByAccessToken( + #[\SensitiveParameter] + $accessToken + ) { + $service = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Oauth2($this->getConfiguredClient($accessToken)); + return $service->userinfo->get(); + } + /** + * Checks if account can be used to query the API + * + * @param string $accountId + * @return bool + * @throws \Exception + */ + public function testConfiguration($accountId) + { + $accessToken = $this->configuration->getAccessToken($accountId); + try { + $service = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole($this->getConfiguredClient($accessToken)); + $service->sites->listSites(); + } catch (\Exception $e) { + $this->handleServiceException($e); + throw $e; + } + return \true; + } + /** + * Returns the urls keyword data is available for (in connected google account) + * + * @param string $accountId + * @param bool $removeUrlsWithoutAccess wether to return unverified urls + * @return array + */ + public function getAvailableUrls($accountId, $removeUrlsWithoutAccess = \true) + { + $accessToken = $this->configuration->getAccessToken($accountId); + $sites = []; + try { + $service = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole($this->getConfiguredClient($accessToken)); + $service->getClient()->getCache()->clear(); + //After Guzzle upgrade this seems to fetch same token for all the accounts, to solve that we are clearing the caache explicitly + $response = $service->sites->listSites(); + } catch (\Exception $e) { + return $sites; + } + foreach ($response as $site) { + if (!$removeUrlsWithoutAccess || $site['permissionLevel'] != 'siteUnverifiedUser') { + $sites[$site['siteUrl']] = $site['permissionLevel']; + } + } + return $sites; + } + /** + * Returns the search analytics data from google search console for the given parameters + * + * @param string $accountId + * @param string $url url, eg. http://matomo.org + * @param string $date day string, eg. 2016-12-24 + * @param string $type 'web', 'image', 'video' or 'news' + * @param int $limit maximum of rows to fetch + * @return \Google\Service\SearchConsole\SearchAnalyticsQueryResponse + * @throws InvalidClientConfigException + * @throws InvalidCredentialsException + * @throws MissingOAuthConfigException + * @throws MissingClientConfigException + * @throws UnknownAPIException + */ + public function getSearchAnalyticsData($accountId, $url, $date, $type = 'web', $limit = 500) + { + $accessToken = $this->configuration->getAccessToken($accountId); + if (empty($accessToken)) { + throw new MissingOAuthConfigException(); + } + $limit = min($limit, 5000); + // maximum allowed by API is 5.000 + // Google API is only able to handle dates up to ~490 days old + $threeMonthBefore = Date::now()->subDay(500); + $archivedDate = Date::factory($date); + if ($archivedDate->isEarlier($threeMonthBefore) || $archivedDate->isToday()) { + Log::debug("[SearchEngineKeywordsPerformance] Skip fetching keywords from Search Console for today and dates more than 500 days in the past"); + return null; + } + $service = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole($this->getConfiguredClient($accessToken)); + $request = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole\SearchAnalyticsQueryRequest(); + $request->setStartDate($date); + $request->setEndDate($date); + $request->setDimensions(['query']); + $request->setRowLimit($limit); + $request->setSearchType($type); + $request->setDataState('all'); + $retries = 0; + while ($retries < 5) { + try { + $response = $service->searchanalytics->query($url, $request); + return $response; + } catch (\Exception $e) { + $this->handleServiceException($e, $retries < 4); + usleep(500 * $retries); + $retries++; + } + } + return null; + } + /** + * Returns an array of dates where search analytics data is availabe for on search console + * + * @param string $accountId + * @param string $url url, eg. http://matomo.org + * @param boolean $onlyFinalized + * @return array + * @throws MissingClientConfigException + * @throws MissingOAuthConfigException + * @throws InvalidClientConfigException + * @throws InvalidCredentialsException + * @throws UnknownAPIException + */ + public function getDatesWithSearchAnalyticsData($accountId, $url, $onlyFinalized = \true) + { + $accessToken = $this->configuration->getAccessToken($accountId); + $service = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole($this->getConfiguredClient($accessToken)); + $request = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole\SearchAnalyticsQueryRequest(); + $request->setStartDate(Date::now()->subDay(StaticContainer::get('SearchEngineKeywordsPerformance.Google.ImportLastDaysMax'))->toString()); + $request->setEndDate(Date::now()->toString()); + $request->setDimensions(['date']); + if ($onlyFinalized === \false) { + $request->setDataState('all'); + } + $retries = 0; + while ($retries < 5) { + try { + $entries = $service->searchanalytics->query($url, $request); + if (empty($entries) || !($rows = $entries->getRows())) { + return []; + } + $days = []; + foreach ($rows as $row) { + /** @var \Google\Service\SearchConsole\ApiDataRow $row */ + $keys = $keys = $row->getKeys(); + $days[] = array_shift($keys); + } + return array_unique($days); + } catch (\Exception $e) { + $this->handleServiceException($e, $retries < 4); + $retries++; + usleep(500 * $retries); + } + } + return []; + } + /** + * @param \Exception $e + * @param bool $ignoreUnknowns + * @throws InvalidClientConfigException + * @throws InvalidCredentialsException + * @throws UnknownAPIException + */ + protected function handleServiceException($e, $ignoreUnknowns = \false) + { + if (!$e instanceof \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Exception) { + if (!PluginsArchiver::isArchivingProcessActive()) { + Log::debug('Exception: ' . $e->getMessage()); + } + return; + } + $error = json_decode($e->getMessage(), \true); + if (!empty($error['error']) && $error['error'] == 'invalid_client') { + // invalid credentials + throw new InvalidClientConfigException($error['error_description']); + } elseif (!empty($error['error']['code']) && $error['error']['code'] == 401) { + // invalid credentials + throw new InvalidCredentialsException($error['error']['message'], $error['error']['code']); + } elseif (!empty($error['error']['code']) && $error['error']['code'] == 403) { + // no access for given resource (website / app) + throw new InvalidCredentialsException($error['error']['message'], $error['error']['code']); + } elseif (!empty($error['error']['code']) && in_array($error['error']['code'], [500, 503]) && !$ignoreUnknowns) { + // backend or api server error + throw new UnknownAPIException($error['error']['message'], $error['error']['code']); + } else { + if (!PluginsArchiver::isArchivingProcessActive()) { + Log::debug('Exception: ' . $e->getMessage()); + } + } + } + /** + * Returns a valid uri. Copied from GA Importer Authorization class. + * + * @param array $uris + * @return string + */ + private function getValidUri(array $uris): string + { + $validUri = Url::getCurrentUrlWithoutQueryString() . '?module=SearchEngineKeywordsPerformance&action=processAuthCode'; + $settingURL = SettingsPiwik::getPiwikUrl(); + if (stripos($settingURL, 'index.php') === false) { + $settingURL .= 'index.php'; + } + // Some MWP installs was not working as expected when using Url::getCurrentUrlWithoutQueryString() + $validUriFallback = $settingURL . '?module=SearchEngineKeywordsPerformance&action=processAuthCode'; + foreach ($uris as $uri) { + if (stripos($uri, $validUri) !== \false || stripos($uri, $validUriFallback) !== \false) { + return $uri; + } + } + return ''; + } + + private function isMiscCron() + { + $currentURL = Url::getCurrentUrlWithoutQueryString(); + + return (stripos($currentURL, 'misc/cron/archive.php') !== false); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Yandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Yandex.php new file mode 100644 index 0000000..0a0174f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Client/Yandex.php @@ -0,0 +1,575 @@ +configuration = $configuration; + } + /** + * Returns if client is configured + * + * @return bool + */ + public function isConfigured() + { + return $this->isClientConfigured() && count($this->configuration->getAccounts()) > 0; + } + /** + * Returns if oauth client config is available + */ + public function isClientConfigured() + { + return \true && $this->getClientConfig(); + } + /** + * Returns the client config + * + * @return mixed|null + */ + public function getClientConfig() + { + return $this->configuration->getClientConfig(); + } + /** + * Checks if account can be used to query the API + * + * @param string $accountId + * @return bool + * @throws \Exception + */ + public function testConfiguration($accountId) + { + $accessToken = $this->configuration->getAccessToken($accountId); + $this->getHosts($accessToken); + return \true; + } + /** + * Updates the client config + * + * @param string $clientId new client id + * @param string $clientSecret new client secret + */ + public function setClientConfig($clientId, $clientSecret) + { + $this->configuration->setClientConfig($clientId, $clientSecret); + Piwik::postEvent('SearchEngineKeywordsPerformance.GoogleClientConfigChanged'); + } + /** + * Returns the urls keyword data is available for (in connected yandex account) + * + * @param string $accountId + * @param bool $removeUrlsWithoutAccess whether to return unverified urls + * @return array + */ + public function getAvailableUrls($accountId, $removeUrlsWithoutAccess = \true) + { + $accessToken = $this->configuration->getAccessToken($accountId); + $sites = []; + try { + $availableSites = $this->getHosts($accessToken); + } catch (\Exception $e) { + return $sites; + } + if (property_exists($availableSites, 'hosts')) { + foreach ($availableSites->hosts as $availableSite) { + if (!$removeUrlsWithoutAccess || $availableSite->verified) { + $sites[$availableSite->unicode_host_url] = ['verified' => $availableSite->verified, 'host_id' => $availableSite->host_id]; + } + } + } + return $sites; + } + /** + * Returns popular search queries from Yandex Webmaster API + * + * @param string $accountId + * @param string $hostId + * @param string $date + * @return ?array + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + public function getSearchAnalyticsData($accountId, $hostId, $date) + { + $accessToken = $this->configuration->getAccessToken($accountId); + $archivedDate = Date::factory($date); + if ($archivedDate->isToday()) { + Log::debug("[SearchEngineKeywordsPerformance] Skip fetching keywords from Yandex Webmaster for today."); + return null; + } + $date = strtotime($date); + $searchQueries = $this->retryApiMethod(function () use ($accessToken, $hostId, $date) { + return $this->getPopularQueries($accessToken, $hostId, $date); + }); + if (empty($searchQueries) || empty($searchQueries->queries)) { + return null; + } + $keywords = []; + foreach ($searchQueries->queries as $query) { + $keywords[] = ['keyword' => $query->query_text, 'clicks' => $query->indicators->TOTAL_CLICKS, 'impressions' => $query->indicators->TOTAL_SHOWS, 'position' => $query->indicators->AVG_SHOW_POSITION]; + } + return $keywords; + } + /** + * Returns crawl statistics from Yandex Webmaster API + * + * @param string $accountId + * @param string $hostId + * @return array + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + public function getCrawlStats($accountId, $hostId, $date) + { + $accessToken = $this->configuration->getAccessToken($accountId); + $archivedDate = Date::factory($date); + if ($archivedDate->isToday()) { + Log::debug("[SearchEngineKeywordsPerformance] Skip fetching crawl stats from Yandex Webmaster for today."); + return null; + } + $dateTs = strtotime($date); + $crawlStatsByDate = []; + $crawlStats = $this->retryApiMethod(function () use ($accessToken, $hostId, $dateTs) { + return $this->getIndexingHistory($accessToken, $hostId, $dateTs); + }); + if (!empty($crawlStats) && !empty($crawlStats->indicators)) { + $indicators = (array) $crawlStats->indicators; + foreach ($indicators as $indicator => $indicatorByDate) { + foreach ($indicatorByDate as $dateItem) { + if (strpos($dateItem->date, $date) === 0) { + $crawlStatsByDate[$indicator] = (int) $dateItem->value; + } + } + } + } + $pagesInIndex = $this->retryApiMethod(function () use ($accessToken, $hostId, $dateTs) { + return $this->getPagesInIndex($accessToken, $hostId, $dateTs); + }); + if (!empty($pagesInIndex) && !empty($pagesInIndex->history)) { + $history = (array) $pagesInIndex->history; + foreach ($history as $entry) { + // Look for matching date + if (strpos($entry->date, $date) === 0) { + $crawlStatsByDate['SEARCHABLE'] = (int) $entry->value; + } + } + } + $pageChanges = $this->retryApiMethod(function () use ($accessToken, $hostId, $dateTs) { + return $this->getPageChangesInSearch($accessToken, $hostId, $dateTs); + }); + if (!empty($pageChanges) && !empty($pageChanges->indicators)) { + $indicators = (array) $pageChanges->indicators; + foreach ($indicators as $indicator => $indicatorByDate) { + foreach ($indicatorByDate as $dateItem) { + // Look for matching date + if (strpos($dateItem->date, $date) === 0) { + $crawlStatsByDate[$indicator] = (int) $dateItem->value; + } + } + } + } + return $crawlStatsByDate; + } + /** + * @param callback $method + * @return mixed + * @throws \Exception + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function retryApiMethod($method) + { + $retries = 0; + while ($retries < 5) { + try { + return $method(); + } catch (InvalidCredentialsException $e) { + throw $e; + } catch (\Exception $e) { + if ($retries >= 4) { + throw $e; + } + usleep(500); + $retries++; + } + } + } + /** + * Process the given auth code to gain access and refresh token from yandex api + * + * @param string $authCode + * @throws InvalidCredentialsException + * @throws MissingClientConfigException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + public function processAuthCode($authCode) + { + if (!$this->isClientConfigured()) { + throw new MissingClientConfigException(); + } + $accessToken = $this->fetchAccessTokenWithAuthCode($authCode); + $userId = $this->getYandexUserId($accessToken); + $this->addAccount($userId, $accessToken, Piwik::getCurrentUserLogin()); + $userInfo = $this->getUserInfo($userId); + Piwik::postEvent('SearchEngineKeywordsPerformance.AccountAdded', [['provider' => \Piwik\Plugins\SearchEngineKeywordsPerformance\Provider\Yandex::getInstance()->getName(), 'account' => $userInfo['name']]]); + } + /** + * Returns user information for given account id + * + * @param $accountId + * @return array|null + */ + public function getUserInfo($accountId) + { + return $this->configuration->getUserInfo($accountId); + } + /** + * Fetches an access token from Yandex OAuth with the given auth code + * + * @param string $authCode + * @return string + * @throws \Exception + */ + protected function fetchAccessTokenWithAuthCode($authCode) + { + $clientConfig = $this->getClientConfig(); + $response = Http::sendHttpRequestBy( + Http::getTransportMethod(), + 'https://oauth.yandex.com/token', + 2000, + null, + null, + null, + 0, + \false, + \false, + \false, + \false, + 'POST', + $clientConfig['id'], + $clientConfig['secret'], + 'grant_type=authorization_code&code=' . $authCode + ); + $result = json_decode($response, \true); + if (isset($result['error'])) { + throw new \Exception($result['error_description']); + } + if (isset($result['access_token'])) { + return $result['access_token']; + } + throw new \Exception('Unknown Error'); + } + /** + * Returns Yandex OAuth url + * + * @return string + */ + public function createAuthUrl() + { + $clientConfig = $this->getClientConfig(); + return 'https://oauth.yandex.com/authorize?response_type=code&client_id=' . $clientConfig['id']; + } + /** + * Returns connected oauth accounts + * + * @return array + */ + public function getAccounts() + { + return $this->configuration->getAccounts(); + } + /** + * Removes oauth account + * + * @param string $id + * @return boolean + */ + public function removeAccount($id) + { + $userInfo = $this->getUserInfo($id); + $this->configuration->removeAccount($id); + Piwik::postEvent('SearchEngineKeywordsPerformance.AccountRemoved', [['provider' => \Piwik\Plugins\SearchEngineKeywordsPerformance\Provider\Yandex::getInstance()->getName(), 'account' => $userInfo['name']]]); + return \true; + } + /** + * Adds a oauth account + * + * @param string $id + * @param string $config + * @param string $username + * @return boolean + */ + public function addAccount( + $id, + #[\SensitiveParameter] + $accessToken, + $username + ) { + $userInfo = $this->getUserInfoByAccessToken($accessToken); + $config = ['userInfo' => ['picture' => 'https://avatars.yandex.net/get-yapic/' . $userInfo['default_avatar_id'] . '/islands-retina-50', 'name' => $userInfo['display_name']], 'accessToken' => $accessToken]; + $this->configuration->addAccount($id, $config, $username); + return \true; + } + /** + * Fetches user info from Yandex Passport API + * + * @param string $accessToken + * @return mixed + * @throws InvalidCredentialsException + * @throws UnknownAPIException + */ + protected function getUserInfoByAccessToken( + #[\SensitiveParameter] + $accessToken + ) { + $url = 'https://login.yandex.ru/info'; + $response = Http::sendHttpRequestBy(Http::getTransportMethod(), $url, 2000, null, null, null, 0, \false, \false, \false, \false, 'GET', null, null, null, ['Authorization: OAuth ' . $accessToken]); + $result = json_decode($response, \true); + if (isset($result['error'])) { + throw new InvalidCredentialsException($result['error_description'], $result['error']); + } + if (empty($result) || !is_array($result) || !isset($result['display_name'])) { + throw new UnknownAPIException('Unable to receive user information'); + } + return $result; + } + /** + * @param string $accessToken + * @param string $hostId + * @param string $date + * @return mixed + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function getPopularQueries( + #[\SensitiveParameter] + $accessToken, + $hostId, + $date + ) { + return $this->sendApiRequest( + $accessToken, + 'user/' . $this->getYandexUserId($accessToken) . '/hosts/' . $hostId . '/search-queries/popular/', + ['date_from' => date(\DATE_ATOM, $date), 'date_to' => date(\DATE_ATOM, $date + 24 * 3600 - 1), 'order_by' => 'TOTAL_CLICKS', 'query_indicator' => ['TOTAL_CLICKS', 'TOTAL_SHOWS', 'AVG_SHOW_POSITION', 'AVG_CLICK_POSITION'], 'limit' => 500] + ); + } + /** + * @param string $accessToken + * @param string $hostId + * @param string $date + * @return mixed + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function getIndexingHistory( + #[\SensitiveParameter] + $accessToken, + $hostId, + $date + ) { + // note we query a weeks data as otherwise the results might not contain the date we actually want to look at + return $this->sendApiRequest( + $accessToken, + 'user/' . $this->getYandexUserId($accessToken) . '/hosts/' . $hostId . '/indexing/history/', + array('date_from' => date(\DATE_ATOM, $date - 7 * 24 * 3600), 'date_to' => date(\DATE_ATOM, $date + 24 * 3600 - 1)) + ); + } + /** + * @param string $accessToken + * @param string $hostId + * @param string $date + * @return mixed + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function getPagesInIndex( + #[\SensitiveParameter] + $accessToken, + $hostId, + $date + ) { + // note we query a weeks data as otherwise the results might not contain the date we actually want to look at + return $this->sendApiRequest( + $accessToken, + 'user/' . $this->getYandexUserId($accessToken) . '/hosts/' . $hostId . '/search-urls/in-search/history/', + array('date_from' => date(\DATE_ATOM, $date - 7 * 24 * 3600), 'date_to' => date(\DATE_ATOM, $date + 24 * 3600 - 1)) + ); + } + /** + * @param string $accessToken + * @param string $hostId + * @param string $date + * @return mixed + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function getPageChangesInSearch( + #[\SensitiveParameter] + $accessToken, + $hostId, + $date + ) { + // note we query a weeks data as otherwise the results might not contain the date we actually want to look at + return $this->sendApiRequest( + $accessToken, + 'user/' . $this->getYandexUserId($accessToken) . '/hosts/' . $hostId . '/search-urls/events/history/', + array('date_from' => date(\DATE_ATOM, $date - 7 * 24 * 3600), 'date_to' => date(\DATE_ATOM, $date + 24 * 3600 - 1)) + ); + } + /** + * Returns the available hosts for the given access token + * @param string $accessToken + * @return object + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function getHosts( + #[\SensitiveParameter] + $accessToken + ) { + return $this->sendApiRequest($accessToken, 'user/' . $this->getYandexUserId($accessToken) . '/hosts'); + } + /** + * Returns the Yandex User ID for the given access token + * @param string $accessToken + * @return string + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function getYandexUserId( + #[\SensitiveParameter] + $accessToken + ) { + static $userIdByToken = []; + if (!empty($userIdByToken[$accessToken])) { + return $userIdByToken[$accessToken]; + } + $result = $this->sendApiRequest($accessToken, 'user'); + if (!empty($result->user_id)) { + $userIdByToken[$accessToken] = $result->user_id; + return $userIdByToken[$accessToken]; + } + throw new InvalidCredentialsException('Unable to find user ID'); + } + /** + * @param string $accessToken + * @param string $method + * @param array $params + * @return mixed + * @throws InvalidCredentialsException + * @throws RateLimitApiException + * @throws UnknownAPIException + */ + protected function sendApiRequest( + #[\SensitiveParameter] + $accessToken, + $method, + $params = [] + ) { + $urlParams = []; + foreach ($params as $name => $value) { + if (is_array($value)) { + foreach ($value as $val) { + $urlParams[] = $name . '=' . urlencode($val); + } + continue; + } + $urlParams[] = $name . '=' . urlencode($value); + } + $url = $this->baseAPIUrl . $method . '?' . implode('&', $urlParams); + $additionalHeaders = ['Authorization: OAuth ' . $accessToken, 'Accept: application/json', 'Content-type: application/json']; + $response = Http::sendHttpRequestBy( + Http::getTransportMethod(), + $url, + $timeout = 60, + $userAgent = null, + $destinationPath = null, + $file = null, + $followDepth = 0, + $acceptLanguage = \false, + $acceptInvalidSslCertificate = \false, + $byteRange = \false, + $getExtendedInfo = \true, + $httpMethod = 'GET', + $httpUsername = '', + $httpPassword = '', + $requestBody = null, + $additionalHeaders + ); + if (empty($response['data'])) { + throw new \Exception('Yandex API returned no data: ' . var_export($response, \true)); + } + $data = json_decode($response['data'], \false, 512, \JSON_BIGINT_AS_STRING); + if (!empty($data->error_code)) { + switch ($data->error_code) { + case 'INVALID_OAUTH_TOKEN': + case 'INVALID_USER_ID': + throw new InvalidCredentialsException($data->error_message, (int) $data->error_code); + case 'QUOTA_EXCEEDED': + case 'TOO_MANY_REQUESTS_ERROR': + throw new RateLimitApiException($data->error_message, (int) $data->error_code); + } + throw new UnknownAPIException($data->error_message, (int) $data->error_code); + } + return $data; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Columns/Keyword.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Columns/Keyword.php new file mode 100644 index 0000000..8745447 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Columns/Keyword.php @@ -0,0 +1,28 @@ +setName('searchengines:import-bing')->setDescription('Imports Bing Keywords')->addNoValueOption('force', 'f', 'Force reimport for data')->addRequiredValueOption('idsite', '', 'Site id'); + } + /** + * @return int + */ + protected function doExecute(): int + { + $input = $this->getInput(); + $output = $this->getOutput(); + $output->writeln("Starting to import Bing Keywords"); + $start = microtime(\true); + $idSite = $input->getOption('idsite'); + $setting = new MeasurableSettings($idSite); + $bingSiteUrl = $setting->bingSiteUrl; + if (!$bingSiteUrl || !$bingSiteUrl->getValue()) { + $output->writeln("Site with ID {$idSite} not configured for Bing Import"); + } + $importer = new Bing($idSite, $input->hasOption('force')); + $importer->importAllAvailableData(); + $output->writeln("Finished in " . round(microtime(\true) - $start, 3) . "s"); + return self::SUCCESS; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Commands/ImportGoogle.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Commands/ImportGoogle.php new file mode 100644 index 0000000..0f59541 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Commands/ImportGoogle.php @@ -0,0 +1,55 @@ +setName('searchengines:import-google')->setDescription('Imports Google Keywords') + ->addNoValueOption('force', 'f', 'Force reimport for data') + ->addRequiredValueOption('idsite', '', 'Site id') + ->addOptionalValueOption('date', 'd', 'specific date'); + } + /** + * @return int + */ + protected function doExecute(): int + { + $input = $this->getInput(); + $output = $this->getOutput(); + $output->writeln("Starting to import Google Keywords"); + $start = microtime(\true); + $idSite = $input->getOption('idsite'); + $setting = new MeasurableSettings($idSite); + $searchConsoleUrl = $setting->googleSearchConsoleUrl; + if (!$searchConsoleUrl || !$searchConsoleUrl->getValue()) { + $output->writeln("Site with ID {$idSite} not configured for Google Import"); + } + $importer = new Google($idSite, $input->getOption('force')); + $date = $input->getOption('date') ? $input->getOption('date') : null; + $importer->importAllAvailableData($date); + $output->writeln("Finished in " . round(microtime(\true) - $start, 3) . "s"); + return self::SUCCESS; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Commands/ImportYandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Commands/ImportYandex.php new file mode 100644 index 0000000..f8d243e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Commands/ImportYandex.php @@ -0,0 +1,55 @@ +setName('searchengines:import-yandex')->setDescription('Imports Yandex Keywords') + ->addNoValueOption('force', 'f', 'Force reimport for data') + ->addRequiredValueOption('idsite', '', 'Site id') + ->addOptionalValueOption('date', 'd', 'specific date'); + } + /** + * @return int + */ + protected function doExecute(): int + { + $input = $this->getInput(); + $output = $this->getOutput(); + $output->writeln("Starting to import Yandex Keywords"); + $start = microtime(\true); + $idSite = $input->getOption('idsite'); + $setting = new MeasurableSettings($idSite); + $yandexSiteUrl = $setting->yandexAccountAndHostId; + if (!$yandexSiteUrl || !$yandexSiteUrl->getValue()) { + $output->writeln("Site with ID {$idSite} not configured for Yandex Import"); + } + $importer = new Yandex($idSite, $input->hasOption('force')); + $date = $input->hasOption('date') ? $input->getOption('date') : 100; + $importer->importAllAvailableData($date); + $output->writeln("Finished in " . round(microtime(\true) - $start, 3) . "s"); + return self::SUCCESS; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Controller.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Controller.php new file mode 100644 index 0000000..ee30156 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Controller.php @@ -0,0 +1,1125 @@ +showNotificationIfNoWebsiteConfigured($provider); + } + SearchEngineKeywordsPerformance::displayNotificationIfRecentApiErrorsExist($viewVariables['providers']); + + $viewVariables['providers'] = array_map(function (ProviderAbstract $provider) { + return $this->toProviderArray($provider); + }, $viewVariables['providers']); + + return $this->renderTemplate('index', $viewVariables); + } + + private function toProviderArray(ProviderAbstract $provider) + { + return [ + 'id' => $provider->getId(), + 'is_configured' => $provider->isConfigured(), + 'configured_site_ids' => $provider->getConfiguredSiteIds(), + 'problems' => $provider->getConfigurationProblems(), + 'is_experimental' => $provider->isExperimental(), + 'logos' => $provider->getLogoUrls(), + 'name' => $provider->getName(), + 'description' => $provider->getDescription(), + 'note' => $provider->getNote(), + ]; + } + + private function showNotificationIfNoWebsiteConfigured(ProviderAbstract $provider) + { + if (!$provider->isConfigured()) { + return; + } + + if (count($provider->getConfiguredSiteIds()) == 0) { + $notification = new Notification(Piwik::translate( + 'SearchEngineKeywordsPerformance_NoWebsiteConfiguredWarning', + $provider->getName() + )); + $notification->context = Notification::CONTEXT_WARNING; + Notification\Manager::notify($provider->getId() . 'nowebsites', $notification); + } + + $errors = $provider->getConfigurationProblems(); + + if (count($errors['sites'])) { + $notification = new Notification(Piwik::translate( + 'SearchEngineKeywordsPerformance_ProviderXSitesWarning', + [$provider->getName()] + )); + $notification->context = Notification::CONTEXT_WARNING; + $notification->raw = true; + Notification\Manager::notify($provider->getId() . 'siteswarning', $notification); + } + + if (count($errors['accounts'])) { + $notification = new Notification(Piwik::translate( + 'SearchEngineKeywordsPerformance_ProviderXAccountWarning', + [$provider->getName()] + )); + $notification->context = Notification::CONTEXT_WARNING; + $notification->raw = true; + Notification\Manager::notify($provider->getId() . 'accountwarning', $notification); + } + } + + private function getCurrentSite() + { + if ($this->site instanceof Site) { + return ['id' => $this->site->getId(), 'name' => $this->site->getName()]; + } + + $sites = Request::processRequest('SitesManager.getSitesWithAdminAccess', [], []); + + if (!empty($sites[0])) { + return ['id' => $sites[0]['idsite'], 'name' => $sites[0]['name']]; + } + + return []; + } + + /***************************************************************************************** + * Configuration actions for Google provider + */ + + /** + * Show Google configuration page + * + * @param bool $hasOAuthError indicates if a oAuth access error occurred + * @return string + */ + public function configureGoogle($hasOAuthError = false) + { + Piwik::checkUserHasSomeAdminAccess(); + + $configSaved = $this->configureGoogleClientIfProvided(); + if (false === $configSaved) { + $notification = new Notification(Piwik::translate('SearchEngineKeywordsPerformance_ClientConfigSaveError')); + $notification->context = Notification::CONTEXT_ERROR; + Notification\Manager::notify('clientConfigSaved', $notification); + } + + $errorMessage = Common::getRequestVar('error', ''); + if (!empty($errorMessage)) { + if ($errorMessage === 'access_denied') { + $errorMessage = Piwik::translate('SearchEngineKeywordsPerformance_OauthFailedMessage'); + } elseif ($errorMessage === 'jwt_validation_error') { + $errorMessage = Piwik::translate('General_ExceptionSecurityCheckFailed'); + } + $notification = new Notification($errorMessage); + $notification->context = Notification::CONTEXT_ERROR; + $notification->type = Notification::TYPE_TRANSIENT; + Notification\Manager::notify('configureerror', $notification); + } + + $googleClient = ProviderGoogle::getInstance()->getClient(); + $clientConfigured = true; + + try { + $googleClient->getConfiguredClient(''); + } catch (MissingClientConfigException $e) { + $clientConfigured = false; + } catch (MissingOAuthConfigException $e) { + // ignore missing accounts + } catch (\Exception $e) { + // Catch any general exceptions because they likely won't be recoverable. Delete the config so that they can try again + // If we don't delete the config, the customer won't have any way to fix the issue + $googleClient->deleteClientConfig(); + + // Make sure we cancel the success notification because that could confuse the customer since things failed + Notification\Manager::cancel('clientConfigSaved'); + + // Mark the client as not configured and notify the user that something is wrong with the configuration + $clientConfigured = false; + $notification = new Notification($e->getMessage()); + $notification->context = Notification::CONTEXT_ERROR; + $notification->type = Notification::TYPE_TRANSIENT; + Notification\Manager::notify('configureerror', $notification); + } + + $this->addGoogleSiteConfigIfProvided(); + $this->removeGoogleSiteConfigIfProvided(); + $this->removeGoogleAccountIfProvided(); + + $urlOptions = []; + $accounts = $googleClient->getAccounts(); + $countOfAccountsWithAccess = 0; + + foreach ($accounts as $id => &$account) { + $userInfo = $googleClient->getUserInfo($id); + $urls = $googleClient->getAvailableUrls($id, false); + $account['picture'] = $userInfo['picture']; + $account['name'] = $userInfo['name']; + $account['urls'] = $urls; + $account['hasAccess'] = Piwik::hasUserSuperUserAccessOrIsTheUser($account['username']); + if ($account['hasAccess']) { + ++$countOfAccountsWithAccess; + } + $account['created_formatted'] = Date::factory(date( + 'Y-m-d', + $account['created'] + ))->getLocalized(Date::DATE_FORMAT_LONG); + try { + $googleClient->testConfiguration($id); + } catch (\Exception $e) { + $account['hasError'] = $e->getMessage(); + } + + if ($account['hasAccess']) { + foreach ($googleClient->getAvailableUrls($id) as $url => $status) { + $urlOptions[$id . '##' . $url] = $url . ' (' . $account['name'] . ')'; + } + } + } + + $isClientConfigurable = StaticContainer::get('SearchEngineKeywordsPerformance.Google.isClientConfigurable'); + + $viewVariables = []; + $viewVariables['isConfigured'] = $googleClient->isConfigured(); + $viewVariables['clientId'] = $googleClient->getClientId(); + $viewVariables['auth_nonce'] = Nonce::getNonce('SEKP.google.auth'); + $viewVariables['clientSecret'] = preg_replace('/\w/', '*', $googleClient->getClientSecret() ?? ''); + $viewVariables['isClientConfigured'] = $clientConfigured; + $viewVariables['isClientConfigurable'] = $isClientConfigurable; + $viewVariables['isOAuthConfigured'] = count($accounts) > 0; + $viewVariables['accounts'] = $accounts; + $viewVariables['urlOptions'] = $urlOptions; + $viewVariables['hasOAuthError'] = $hasOAuthError; + $viewVariables['configuredMeasurables'] = ProviderGoogle::getInstance()->getConfiguredSiteIds(); + $viewVariables['nonce'] = Nonce::getNonce('SEKP.google.config'); + $viewVariables['sitesInfos'] = []; + $viewVariables['currentSite'] = $this->getCurrentSite(); + $viewVariables['countOfAccountsWithAccess'] = $countOfAccountsWithAccess; + $viewVariables['addGoogleSiteConfigNonce'] = Nonce::getNonce(self::GOOGLE_ADD_SITE_CONFIG_NONCE_KEY); + $viewVariables['removeGoogleSiteConfigNonce'] = Nonce::getNonce(self::GOOGLE_REMOVE_SITE_CONFIG_NONCE_KEY); + $viewVariables['removeGoogleAccountNonce'] = Nonce::getNonce(self::GOOGLE_REMOVE_ACCOUNT_NONCE_KEY); + + $siteIds = $viewVariables['configuredMeasurables']; + + foreach ($siteIds as $siteId => $config) { + $googleSiteUrl = $config['googleSearchConsoleUrl']; + $viewVariables['sitesInfos'][$siteId] = Site::getSite($siteId); + $lastRun = Option::get('GoogleImporterTask_LastRun_' . $siteId); + + if ($lastRun) { + $lastRun = date('Y-m-d H:i', $lastRun) . ' UTC'; + } else { + $lastRun = Piwik::translate('General_Never'); + } + + $viewVariables['sitesInfos'][$siteId]['lastRun'] = $lastRun; + + [$accountId, $url] = explode('##', $googleSiteUrl); + + try { + $viewVariables['sitesInfos'][$siteId]['accountValid'] = $googleClient->testConfiguration($accountId); + } catch (\Exception $e) { + $viewVariables['sitesInfos'][$siteId]['accountValid'] = false; + } + + $urls = $googleClient->getAvailableUrls($accountId); + + $viewVariables['sitesInfos'][$siteId]['urlValid'] = key_exists($url, $urls); + } + + if (!empty($this->securityPolicy)) { + $this->securityPolicy->addPolicy('img-src', '*.googleusercontent.com'); + } + + $configureConnectionProps = []; + $configureConnectionProps['baseUrl'] = Url::getCurrentUrlWithoutQueryString(); + $configureConnectionProps['baseDomain'] = Url::getCurrentScheme() . '://' . Url::getCurrentHost(); + $configureConnectionProps['manualConfigNonce'] = $viewVariables['nonce']; + $configureConnectionProps['primaryText'] = Piwik::translate('SearchEngineKeywordsPerformance_ConfigureTheImporterLabel1'); + + // There are certain cases where index.php isn't part of the baseUrl when it should be. Append it if missing. + if (stripos($configureConnectionProps['baseUrl'], 'index.php') === false) { + $configureConnectionProps['baseUrl'] .= 'index.php'; + } + + $isConnectAccountsActivated = Manager::getInstance()->isPluginActivated('ConnectAccounts'); + $authBaseUrl = $isConnectAccountsActivated ? "https://" . StaticContainer::get('CloudAccountsInstanceId') . '/index.php?' : ''; + $jwt = Common::getRequestVar('state', '', 'string'); + if (empty($jwt) && Piwik::hasUserSuperUserAccess() && $isConnectAccountsActivated) { + // verify an existing user by supplying a jwt too + $jwt = ConnectHelper::buildOAuthStateJwt( + SettingsPiwik::getPiwikInstanceId(), + ConnectAccounts::INITIATED_BY_SEK + ); + } + $googleAuthUrl = ''; + if ($isConnectAccountsActivated) { + $strategyName = GoogleSearchConnect::getStrategyName(); + $googleAuthUrl = $authBaseUrl . Http::buildQuery([ + 'module' => 'ConnectAccounts', + 'action' => 'initiateOauth', + 'state' => $jwt, + 'strategy' => $strategyName + ]); + $configureConnectionProps['strategy'] = $strategyName; + $configureConnectionProps['connectedWith'] = 'Google'; + $configureConnectionProps['unlinkUrl'] = Url::getCurrentUrlWithoutQueryString() . '?' . Http::buildQuery([ + 'module' => 'ConnectAccounts', + 'action' => 'unlink', + 'nonce' => ConnectHelper::getUnlinkNonce(), + 'strategy' => $strategyName + ]); + $configureConnectionProps['authUrl'] = $googleAuthUrl; + $configureConnectionProps['connectAccountsUrl'] = $googleAuthUrl; + $configureConnectionProps['connectAccountsBtnText'] = Piwik::translate('ConnectAccounts_ConnectWithGoogleText'); + } + + $configureConnectionProps['isConnectAccountsActivated'] = $isConnectAccountsActivated; + if ($isConnectAccountsActivated) { + $configureConnectionProps['radioOptions'] = [ + 'connectAccounts' => Piwik::translate('SearchEngineKeywordsPerformance_OptionQuickConnectWithGoogle'), + 'manual' => Piwik::translate('ConnectAccounts_OptionAdvancedConnectWithGa'), + ]; + } + $configureConnectionProps['googleAuthUrl'] = $googleAuthUrl; + $faqUrl = Url::addCampaignParametersToMatomoLink('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-search-console-and-verify-your-website'); + $faqAnchorOpen = ""; + $configureConnectionProps['manualConfigText'] = Piwik::translate('SearchEngineKeywordsPerformance_ConfigureTheImporterLabel2') + . '
' . Piwik::translate('SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3', [ + $faqAnchorOpen, + '
', + ]) . '

' . Piwik::translate('SearchEngineKeywordsPerformance_OAuthExampleText') + . '
' . Piwik::translate('SearchEngineKeywordsPerformance_GoogleAuthorizedJavaScriptOrigin') + . ": {$configureConnectionProps['baseDomain']}
" + . Piwik::translate('SearchEngineKeywordsPerformance_GoogleAuthorizedRedirectUri') + . ": {$configureConnectionProps['baseUrl']}?module=SearchEngineKeywordsPerformance&action=processAuthCode"; + + $viewVariables['configureConnectionProps'] = $configureConnectionProps; + $viewVariables['extensions'] = self::getComponentExtensions(); + $viewVariables['removeConfigUrl'] = Url::getCurrentQueryStringWithParametersModified([ 'action' => 'removeGoogleClientConfig' ]); + + return $this->renderTemplate('google\configuration', $viewVariables); + } + + /** + * Save Google client configuration if set in request + * + * @return bool|null bool on success or failure, null if not data present in request + */ + protected function configureGoogleClientIfProvided() + { + $googleClient = ProviderGoogle::getInstance()->getClient(); + + $config = Common::getRequestVar('client', ''); + + if (empty($config) && !empty($_FILES['clientfile'])) { + if (!empty($_FILES['clientfile']['error'])) { + return false; + } + + $file = $_FILES['clientfile']['tmp_name']; + if (!file_exists($file)) { + return false; + } + + $config = file_get_contents($_FILES['clientfile']['tmp_name']); + } + + if (!empty($config)) { + Nonce::checkNonce('SEKP.google.config', Common::getRequestVar('config_nonce')); + try { + $config = Common::unsanitizeInputValue($config); + $saveResult = $googleClient->setClientConfig($config); + if (!$saveResult) { + return false; + } + + // Show success notification + $notification = new Notification(Piwik::translate('SearchEngineKeywordsPerformance_ClientConfigImported')); + $notification->context = Notification::CONTEXT_SUCCESS; + Notification\Manager::notify('clientConfigSaved', $notification); + + // Redirect so that it's the correct URL and doesn't try to resubmit the form if the customer refreshes + Url::redirectToUrl(Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified([ + 'action' => 'configureGoogle', + 'code' => null, + 'scope' => null, + 'state' => null, + 'error' => null, + ])); + } catch (\Exception $e) { + return false; + } + } + + return null; + } + + /** + * Save google configuration for a site if given in request + */ + protected function addGoogleSiteConfigIfProvided() + { + $googleSiteId = Common::getRequestVar('googleSiteId', ''); + $googleAccountAndUrl = Common::getRequestVar('googleAccountAndUrl', ''); + $googleTypes = explode(',', Common::getRequestVar('googleTypes', '')); + + if (!empty($googleSiteId) && !empty($googleAccountAndUrl)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::GOOGLE_ADD_SITE_CONFIG_NONCE_KEY, $request->getStringParameter('addSiteConfigNonce', '')); + // Do not allow to configure websites with unsupported type or force enabled config + if (SearchEngineKeywordsPerformance::isGoogleForceEnabled($googleSiteId) || WebsiteMeasurableType::ID !== Site::getTypeFor($googleSiteId)) { + $notification = new Notification( + Piwik::translate('SearchEngineKeywordsPerformance_WebsiteTypeUnsupported', [ + Site::getNameFor($googleSiteId) + ]) + ); + + if (class_exists('\Piwik\Plugins\RollUpReporting\Type') && \Piwik\Plugins\RollUpReporting\Type::ID === Site::getTypeFor($googleSiteId)) { + $notification->message .= '
' . Piwik::translate('SearchEngineKeywordsPerformance_WebsiteTypeUnsupportedRollUp'); + } + + $notification->context = Notification::CONTEXT_ERROR; + $notification->raw = true; + $notification->flags = Notification::FLAG_CLEAR; + Notification\Manager::notify('websiteNotConfigurable', $notification); + + return; + } + + $measurableSettings = new MeasurableSettings($googleSiteId); + $measurableSettings->googleConfigCreatedBy->setValue(Piwik::getCurrentUserLogin()); + + //Need to explicitly setIsWritableByCurrentUser=true, since it can be set as false when we instantiate MeasurableSettings object due to previously added by another user + $measurableSettings->googleSearchConsoleUrl->setIsWritableByCurrentUser(true); + $measurableSettings->googleWebKeywords->setIsWritableByCurrentUser(true); + $measurableSettings->googleImageKeywords->setIsWritableByCurrentUser(true); + $measurableSettings->googleNewsKeywords->setIsWritableByCurrentUser(true); + $measurableSettings->googleVideoKeywords->setIsWritableByCurrentUser(true); + + $measurableSettings->googleSearchConsoleUrl->setValue($googleAccountAndUrl); + $measurableSettings->googleWebKeywords->setValue(in_array('web', $googleTypes)); + $measurableSettings->googleImageKeywords->setValue(in_array('image', $googleTypes)); + $measurableSettings->googleNewsKeywords->setValue(in_array('news', $googleTypes)); + $measurableSettings->googleVideoKeywords->setValue(in_array('video', $googleTypes)); + $measurableSettings->save(); + + $notification = new Notification( + Piwik::translate('SearchEngineKeywordsPerformance_WebsiteSuccessfulConfigured', [ + Site::getNameFor($googleSiteId), + '', + '' + ]) + ); + $notification->context = Notification::CONTEXT_SUCCESS; + $notification->raw = true; + $notification->flags = Notification::FLAG_CLEAR; + Notification\Manager::notify('websiteConfigured', $notification); + } + } + + /** + * Removes a Google account if `remove` param is given in request + */ + protected function removeGoogleAccountIfProvided() + { + $remove = Common::getRequestVar('remove', ''); + + if (!empty($remove)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::GOOGLE_REMOVE_ACCOUNT_NONCE_KEY, $request->getStringParameter('removeAccountNonce', '')); + ProviderGoogle::getInstance()->getClient()->removeAccount($remove); + + $sitesWithConfig = ProviderGoogle::getInstance()->getConfiguredSiteIds(); + foreach ($sitesWithConfig as $siteId => $siteConfig) { + $googleSetting = explode('##', $siteConfig['googleSearchConsoleUrl']); + if (!empty($googleSetting[0]) && $googleSetting[0] == $remove) { + $config = new MeasurableSettings($siteId); + $config->googleSearchConsoleUrl->setValue('0'); + $config->save(); + } + } + } + } + + /** + * Removes a Google site config if `removeConfig` param is given in request + */ + protected function removeGoogleSiteConfigIfProvided() + { + $removeConfig = Common::getRequestVar('removeConfig', ''); + + if (!empty($removeConfig)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::GOOGLE_REMOVE_SITE_CONFIG_NONCE_KEY, $request->getStringParameter('removeSiteConfigNonce', '')); + $measurableSettings = new MeasurableSettings($removeConfig); + $measurableSettings->googleSearchConsoleUrl->setValue('0'); + $measurableSettings->save(); + } + } + + /** + * Delete the Google client config option so that the customer will be prompted to upload a new one or use the Cloud + * config. Then refresh the page so show the change. + */ + public function removeGoogleClientConfig() + { + Piwik::checkUserHasSuperUserAccess(); + + Nonce::checkNonce('SEKP.google.config', Common::getRequestVar('config_nonce')); + + ProviderGoogle::getInstance()->getClient()->deleteClientConfig(); + + Url::redirectToUrl(Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified([ + 'action' => 'configureGoogle', + 'code' => null, + 'scope' => null, + 'state' => null, + 'error' => null, + ])); + } + + public function forwardToAuth() + { + Piwik::checkUserHasSomeAdminAccess(); + + Nonce::checkNonce('SEKP.google.auth', Common::getRequestVar('auth_nonce')); + + $client = ProviderGoogle::getInstance()->getClient(); + $state = Nonce::getNonce(self::OAUTH_STATE_NONCE_NAME, 900); + + Url::redirectToUrl($client->createAuthUrl($state)); + } + + protected function getSession() + { + return new SessionNamespace('searchperformance'); + } + + /** + * Processes the response from google oauth service + * + * @return string + * @throws \Exception + */ + public function processAuthCode() + { + Piwik::checkUserHasSomeAdminAccess(); + + $error = Common::getRequestVar('error', ''); + $oauthCode = Common::getRequestVar('code', ''); + + if (!$error) { + $state = Common::getRequestVar('state'); + if ($state && !empty($_SERVER['HTTP_REFERER']) && stripos($_SERVER['HTTP_REFERER'], 'https://accounts.google.') === 0) { + //We need tp update this, else it will fail for referer like https://accounts.google.co.in + $_SERVER['HTTP_REFERER'] = 'https://accounts.google.com'; + } + try { + Nonce::checkNonce(static::OAUTH_STATE_NONCE_NAME, $state, defined('PIWIK_TEST_MODE') ? null : 'google.com'); + } catch (\Exception $ex) { + $error = $ex->getMessage(); + } + } + + if ($error) { + return $this->configureGoogle(true); + } + + try { + ProviderGoogle::getInstance()->getClient()->processAuthCode($oauthCode); + } catch (\Exception $e) { + return $this->configureGoogle($e->getMessage()); + } + + // we need idSite in the url to display all the menus like Conversion Import after redirect + $siteInfo = $this->getCurrentSite(); + // reload index action to prove everything is configured + Url::redirectToUrl(Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified([ + 'action' => 'configureGoogle', + 'idSite' => (isset($siteInfo['id']) ? $siteInfo['id'] : 0), + 'code' => null, + 'scope' => null, + 'state' => null + ])); + } + /****************************************************************************************** + *****************************************************************************************/ + + /***************************************************************************************** + ***************************************************************************************** + * Configuration actions for Bing provider + */ + + /** + * Show configuration page for Bing + * + * @return string + */ + public function configureBing() + { + Piwik::checkUserHasSomeAdminAccess(); + + $viewVariables = []; + $viewVariables['apikey'] = ''; + $bingClient = ProviderBing::getInstance()->getClient(); + + $apiKey = Common::getRequestVar('apikey', ''); + + if (!empty($apiKey)) { + Nonce::checkNonce('SEKP.bing.config', Common::getRequestVar('config_nonce')); + try { + $bingClient->testConfiguration($apiKey); + $bingClient->addAccount($apiKey, Piwik::getCurrentUserLogin()); + } catch (\Exception $e) { + $viewVariables['error'] = $e->getMessage(); + $viewVariables['apikey'] = $apiKey; + } + } + + $this->addBingSiteConfigIfProvided(); + $this->removeBingSiteConfigIfProvided(); + $this->removeBingAccountIfProvided(); + + $urlOptions = []; + $accounts = $bingClient->getAccounts(); + $countOfAccountsWithAccess = 0; + foreach ($accounts as &$account) { + $account['urls'] = []; + $account['created_formatted'] = Date::factory(date( + 'Y-m-d', + $account['created'] + ))->getLocalized(Date::DATE_FORMAT_LONG); + $account['hasAccess'] = Piwik::hasUserSuperUserAccessOrIsTheUser($account['username']); + if ($account['hasAccess']) { + ++$countOfAccountsWithAccess; + } + try { + $bingClient->testConfiguration($account['apiKey']); + } catch (\Exception $e) { + $account['hasError'] = $e->getMessage(); + continue; + } + + $account['urls'] = $bingClient->getAvailableUrls($account['apiKey'], false); + + if ($account['hasAccess']) { + foreach ($bingClient->getAvailableUrls($account['apiKey']) as $url => $status) { + $urlOptions[$account['apiKey'] . '##' . $url] = $url . ' (' . substr( + $account['apiKey'], + 0, + 5 + ) . '*****' . substr($account['apiKey'], -5, 5) . ')'; + } + } + } + + $viewVariables['nonce'] = Nonce::getNonce('SEKP.bing.config'); + $viewVariables['accounts'] = $accounts; + $viewVariables['urlOptions'] = $urlOptions; + $viewVariables['configuredMeasurables'] = ProviderBing::getInstance()->getConfiguredSiteIds(); + $viewVariables['sitesInfos'] = []; + $viewVariables['currentSite'] = $this->getCurrentSite(); + $viewVariables['countOfAccountsWithAccess'] = $countOfAccountsWithAccess; + $viewVariables['addBingSiteConfigNonce'] = Nonce::getNonce(self::BING_ADD_SITE_CONFIG_NONCE_KEY); + $viewVariables['removeBingSiteConfigNonce'] = Nonce::getNonce(self::BING_REMOVE_SITE_CONFIG_NONCE_KEY); + $viewVariables['removeBingAccountNonce'] = Nonce::getNonce(self::BING_REMOVE_ACCOUNT_NONCE_KEY); + + $siteIds = $viewVariables['configuredMeasurables']; + + foreach ($siteIds as $siteId => $config) { + $viewVariables['sitesInfos'][$siteId] = Site::getSite($siteId); + $lastRun = Option::get('BingImporterTask_LastRun_' . $siteId); + + if ($lastRun) { + $lastRun = date('Y-m-d H:i', $lastRun) . ' UTC'; + } else { + $lastRun = Piwik::translate('General_Never'); + } + + $viewVariables['sitesInfos'][$siteId]['lastRun'] = $lastRun; + + $bingSiteUrl = $config['bingSiteUrl']; + [$apiKey, $url] = explode('##', $bingSiteUrl); + + try { + $viewVariables['sitesInfos'][$siteId]['accountValid'] = $bingClient->testConfiguration($apiKey); + } catch (\Exception $e) { + $viewVariables['sitesInfos'][$siteId]['accountValid'] = false; + } + + $urls = $bingClient->getAvailableUrls($apiKey); + + $viewVariables['sitesInfos'][$siteId]['urlValid'] = key_exists($url, $urls); + } + + return $this->renderTemplate('bing\configuration', $viewVariables); + } + + /** + * Save Bing configuration for a site if given in request + */ + protected function addBingSiteConfigIfProvided() + { + $bingSiteId = Common::getRequestVar('bingSiteId', ''); + $bingAccountAndUrl = Common::getRequestVar('bingAccountAndUrl', ''); + + if (!empty($bingSiteId) && !empty($bingAccountAndUrl)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::BING_ADD_SITE_CONFIG_NONCE_KEY, $request->getStringParameter('addSiteConfigNonce', '')); + // Do not allow to configure websites with unsupported type or force enabled config + if (SearchEngineKeywordsPerformance::isBingForceEnabled($bingSiteId) || WebsiteMeasurableType::ID !== Site::getTypeFor($bingSiteId)) { + $notification = new Notification( + Piwik::translate('SearchEngineKeywordsPerformance_WebsiteTypeUnsupported', [ + Site::getNameFor($bingSiteId) + ]) + ); + + if (class_exists('\Piwik\Plugins\RollUpReporting\Type') && \Piwik\Plugins\RollUpReporting\Type::ID === Site::getTypeFor($bingSiteId)) { + $notification->message .= '
' . Piwik::translate('SearchEngineKeywordsPerformance_WebsiteTypeUnsupportedRollUp'); + } + + $notification->context = Notification::CONTEXT_ERROR; + $notification->raw = true; + $notification->flags = Notification::FLAG_CLEAR; + Notification\Manager::notify('websiteNotConfigurable', $notification); + + return; + } + + $measurableSettings = new MeasurableSettings($bingSiteId); + $measurableSettings->bingConfigCreatedBy->setValue(Piwik::getCurrentUserLogin()); + + //Need to explicitly setIsWritableByCurrentUser=true, since it can be set as false when we instantiate MeasurableSettings object due to previously added by another user + $measurableSettings->bingSiteUrl->setIsWritableByCurrentUser(true); + + $measurableSettings->bingSiteUrl->setValue($bingAccountAndUrl); + $measurableSettings->save(); + + $notification = new Notification( + Piwik::translate('SearchEngineKeywordsPerformance_WebsiteSuccessfulConfigured', [ + Site::getNameFor($bingSiteId), + '', + '' + ]) + ); + $notification->context = Notification::CONTEXT_SUCCESS; + $notification->raw = true; + $notification->flags = Notification::FLAG_CLEAR; + Notification\Manager::notify('websiteConfigured', $notification); + } + } + + /** + * Removes a Bing account if `remove` param is given in request + */ + protected function removeBingAccountIfProvided() + { + $remove = Common::getRequestVar('remove', ''); + + if (!empty($remove)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::BING_REMOVE_ACCOUNT_NONCE_KEY, $request->getStringParameter('removeAccountNonce', '')); + ProviderBing::getInstance()->getClient()->removeAccount($remove); + + $sitesWithConfig = ProviderBing::getInstance()->getConfiguredSiteIds(); + foreach ($sitesWithConfig as $siteId => $siteConfig) { + $bingSetting = explode('##', $siteConfig['bingSiteUrl']); + if (!empty($bingSetting[0]) && $bingSetting[0] == $remove) { + $config = new MeasurableSettings($siteId); + $config->bingSiteUrl->setValue('0'); + $config->save(); + } + } + } + } + + /** + * Removes a Bing site config if `removeConfig` param is given in request + */ + protected function removeBingSiteConfigIfProvided() + { + $removeConfig = Common::getRequestVar('removeConfig', ''); + + if (!empty($removeConfig)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::BING_REMOVE_SITE_CONFIG_NONCE_KEY, $request->getStringParameter('removeSiteConfigNonce', '')); + $measurableSettings = new MeasurableSettings($removeConfig); + $measurableSettings->bingSiteUrl->setValue('0'); + $measurableSettings->save(); + } + } + /****************************************************************************************** + *****************************************************************************************/ + + + /***************************************************************************************** + ***************************************************************************************** + * Configuration actions for Yandex provider + */ + + /** + * Show Yandex configuration page + * + * @param bool $hasOAuthError indicates if a oAuth access error occurred + * @return string + */ + public function configureYandex($hasOAuthError = false) + { + Piwik::checkUserHasSomeAdminAccess(); + + $configSaved = $this->configureYandexClientIfProvided(); + + if (true === $configSaved) { + $notification = new Notification(Piwik::translate('SearchEngineKeywordsPerformance_ClientConfigImported')); + $notification->context = Notification::CONTEXT_SUCCESS; + Notification\Manager::notify('clientConfigSaved', $notification); + } elseif (false === $configSaved) { + $notification = new Notification(Piwik::translate('SearchEngineKeywordsPerformance_ClientConfigSaveError')); + $notification->context = Notification::CONTEXT_ERROR; + Notification\Manager::notify('clientConfigSaved', $notification); + } + + $yandexClient = ProviderYandex::getInstance()->getClient(); + $clientConfigured = $yandexClient->isClientConfigured(); + + $this->addYandexSiteConfigIfProvided(); + $this->removeYandexSiteConfigIfProvided(); + $this->removeYandexAccountIfProvided(); + + $urlOptions = []; + $accounts = $yandexClient->getAccounts(); + $countOfAccountsWithAccess = 0; + + foreach ($accounts as $id => &$account) { + $userInfo = $yandexClient->getUserInfo($id); + $account['urls'] = []; + $account['picture'] = $userInfo['picture']; + $account['name'] = $userInfo['name']; + $account['created_formatted'] = Date::factory(date( + 'Y-m-d', + $account['created'] + ))->getLocalized(Date::DATE_FORMAT_LONG); + $account['authDaysAgo'] = floor((time() - $account['created']) / (3600 * 24)); + $account['hasAccess'] = Piwik::hasUserSuperUserAccessOrIsTheUser($account['username']); + if ($account['hasAccess']) { + ++$countOfAccountsWithAccess; + } + + try { + $yandexClient->testConfiguration($id); + } catch (\Exception $e) { + $account['hasError'] = $e->getMessage(); + continue; + } + + $account['urls'] = $yandexClient->getAvailableUrls($id, false); + + if ($account['hasAccess']) { + foreach ($yandexClient->getAvailableUrls($id) as $url => $hostData) { + $urlOptions[$id . '##' . $hostData['host_id']] = $url . ' (' . $account['name'] . ')'; + } + } + } + + $clientConfig = $yandexClient->getClientConfig(); + $viewVariables = []; + $viewVariables['isConfigured'] = $yandexClient->isConfigured(); + $viewVariables['auth_nonce'] = Nonce::getNonce('SEKP.yandex.auth'); + $viewVariables['clientId'] = isset($clientConfig['id']) ? $clientConfig['id'] : ''; + $viewVariables['clientSecret'] = preg_replace('/\w/', '*', isset($clientConfig['secret']) ? $clientConfig['secret'] : ''); + $viewVariables['isClientConfigured'] = $clientConfigured; + $viewVariables['isOAuthConfigured'] = count($accounts) > 0; + $viewVariables['accounts'] = $accounts; + $viewVariables['urlOptions'] = $urlOptions; + $viewVariables['hasOAuthError'] = $hasOAuthError; + $viewVariables['configuredMeasurables'] = ProviderYandex::getInstance()->getConfiguredSiteIds(); + $viewVariables['nonce'] = Nonce::getNonce('SEKP.yandex.config'); + $viewVariables['addYandexSiteConfigNonce'] = Nonce::getNonce(self::YANDEX_ADD_SITE_CONFIG_NONCE_KEY); + $viewVariables['removeYandexSiteConfigNonce'] = Nonce::getNonce(self::YANDEX_REMOVE_SITE_CONFIG_NONCE_KEY); + $viewVariables['removeYandexAccountNonce'] = Nonce::getNonce(self::YANDEX_REMOVE_ACCOUNT_NONCE_KEY); + $viewVariables['sitesInfos'] = []; + $viewVariables['currentSite'] = $this->getCurrentSite(); + $viewVariables['currentSite'] = $this->getCurrentSite(); + $viewVariables['countOfAccountsWithAccess'] = $countOfAccountsWithAccess; + + $siteIds = $viewVariables['configuredMeasurables']; + + foreach ($siteIds as $siteId => $config) { + $viewVariables['sitesInfos'][$siteId] = Site::getSite($siteId); + $lastRun = Option::get('YandexImporterTask_LastRun_' . $siteId); + + if ($lastRun) { + $lastRun = date('Y-m-d H:i', $lastRun) . ' UTC'; + } else { + $lastRun = Piwik::translate('General_Never'); + } + + $viewVariables['sitesInfos'][$siteId]['lastRun'] = $lastRun; + + $yandexAccountAndHostId = $config['yandexAccountAndHostId']; + [$accountId, $url] = explode('##', $yandexAccountAndHostId); + + try { + $viewVariables['sitesInfos'][$siteId]['accountValid'] = $yandexClient->testConfiguration($accountId); + } catch (\Exception $e) { + $viewVariables['sitesInfos'][$siteId]['accountValid'] = false; + } + + try { + $urls = $yandexClient->getAvailableUrls($accountId); + } catch (\Exception $e) { + $urls = []; + } + + $viewVariables['sitesInfos'][$siteId]['urlValid'] = false; + + foreach ($urls as $data) { + if ($data['host_id'] == $url) { + $viewVariables['sitesInfos'][$siteId]['urlValid'] = true; + } + } + } + + if (!empty($this->securityPolicy)) { + $this->securityPolicy->addPolicy('img-src', 'avatars.yandex.net'); + } + + $viewVariables['baseUrl'] = Url::getCurrentUrlWithoutQueryString(); + $viewVariables['baseDomain'] = Url::getCurrentScheme() . '://' . Url::getCurrentHost(); + + return $this->renderTemplate('yandex\configuration', $viewVariables); + } + + /** + * Save Yandex configuration if set in request + * + * @return bool|null bool on success or failure, null if not data present in request + */ + protected function configureYandexClientIfProvided() + { + $clientId = Common::getRequestVar('clientid', ''); + $clientSecret = Common::getRequestVar('clientsecret', ''); + + if (!empty($clientSecret) || !empty($clientId)) { + Nonce::checkNonce('SEKP.yandex.config', Common::getRequestVar('config_nonce')); + + $clientUpdated = false; + + if (!empty($clientSecret) && !empty($clientId)) { + $yandexClient = ProviderYandex::getInstance()->getClient(); + $yandexClient->setClientConfig($clientId, $clientSecret); + $clientUpdated = true; + } + + return $clientUpdated; + } + + return null; + } + + /** + * Save yandex configuration for a site if given in request + */ + protected function addYandexSiteConfigIfProvided() + { + $yandexSiteId = Common::getRequestVar('yandexSiteId', ''); + $yandexAccountAndHostId = Common::getRequestVar('yandexAccountAndHostId', ''); + + if (!empty($yandexSiteId) && !empty($yandexAccountAndHostId)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::YANDEX_ADD_SITE_CONFIG_NONCE_KEY, $request->getStringParameter('addSiteConfigNonce', '')); + $measurableSettings = new MeasurableSettings($yandexSiteId); + $measurableSettings->yandexConfigCreatedBy->setValue(Piwik::getCurrentUserLogin()); + + //Need to explicitly setIsWritableByCurrentUser=true, since it can be set as false when we instantiate MeasurableSettings object due to previously added by another user + $measurableSettings->yandexAccountAndHostId->setIsWritableByCurrentUser(true); + + $measurableSettings->yandexAccountAndHostId->setValue($yandexAccountAndHostId); + + $measurableSettings->save(); + + $notification = new Notification( + Piwik::translate('SearchEngineKeywordsPerformance_WebsiteSuccessfulConfigured', [ + Site::getNameFor($yandexSiteId), + '', + '' + ]) + ); + $notification->context = Notification::CONTEXT_SUCCESS; + $notification->raw = true; + $notification->flags = Notification::FLAG_CLEAR; + Notification\Manager::notify('websiteConfigured', $notification); + } + } + + /** + * Removes a Yandex account if `remove` param is given in request + */ + protected function removeYandexAccountIfProvided() + { + $remove = Common::getRequestVar('remove', ''); + + if (!empty($remove)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::YANDEX_REMOVE_ACCOUNT_NONCE_KEY, $request->getStringParameter('removeAccountNonce', '')); + ProviderYandex::getInstance()->getClient()->removeAccount($remove); + + $sitesWithConfig = ProviderYandex::getInstance()->getConfiguredSiteIds(); + foreach ($sitesWithConfig as $siteId => $siteConfig) { + $yandexSetting = explode('##', $siteConfig['yandexAccountAndHostId']); + if (!empty($yandexSetting[0]) && $yandexSetting[0] == $remove) { + $config = new MeasurableSettings($siteId); + $config->yandexAccountAndHostId->setValue('0'); + $config->save(); + } + } + } + } + + /** + * Removes a Yandex site config if `removeConfig` param is given in request + */ + protected function removeYandexSiteConfigIfProvided() + { + $removeConfig = Common::getRequestVar('removeConfig', ''); + + if (!empty($removeConfig)) { + $request = \Piwik\Request::fromRequest(); + Nonce::checkNonce(self::YANDEX_REMOVE_SITE_CONFIG_NONCE_KEY, $request->getStringParameter('removeSiteConfigNonce', '')); + $measurableSettings = new MeasurableSettings($removeConfig); + $measurableSettings->yandexAccountAndHostId->setValue('0'); + $measurableSettings->save(); + } + } + + + public function forwardToYandexAuth() + { + Piwik::checkUserHasSomeAdminAccess(); + + Nonce::checkNonce('SEKP.yandex.auth', Common::getRequestVar('auth_nonce')); + + $session = $this->getSession(); + $session->yandexauthtime = time() + 60 * 15; + + Url::redirectToUrl(ProviderYandex::getInstance()->getClient()->createAuthUrl()); + } + + /** + * Processes an auth code given by Yandex + */ + public function processYandexAuthCode() + { + Piwik::checkUserHasSomeAdminAccess(); + + $error = Common::getRequestVar('error', ''); + $oauthCode = Common::getRequestVar('code', ''); + $timeLimit = $this->getSession()->yandexauthtime; + + // if the auth wasn't triggered within the allowed time frame + if (!$timeLimit || time() > $timeLimit) { + $error = true; + } + + if ($error) { + return $this->configureYandex(true); + } + + try { + ProviderYandex::getInstance()->getClient()->processAuthCode($oauthCode); + } catch (\Exception $e) { + return $this->configureYandex($e->getMessage()); + } + + // we need idSite in the url to display all the menus like Conversion Import after redirect + $siteInfo = $this->getCurrentSite(); + + // reload index action to prove everything is configured + Url::redirectToUrl(Url::getCurrentUrlWithoutQueryString() . Url::getCurrentQueryStringWithParametersModified([ + 'action' => 'configureYandex', + 'idSite' => (isset($siteInfo['id']) ? $siteInfo['id'] : 0), + 'code' => null + ])); + } + + /** + * Get the map of component extensions to be passed into the Vue template. This allows other plugins to provide + * content to display in the template. In this case this plugin will display one component, but that can be + * overridden by the ConnectAccounts plugin to display a somewhat different component. This is doing something + * similar to what we use {{ postEvent('MyPlugin.MyEventInATemplate) }} for in Twig templates. + * + * @return array Map of component extensions. Like [ 'plugin' => 'PluginName', 'component' => 'ComponentName' ] + * See {@link https://developer.matomo.org/guides/in-depth-vue#allowing-plugins-to-add-content-to-your-vue-components the developer documentation} for more information. + */ + public static function getComponentExtensions(): array + { + $componentExtensions = []; + Piwik::postEvent('SearchEngineKeywordsPerformance.getGoogleConfigComponentExtensions', [ + &$componentExtensions + ]); + return $componentExtensions; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/BingAccountDiagnostic.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/BingAccountDiagnostic.php new file mode 100644 index 0000000..ea26d16 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/BingAccountDiagnostic.php @@ -0,0 +1,76 @@ +translator = $translator; + } + public function execute() + { + $client = ProviderBing::getInstance()->getClient(); + $accounts = $client->getAccounts(); + if (empty($accounts)) { + return []; + // skip if no accounts configured + } + $errors = ProviderBing::getInstance()->getConfigurationProblems(); + $resultAccounts = new DiagnosticResult(Bing::getInstance()->getName() . ' - ' . $this->translator->translate('SearchEngineKeywordsPerformance_ConfiguredAccounts')); + foreach ($accounts as $account) { + if (array_key_exists($account['apiKey'], $errors['accounts'])) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_ERROR, $this->obfuscateApiKey($account['apiKey']) . ': ' . $errors['accounts'][$account['apiKey']]); + } else { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_OK, $this->obfuscateApiKey($account['apiKey']) . ': ' . $this->translator->translate('SearchEngineKeywordsPerformance_BingAccountOk')); + } + $resultAccounts->addItem($item); + } + $resultMeasurables = new DiagnosticResult(Bing::getInstance()->getName() . ' - ' . $this->translator->translate('SearchEngineKeywordsPerformance_MeasurableConfig')); + $configuredSiteIds = ProviderBing::getInstance()->getConfiguredSiteIds(); + foreach ($configuredSiteIds as $configuredSiteId => $config) { + if (array_key_exists($configuredSiteId, $errors['sites'])) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_ERROR, Site::getNameFor($configuredSiteId) . ' (' . Site::getMainUrlFor($configuredSiteId) . ')' . ': ' . $errors['sites'][$configuredSiteId]); + } else { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_OK, Site::getNameFor($configuredSiteId) . ' (' . Site::getMainUrlFor($configuredSiteId) . ')'); + } + $resultMeasurables->addItem($item); + } + return [$resultAccounts, $resultMeasurables]; + } + protected function obfuscateApiKey( + #[\SensitiveParameter] + $apiKey + ) { + return substr($apiKey, 0, 5) . '*****' . substr($apiKey, -5, 5); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/GoogleAccountDiagnostic.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/GoogleAccountDiagnostic.php new file mode 100644 index 0000000..c7dc492 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/GoogleAccountDiagnostic.php @@ -0,0 +1,71 @@ +translator = $translator; + } + public function execute() + { + $client = ProviderGoogle::getInstance()->getClient(); + $accounts = $client->getAccounts(); + if (empty($accounts)) { + return []; + // skip if no accounts configured + } + $errors = ProviderGoogle::getInstance()->getConfigurationProblems(); + $resultAccounts = new DiagnosticResult(Google::getInstance()->getName() . ' - ' . $this->translator->translate('SearchEngineKeywordsPerformance_ConfiguredAccounts')); + foreach ($accounts as $id => $account) { + $userInfo = $client->getUserInfo($id); + if (array_key_exists($id, $errors['accounts'])) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_ERROR, $userInfo['name'] . ': ' . $errors['accounts'][$id]); + } else { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_OK, $userInfo['name'] . ': ' . $this->translator->translate('SearchEngineKeywordsPerformance_GoogleAccountOk')); + } + $resultAccounts->addItem($item); + } + $resultMeasurables = new DiagnosticResult(Google::getInstance()->getName() . ' - ' . $this->translator->translate('SearchEngineKeywordsPerformance_MeasurableConfig')); + $configuredSiteIds = ProviderGoogle::getInstance()->getConfiguredSiteIds(); + foreach ($configuredSiteIds as $configuredSiteId => $config) { + if (array_key_exists($configuredSiteId, $errors['sites'])) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_ERROR, Site::getNameFor($configuredSiteId) . ' (' . Site::getMainUrlFor($configuredSiteId) . ')' . ': ' . $errors['sites'][$configuredSiteId]); + } else { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_OK, Site::getNameFor($configuredSiteId) . ' (' . Site::getMainUrlFor($configuredSiteId) . ')'); + } + $resultMeasurables->addItem($item); + } + return [$resultAccounts, $resultMeasurables]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/YandexAccountDiagnostic.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/YandexAccountDiagnostic.php new file mode 100644 index 0000000..a2a2f60 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Diagnostic/YandexAccountDiagnostic.php @@ -0,0 +1,76 @@ +translator = $translator; + } + public function execute() + { + $client = ProviderYandex::getInstance()->getClient(); + $accounts = $client->getAccounts(); + if (empty($accounts)) { + return []; + // skip if no accounts configured + } + $errors = ProviderYandex::getInstance()->getConfigurationProblems(); + $resultAccounts = new DiagnosticResult(Yandex::getInstance()->getName() . ' - ' . $this->translator->translate('SearchEngineKeywordsPerformance_ConfiguredAccounts')); + foreach ($accounts as $id => $account) { + $userInfo = $client->getUserInfo($id); + $oauthDaysAgo = floor((time() - $account['created']) / (3600 * 24)); + if (array_key_exists($id, $errors['accounts'])) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_ERROR, $userInfo['name'] . ': ' . $errors['accounts'][$id]); + } else { + if ($oauthDaysAgo >= 150) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_WARNING, $userInfo['name'] . ': ' . $this->translator->translate('SearchEngineKeywordsPerformance_OAuthAccessWillTimeOutSoon', 180 - $oauthDaysAgo)); + } else { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_OK, $userInfo['name'] . ': ' . $this->translator->translate('SearchEngineKeywordsPerformance_YandexAccountOk')); + } + } + $resultAccounts->addItem($item); + } + $resultMeasurables = new DiagnosticResult(Yandex::getInstance()->getName() . ' - ' . $this->translator->translate('SearchEngineKeywordsPerformance_MeasurableConfig')); + $configuredSiteIds = ProviderYandex::getInstance()->getConfiguredSiteIds(); + foreach ($configuredSiteIds as $configuredSiteId => $config) { + if (array_key_exists($configuredSiteId, $errors['sites'])) { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_ERROR, Site::getNameFor($configuredSiteId) . ' (' . Site::getMainUrlFor($configuredSiteId) . ')' . ': ' . $errors['sites'][$configuredSiteId]); + } else { + $item = new DiagnosticResultItem(DiagnosticResult::STATUS_OK, Site::getNameFor($configuredSiteId) . ' (' . Site::getMainUrlFor($configuredSiteId) . ')'); + } + $resultMeasurables->addItem($item); + } + return [$resultAccounts, $resultMeasurables]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Exceptions/InvalidClientConfigException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Exceptions/InvalidClientConfigException.php new file mode 100644 index 0000000..8da8b3e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Exceptions/InvalidClientConfigException.php @@ -0,0 +1,21 @@ +idSite = $idSite; + $this->force = $force; + $setting = new MeasurableSettings($idSite); + $searchConsoleUrl = $setting->bingSiteUrl; + $siteConfig = $searchConsoleUrl->getValue(); + [$this->apiKey, $this->bingSiteUrl] = explode('##', $siteConfig); + } + protected static function getRowCountToImport() + { + return Config::getInstance()->General['datatable_archiving_maximum_rows_referrers']; + } + /** + * Run importer for all available data + */ + public function importAllAvailableData() + { + $dates = self::importAvailablePeriods($this->apiKey, $this->bingSiteUrl, $this->force); + if (empty($dates)) { + return; + } + $days = $weeks = $months = $years = []; + foreach ($dates as $date) { + $date = Date::factory($date); + $day = new Day($date); + $days[$day->toString()] = $day; + $week = new Week($date); + $weeks[$week->getRangeString()] = $week; + $month = new Month($date); + $months[$month->getRangeString()] = $month; + $year = new Year($date); + $years[$year->getRangeString()] = $year; + } + $periods = $days + $weeks + $months + $years; + foreach ($periods as $period) { + $this->completeExistingArchiveIfAny($period); + } + } + /** + * Imports available data to model storage if not already done + * + * @param string $apiKey API key to use + * @param string $url url, eg http://matomo.org + * @return array + */ + public static function importAvailablePeriods( + #[\SensitiveParameter] + $apiKey, + $url, + $force = \false + ) { + if (self::$dataImported && !defined('PIWIK_TEST_MODE')) { + return []; + } + $datesImported = []; + $logger = StaticContainer::get(LoggerInterface::class); + $model = new BingModel(); + $logger->debug("[SearchEngineKeywordsPerformance] Fetching Bing keywords for {$url}"); + try { + $keywordData = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Bing')->getSearchAnalyticsData($apiKey, $url); + foreach ($keywordData as $date => $keywords) { + $availableKeywords = $model->getKeywordData($url, $date); + $datesImported[] = $date; + if (!empty($availableKeywords) && !$force) { + continue; + // skip as data was already imported before + } + $dataTable = self::getKeywordsAsDataTable($keywords); + if ($dataTable) { + $keywordData = $dataTable->getSerialized(self::getRowCountToImport(), null, Metrics::NB_CLICKS); + $logger->debug("[SearchEngineKeywordsPerformance] Importing Bing keywords for {$url} / {$date}"); + $model->archiveKeywordData($url, $date, $keywordData[0]); + } + } + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (UnknownAPIException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (RateLimitApiException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing keywords for ' . $url . ' ErrorCode: ' . $e->getCode() . ' ErrorMessage: ' . $e->getMessage()); + } catch (\Exception $e) { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Bing keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } + $logger->debug("[SearchEngineKeywordsPerformance] Fetching Bing crawl stats for {$url}"); + try { + $crawlStatsDataSets = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Bing')->getCrawlStats($apiKey, $url); + foreach ($crawlStatsDataSets as $date => $crawlStats) { + $availableCrawlStats = $model->getCrawlStatsData($url, $date); + $datesImported[] = $date; + if (!empty($availableCrawlStats)) { + continue; + // skip as data was already imported before + } + $dataTable = self::getCrawlStatsAsDataTable($crawlStats); + if ($dataTable) { + $keywordData = $dataTable->getSerialized(); + $logger->debug("[SearchEngineKeywordsPerformance] Importing Bing crawl stats for {$url} / {$date}"); + $model->archiveCrawlStatsData($url, $date, $keywordData[0]); + } + } + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl stats for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (UnknownAPIException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl stats for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (RateLimitApiException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing keywords for ' . $url . ' ErrorCode: ' . $e->getCode() . ' ErrorMessage: ' . $e->getMessage()); + } catch (\Exception $e) { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl stats for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } + try { + $crawlErrorsDataSets = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Bing')->getUrlWithCrawlIssues($apiKey, $url); + $logger->debug("[SearchEngineKeywordsPerformance] Importing Bing crawl issues for {$url}"); + $dataTable = self::getCrawlErrorsAsDataTable($crawlErrorsDataSets); + if ($dataTable->getRowsCount()) { + $crawlErrorsData = $dataTable->getSerialized(); + $model->archiveCrawlErrors($url, $crawlErrorsData[0]); + } + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl issues for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (UnknownAPIException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl issues for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (RateLimitApiException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl issues for ' . $url . ' ErrorCode: ' . $e->getCode() . ' ErrorMessage: ' . $e->getMessage()); + } catch (\Exception $e) { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Bing crawl issues for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } + $datesImported = array_unique($datesImported); + sort($datesImported); + self::$dataImported = \true; + return $datesImported; + } + protected static function getKeywordsAsDataTable($keywords) + { + $dataTable = new DataTable(); + foreach ($keywords as $keywordDataSet) { + $rowData = [ + DataTable\Row::COLUMNS => [ + 'label' => $keywordDataSet['keyword'], + Metrics::NB_CLICKS => (int) $keywordDataSet['clicks'], + Metrics::NB_IMPRESSIONS => (int) $keywordDataSet['impressions'], + Metrics::CTR => (float) round($keywordDataSet['clicks'] / $keywordDataSet['impressions'], 2), + Metrics::POSITION => (float) $keywordDataSet['position'] + ] + ]; + $row = new DataTable\Row($rowData); + $dataTable->addRow($row); + } + return $dataTable; + } + protected static function getCrawlStatsAsDataTable($crawlStats) + { + $dataTable = new DataTable(); + foreach ($crawlStats as $label => $pagesCount) { + $rowData = [DataTable\Row::COLUMNS => ['label' => $label, Metrics::NB_PAGES => (int) $pagesCount]]; + $row = new DataTable\Row($rowData); + $dataTable->addRow($row); + } + return $dataTable; + } + protected static function getCrawlErrorsAsDataTable($crawlErrors) + { + $dataTable = new DataTable(); + foreach ($crawlErrors as $crawlError) { + $rowData = [DataTable\Row::COLUMNS => ['label' => $crawlError['Url'], 'category' => $crawlError['Issues'], 'inLinks' => $crawlError['InLinks'], 'responseCode' => $crawlError['HttpCode']]]; + $row = new DataTable\Row($rowData); + $dataTable->addRow($row); + } + return $dataTable; + } + /** + * Runs the Archiving for SearchEngineKeywordsPerformance plugin if an archive for the given period already exists + * + * @param \Piwik\Period $period + */ + protected function completeExistingArchiveIfAny($period) + { + $parameters = new Parameters(new Site($this->idSite), $period, new Segment('', [$this->idSite])); + $parameters->setRequestedPlugin('SearchEngineKeywordsPerformance'); + $parameters->onlyArchiveRequestedPlugin(); + $result = ArchiveSelector::getArchiveIdAndVisits($parameters, $period->getDateStart()->getDateStartUTC()); + $idArchive = $result[0][0] ?? null; + if (empty($idArchive)) { + return; + // ignore periods that weren't archived before + } + $archiveWriter = new ArchiveWriter($parameters); + $archiveWriter->idArchive = $idArchive; + $archiveProcessor = new ArchiveProcessor($parameters, $archiveWriter, new LogAggregator($parameters)); + $archiveProcessor->setNumberOfVisits(1, 1); + $bingRecordBuilder = BingRecordBuilder::make($this->idSite); + if (empty($bingRecordBuilder)) { + return; + } + if ($period instanceof Day) { + $bingRecordBuilder->buildFromLogs($archiveProcessor); + } else { + $bingRecordBuilder->buildForNonDayPeriod($archiveProcessor); + } + $archiveWriter->flushSpools(); + DataTableManager::getInstance()->deleteAll(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Importer/Google.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Importer/Google.php new file mode 100644 index 0000000..613d72f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Importer/Google.php @@ -0,0 +1,361 @@ +idSite = $idSite; + $this->force = $force; + $setting = new MeasurableSettings($idSite); + $searchConsoleUrl = $setting->googleSearchConsoleUrl; + [$this->accountId, $this->searchConsoleUrl] = explode('##', $searchConsoleUrl->getValue()); + } + protected static function getRowCountToImport() + { + return Config::getInstance()->General['datatable_archiving_maximum_rows_referrers']; + } + /** + * Triggers keyword import and plugin archiving for all dates search console has data for + * + * @param string|int|null $limitKeywordDates if integer given: limits the amount of imported dates to the last + * available X if string given: only imports keywords for the given + * string date + * @return void + */ + public function importAllAvailableData($limitKeywordDates = null) + { + // if specific date given + if (is_string($limitKeywordDates) && strlen($limitKeywordDates) == 10) { + $availableDates = [$limitKeywordDates]; + } else { + $availableDates = self::getAvailableDates($this->accountId, $this->searchConsoleUrl); + sort($availableDates); + if ($limitKeywordDates > 0) { + $limitKeywordDates += 5; + // always import 5 days more in the past, to ensure that non final data is imported again. + $availableDates = array_slice($availableDates, -$limitKeywordDates, $limitKeywordDates); + } + } + $this->importKeywordsForListOfDates($availableDates); + $this->completeExistingArchivesForListOfDates($availableDates); + } + protected function importKeywordsForListOfDates($datesToImport) + { + foreach ($datesToImport as $date) { + foreach (self::$typesToImport as $type) { + $this->importKeywordsIfNecessary($this->accountId, $this->searchConsoleUrl, $date, $type, $this->force); + } + } + } + protected function completeExistingArchivesForListOfDates($datesToComplete) + { + $days = $weeks = $months = $years = []; + sort($datesToComplete); + foreach ($datesToComplete as $date) { + $date = Date::factory($date); + $day = new Day($date); + $days[$day->toString()] = $day; + $week = new Week($date); + $weeks[$week->getRangeString()] = $week; + $month = new Month($date); + $months[$month->getRangeString()] = $month; + $year = new Year($date); + $years[$year->getRangeString()] = $year; + } + $periods = $days + $weeks + $months + $years; + foreach ($periods as $period) { + $this->completeExistingArchiveIfAny($period); + } + } + /** + * Imports keyword to model storage if not already done + * + * @param string $accountId google account id + * @param string $url url, eg http://matomo.org + * @param string $date date string, eg 2016-12-24 + * @param string $type 'web', 'image', 'video' or 'news' + * @param bool $force force reimport + * @return boolean + */ + public function importKeywordsIfNecessary($accountId, $url, $date, $type, $force = \false) + { + $model = new GoogleModel(); + $logger = StaticContainer::get(LoggerInterface::class); + $keywordData = $model->getKeywordData($url, $date, $type); + // check if available data is temporary and force a reimport in that case + if ($keywordData) { + $dataTable = new DataTable(); + $dataTable->addRowsFromSerializedArray($keywordData); + $isTemporary = $dataTable->getMetadata(self::DATATABLE_METADATA_TEMPORARY); + if ($isTemporary === \true) { + $logger->info('[SearchEngineKeywordsPerformance] Forcing reimport Google keywords for ' . $url . ' as imported data was not final.'); + $force = \true; + } + } + if ($keywordData && !$force) { + $logger->info('[SearchEngineKeywordsPerformance] Skipping import of Google keywords for ' . $date . ' and ' . $url . ' as data already imported.'); + return \false; + // skip if data already available and no reimport forced + } + $dataTable = $this->getKeywordsFromConsoleAsDataTable($accountId, $url, $date, $type); + if ($dataTable) { + $keywordData = $dataTable->getSerialized(self::getRowCountToImport(), null, Metrics::NB_CLICKS); + $model->archiveKeywordData($url, $date, $type, $keywordData[0]); + return \true; + } + return \false; + } + protected static function getAvailableDates($accountId, $url) + { + $logger = StaticContainer::get(LoggerInterface::class); + try { + if (!array_key_exists($accountId . $url, self::$availableDates) || defined('PIWIK_TEST_MODE')) { + $finalDates = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Google')->getDatesWithSearchAnalyticsData($accountId, $url); + self::$availableDates[$accountId . $url] = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Google')->getDatesWithSearchAnalyticsData($accountId, $url, \false); + self::$availableDatesNonFinal[$accountId . $url] = array_diff(self::$availableDates[$accountId . $url], $finalDates); + } + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return []; + } catch (InvalidClientConfigException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return []; + } catch (MissingOAuthConfigException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return []; + } catch (MissingClientConfigException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return []; + } catch (UnknownAPIException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return []; + } catch (\Exception $e) { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return []; + } + if (array_key_exists($accountId . $url, self::$availableDates)) { + return self::$availableDates[$accountId . $url]; + } + return []; + } + private static function isFinalDate($accountId, $url, $date) + { + if (array_key_exists($accountId . $url, self::$availableDatesNonFinal)) { + return !in_array($date, self::$availableDatesNonFinal[$accountId . $url]); + } + return \true; + } + /** + * Fetches data from google search console and migrates it to a Matomo Datatable + * + * @param string $accountId google account id + * @param string $url url, eg http://matomo.org + * @param string $date date string, eg 2016-12-24 + * @param string $type 'web', 'image', 'video' or 'news' + * @return null|DataTable + */ + protected function getKeywordsFromConsoleAsDataTable($accountId, $url, $date, $type) + { + $dataTable = new DataTable(); + $logger = StaticContainer::get(LoggerInterface::class); + try { + if (!defined('PIWIK_TEST_MODE') && !$this->isImportAllowedForDate($date)) { + $logger->debug("[SearchEngineKeywordsPerformance] Skip fetching keywords from Search Console for today and dates more than 500 days in the past: " . $date); + return null; + } + $availableDates = self::getAvailableDates($accountId, $url); + if (!in_array($date, $availableDates)) { + $logger->debug("[SearchEngineKeywordsPerformance] No {$type} keywords available for {$date} and {$url}"); + return null; + } + $logger->debug("[SearchEngineKeywordsPerformance] Fetching {$type} keywords for {$date} and {$url}"); + $keywordData = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Google')->getSearchAnalyticsData($accountId, $url, $date, $type, self::getRowCountToImport()); + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return null; + } catch (InvalidClientConfigException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return null; + } catch (MissingOAuthConfigException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return null; + } catch (MissingClientConfigException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return null; + } catch (UnknownAPIException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return null; + } catch (\Exception $e) { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Google keywords for ' . $url . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + return null; + } + if (!self::isFinalDate($accountId, $url, $date)) { + $dataTable->setMetadata(self::DATATABLE_METADATA_TEMPORARY, \true); + } + if (empty($keywordData) || !($rows = $keywordData->getRows())) { + return $dataTable; + // return empty table so it will be stored + } + foreach ($rows as $keywordDataSet) { + /** @var \Google\Service\SearchConsole\ApiDataRow $keywordDataSet */ + $keys = $keywordDataSet->getKeys(); + $rowData = [ + DataTable\Row::COLUMNS => [ + 'label' => reset($keys), + Metrics::NB_CLICKS => (int) $keywordDataSet->getClicks(), + Metrics::NB_IMPRESSIONS => (int) $keywordDataSet->getImpressions(), + Metrics::CTR => (float) $keywordDataSet->getCtr(), + Metrics::POSITION => (float) $keywordDataSet->getPosition() + ] + ]; + $row = new DataTable\Row($rowData); + $dataTable->addRow($row); + } + unset($keywordData); + return $dataTable; + } + protected function isImportAllowedForDate($date): bool + { + $site = new Site($this->idSite); + $siteCreationDate = $site->getCreationDate()->subDay(30); + $earliestDate = Date::now()->subDay(500); + $earliestImportDate = $siteCreationDate->isEarlier($earliestDate) ? $earliestDate : $siteCreationDate; + $archivedDate = Date::factory($date); + if ($archivedDate->isEarlier($earliestImportDate) || $archivedDate->isToday()) { + return \false; + } + return \true; + } + /** + * Runs the Archiving for SearchEngineKeywordsPerformance plugin if an archive for the given period already exists + * + * @param \Piwik\Period $period + */ + protected function completeExistingArchiveIfAny($period) + { + $parameters = new Parameters(new Site($this->idSite), $period, new Segment('', [$this->idSite])); + $parameters->setRequestedPlugin('SearchEngineKeywordsPerformance'); + $parameters->onlyArchiveRequestedPlugin(); + $result = ArchiveSelector::getArchiveIdAndVisits($parameters, $period->getDateStart()->getDateStartUTC()); + $idArchive = $result[0][0] ?? null; + if (empty($idArchive)) { + return; + // ignore periods that weren't archived before + } + $archiveWriter = new ArchiveWriter($parameters); + $archiveWriter->idArchive = $idArchive; + $archiveProcessor = new ArchiveProcessor($parameters, $archiveWriter, new LogAggregator($parameters)); + $archiveProcessor->setNumberOfVisits(1, 1); + /** @var GoogleRecordBuilder[] $recordBuilders */ + $recordBuilders = GoogleRecordBuilder::makeAll($this->idSite); + if (empty($recordBuilders)) { + return; + } + foreach ($recordBuilders as $builder) { + if ($period instanceof Day) { + $builder->buildFromLogs($archiveProcessor); + } else { + $builder->buildForNonDayPeriod($archiveProcessor); + } + } + $archiveWriter->flushSpools(); + DataTableManager::getInstance()->deleteAll(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Importer/Yandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Importer/Yandex.php new file mode 100644 index 0000000..b2ee231 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Importer/Yandex.php @@ -0,0 +1,292 @@ +idSite = $idSite; + $this->force = $force; + $setting = new MeasurableSettings($idSite); + $yandexConfig = $setting->yandexAccountAndHostId; + $siteConfig = $yandexConfig->getValue(); + [$this->accountId, $this->yandexHostId] = explode('##', $siteConfig); + } + protected static function getRowCountToImport() + { + return Config::getInstance()->General['datatable_archiving_maximum_rows_referrers']; + } + /** + * Run importer for all available data + */ + public function importAllAvailableData($limitDays = 100) + { + if (is_string($limitDays) && strlen($limitDays) == 10) { + $dates = [$limitDays]; + } else { + for ($i = 0; $i <= $limitDays; $i++) { + $dates[] = date('Y-m-d', strtotime("-{$i} days")); + } + } + foreach ($dates as $date) { + self::importAvailableDataForDate($this->accountId, $this->yandexHostId, $date, $this->force); + } + if (empty($dates)) { + return; + } + $this->completeExistingArchivesForListOfDates($dates); + } + protected function completeExistingArchivesForListOfDates($datesToComplete) + { + $days = $weeks = $months = $years = []; + sort($datesToComplete); + foreach ($datesToComplete as $date) { + $date = Date::factory($date); + $day = new Day($date); + $days[$day->toString()] = $day; + $week = new Week($date); + $weeks[$week->getRangeString()] = $week; + $month = new Month($date); + $months[$month->getRangeString()] = $month; + $year = new Year($date); + $years[$year->getRangeString()] = $year; + } + $periods = $days + $weeks + $months + $years; + foreach ($periods as $period) { + $this->completeExistingArchiveIfAny($period); + } + } + /** + * Imports available data to model storage if not already done + * + * @param string $accountId Id oc account to use + * @param string $hostId url, eg https:piwik.org:443 + * @param string $date date, eg 2019-05-20 + * @return array + */ + public static function importAvailableDataForDate($accountId, $hostId, $date, $force = \false) + { + $datesImported = []; + $timestamp = strtotime($date); + if ($timestamp > time()) { + return []; + // no import for dates in the future + } + $logger = StaticContainer::get(LoggerInterface::class); + if ($timestamp > time() - self::MAX_DAYS_KEYWORD_DATA_DELAY * 24 * 3600) { + $force = \true; + // always reimport the last few days + } + $model = new YandexModel(); + try { + $availableKeywordsDataTable = new DataTable(); + $availableKeywords = $model->getKeywordData($hostId, $date); + if (!empty($availableKeywords)) { + $availableKeywordsDataTable->addRowsFromSerializedArray($availableKeywords); + } + // Only assume keywords were imported if there are actually some rows available, otherwise try to import them (again) + if ($availableKeywordsDataTable->getRowsCountWithoutSummaryRow() > 0 && !$force) { + $logger->debug("[SearchEngineKeywordsPerformance] Yandex keywords already imported for {$hostId} and date {$date}"); + } else { + $logger->debug("[SearchEngineKeywordsPerformance] Fetching Yandex keywords for {$hostId} and date {$date}"); + $keywords = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Yandex')->getSearchAnalyticsData($accountId, $hostId, $date); + $datesImported[] = $date; + $dataTable = self::getKeywordsAsDataTable($keywords); + // do not store empty results for the last days + if ($dataTable && ($dataTable->getRowsCountWithoutSummaryRow() > 0 || $timestamp < time() - self::MAX_DAYS_KEYWORD_DATA_DELAY * 24 * 3600)) { + $keywordData = $dataTable->getSerialized(self::getRowCountToImport(), null, Metrics::NB_CLICKS); + $logger->debug("[SearchEngineKeywordsPerformance] Importing Yandex keywords for {$hostId} / {$date}"); + $model->archiveKeywordData($hostId, $date, $keywordData[0]); + } + } + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Yandex keywords for ' . $hostId . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (RateLimitApiException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Yandex keywords for ' . $hostId . ': ' . $e->getMessage()); + } catch (\Exception $e) { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Yandex keywords for ' . $hostId . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } + try { + $availableCrawlStats = $model->getCrawlStatsData($hostId, $date); + if (!empty($availableCrawlStats) && !$force) { + $logger->debug("[SearchEngineKeywordsPerformance] Yandex crawl stats already imported for {$hostId} and date {$date}"); + } else { + $logger->debug("[SearchEngineKeywordsPerformance] Fetching Yandex crawl stats for {$hostId} and date {$date}"); + $crawlStats = StaticContainer::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Yandex')->getCrawlStats($accountId, $hostId, $date); + $datesImported[] = $date; + $dataTable = self::getCrawlStatsAsDataTable($crawlStats); + if ($dataTable) { + $keywordData = $dataTable->getSerialized(); + $logger->debug("[SearchEngineKeywordsPerformance] Importing Yandex crawl stats for {$hostId} and date {$date}"); + $model->archiveCrawlStatsData($hostId, $date, $keywordData[0]); + } + } + } catch (InvalidCredentialsException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Yandex crawl stats for ' . $hostId . ': ' . $e->getMessage()); + Provider::getInstance()->recordNewApiErrorForProvider(); + } catch (RateLimitApiException $e) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Yandex crawl stats for ' . $hostId . ': ' . $e->getMessage()); + } catch (\Exception $e) { + // ignore empty server reply as they seem temporary only + if (strpos($e->getMessage(), 'Empty reply from server')) { + $logger->info('[SearchEngineKeywordsPerformance] Exception while importing Yandex crawl stats for ' . $hostId . ': ' . $e->getMessage()); + } else { + $logger->error('[SearchEngineKeywordsPerformance] Exception while importing Yandex crawl stats for ' . $hostId . ': ' . $e->getMessage()); + } + Provider::getInstance()->recordNewApiErrorForProvider(); + } + $datesImported = array_unique($datesImported); + sort($datesImported); + return $datesImported; + } + protected static function getKeywordsAsDataTable($keywords) + { + $dataTable = new DataTable(); + if (empty($keywords)) { + return $dataTable; + } + foreach ($keywords as $keywordDataSet) { + // If the keyword is empty, that will cause an error if we try to add the row. Skip and move on to the next. + if (empty($keywordDataSet['keyword'])) { + continue; + } + $rowData = [ + DataTable\Row::COLUMNS => [ + 'label' => $keywordDataSet['keyword'], + Metrics::NB_CLICKS => (int) $keywordDataSet['clicks'], + Metrics::NB_IMPRESSIONS => (int) $keywordDataSet['impressions'], + Metrics::CTR => (float) round($keywordDataSet['clicks'] / $keywordDataSet['impressions'], 2), + Metrics::POSITION => (float) $keywordDataSet['position'] + ] + ]; + $row = new DataTable\Row($rowData); + $dataTable->addRow($row); + } + return $dataTable; + } + protected static function getCrawlStatsAsDataTable($crawlStats) + { + $dataTable = new DataTable(); + if (empty($crawlStats) || !is_array($crawlStats)) { + return $dataTable; + } + foreach ($crawlStats as $label => $pagesCount) { + if (empty($label)) { + continue; + } + $rowData = [DataTable\Row::COLUMNS => ['label' => $label, Metrics::NB_PAGES => (int) $pagesCount]]; + $row = new DataTable\Row($rowData); + $dataTable->addRow($row); + } + return $dataTable; + } + /** + * Runs the Archiving for SearchEngineKeywordsPerformance plugin if an archive for the given period already exists + * + * @param \Piwik\Period $period + */ + protected function completeExistingArchiveIfAny($period) + { + $parameters = new Parameters(new Site($this->idSite), $period, new Segment('', [$this->idSite])); + $parameters->setRequestedPlugin('SearchEngineKeywordsPerformance'); + $parameters->onlyArchiveRequestedPlugin(); + $result = ArchiveSelector::getArchiveIdAndVisits($parameters, $period->getDateStart()->getDateStartUTC()); + $idArchive = $result[0][0] ?? null; + if (empty($idArchive)) { + return; + // ignore periods that weren't archived before + } + $archiveWriter = new ArchiveWriter($parameters); + $archiveWriter->idArchive = $idArchive; + $archiveProcessor = new ArchiveProcessor($parameters, $archiveWriter, new LogAggregator($parameters)); + $archiveProcessor->setNumberOfVisits(1, 1); + $builder = YandexRecordBuilder::make($this->idSite); + if (empty($builder)) { + return; + } + if ($period instanceof Day) { + $builder->buildFromLogs($archiveProcessor); + } else { + $builder->buildForNonDayPeriod($archiveProcessor); + } + $archiveWriter->flushSpools(); + DataTableManager::getInstance()->deleteAll(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/LICENSE new file mode 100644 index 0000000..4686f35 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/LICENSE @@ -0,0 +1,49 @@ +InnoCraft License + +This InnoCraft End User License Agreement (the "InnoCraft EULA") is between you and InnoCraft Ltd (NZBN 6106769) ("InnoCraft"). If you are agreeing to this Agreement not as an individual but on behalf of your company, then "Customer" or "you" means your company, and you are binding your company to this Agreement. InnoCraft may modify this Agreement from time to time, subject to the terms in Section (xii) below. + +By clicking on the "I’ve read and accept the terms & conditions (https://shop.matomo.org/terms-conditions/)" (or similar button) that is presented to you at the time of your Order, or by using or accessing InnoCraft products, you indicate your assent to be bound by this Agreement. + + +InnoCraft EULA + +(i) InnoCraft is the licensor of the Plugin for Matomo Analytics (the "Software"). + +(ii) Subject to the terms and conditions of this Agreement, InnoCraft grants you a limited, worldwide, non-exclusive, non-transferable and non-sublicensable license to install and use the Software only on hardware systems owned, leased or controlled by you, during the applicable License Term. The term of each Software license ("License Term") will be specified in your Order. Your License Term will end upon any breach of this Agreement. + +(iii) Unless otherwise specified in your Order, for each Software license that you purchase, you may install one production instance of the Software in a Matomo Analytics instance owned or operated by you, and accessible via one URL ("Matomo instance"). Additional licenses must be purchased in order to deploy the Software in multiple Matomo instances, including when these multiple Matomo instances are hosted on a single hardware system. + +(iv) Licenses granted by InnoCraft are granted subject to the condition that you must ensure the maximum number of Authorized Users and Authorized Sites that are able to access and use the Software is equal to the number of User and Site Licenses for which the necessary fees have been paid to InnoCraft for the Subscription period. You may upgrade your license at any time on payment of the appropriate fees to InnoCraft in order to increase the maximum number of authorized users or sites. The number of User and Site Licenses granted to you is dependent on the fees paid by you. “User License” means a license granted under this EULA to you to permit an Authorized User to use the Software. “Authorized User” means a person who has an account in the Matomo instance and for which the necessary fees (“Subscription fees”) have been paid to InnoCraft for the current license term. "Site License" means a license granted under this EULA to you to permit an Authorized Site to use the Matomo Marketplace Plugin. “Authorized Sites” means a website or a measurable within Matomo instance and for which the necessary fees (“Subscription fees”) have been paid to InnoCraft for the current license term. These restrictions also apply if you install the Matomo Analytics Platform as part of your WordPress. + +(v) Piwik Analytics was renamed to Matomo Analytics in January 2018. The same terms and conditions as well as any restrictions or grants apply if you are using any version of Piwik. + +(vi) The Software requires a license key in order to operate, which will be delivered to the email addresses specified in your Order when we have received payment of the applicable fees. + +(vii) Any information that InnoCraft may collect from you or your device will be subject to InnoCraft Privacy Policy (https://www.innocraft.com/privacy). + +(viii) You are bound by the Matomo Marketplace Terms and Conditions (https://shop.matomo.org/terms-conditions/). + +(ix) You may not reverse engineer or disassemble or re-distribute the Software in whole or in part, or create any derivative works from or sublicense any rights in the Software, unless otherwise expressly authorized in writing by InnoCraft. + +(x) The Software is protected by copyright and other intellectual property laws and treaties. InnoCraft own all title, copyright and other intellectual property rights in the Software, and the Software is licensed to you directly by InnoCraft, not sold. + +(xi) The Software is provided under an "as is" basis and without any support or maintenance. Nothing in this Agreement shall require InnoCraft to provide you with support or fixes to any bug, failure, mis-performance or other defect in The Software. InnoCraft may provide you, from time to time, according to his sole discretion, with updates of the Software. You hereby warrant to keep the Software up-to-date and install all relevant updates. InnoCraft shall provide any update free of charge. + +(xii) The Software is provided "as is", and InnoCraft hereby disclaim all warranties, including but not limited to any implied warranties of title, non-infringement, merchantability or fitness for a particular purpose. InnoCraft shall not be liable or responsible in any way for any losses or damage of any kind, including lost profits or other indirect or consequential damages, relating to your use of or reliance upon the Software. + +(xiii) We may update or modify this Agreement from time to time, including the referenced Privacy Policy and the Matomo Marketplace Terms and Conditions. If a revision meaningfully reduces your rights, we will use reasonable efforts to notify you (by, for example, sending an email to the billing or technical contact you designate in the applicable Order). If we modify the Agreement during your License Term or Subscription Term, the modified version will be effective upon your next renewal of a License Term. + + +About InnoCraft Ltd + +At InnoCraft Ltd, we create innovating quality products to grow your business and to maximize your success. + +Our software products are built on top of Matomo Analytics: the leading open digital analytics platform used by more than one million websites worldwide. We are the creators and makers of the Matomo Analytics platform. + + +Contact + +Email: contact@innocraft.com +Contact form: https://www.innocraft.com/#contact +Website: https://www.innocraft.com/ +Buy our products: Premium Features for Matomo Analytics https://plugins.matomo.org/premium diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/MeasurableSettings.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/MeasurableSettings.php new file mode 100644 index 0000000..2172fc8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/MeasurableSettings.php @@ -0,0 +1,182 @@ +configureGoogleSettings(); + $this->configureBingSettings(); + $this->configureYandexSettings(); + } + /** + * Configures Settings used for Google Search Console Import + */ + protected function configureGoogleSettings() + { + $googleClient = ProviderGoogle::getInstance()->getClient(); + // check if google search console is configured and available for website type + if (!\Piwik\Plugins\SearchEngineKeywordsPerformance\SearchEngineKeywordsPerformance::isGoogleForceEnabled($this->idSite) && (!$this->hasMeasurableType(WebsiteMeasurableType::ID) || !$googleClient->isConfigured())) { + return; + } + $this->googleConfigCreatedBy = $this->makeSetting('googleconfigcreatedby', '', FieldConfig::TYPE_STRING, function (FieldConfig $field) { + $field->uiControl = FieldConfig::UI_CONTROL_HIDDEN; + }); + $this->googleSearchConsoleUrl = $this->makeSetting('searchconsoleurl', '0', FieldConfig::TYPE_STRING, function (FieldConfig $field) use ($googleClient) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_GoogleSearchConsoleUrl'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_GoogleSearchConsoleUrlDescription'); + $field->uiControl = FieldConfig::UI_CONTROL_SINGLE_SELECT; + $field->availableValues = ['0' => Piwik::translate('SearchEngineKeywordsPerformance_NotAvailable')]; + foreach ($googleClient->getAccounts() as $id => $account) { + if (Piwik::hasUserSuperUserAccessOrIsTheUser($account['username'])) { + $availableSites = $googleClient->getAvailableUrls($id); + foreach ($availableSites as $url => $accessLevel) { + $value = $id . '##' . $url; + $field->availableValues[$value] = $url; + } + } + } + }); + $this->googleWebKeywords = $this->makeSetting('googlewebkeywords', \true, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_FetchWebKeyword'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_FetchWebKeywordDesc'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + $field->condition = 'searchconsoleurl'; + }); + $this->googleImageKeywords = $this->makeSetting('googleimagekeywords', \false, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_FetchImageKeyword'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_FetchImageKeywordDesc'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + $field->condition = 'searchconsoleurl && searchconsoleurl.indexOf(\'android-app\') == -1'; + }); + $this->googleVideoKeywords = $this->makeSetting('googlevideokeywords', \false, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_FetchVideoKeyword'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_FetchVideoKeywordDesc'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + $field->condition = 'searchconsoleurl && searchconsoleurl.indexOf(\'android-app\') == -1'; + }); + $this->googleNewsKeywords = $this->makeSetting('googlenewskeywords', \false, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_FetchNewsKeyword'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_FetchNewsKeywordDesc'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + $field->condition = 'searchconsoleurl && searchconsoleurl.indexOf(\'android-app\') == -1'; + }); + $createdByUser = $this->googleConfigCreatedBy->getValue(); + if (!empty($createdByUser) && !Piwik::hasUserSuperUserAccessOrIsTheUser($createdByUser)) { + $this->googleSearchConsoleUrl->setIsWritableByCurrentUser(\false); + $this->googleWebKeywords->setIsWritableByCurrentUser(\false); + $this->googleImageKeywords->setIsWritableByCurrentUser(\false); + $this->googleVideoKeywords->setIsWritableByCurrentUser(\false); + $this->googleNewsKeywords->setIsWritableByCurrentUser(\false); + } + } + /** + * Configures Settings used for Bing Webmaster API Import + */ + protected function configureBingSettings() + { + $bingClient = ProviderBing::getInstance()->getClient(); + // check if Bing Webmaster API is configured and available for website type + if (!\Piwik\Plugins\SearchEngineKeywordsPerformance\SearchEngineKeywordsPerformance::isBingForceEnabled($this->idSite) && (!$this->hasMeasurableType(WebsiteMeasurableType::ID) || !$bingClient->isConfigured())) { + return; + } + $this->bingConfigCreatedBy = $this->makeSetting('bingconfigcreatedby', '', FieldConfig::TYPE_STRING, function (FieldConfig $field) { + $field->uiControl = FieldConfig::UI_CONTROL_HIDDEN; + }); + $this->bingSiteUrl = $this->makeSetting('bingsiteurl', '0', FieldConfig::TYPE_STRING, function (FieldConfig $field) use ($bingClient) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_BingWebmasterApiUrl'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_BingWebmasterApiUrlDescription'); + $field->uiControl = FieldConfig::UI_CONTROL_SINGLE_SELECT; + $field->availableValues = ['0' => Piwik::translate('SearchEngineKeywordsPerformance_NotAvailable')]; + foreach ($bingClient->getAccounts() as $account) { + if (Piwik::hasUserSuperUserAccessOrIsTheUser($account['username'])) { + $availableSites = $bingClient->getAvailableUrls($account['apiKey']); + foreach ($availableSites as $url => $isVerified) { + $value = $account['apiKey'] . '##' . $url; + $field->availableValues[$value] = $url; + } + } + } + }); + $createdByUser = $this->bingConfigCreatedBy->getValue(); + if (!empty($createdByUser) && !Piwik::hasUserSuperUserAccessOrIsTheUser($createdByUser)) { + $this->bingSiteUrl->setIsWritableByCurrentUser(\false); + } + } + /** + * Configures Settings used for Yandex Webmaster API Import + */ + protected function configureYandexSettings() + { + $yandexClient = ProviderYandex::getInstance()->getClient(); + // check if Yandex Webmaster API is configured and available for website type + if (!$this->hasMeasurableType(WebsiteMeasurableType::ID) || !$yandexClient->isConfigured()) { + return; + } + $this->yandexConfigCreatedBy = $this->makeSetting('yandexconfigcreatedby', '', FieldConfig::TYPE_STRING, function (FieldConfig $field) { + $field->uiControl = FieldConfig::UI_CONTROL_HIDDEN; + }); + $this->yandexAccountAndHostId = $this->makeSetting('yandexAccountAndHostId', '0', FieldConfig::TYPE_STRING, function (FieldConfig $field) use ($yandexClient) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_YandexWebmasterApiUrl'); + $field->description = Piwik::translate('SearchEngineKeywordsPerformance_YandexWebmasterApiUrlDescription'); + $field->uiControl = FieldConfig::UI_CONTROL_SINGLE_SELECT; + $field->availableValues = ['0' => Piwik::translate('SearchEngineKeywordsPerformance_NotAvailable')]; + foreach ($yandexClient->getAccounts() as $id => $account) { + if (Piwik::hasUserSuperUserAccessOrIsTheUser($account['username'])) { + $availableSites = $yandexClient->getAvailableUrls($id); + foreach ($availableSites as $url => $hostData) { + $value = $id . '##' . $hostData['host_id']; + $field->availableValues[$value] = $url; + } + } + } + }); + $createdByUser = $this->yandexConfigCreatedBy->getValue(); + if (!empty($createdByUser) && !Piwik::hasUserSuperUserAccessOrIsTheUser($createdByUser)) { + $this->yandexAccountAndHostId->setIsWritableByCurrentUser(\false); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Menu.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Menu.php new file mode 100644 index 0000000..d71cd44 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Menu.php @@ -0,0 +1,30 @@ +addSystemItem('SearchEngineKeywordsPerformance_AdminMenuTitle', $this->urlForAction('index'), $order = 50); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Metrics.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Metrics.php new file mode 100644 index 0000000..f9fbd33 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Metrics.php @@ -0,0 +1,144 @@ + Piwik::translate('SearchEngineKeywordsPerformance_Clicks'), + self::NB_IMPRESSIONS => Piwik::translate('SearchEngineKeywordsPerformance_Impressions'), + self::CTR => Piwik::translate('SearchEngineKeywordsPerformance_Ctr'), + self::POSITION => Piwik::translate('SearchEngineKeywordsPerformance_Position') + ]; + } + /** + * Returns metric semantic types for this plugin's metrics. + * + * @return array + */ + public static function getMetricSemanticTypes(): array + { + return [self::NB_CLICKS => Dimension::TYPE_NUMBER, self::NB_IMPRESSIONS => Dimension::TYPE_NUMBER, self::CTR => Dimension::TYPE_NUMBER, self::POSITION => Dimension::TYPE_NUMBER]; + } + /** + * Return metric documentations + * + * @return array + */ + public static function getMetricsDocumentation() + { + return [ + self::NB_CLICKS => Piwik::translate('SearchEngineKeywordsPerformance_ClicksDocumentation'), + self::NB_IMPRESSIONS => Piwik::translate('SearchEngineKeywordsPerformance_ImpressionsDocumentation'), + self::CTR => Piwik::translate('SearchEngineKeywordsPerformance_CtrDocumentation'), + self::POSITION => Piwik::translate('SearchEngineKeywordsPerformance_PositionDocumentation'), + Bing::CRAWLSTATS_OTHER_CODES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlStatsOtherCodesDesc'), + Bing::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlBlockedByRobotsTxtDesc'), + Bing::CRAWLSTATS_CODE_2XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus2xxDesc'), + Bing::CRAWLSTATS_CODE_301_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus301Desc'), + Bing::CRAWLSTATS_CODE_302_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus302Desc'), + Bing::CRAWLSTATS_CODE_4XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus4xxDesc'), + Bing::CRAWLSTATS_CODE_5XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus5xxDesc'), + Bing::CRAWLSTATS_TIMEOUT_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlConnectionTimeoutDesc'), + Bing::CRAWLSTATS_MALWARE_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlMalwareInfectedDesc'), + Bing::CRAWLSTATS_ERRORS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlErrorsDesc'), + Bing::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlCrawledPagesDesc'), + Bing::CRAWLSTATS_DNS_FAILURE_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlDNSFailuresDesc'), + Bing::CRAWLSTATS_IN_INDEX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlPagesInIndexDesc'), + Bing::CRAWLSTATS_IN_LINKS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlInboundLinkDesc'), + Yandex::CRAWLSTATS_IN_INDEX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlInIndexDesc'), + Yandex::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlAppearedPagesDesc'), + Yandex::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlRemovedPagesDesc'), + Yandex::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlCrawledPagesDesc'), + Yandex::CRAWLSTATS_CODE_2XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus2xxDesc'), + Yandex::CRAWLSTATS_CODE_3XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus3xxDesc'), + Yandex::CRAWLSTATS_CODE_4XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus4xxDesc'), + Yandex::CRAWLSTATS_CODE_5XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus5xxDesc'), + Yandex::CRAWLSTATS_ERRORS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlErrorsDesc') + ]; + } + public static function getMetricIdsToProcessReportTotal() + { + return [self::NB_CLICKS, self::NB_IMPRESSIONS]; + } + /** + * Returns operations used to aggregate the metric columns + * + * @return array + */ + public static function getColumnsAggregationOperations() + { + /* + * Calculate average CTR based on summed impressions and summed clicks + */ + $calcCtr = function ($val1, $val2, $thisRow, $rowToSum) { + $sumImpressions = $thisRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS) + $rowToSum->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS); + $sumClicks = $thisRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS) + $rowToSum->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS); + if (!$sumImpressions) { + return 0.0; + } + return round($sumClicks / $sumImpressions, 2); + }; + /* + * Calculate average position based on impressions and positions + */ + $calcPosition = function ($val1, $val2, $thisRow, $rowToSum) { + return round( + ( + $thisRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS) + * $thisRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::POSITION) + + $rowToSum->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS) + * $rowToSum->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::POSITION) + ) / ( + $thisRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS) + + $rowToSum->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS) + ), + 2 + ); + }; + return [\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::CTR => $calcCtr, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::POSITION => $calcPosition]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Bing.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Bing.php new file mode 100644 index 0000000..973ccd5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Bing.php @@ -0,0 +1,168 @@ +table = Common::prefixTable(self::$rawTableName); + } + /** + * Installs required database table + */ + public static function install() + { + $table = "`url` VARCHAR( 170 ) NOT NULL ,\n\t\t\t\t\t `date` DATE NOT NULL ,\n\t\t\t\t\t `data` MEDIUMBLOB,\n\t\t\t\t\t `type` VARCHAR( 15 ) NOT NULL,\n\t\t\t\t\t PRIMARY KEY ( `url` , `date` , `type` )"; + // Key length = 170 + 3 byte (date) + 15 = 188 + DbHelper::createTable(self::$rawTableName, $table); + } + /** + * Saves keywords for given url and day + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $keywords serialized keyword data + * @return bool + */ + public function archiveKeywordData($url, $date, $keywords) + { + return $this->archiveData($url, $date, $keywords, 'keywords'); + } + /** + * Returns the saved keyword data for given parameters (or null if not available) + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @return null|string serialized keyword data + */ + public function getKeywordData($url, $date) + { + return $this->getData($url, $date, 'keywords'); + } + /** + * Returns the latest date keyword data is available for + * + * @param string $url url, eg. http://matomo.org + * @return null|string + */ + public function getLatestDateKeywordDataIsAvailableFor($url) + { + $date = Db::fetchOne('SELECT `date` FROM ' . $this->table . ' WHERE `url` = ? AND `type` = ? ORDER BY `date` DESC LIMIT 1', [$url, 'keywords']); + return $date; + } + /** + * Saves crawl stats for given url and day + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $keywords serialized keyword data + * @return bool + */ + public function archiveCrawlStatsData($url, $date, $keywords) + { + return $this->archiveData($url, $date, $keywords, 'crawlstats'); + } + /** + * Returns the saved crawl stats for given parameters (or null if not available) + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @return null|string serialized keyword data + */ + public function getCrawlStatsData($url, $date) + { + return $this->getData($url, $date, 'crawlstats'); + } + /** + * Saves crawl error for given url + * + * @param string $url url, eg. http://matomo.org + * @param string $keywords serialized keyword data + * @return bool + */ + public function archiveCrawlErrors($url, $keywords) + { + return $this->archiveData($url, '0000-00-00', $keywords, 'crawlerrors'); + } + /** + * Returns the saved crawl stats for given parameters (or null if not available) + * + * @param string $url url, eg. http://matomo.org + * @return null|string serialized keyword data + */ + public function getCrawlErrors($url) + { + return $this->getData($url, '0000-00-00', 'crawlerrors'); + } + /** + * Returns the saved data for given parameters (or null if not available) + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $type type of data, like keywords, crawlstats,... + * @return null|string serialized data + */ + protected function getData($url, $date, $type) + { + $keywordData = Db::fetchOne('SELECT `data` FROM ' . $this->table . ' WHERE `url` = ? AND `date` = ? AND `type` = ?', [$url, $date, $type]); + if ($keywordData) { + return $this->uncompress($keywordData); + } + return null; + } + /** + * Saves data for given type, url and day + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $keywords serialized keyword data + * @param string $type type of data, like keywords, crawlstats,... + * @return bool + */ + protected function archiveData($url, $date, $data, $type) + { + $query = "REPLACE INTO " . $this->table . " (`url`, `date`, `data`, `type`) VALUES (?,?,?,?)"; + $bindSql = []; + $bindSql[] = $url; + $bindSql[] = $date; + $bindSql[] = $this->compress($data); + $bindSql[] = $type; + Db::query($query, $bindSql); + return \true; + } + protected function compress($data) + { + if (Db::get()->hasBlobDataType()) { + $data = gzcompress($data); + } + return $data; + } + protected function uncompress($data) + { + if (Db::get()->hasBlobDataType()) { + $data = gzuncompress($data); + } + return $data; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Google.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Google.php new file mode 100644 index 0000000..b815517 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Google.php @@ -0,0 +1,131 @@ +table = Common::prefixTable(self::$rawTableName); + } + /** + * Installs required database table + */ + public static function install() + { + $dashboard = "`url` VARCHAR( 170 ) NOT NULL ,\n\t\t\t\t\t `date` DATE NOT NULL ,\n\t\t\t\t\t `data` MEDIUMBLOB,\n\t\t\t\t\t `type` VARCHAR( 15 ),\n\t\t\t\t\t PRIMARY KEY ( `url` , `date`, `type` )"; + // Key length = 170 + 3 byte (date) + 15 = 188 + DbHelper::createTable(self::$rawTableName, $dashboard); + } + /** + * Saves keywords for given url and day + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $type 'web', 'image', 'video' or 'news' + * @param string $keywords serialized keyword data + * @return bool + */ + public function archiveKeywordData($url, $date, $type, $keywords) + { + return $this->archiveData($url, $date, $keywords, 'keywords' . $type); + } + /** + * Returns the saved keyword data for given parameters (or null if not available) + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $type 'web', 'image', 'video' or 'news' + * @return null|string serialized keyword data + */ + public function getKeywordData($url, $date, $type) + { + return $this->getData($url, $date, 'keywords' . $type); + } + /** + * Returns the latest date keyword data is available for + * + * @param string $url url, eg. http://matomo.org + * @param string|null $type 'web', 'image', 'video' or 'news' + * @return null|string + */ + public function getLatestDateKeywordDataIsAvailableFor($url, $type = null) + { + if ($type === null) { + $date = Db::fetchOne('SELECT `date` FROM ' . $this->table . ' WHERE `url` = ? AND `type` LIKE ? ORDER BY `date` DESC LIMIT 1', [$url, 'keywords%']); + } else { + $date = Db::fetchOne('SELECT `date` FROM ' . $this->table . ' WHERE `url` = ? AND `type` = ? ORDER BY `date` DESC LIMIT 1', [$url, 'keywords' . $type]); + } + return $date; + } + /** + * Returns the saved data for given parameters (or null if not available) + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $type type of data, like keywords, crawlstats,... + * @return null|string serialized data + */ + protected function getData($url, $date, $type) + { + $keywordData = Db::fetchOne('SELECT `data` FROM ' . $this->table . ' WHERE `url` = ? AND `date` = ? AND `type` = ?', [$url, $date, $type]); + if ($keywordData) { + return $this->uncompress($keywordData); + } + return null; + } + /** + * Saves data for given type, url and day + * + * @param string $url url, eg. http://matomo.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $data serialized keyword data + * @param string $type type of data, like keywords, crawlstats,... + * @return bool + */ + protected function archiveData($url, $date, $data, $type) + { + $query = "REPLACE INTO " . $this->table . " (`url`, `date`, `data`, `type`) VALUES (?,?,?,?)"; + $bindSql = []; + $bindSql[] = $url; + $bindSql[] = $date; + $bindSql[] = $this->compress($data); + $bindSql[] = $type; + Db::query($query, $bindSql); + return \true; + } + protected function compress($data) + { + if (Db::get()->hasBlobDataType()) { + $data = gzcompress($data); + } + return $data; + } + protected function uncompress($data) + { + if (Db::get()->hasBlobDataType()) { + $data = gzuncompress($data); + } + return $data; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Yandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Yandex.php new file mode 100644 index 0000000..5d8d4be --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Model/Yandex.php @@ -0,0 +1,147 @@ +table = Common::prefixTable(self::$rawTableName); + } + /** + * Installs required database table + */ + public static function install() + { + $table = "`url` VARCHAR( 170 ) NOT NULL ,\n\t\t\t\t\t `date` DATE NOT NULL ,\n\t\t\t\t\t `data` MEDIUMBLOB,\n\t\t\t\t\t `type` VARCHAR(15) NOT NULL,\n\t\t\t\t\t PRIMARY KEY ( `url` , `date` , `type` )"; + // Key length = 170 + 3 byte (date) + 15 = 188 + DbHelper::createTable(self::$rawTableName, $table); + } + /** + * Saves keywords for given url and day + * + * @param string $url url, eg. http://piwik.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $keywords serialized keyword data + * @return bool + */ + public function archiveKeywordData($url, $date, $keywords) + { + return $this->archiveData($url, $date, $keywords, 'keywords'); + } + /** + * Returns the saved keyword data for given parameters (or null if not available) + * + * @param string $url url, eg. http://piwik.org + * @param string $date a day string, eg. 2016-12-24 + * @return null|string serialized keyword data + */ + public function getKeywordData($url, $date) + { + return $this->getData($url, $date, 'keywords'); + } + /** + * Returns the latest date keyword data is available for + * + * @param string $url url, eg. http://piwik.org + * @return null|string + */ + public function getLatestDateKeywordDataIsAvailableFor($url) + { + $date = Db::fetchOne('SELECT `date` FROM ' . $this->table . ' WHERE `url` = ? AND `type` = ? ORDER BY `date` DESC LIMIT 1', array($url, 'keywords')); + return $date; + } + /** + * Saves crawl stats for given url and day + * + * @param string $url url, eg. http://piwik.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $keywords serialized keyword data + * @return bool + */ + public function archiveCrawlStatsData($url, $date, $keywords) + { + return $this->archiveData($url, $date, $keywords, 'crawlstats'); + } + /** + * Returns the saved crawl stats for given parameters (or null if not available) + * + * @param string $url url, eg. http://piwik.org + * @param string $date a day string, eg. 2016-12-24 + * @return null|string serialized keyword data + */ + public function getCrawlStatsData($url, $date) + { + return $this->getData($url, $date, 'crawlstats'); + } + /** + * Returns the saved data for given parameters (or null if not available) + * + * @param string $url url, eg. http://piwik.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $type type of data, like keywords, crawlstats,... + * @return null|string serialized data + */ + protected function getData($url, $date, $type) + { + $keywordData = Db::fetchOne('SELECT `data` FROM ' . $this->table . ' WHERE `url` = ? AND `date` = ? AND `type` = ?', [$url, $date, $type]); + if ($keywordData) { + return $this->uncompress($keywordData); + } + return null; + } + /** + * Saves data for given type, url and day + * + * @param string $url url, eg. http://piwik.org + * @param string $date a day string, eg. 2016-12-24 + * @param string $keywords serialized keyword data + * @param string $type type of data, like keywords, crawlstats,... + * @return bool + */ + protected function archiveData($url, $date, $data, $type) + { + $query = "REPLACE INTO " . $this->table . " (`url`, `date`, `data`, `type`) VALUES (?,?,?,?)"; + $bindSql = []; + $bindSql[] = $url; + $bindSql[] = $date; + $bindSql[] = $this->compress($data); + $bindSql[] = $type; + Db::query($query, $bindSql); + return \true; + } + protected function compress($data) + { + if (Db::get()->hasBlobDataType()) { + return gzcompress($data); + } + return $data; + } + protected function uncompress($data) + { + if (Db::get()->hasBlobDataType()) { + return gzuncompress($data); + } + return $data; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Monolog/Handler/SEKPSystemLogHandler.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Monolog/Handler/SEKPSystemLogHandler.php new file mode 100644 index 0000000..ab91f05 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Monolog/Handler/SEKPSystemLogHandler.php @@ -0,0 +1,33 @@ +getClient()->isConfigured(); + } + public function isSupportedPeriod($date, $period) + { + // disabled for date ranges that need days for processing + if ($period == 'range') { + $periodObject = new Range($period, $date); + $subPeriods = $periodObject->getSubperiods(); + foreach ($subPeriods as $subPeriod) { + if ($subPeriod->getLabel() == 'day') { + return \false; + } + } + } + // bing statistics are not available for single days + if ($period == 'day') { + return \false; + } + return \true; + } + /** + * @inheritdoc + */ + public function getConfiguredSiteIds() + { + $configuredSites = []; + foreach ($this->getMeasurableHelper()->getAllSiteSettings() as $siteId => $settings) { + $createdByUser = !is_null($settings->bingConfigCreatedBy) ? $settings->bingConfigCreatedBy->getValue() : ''; + $siteConfig = []; + if ($settings->bingSiteUrl && $settings->bingSiteUrl->getValue()) { + $siteConfig['bingSiteUrl'] = $settings->bingSiteUrl->getValue(); + $siteConfig['createdByUser'] = $createdByUser; + $siteConfig['isDeletionAllowed'] = empty($createdByUser) || Piwik::hasUserSuperUserAccessOrIsTheUser($createdByUser); + } + if (!empty($siteConfig)) { + $configuredSites[$siteId] = $siteConfig; + } + } + return $configuredSites; + } + public function getConfigurationProblems() + { + return ['sites' => $this->getSiteErrors(), 'accounts' => $this->getAccountErrors()]; + } + protected function getSiteErrors() + { + $errors = []; + $client = $this->getClient(); + $accounts = $client->getAccounts(); + $configuredSiteIds = $this->getConfiguredSiteIds(); + foreach ($configuredSiteIds as $configuredSiteId => $config) { + $bingSiteUrl = $config['bingSiteUrl']; + list($apiKey, $url) = explode('##', $bingSiteUrl); + if (!key_exists($apiKey, $accounts)) { + $errors[$configuredSiteId] = Piwik::translate('SearchEngineKeywordsPerformance_AccountDoesNotExist', [$this->obfuscateApiKey($apiKey)]); + continue; + } + $urls = $client->getAvailableUrls($apiKey); + if (!key_exists($url, $urls)) { + $errors[$configuredSiteId] = Piwik::translate('SearchEngineKeywordsPerformance_ConfiguredUrlNotAvailable'); + continue; + } + } + return $errors; + } + protected function getAccountErrors() + { + $errors = []; + $client = $this->getClient(); + $accounts = $client->getAccounts(); + if (empty($accounts)) { + return []; + } + foreach ($accounts as $id => $account) { + try { + $client->testConfiguration($account['apiKey']); + } catch (\Exception $e) { + $errors[$id] = Piwik::translate('SearchEngineKeywordsPerformance_BingAccountError', $e->getMessage()); + } + } + return $errors; + } + protected function obfuscateApiKey( + #[\SensitiveParameter] + $apiKey + ) { + return substr($apiKey, 0, 5) . '*****' . substr($apiKey, -5, 5); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Google.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Google.php new file mode 100644 index 0000000..cc2c951 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Google.php @@ -0,0 +1,147 @@ +getClient()->isConfigured(); + } + /** + * @inheritdoc + */ + public function getConfiguredSiteIds() + { + $configuredSites = []; + foreach ($this->getMeasurableHelper()->getAllSiteSettings() as $siteId => $settings) { + $createdByUser = !is_null($settings->googleConfigCreatedBy) ? $settings->googleConfigCreatedBy->getValue() : ''; + $siteConfig = []; + if ($settings->googleSearchConsoleUrl && $settings->googleSearchConsoleUrl->getValue()) { + $siteConfig['googleSearchConsoleUrl'] = $settings->googleSearchConsoleUrl->getValue(); + $siteConfig['googleWebKeywords'] = $settings->googleWebKeywords->getValue(); + $siteConfig['googleImageKeywords'] = $settings->googleImageKeywords->getValue(); + $siteConfig['googleVideoKeywords'] = $settings->googleVideoKeywords->getValue(); + $siteConfig['googleNewsKeywords'] = $settings->googleNewsKeywords->getValue(); + $siteConfig['createdByUser'] = $createdByUser; + $siteConfig['isDeletionAllowed'] = empty($createdByUser) || Piwik::hasUserSuperUserAccessOrIsTheUser($createdByUser); + } + if (!empty($siteConfig)) { + $configuredSites[$siteId] = $siteConfig; + } + } + return $configuredSites; + } + public function getConfigurationProblems() + { + $errors = ['sites' => $this->getSiteErrors(), 'accounts' => $this->getAccountErrors()]; + return $errors; + } + protected function getSiteErrors() + { + $errors = []; + $client = $this->getClient(); + $accounts = $client->getAccounts(); + $configuredSiteIds = $this->getConfiguredSiteIds(); + foreach ($configuredSiteIds as $configuredSiteId => $config) { + $googleSiteUrl = $config['googleSearchConsoleUrl']; + list($accountId, $url) = explode('##', $googleSiteUrl); + if (!key_exists($accountId, $accounts)) { + $errors[$configuredSiteId] = Piwik::translate('SearchEngineKeywordsPerformance_AccountDoesNotExist', ['']); + continue; + } + // Property Sets and Apps are deprecated and will be removed, so warn users why it doesn't work anymore + // @todo can be removed in august 2019 + if (strpos($url, 'sc-set:') === 0) { + $errors[$configuredSiteId] = 'You are using a property set for importing. Property sets have been deprecated/removed by Google. To ensure no error occurs, please choose another site for import'; + continue; + } + if (strpos($url, 'android-app:') === 0) { + $errors[$configuredSiteId] = 'You are using a Android App for importing. Importing Android Apps has been deprecated/removed by Google. To ensure no error occurs, please choose another site for import'; + continue; + } + $urls = $client->getAvailableUrls($accountId); + if (!key_exists($url, $urls)) { + $errors[$configuredSiteId] = Piwik::translate('SearchEngineKeywordsPerformance_ConfiguredUrlNotAvailable'); + continue; + } + } + return $errors; + } + protected function getAccountErrors() + { + $errors = []; + $client = $this->getClient(); + $accounts = $client->getAccounts(); + if (empty($accounts)) { + return []; + } + foreach ($accounts as $id => $account) { + try { + $client->testConfiguration($id); + } catch (\Exception $e) { + $errors[$id] = $e->getMessage(); + } + } + return $errors; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Helper/MeasurableHelper.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Helper/MeasurableHelper.php new file mode 100644 index 0000000..995fab8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Helper/MeasurableHelper.php @@ -0,0 +1,53 @@ +allSiteSettings)) { + return $this->allSiteSettings; + } + + $siteManagerModel = StaticContainer::get(SitesManagerModel::class); + $allSiteIds = $siteManagerModel->getSitesId(); + $this->allSiteSettings = []; + foreach ($allSiteIds as $siteId) { + if (!Piwik::isUserHasAdminAccess($siteId)) { + continue; + // skip sites without access + } + $this->allSiteSettings[$siteId] = $this->getMeasurableSettings($siteId); + } + + return $this->allSiteSettings; + } + + protected function getMeasurableSettings(int $idSite): MeasurableSettings + { + return new MeasurableSettings($idSite); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/ProviderAbstract.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/ProviderAbstract.php new file mode 100644 index 0000000..4755515 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/ProviderAbstract.php @@ -0,0 +1,151 @@ + [], accounts => [] ] + */ + abstract public function getConfigurationProblems(); + /** + * Record a new timestamp for the current provider indicating an API error occurred. + * + * @return void + */ + public function recordNewApiErrorForProvider(): void + { + Option::set(self::OPTION_PREFIX_LAST_ERROR_TIME . $this->getId(), time()); + } + /** + * Get the timestamp of the most recent API error for the current provider. If none is found, 0 is returned. + * + * @return int Unix timestamp or 0; + */ + public function getLastApiErrorTimestamp(): int + { + $option = Option::get(self::OPTION_PREFIX_LAST_ERROR_TIME . $this->getId()); + if (empty($option)) { + return 0; + } + return (int) $option; + } + /** + * Checks if there has been an API error for the current provider within the past week. + * + * @return bool Indicates whether the most recent API error was less than a week ago. + */ + public function hasApiErrorWithinWeek(): bool + { + $timestamp = $this->getLastApiErrorTimestamp(); + if ($timestamp === 0) { + return \false; + } + return $timestamp > strtotime('-1 week'); + } + /** + * If there's been an API error within the past week a message string is provided. Otherwise, the string is empty. + * + * @return string Either the message or empty string depending on whether there's been a recent error. + */ + public function getRecentApiErrorMessage(): string + { + $message = ''; + if ($this->hasApiErrorWithinWeek()) { + $message = '' . $this->getName() . ' - Most recent error: ' . (new Formatter())->getPrettyTimeFromSeconds(time() - $this->getLastApiErrorTimestamp()) . ' ago'; + } + return $message; + } + + protected function getMeasurableHelper(): MeasurableHelper + { + return MeasurableHelper::getInstance(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Yandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Yandex.php new file mode 100644 index 0000000..ce70f3d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Provider/Yandex.php @@ -0,0 +1,147 @@ +getClient()->isConfigured(); + } + /** + * @inheritdoc + */ + public function getConfiguredSiteIds() + { + $configuredSites = []; + foreach ($this->getMeasurableHelper()->getAllSiteSettings() as $siteId => $settings) { + $siteConfig = []; + $createdByUser = !is_null($settings->yandexConfigCreatedBy) ? $settings->yandexConfigCreatedBy->getValue() : ''; + if ($settings->yandexAccountAndHostId && $settings->yandexAccountAndHostId->getValue()) { + $siteConfig['yandexAccountAndHostId'] = $settings->yandexAccountAndHostId->getValue(); + $siteConfig['createdByUser'] = $createdByUser; + $siteConfig['isDeletionAllowed'] = empty($createdByUser) || Piwik::hasUserSuperUserAccessOrIsTheUser($createdByUser); + } + if (!empty($siteConfig)) { + $configuredSites[$siteId] = $siteConfig; + } + } + return $configuredSites; + } + public function getConfigurationProblems() + { + $errors = ['sites' => $this->getSiteErrors(), 'accounts' => $this->getAccountErrors()]; + return $errors; + } + protected function getSiteErrors() + { + $errors = []; + $client = $this->getClient(); + $accounts = $client->getAccounts(); + $configuredSiteIds = $this->getConfiguredSiteIds(); + foreach ($configuredSiteIds as $configuredSiteId => $config) { + $yandexSiteUrl = $config['yandexAccountAndHostId']; + list($accountId, $url) = explode('##', $yandexSiteUrl); + if (!key_exists($accountId, $accounts)) { + $errors[$configuredSiteId] = Piwik::translate('SearchEngineKeywordsPerformance_AccountDoesNotExist', ['']); + continue; + } + $urls = []; + try { + $urlArray = $client->getAvailableUrls($accountId); + foreach ($urlArray as $item) { + $urls[] = $item['host_id']; + } + } catch (\Exception $e) { + } + if (!in_array($url, $urls)) { + $errors[$configuredSiteId] = Piwik::translate('SearchEngineKeywordsPerformance_ConfiguredUrlNotAvailable'); + continue; + } + } + return $errors; + } + protected function getAccountErrors() + { + $errors = []; + $client = $this->getClient(); + $accounts = $client->getAccounts(); + if (empty($accounts)) { + return []; + } + foreach ($accounts as $id => $account) { + try { + $client->testConfiguration($id); + } catch (\Exception $e) { + $errors[$id] = $e->getMessage(); + } + } + return $errors; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/README.md b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/README.md new file mode 100644 index 0000000..9e56904 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/README.md @@ -0,0 +1,87 @@ +# Search Engine Keywords Performance Plugin for Matomo + +## Description + +Uncover the keywords people use to find your site in the search engines. Learn which keywords are driving the most traffic, leads, and sales. + +There was a time when Google Analytics let you see what keywords people searched for to find your site. But one day, Google curtailed this critical information behind two fateful, cryptic words: "(not provided)." + +Since then, there was no way you could access this data. Unless you used Matomo's Search Engine Keywords Performance plugin, that is. + +With Search Engine Keywords Performance, the keywords people use to find your site become a dimension in your "Referrers" reports. + +Monitor your keywords' positions and boost your SEO performance like in the old days. + +### How Search Engine Keywords Performance Works + +#### All the Keywords Search Engines Don't Want You to See In One Report + +
+
+

Google, Yahoo, and Bing may not want you to see what keywords get you traffic, but we do. How? By leveraging their APIs.

+

Slice the keywords data with one of the 90+ dimensions and mix them with metrics like impressions, clicks, CTR, and the average position in the SERPs.

+
+
+All the Keywords Search Engines Don't Want You to See In One Report +
+
+ +#### Get An In-Depth Look at Your Crawling Performance + +
+
+

No matter how well you optimise your site, without proper crawling, your SEO efforts will be in vain.

+

Discover the number of pages crawled and indexed, 404 pages found, and other issues that could affect your crawling performance in Yahoo and Bing.

+

The page crawling error reports will show you what pages could not be crawled by a search engine with a detailed reason, so you can fix them right away.

+
+
+Get An In-Depth Look at Your Crawling Performance +
+
+ +#### Identify What Keywords Your Images and Videos Bring You Traffic + +
+
+

Considering that YouTube and Google Images are the second and third largest search engines, your videos and images can drive significant organic traffic to your site.

+

With the Search Engine Keywords Performance plugin, you can uncover every keyword they rank for and how many visitors they attract, among other metrics.

+
+
+Identify What Keywords Your Images and Videos Bring You Traffic +
+
+ +#### See How Your Keyword Performance Evolves Over Time + +
+
+

Track your top keywords and see how your metrics and KPIs unfold. Monitor, identify, and optimise your SEO strategy for opportunities to get the highest return from your efforts.

+
+
+See How Your Keyword Performance Evolves Over Time +
+
+ +### Try Search Engine Keywords Performance Today + +Unveil the true picture of your SEO performance with Matomo's Search Engine Keywords Performance plugin. See once again what keywords you rank for and take your organic traffic to the next level. + +It's time you enjoy an unparalleled data-driven SEO strategy with Matomo. Start your 30-day free trial today. + +## Dependencies +This plugin had its vendored dependencies scoped using [matomo scoper](https://github.com/matomo-org/matomo-scoper). This means that composer packages are prefixed so that they won't conflict with the same libraries used by other plugins. If you need to update a dependency, you should be able to run `composer install` to populate the vendor directory, make sure that you have the [DevPluginCommands plugin](https://github.com/innocraft/dev-plugin-commands) installed, and run the following command `./console devplugincommands:process-dependencies --plugin="SearchEngineKeywordsPerformance" --downgrade-php` to scope and transpile the dependencies. + +### Features +* New Search Keywords report in Matomo Referrers section. +* View Keywords analytics by search type (web VS image VS video). +* View combined Keywords across all search engines (Google + Bing + Yahoo + Yandex). +* Monitor Keyword rankings and Search Engine Optimisation performance for each keyword with [Row Evolution](https://matomo.org/docs/row-evolution/). +* New Crawling overview report show how Search engines bots crawl your websites (Bing + Yahoo and Yandex). +* View crawling overview key metrics (for Bing + Yahoo and Yandex): crawled pages, total pages in index, total inboud links, robots.txt exclusion page count, crawl errors, DNS failures, connection timeouts, page redirects (301, 302 http status), error pages (4xx http status), internet error pages (5xx http status). +* Import the detailed list of search keywords for Google search, Google images and Google Videos directly from Google Search Console. +* Import the detailed list of search keywords from Bing and Yahoo! search directly from Bing Webmaster Tools. +* Import the detailed list of search keywords from Yandex search directly from Yandex Webmaster API. +* View all crawling errors with detailed reasons like server errors, robots.txt exclusions, not found pages, ... (Bing + Yahoo) +* Possibility to add support for other search engines that provide their data through an API (contact us). +* Get your Keyword analytics SEO reports by [email](https://matomo.org/docs/email-reports/) to you, your colleagues or customers. +* Export your Keyword analytics report using the [Search Keywords Performance Monitor API](http://developer.matomo.org/api-reference/reporting-api#SearchEngineKeywordsPerformance). \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Base.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Base.php new file mode 100644 index 0000000..dbf86c2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Base.php @@ -0,0 +1,32 @@ +maxRowsInTable = PiwikConfig::getInstance()->General['datatable_archiving_maximum_rows_referrers']; + $this->columnToSortByBeforeTruncation = Metrics::NB_CLICKS; + $this->columnAggregationOps = Metrics::getColumnsAggregationOperations(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Bing.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Bing.php new file mode 100644 index 0000000..690540c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Bing.php @@ -0,0 +1,208 @@ +apiKey = $apiKey; + $this->apiUrl = $apiUrl; + $this->logger = $logger; + $this->columnAggregationOps = array_merge(Metrics::getColumnsAggregationOperations(), [ + self::CRAWLSTATS_OTHER_CODES_RECORD_NAME => 'max', + self::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_2XX_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_301_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_302_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_4XX_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_5XX_RECORD_NAME => 'max', + self::CRAWLSTATS_TIMEOUT_RECORD_NAME => 'max', + self::CRAWLSTATS_MALWARE_RECORD_NAME => 'max', + self::CRAWLSTATS_ERRORS_RECORD_NAME => 'max', + self::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => 'max', + self::CRAWLSTATS_DNS_FAILURE_RECORD_NAME => 'max', + self::CRAWLSTATS_IN_INDEX_RECORD_NAME => 'max', + self::CRAWLSTATS_IN_LINKS_RECORD_NAME => 'max' + ]); + } + public function getRecordMetadata(ArchiveProcessor $archiveProcessor): array + { + return [ + Record::make(Record::TYPE_BLOB, self::KEYWORDS_BING_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_OTHER_CODES_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_2XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_301_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_302_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_4XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_5XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_TIMEOUT_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_MALWARE_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_ERRORS_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_DNS_FAILURE_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_IN_INDEX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_IN_LINKS_RECORD_NAME) + ]; + } + protected function aggregate(ArchiveProcessor $archiveProcessor): array + { + $records = []; + $parameters = $archiveProcessor->getParams(); + $date = $parameters->getDateStart()->setTimezone('UTC')->toString('Y-m-d'); + $this->logger->debug("[SearchEngineKeywordsPerformance] Archiving bing records for {$date} and {$this->apiUrl}"); + $dataTable = $this->getKeywordsAsDataTable($date); + if (empty($dataTable)) { + // ensure data is present (if available) + BingImporter::importAvailablePeriods($this->apiKey, $this->apiUrl); + $dataTable = $this->getKeywordsAsDataTable($date); + } + if (!empty($dataTable)) { + $this->logger->debug("[SearchEngineKeywordsPerformance] Archiving bing keywords for {$date} and {$this->apiUrl}"); + $records[self::KEYWORDS_BING_RECORD_NAME] = $dataTable; + } + $this->archiveDayCrawlStatNumerics($records, $date); + return $records; + } + /** + * Returns keyword data for given parameters as DataTable + */ + protected function getKeywordsAsDataTable(string $date): ?DataTable + { + $model = new BingModel(); + $keywordData = $model->getKeywordData($this->apiUrl, $date); + if (!empty($keywordData)) { + $dataTable = new DataTable(); + $dataTable->addRowsFromSerializedArray($keywordData); + return $dataTable; + } + return null; + } + /** + * Inserts various numeric records for crawl stats + */ + protected function archiveDayCrawlStatNumerics(array &$records, string $date): void + { + $dataTable = $this->getCrawlStatsAsDataTable($date); + if (!empty($dataTable)) { + Log::debug("[SearchEngineKeywordsPerformance] Archiving bing crawl stats for {$date} and {$this->apiUrl}"); + $getValue = function ($label) use ($dataTable) { + $row = $dataTable->getRowFromLabel($label); + if ($row) { + return (int) $row->getColumn(Metrics::NB_PAGES); + } + return 0; + }; + $records = array_merge($records, [ + self::CRAWLSTATS_OTHER_CODES_RECORD_NAME => $getValue('AllOtherCodes'), + self::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME => $getValue('BlockedByRobotsTxt'), + self::CRAWLSTATS_CODE_2XX_RECORD_NAME => $getValue('Code2xx'), + self::CRAWLSTATS_CODE_301_RECORD_NAME => $getValue('Code301'), + self::CRAWLSTATS_CODE_302_RECORD_NAME => $getValue('Code302'), + self::CRAWLSTATS_CODE_4XX_RECORD_NAME => $getValue('Code4xx'), + self::CRAWLSTATS_CODE_5XX_RECORD_NAME => $getValue('Code5xx'), + self::CRAWLSTATS_TIMEOUT_RECORD_NAME => $getValue('ConnectionTimeout'), + self::CRAWLSTATS_MALWARE_RECORD_NAME => $getValue('ContainsMalware'), + self::CRAWLSTATS_ERRORS_RECORD_NAME => $getValue('CrawlErrors'), + self::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => $getValue('CrawledPages'), + self::CRAWLSTATS_DNS_FAILURE_RECORD_NAME => $getValue('DnsFailures'), + self::CRAWLSTATS_IN_INDEX_RECORD_NAME => $getValue('InIndex'), + self::CRAWLSTATS_IN_LINKS_RECORD_NAME => $getValue('InLinks') + ]); + Common::destroy($dataTable); + unset($dataTable); + } + } + /** + * Returns crawl stats for given parameters as DataTable + */ + protected function getCrawlStatsAsDataTable(string $date): ?DataTable + { + $model = new BingModel(); + $keywordData = $model->getCrawlStatsData($this->apiUrl, $date); + if (!empty($keywordData)) { + $dataTable = new DataTable(); + $dataTable->addRowsFromSerializedArray($keywordData); + return $dataTable; + } + return null; + } + public static function make(int $idSite): ?self + { + $site = new Site($idSite); + $setting = new MeasurableSettings($site->getId(), $site->getType()); + $bingSiteUrl = $setting->bingSiteUrl; + $doesNotHaveBing = empty($bingSiteUrl) || !$bingSiteUrl->getValue() || \false === strpos($bingSiteUrl->getValue(), '##'); + if ($doesNotHaveBing) { + // bing api not activated for that site + return null; + } + list($apiKey, $url) = explode('##', $bingSiteUrl->getValue()); + return StaticContainer::getContainer()->make(\Piwik\Plugins\SearchEngineKeywordsPerformance\RecordBuilders\Bing::class, ['apiKey' => $apiKey, 'apiUrl' => $url]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Google.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Google.php new file mode 100644 index 0000000..796f408 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Google.php @@ -0,0 +1,155 @@ +accountId = $accountId; + $this->searchConsoleUrl = $searchConsoleUrl; + $this->recordName = $recordName; + $this->logger = $logger; + } + public function getRecordMetadata(ArchiveProcessor $archiveProcessor): array + { + return [ArchiveProcessor\Record::make(Record::TYPE_BLOB, $this->recordName)]; + } + protected function aggregate(ArchiveProcessor $archiveProcessor): array + { + $parameters = $archiveProcessor->getParams(); + $date = $parameters->getDateStart()->setTimezone('UTC')->toString('Y-m-d'); + $record = $this->aggregateDayBySearchType($archiveProcessor, $this->recordName, $date); + if (empty($record)) { + return []; + } + return [$this->recordName => $record]; + } + public function isEnabled(ArchiveProcessor $archiveProcessor): bool + { + $segment = $archiveProcessor->getParams()->getSegment(); + if (!$segment->isEmpty()) { + $this->logger->debug("Skip Archiving for SearchEngineKeywordsPerformance plugin for segments"); + return \false; + // do not archive data for segments + } + return \true; + } + /** + * Aggregates data for a given day by type of search + */ + protected function aggregateDayBySearchType(ArchiveProcessor $archiveProcessor, string $recordName, string $date): ?DataTable + { + $types = [self::KEYWORDS_GOOGLE_WEB_RECORD_NAME => 'web', self::KEYWORDS_GOOGLE_IMAGE_RECORD_NAME => 'image', self::KEYWORDS_GOOGLE_VIDEO_RECORD_NAME => 'video', self::KEYWORDS_GOOGLE_NEWS_RECORD_NAME => 'news']; + $this->logger->debug("[SearchEngineKeywordsPerformance] Archiving {$types[$recordName]} keywords for {$date} and {$this->searchConsoleUrl}"); + $dataTable = $this->getKeywordsAsDataTable($archiveProcessor, $date, $types[$recordName]); + if (empty($dataTable)) { + return null; + } + return $dataTable; + } + /** + * Returns keyword data for given parameters as DataTable + */ + protected function getKeywordsAsDataTable(ArchiveProcessor $archiveProcessor, string $date, string $type): ?DataTable + { + // ensure keywords are present (if available) + $googleImporter = new GoogleImporter($archiveProcessor->getParams()->getSite()->getId()); + $googleImporter->importKeywordsIfNecessary($this->accountId, $this->searchConsoleUrl, $date, $type); + $model = new GoogleModel(); + $keywordData = $model->getKeywordData($this->searchConsoleUrl, $date, $type); + if (!empty($keywordData)) { + $dataTable = new DataTable(); + $dataTable->addRowsFromSerializedArray($keywordData); + return $dataTable; + } + return null; + } + public static function makeAll(int $idSite): array + { + $site = new Site($idSite); + $settings = new MeasurableSettings($site->getId(), $site->getType()); + $searchConsoleUrl = $settings->googleSearchConsoleUrl; + if (empty($searchConsoleUrl) || !$searchConsoleUrl->getValue() || \false === strpos($searchConsoleUrl->getValue(), '##')) { + return []; + // search console not activated for that site + } + $searchConsoleSetting = $settings->googleSearchConsoleUrl->getValue(); + list($accountId, $searchConsoleUrl) = explode('##', $searchConsoleSetting); + $archives = []; + if ($settings->googleWebKeywords->getValue()) { + $archives[] = self::KEYWORDS_GOOGLE_WEB_RECORD_NAME; + } + if ($settings->googleImageKeywords->getValue()) { + $archives[] = self::KEYWORDS_GOOGLE_IMAGE_RECORD_NAME; + } + if ($settings->googleVideoKeywords->getValue()) { + $archives[] = self::KEYWORDS_GOOGLE_VIDEO_RECORD_NAME; + } + if ($settings->googleNewsKeywords->getValue()) { + $archives[] = self::KEYWORDS_GOOGLE_NEWS_RECORD_NAME; + } + $logger = StaticContainer::get(LoggerInterface::class); + $builders = array_map(function ($recordName) use ($accountId, $searchConsoleUrl, $logger) { + return new self($accountId, $searchConsoleUrl, $recordName, $logger); + }, $archives); + return $builders; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Yandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Yandex.php new file mode 100644 index 0000000..140a5b8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/RecordBuilders/Yandex.php @@ -0,0 +1,196 @@ +accountId = $accountId; + $this->hostId = $hostId; + $this->logger = $logger; + $this->columnAggregationOps = array_merge(Metrics::getColumnsAggregationOperations(), [ + self::CRAWLSTATS_IN_INDEX_RECORD_NAME => 'max', + self::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME => 'max', + self::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME => 'max', + self::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_2XX_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_3XX_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_4XX_RECORD_NAME => 'max', + self::CRAWLSTATS_CODE_5XX_RECORD_NAME => 'max', + self::CRAWLSTATS_ERRORS_RECORD_NAME => 'max' + ]); + } + public function getRecordMetadata(ArchiveProcessor $archiveProcessor): array + { + return [ + Record::make(Record::TYPE_BLOB, self::KEYWORDS_YANDEX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_IN_INDEX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_2XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_3XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_4XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_CODE_5XX_RECORD_NAME), + Record::make(Record::TYPE_NUMERIC, self::CRAWLSTATS_ERRORS_RECORD_NAME) + ]; + } + protected function aggregate(ArchiveProcessor $archiveProcessor): array + { + $records = []; + $parameters = $archiveProcessor->getParams(); + $date = $parameters->getDateStart()->setTimezone('UTC')->toString('Y-m-d'); + $this->logger->debug("[SearchEngineKeywordsPerformance] Archiving yandex records for {$date} and {$this->hostId}"); + $dataTable = $this->getKeywordsAsDataTable($date); + if (empty($dataTable)) { + // ensure data is present (if available) + YandexImporter::importAvailableDataForDate($this->accountId, $this->hostId, $date); + $dataTable = $this->getKeywordsAsDataTable($date); + } + if (!empty($dataTable)) { + Log::debug("[SearchEngineKeywordsPerformance] Archiving yandex keywords for {$date} and {$this->hostId}"); + $records[self::KEYWORDS_YANDEX_RECORD_NAME] = $dataTable; + } + $records = array_merge($records, $this->archiveDayCrawlStatNumerics($date)); + return $records; + } + public function isEnabled(ArchiveProcessor $archiveProcessor): bool + { + $segment = $archiveProcessor->getParams()->getSegment(); + if (!$segment->isEmpty()) { + $this->logger->debug("Skip Archiving for SearchEngineKeywordsPerformance plugin for segments"); + return \false; + // do not archive data for segments + } + return \true; + } + /** + * Returns keyword data for given parameters as DataTable + */ + protected function getKeywordsAsDataTable(string $date): ?DataTable + { + $model = new YandexModel(); + $keywordData = $model->getKeywordData($this->hostId, $date); + if (!empty($keywordData)) { + $dataTable = new DataTable(); + $dataTable->addRowsFromSerializedArray($keywordData); + return $dataTable; + } + return null; + } + /** + * Returns keyword data for given parameters as DataTable + */ + protected function archiveDayCrawlStatNumerics(string $date): array + { + $dataTable = $this->getCrawlStatsAsDataTable($date); + if (!empty($dataTable)) { + $this->logger->debug("[SearchEngineKeywordsPerformance] Archiving yandex crawl stats for {$date} and {$this->hostId}"); + $getValue = function ($label) use ($dataTable) { + $row = $dataTable->getRowFromLabel($label); + if ($row) { + return (int) $row->getColumn(Metrics::NB_PAGES); + } + return 0; + }; + $numericRecords = [ + self::CRAWLSTATS_IN_INDEX_RECORD_NAME => $getValue('SEARCHABLE'), + self::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME => $getValue('APPEARED_IN_SEARCH'), + self::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME => $getValue('REMOVED_FROM_SEARCH'), + self::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => $getValue('HTTP_2XX') + $getValue('HTTP_3XX') + $getValue('HTTP_4XX') + $getValue('HTTP_5XX') + $getValue('OTHER'), + self::CRAWLSTATS_CODE_2XX_RECORD_NAME => $getValue('HTTP_2XX'), + self::CRAWLSTATS_CODE_3XX_RECORD_NAME => $getValue('HTTP_3XX'), + self::CRAWLSTATS_CODE_4XX_RECORD_NAME => $getValue('HTTP_4XX'), + self::CRAWLSTATS_CODE_5XX_RECORD_NAME => $getValue('HTTP_5XX'), + self::CRAWLSTATS_ERRORS_RECORD_NAME => $getValue('OTHER') + ]; + Common::destroy($dataTable); + unset($dataTable); + return $numericRecords; + } + return []; + } + /** + * Returns crawl stats for given parameters as DataTable + */ + protected function getCrawlStatsAsDataTable(string $date): ?DataTable + { + $model = new YandexModel(); + $keywordData = $model->getCrawlStatsData($this->hostId, $date); + if (!empty($keywordData)) { + $dataTable = new DataTable(); + $dataTable->addRowsFromSerializedArray($keywordData); + return $dataTable; + } + return null; + } + public static function make(int $idSite): ?self + { + $site = new Site($idSite); + $setting = new MeasurableSettings($site->getId(), $site->getType()); + $yandexConfig = $setting->yandexAccountAndHostId; + $doesNotHaveYandex = empty($yandexConfig) || !$yandexConfig->getValue() || \false === strpos($yandexConfig->getValue(), '##'); + if ($doesNotHaveYandex) { + // yandex api not activated for that site + return null; + } + list($accountId, $hostId) = explode('##', $yandexConfig->getValue()); + return StaticContainer::getContainer()->make(self::class, ['accountId' => $accountId, 'hostId' => $hostId]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/Base.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/Base.php new file mode 100644 index 0000000..2006c39 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/Base.php @@ -0,0 +1,205 @@ +categoryId = 'Referrers_Referrers'; + $this->subcategoryId = 'Referrers_SubmenuSearchEngines'; + $this->defaultSortColumn = Metrics::NB_CLICKS; + $this->metrics = Metrics::getKeywordMetrics(); + $this->processedMetrics = []; + if (property_exists($this, 'onlineGuideUrl')) { + $this->onlineGuideUrl = Url::addCampaignParametersToMatomoLink('https://matomo.org/guide/installation-maintenance/import-search-keywords/'); + } + } + public function getMetricsDocumentation() + { + return Metrics::getMetricsDocumentation(); + } + public function configureReportMetadata(&$availableReports, $infos) + { + $this->idSite = $infos['idSite']; + parent::configureReportMetadata($availableReports, $infos); + } + public function configureView(ViewDataTable $view) + { + $view->config->addTranslations(['label' => $this->dimension->getName()]); + $view->config->show_limit_control = \true; + $view->config->show_all_views_icons = \false; + $view->config->show_table_all_columns = \false; + $view->config->columns_to_display = ['label', Metrics::NB_CLICKS, Metrics::NB_IMPRESSIONS, Metrics::CTR, Metrics::POSITION]; + $view->requestConfig->filter_limit = 10; + $this->configureSegmentNotSupported($view); + } + public function getSecondarySortColumnCallback() + { + return function ($firstSortColumn, $table) { + return $firstSortColumn === Metrics::NB_CLICKS ? Metrics::NB_IMPRESSIONS : Metrics::NB_CLICKS; + }; + } + protected function configureSegmentNotSupported(ViewDataTable $view) + { + // show 'not supported' message if segment is chosen + if (Common::getRequestVar('segment', '')) { + $view->config->show_footer_message .= '

' . Piwik::translate('SearchEngineKeywordsPerformance_NoSegmentation') . '

'; + } + } + public function isGoogleEnabledForType($type) + { + $idSite = Common::getRequestVar('idSite', $this->idSite, 'int'); + if (empty($idSite)) { + return \false; + } + if (SearchEngineKeywordsPerformance::isGoogleForceEnabled($idSite)) { + return \true; + } + $setting = new MeasurableSettings($idSite); + $searchConsoleSetting = $setting->googleSearchConsoleUrl; + $typeSetting = $setting->getSetting('google' . $type . 'keywords'); + return $searchConsoleSetting && $searchConsoleSetting->getValue() && $typeSetting && $typeSetting->getValue() && (strpos($searchConsoleSetting->getValue(), 'android-app') === \false || $type == 'web'); + } + public function isAnyGoogleTypeEnabled() + { + return $this->isGoogleEnabledForType('web') || $this->isGoogleEnabledForType('image') || $this->isGoogleEnabledForType('video') || $this->isGoogleEnabledForType('news'); + } + public function isBingEnabled() + { + $idSite = Common::getRequestVar('idSite', $this->idSite, 'int'); + if (empty($idSite)) { + return \false; + } + if (SearchEngineKeywordsPerformance::isBingForceEnabled($idSite)) { + return \true; + } + $setting = new MeasurableSettings($idSite); + return !empty($setting->bingSiteUrl) && $setting->bingSiteUrl->getValue(); + } + public function isYandexEnabled() + { + $idSite = Common::getRequestVar('idSite', \false, 'int'); + if (empty($idSite)) { + return \false; + } + if (SearchEngineKeywordsPerformance::isYandexForceEnabled($idSite)) { + return \true; + } + $setting = new MeasurableSettings($idSite); + return !empty($setting->yandexAccountAndHostId) && $setting->yandexAccountAndHostId->getValue(); + } + public function getMetricNamesToProcessReportTotals() + { + return Metrics::getMetricIdsToProcessReportTotal(); + } + /** + * @param ViewDataTable $view + * @param $type + * @throws \Exception + */ + public function configureViewMessagesGoogle($view, $type) + { + $period = Common::getRequestVar('period', \false, 'string'); + $date = Common::getRequestVar('date', \false, 'string'); + $idSite = Common::getRequestVar('idSite', \false, 'string'); + // Append a footer message if data was not yet reported as final + $view->config->filters[] = function ($table) use ($view) { + if ($table->getMetadata(Google::DATATABLE_METADATA_TEMPORARY) === \true && \false === strpos($view->config->show_footer_message, Piwik::translate('SearchEngineKeywordsPerformance_GoogleDataNotFinal'))) { + $view->config->show_footer_message .= '

' . Piwik::translate('SearchEngineKeywordsPerformance_GoogleDataNotFinal') . '

'; + } + }; + if (SearchEngineKeywordsPerformance::isGoogleForceEnabled($idSite)) { + return; + } + $measurableSetting = new MeasurableSettings($idSite); + [$account, $url] = explode('##', $measurableSetting->googleSearchConsoleUrl->getValue()); + $model = new ModelGoogle(); + $message = ''; + $periodObj = Period\Factory::build($period, $date); + $lastDate = $model->getLatestDateKeywordDataIsAvailableFor($url); + $lastDateForType = $model->getLatestDateKeywordDataIsAvailableFor($url, $type); + if ($lastDate && !Date::factory($lastDate)->isEarlier($periodObj->getDateStart())) { + return; + } + $lastDateMessage = ''; + if ($lastDateForType && $period != 'range') { + $periodObjType = Period\Factory::build($period, Date::factory($lastDateForType)); + $lastDateMessage = Piwik::translate('SearchEngineKeywordsPerformance_LatestAvailableDate', '' . $periodObjType->getLocalizedShortString() . ''); + } + if ($periodObj->getDateEnd()->isLater(Date::now()->subDay(5))) { + $message .= '

' + . Piwik::translate('CoreHome_ThereIsNoDataForThisReport') + . '
' . Piwik::translate('SearchEngineKeywordsPerformance_GoogleDataProvidedWithDelay') + . '
' . $lastDateMessage . '

'; + $view->config->no_data_message = $message; + } + if (empty($message) && $lastDateMessage) { + $view->config->show_footer_message .= '

' . $lastDateMessage . '

'; + } + } + protected function formatColumnsAsNumbers($view, $columns) + { + $numberFormatter = NumberFormatter::getInstance(); + $view->config->filters[] = function (DataTable $table) use ($columns, $numberFormatter) { + $firstRow = $table->getFirstRow(); + if (empty($firstRow)) { + return; + } + foreach ($columns as $metric) { + $value = $firstRow->getColumn($metric); + if (\false !== $value) { + $firstRow->setColumn($metric, $numberFormatter->formatNumber($value)); + } + } + }; + } + /** + * @param ViewDataTable $view + */ + protected function formatCtrAndPositionColumns($view) + { + $settings = new SystemSettings(); + $numberFormatter = NumberFormatter::getInstance(); + $view->config->filters[] = ['ColumnCallbackReplace', [Metrics::CTR, function ($value) use ($numberFormatter) { + return $numberFormatter->formatPercent($value * 100, 0, 0); + }]]; + $precision = $settings->roundKeywordPosition->getValue() ? 0 : 1; + $view->config->filters[] = ['ColumnCallbackReplace', [Metrics::POSITION, function ($value) use ($precision, $numberFormatter) { + if ($precision) { + return $numberFormatter->formatNumber($value, $precision, $precision); + } + return round($value, $precision); + }]]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingErrorExamplesBing.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingErrorExamplesBing.php new file mode 100644 index 0000000..427007d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingErrorExamplesBing.php @@ -0,0 +1,100 @@ +getLocalized(Date::DATETIME_FORMAT_SHORT) : Piwik::translate('General_Never'); + $this->categoryId = 'General_Actions'; + $this->subcategoryId = 'SearchEngineKeywordsPerformance_CrawlingErrors'; + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlErrors'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlErrorsFromDateX', $dateOfLastImport); + $this->defaultSortColumn = 'label'; + $this->metrics = []; + $this->order = 2; + } + public function configureView(ViewDataTable $view) + { + $view->config->show_all_views_icons = \false; + $view->config->show_table_all_columns = \false; + $view->config->disable_row_evolution = \true; + $view->config->addTranslations([ + 'label' => Piwik::translate('Actions_ColumnPageURL'), + 'category' => Piwik::translate('SearchEngineKeywordsPerformance_Category'), + 'inLinks' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlInboundLink'), + 'responseCode' => Piwik::translate('SearchEngineKeywordsPerformance_ResponseCode') + ]); + $translations = [ + 'Code301' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus301'), + 'Code302' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus302'), + 'Code4xx' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus4xx'), + 'Code5xx' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus5xx'), + 'BlockedByRobotsTxt' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlBlockedByRobotsTxt'), + 'ContainsMalware' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlMalwareInfected'), + 'ImportantUrlBlockedByRobotsTxt' => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlImportantBlockedByRobotsTxt') + ]; + $view->config->filters[] = ['ColumnCallbackReplace', ['category', function ($val) use ($translations) { + $codes = explode(',', $val); + $result = []; + foreach ($codes as $code) { + $result[] = array_key_exists($code, $translations) ? $translations[$code] : $code; + } + return implode(', ', $result); + }]]; + $this->configureSegmentNotSupported($view); + } + public function getSecondarySortColumnCallback() + { + return null; + } + public function configureReportMetadata(&$availableReports, $infos) + { + } + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $widget = $factory->createWidget(); + $widget->setIsWide(); + $widgetsList->addWidgetConfig($widget); + } + public function isEnabled() + { + $idSite = Common::getRequestVar('idSite', \false, 'int'); + if (empty($idSite)) { + return \false; + } + if (SearchEngineKeywordsPerformance::isBingForceEnabled($idSite)) { + return \true; + } + $setting = new MeasurableSettings($idSite); + return !empty($setting->bingSiteUrl) && $setting->bingSiteUrl->getValue(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingOverviewBing.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingOverviewBing.php new file mode 100644 index 0000000..9f61693 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingOverviewBing.php @@ -0,0 +1,132 @@ +subcategoryId = 'SearchEngineKeywordsPerformance_CrawlingStats'; + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlingStats'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlingStatsDocumentation'); + $this->defaultSortColumn = null; + $this->metrics = []; + $this->order = 10; + } + public function configureView(ViewDataTable $view) + { + $period = Common::getRequestVar('period', \false, 'string'); + $viewDataTable = Common::getRequestVar('viewDataTable', \false, 'string'); + if ($period != 'day' && $viewDataTable != 'graphEvolution') { + $view->config->show_footer_message .= '

' . Piwik::translate('SearchEngineKeywordsPerformance_ReportShowMaximumValues') . '

'; + } + $view->config->show_limit_control = \false; + $view->config->show_all_views_icons = \false; + $view->config->show_table_all_columns = \false; + $view->config->setDefaultColumnsToDisplay([BingRecordBuilder::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME], \false, \false); + $view->config->addTranslations([ + BingRecordBuilder::CRAWLSTATS_OTHER_CODES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlStatsOtherCodes'), + BingRecordBuilder::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlBlockedByRobotsTxt'), + BingRecordBuilder::CRAWLSTATS_CODE_2XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus2xx'), + BingRecordBuilder::CRAWLSTATS_CODE_301_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus301'), + BingRecordBuilder::CRAWLSTATS_CODE_302_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus302'), + BingRecordBuilder::CRAWLSTATS_CODE_4XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus4xx'), + BingRecordBuilder::CRAWLSTATS_CODE_5XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlHttpStatus5xx'), + BingRecordBuilder::CRAWLSTATS_TIMEOUT_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlConnectionTimeout'), + BingRecordBuilder::CRAWLSTATS_MALWARE_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlMalwareInfected'), + BingRecordBuilder::CRAWLSTATS_ERRORS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_CrawlingErrors'), + BingRecordBuilder::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlCrawledPages'), + BingRecordBuilder::CRAWLSTATS_DNS_FAILURE_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlDNSFailures'), + BingRecordBuilder::CRAWLSTATS_IN_INDEX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlPagesInIndex'), + BingRecordBuilder::CRAWLSTATS_IN_LINKS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_BingCrawlInboundLink') + ]); + $view->config->selectable_columns = [ + BingRecordBuilder::CRAWLSTATS_OTHER_CODES_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_BLOCKED_ROBOTS_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_2XX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_301_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_302_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_4XX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CODE_5XX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_TIMEOUT_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_MALWARE_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_ERRORS_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_DNS_FAILURE_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_IN_INDEX_RECORD_NAME, + BingRecordBuilder::CRAWLSTATS_IN_LINKS_RECORD_NAME + ]; + $this->configureSegmentNotSupported($view); + $this->formatColumnsAsNumbers($view, $view->config->selectable_columns); + } + public function getSecondarySortColumnCallback() + { + return null; + } + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $idSite = Common::getRequestVar('idSite', 0, 'int'); + if (empty($idSite)) { + return; + } + $subcategory = 'SearchEngineKeywordsPerformance_CrawlingStats'; + $widgets = []; + $config = $factory->createWidget(); + $config->forceViewDataTable(Evolution::ID); + $config->setSubcategoryId($subcategory); + $config->setIsNotWidgetizable(); + $widgets[] = $config; + $config = $factory->createWidget(); + $config->forceViewDataTable(Sparklines::ID); + $config->setSubcategoryId($subcategory); + $config->setName(''); + $config->setIsNotWidgetizable(); + $widgets[] = $config; + $config = $factory->createContainerWidget('CrawlingStatsBing'); + $config->setCategoryId($widgets[0]->getCategoryId()); + $config->setSubcategoryId($subcategory); + $config->setIsWidgetizable(); + foreach ($widgets as $widget) { + $config->addWidgetConfig($widget); + } + $widgetsList->addWidgetConfigs([$config]); + } + public function isEnabled() + { + $idSite = Common::getRequestVar('idSite', \false, 'int'); + if (empty($idSite)) { + return \false; + } + if (SearchEngineKeywordsPerformance::isBingForceEnabled($idSite)) { + return \true; + } + $setting = new MeasurableSettings($idSite); + return !empty($setting->bingSiteUrl) && $setting->bingSiteUrl->getValue(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingOverviewYandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingOverviewYandex.php new file mode 100644 index 0000000..058aabe --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetCrawlingOverviewYandex.php @@ -0,0 +1,107 @@ +subcategoryId = 'SearchEngineKeywordsPerformance_CrawlingStats'; + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlingStats'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlingStatsDocumentation'); + $this->defaultSortColumn = null; + $this->metrics = []; + $this->order = 10; + } + public function configureView(ViewDataTable $view) + { + $period = Common::getRequestVar('period', \false, 'string'); + $viewDataTable = Common::getRequestVar('viewDataTable', \false, 'string'); + if ($period != 'day' && $viewDataTable != 'graphEvolution') { + $view->config->show_footer_message .= '

' . Piwik::translate('SearchEngineKeywordsPerformance_ReportShowMaximumValues') . '

'; + } + $view->config->show_limit_control = \false; + $view->config->show_all_views_icons = \false; + $view->config->show_table_all_columns = \false; + $view->config->setDefaultColumnsToDisplay([YandexRecordBuilder::CRAWLSTATS_IN_INDEX_RECORD_NAME], \false, \false); + $view->config->addTranslations([ + YandexRecordBuilder::CRAWLSTATS_IN_INDEX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlInIndex'), + YandexRecordBuilder::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlAppearedPages'), + YandexRecordBuilder::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlRemovedPages'), + YandexRecordBuilder::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlCrawledPages'), + YandexRecordBuilder::CRAWLSTATS_CODE_2XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus2xx'), + YandexRecordBuilder::CRAWLSTATS_CODE_3XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus3xx'), + YandexRecordBuilder::CRAWLSTATS_CODE_4XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus4xx'), + YandexRecordBuilder::CRAWLSTATS_CODE_5XX_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlHttpStatus5xx'), + YandexRecordBuilder::CRAWLSTATS_ERRORS_RECORD_NAME => Piwik::translate('SearchEngineKeywordsPerformance_YandexCrawlErrors') + ]); + $view->config->selectable_columns = [ + YandexRecordBuilder::CRAWLSTATS_IN_INDEX_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_APPEARED_PAGES_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_REMOVED_PAGES_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_CRAWLED_PAGES_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_CODE_2XX_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_CODE_3XX_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_CODE_4XX_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_CODE_5XX_RECORD_NAME, + YandexRecordBuilder::CRAWLSTATS_ERRORS_RECORD_NAME + ]; + $this->configureSegmentNotSupported($view); + } + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $idSite = Common::getRequestVar('idSite', 0, 'int'); + if (empty($idSite)) { + return; + } + $subcategory = 'SearchEngineKeywordsPerformance_CrawlingStats'; + $widgets = []; + $config = $factory->createWidget(); + $config->forceViewDataTable(Evolution::ID); + $config->setSubcategoryId($subcategory); + $config->setIsNotWidgetizable(); + $widgets[] = $config; + $config = $factory->createWidget(); + $config->forceViewDataTable(Sparklines::ID); + $config->setSubcategoryId($subcategory); + $config->setName(''); + $config->setIsNotWidgetizable(); + $widgets[] = $config; + $config = $factory->createContainerWidget('CrawlingStatsYandex'); + $config->setCategoryId($widgets[0]->getCategoryId()); + $config->setSubcategoryId($subcategory); + $config->setIsWidgetizable(); + foreach ($widgets as $widget) { + $config->addWidgetConfig($widget); + } + $widgetsList->addWidgetConfigs([$config]); + } + public function isEnabled() + { + return parent::isYandexEnabled(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywords.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywords.php new file mode 100644 index 0000000..c5be0de --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywords.php @@ -0,0 +1,53 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_KeywordsCombined'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_KeywordsCombinedDocumentation'); + $this->metrics = ['nb_visits']; + $this->order = 1; + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $view->config->columns_to_display = ['label', 'nb_visits']; + } + public function getRelatedReports() + { + $getKeywordsImported = new GetKeywordsImported(); + if ($getKeywordsImported->isEnabled()) { + return [ReportsProvider::factory('SearchEngineKeywordsPerformance', 'getKeywordsImported'), ReportsProvider::factory('Referrers', 'getKeywords')]; + } + + return [ReportsProvider::factory('Referrers', 'getKeywords')]; + } + public function alwaysUseDefaultViewDataTable() + { + return \true; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsBing.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsBing.php new file mode 100644 index 0000000..520852a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsBing.php @@ -0,0 +1,90 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_BingKeywords'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_BingKeywordsDocumentation'); + $this->order = 15; + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $period = Common::getRequestVar('period', \false, 'string'); + $idSite = Common::getRequestVar('idSite', \false, 'string'); + $model = new ModelBing(); + $measurableSetting = new MeasurableSettings($idSite); + $dateLastData = null; + if (!SearchEngineKeywordsPerformance::isBingForceEnabled($idSite)) { + list($apiKey, $url) = explode('##', $measurableSetting->bingSiteUrl->getValue()); + $dateLastData = $model->getLatestDateKeywordDataIsAvailableFor($url); + } + $lastDateMessage = ''; + if ($dateLastData && $period != 'range') { + $reportPeriod = $period != 'day' ? $period : 'week'; + $periodObj = Period\Factory::build($reportPeriod, Date::factory($dateLastData)); + $lastDateMessage = Piwik::translate( + 'SearchEngineKeywordsPerformance_LatestAvailableDate', + '' . $periodObj->getLocalizedShortString() . '' + ); + } + if ($period == 'day') { + $message = '

' + . Piwik::translate('CoreHome_ThereIsNoDataForThisReport') . '
' + . Piwik::translate('SearchEngineKeywordsPerformance_BingKeywordsNotDaily') + . '
' . $lastDateMessage . '

'; + } else { + $message = '

' . Piwik::translate('CoreHome_ThereIsNoDataForThisReport') . '
' . $lastDateMessage . '

'; + } + if ($period == 'range') { + $date = Common::getRequestVar('date', \false, 'string'); + $periodObject = new Range($period, $date, Site::getTimezoneFor($idSite)); + $subPeriods = $periodObject->getSubperiods(); + foreach ($subPeriods as $subPeriod) { + if ($subPeriod->getLabel() == 'day') { + $message = '

' . Piwik::translate('SearchEngineKeywordsPerformance_BingKeywordsNoRangeReports') . '

'; + break; + } + } + } + if (!empty($message)) { + $view->config->no_data_message = $message; + } + $this->formatCtrAndPositionColumns($view); + } + public function isEnabled() + { + return parent::isBingEnabled(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleImage.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleImage.php new file mode 100644 index 0000000..90c9a00 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleImage.php @@ -0,0 +1,44 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_ImageKeywords'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_ImageKeywordsDocumentation'); + $this->order = 20; + } + public function isEnabled() + { + return parent::isGoogleEnabledForType('image'); + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $this->configureViewMessagesGoogle($view, 'image'); + $this->formatCtrAndPositionColumns($view); + $view->requestConfig->filter_limit = 5; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleNews.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleNews.php new file mode 100644 index 0000000..0187f46 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleNews.php @@ -0,0 +1,44 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_NewsKeywords'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_NewsKeywordsDocumentation'); + $this->order = 25; + } + public function isEnabled() + { + return parent::isGoogleEnabledForType('news'); + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $this->configureViewMessagesGoogle($view, 'news'); + $this->formatCtrAndPositionColumns($view); + $view->requestConfig->filter_limit = 5; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleVideo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleVideo.php new file mode 100644 index 0000000..6422ce7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleVideo.php @@ -0,0 +1,44 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_VideoKeywords'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_VideoKeywordsDocumentation'); + $this->order = 25; + } + public function isEnabled() + { + return parent::isGoogleEnabledForType('video'); + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $this->configureViewMessagesGoogle($view, 'video'); + $this->formatCtrAndPositionColumns($view); + $view->requestConfig->filter_limit = 5; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleWeb.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleWeb.php new file mode 100644 index 0000000..3234ed6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsGoogleWeb.php @@ -0,0 +1,43 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_WebKeywords'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_WebKeywordsDocumentation'); + $this->order = 10; + } + public function isEnabled() + { + return parent::isGoogleEnabledForType('web'); + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $this->configureViewMessagesGoogle($view, 'web'); + $this->formatCtrAndPositionColumns($view); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsImported.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsImported.php new file mode 100644 index 0000000..d11996f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsImported.php @@ -0,0 +1,58 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_KeywordsCombinedImported'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_KeywordsCombinedImportedDocumentation'); + $this->subcategoryId = null; + // hide report + } + public function isEnabled() + { + $reportsEnabled = 0; + $reportsEnabled += (int) parent::isGoogleEnabledForType('image'); + $reportsEnabled += (int) parent::isGoogleEnabledForType('web'); + $reportsEnabled += (int) parent::isGoogleEnabledForType('video'); + $reportsEnabled += (int) parent::isGoogleEnabledForType('news'); + $reportsEnabled += (int) parent::isBingEnabled(); + return $reportsEnabled > 1; + } + public function getRelatedReports() + { + return [ReportsProvider::factory('SearchEngineKeywordsPerformance', 'getKeywords'), ReportsProvider::factory('Referrers', 'getKeywords')]; + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $this->formatCtrAndPositionColumns($view); + } + public function alwaysUseDefaultViewDataTable() + { + return \true; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsReferrers.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsReferrers.php new file mode 100644 index 0000000..27472f0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsReferrers.php @@ -0,0 +1,46 @@ +name = Piwik::translate('SearchEngineKeywordsPerformance_KeywordsReferrers'); + $this->module = 'Referrers'; + $this->action = 'getKeywords'; + $this->subcategoryId = 'Referrers_SubmenuSearchEngines'; + $this->order = 10; + } + public function getRelatedReports() + { + // don't show related reports when viewing the goals page, as related reports don't contain goal data + if (Common::getRequestVar('viewDataTable', '') === 'tableGoals' && Common::getRequestVar('idGoal', '') !== '') { + return []; + } + $getKeywordsImported = new GetKeywordsImported(); + if ($getKeywordsImported->isEnabled()) { + return [ReportsProvider::factory('SearchEngineKeywordsPerformance', 'getKeywordsImported'), ReportsProvider::factory('SearchEngineKeywordsPerformance', 'getKeywords')]; + } + return [ReportsProvider::factory('SearchEngineKeywordsPerformance', 'getKeywords')]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsYandex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsYandex.php new file mode 100644 index 0000000..de52173 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Reports/GetKeywordsYandex.php @@ -0,0 +1,62 @@ +dimension = new Keyword(); + $this->name = Piwik::translate('SearchEngineKeywordsPerformance_YandexKeywords'); + $this->documentation = Piwik::translate('SearchEngineKeywordsPerformance_YandexKeywordsDocumentation'); + $this->order = 17; + } + public function configureView(ViewDataTable $view) + { + parent::configureView($view); + $period = Common::getRequestVar('period', \false, 'string'); + $idSite = Common::getRequestVar('idSite', \false, 'string'); + $model = new ModelYandex(); + $measurableSetting = new MeasurableSettings($idSite); + if (!SearchEngineKeywordsPerformance::isYandexForceEnabled($idSite)) { + [$account, $url] = explode('##', $measurableSetting->yandexAccountAndHostId->getValue()); + $dateLastData = $model->getLatestDateKeywordDataIsAvailableFor($url); + } + if ($dateLastData && $period != 'range') { + $periodObjType = Period\Factory::build($period, Date::factory($dateLastData)); + $lastDateMessage = Piwik::translate('SearchEngineKeywordsPerformance_LatestAvailableDate', '' . $periodObjType->getLocalizedShortString() . ''); + $message = '

' . Piwik::translate('CoreHome_ThereIsNoDataForThisReport') . '
' . $lastDateMessage . '

'; + $view->config->no_data_message = $message; + } + $this->formatCtrAndPositionColumns($view); + } + public function isEnabled() + { + return parent::isYandexEnabled(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/SearchEngineKeywordsPerformance.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/SearchEngineKeywordsPerformance.php new file mode 100644 index 0000000..4462e4a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/SearchEngineKeywordsPerformance.php @@ -0,0 +1,962 @@ + 'getStylesheetFiles', + 'Metrics.getDefaultMetricDocumentationTranslations' => 'addMetricDocumentationTranslations', + 'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations', + 'Metrics.getDefaultMetricSemanticTypes' => 'addDefaultMetricSemanticTypes', + 'Metrics.isLowerValueBetter' => 'checkIsLowerMetricValueBetter', + 'ViewDataTable.configure.end' => 'configureViewDataTable', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'Report.filterReports' => 'manipulateReports', + 'API.Request.intercept' => 'manipulateApiRequests', + 'API.Referrers.getAll' => 'manipulateAllReferrersReport', + 'API.Referrers.getSearchEngines' => 'manipulateSearchEnginesReportParameters', + 'API.Referrers.getSearchEngines.end' => 'manipulateSearchEnginesReport', + 'API.Referrers.getKeywordsFromSearchEngineId.end' => 'manipulateSearchEnginesKeywordsReport', + 'Request.dispatch' => 'manipulateRequests', + 'Archiving.getIdSitesToArchiveWhenNoVisits' => 'getIdSitesToArchiveWhenNoVisits', + 'Db.getTablesInstalled' => 'getTablesInstalled', + 'SearchEngineKeywordsPerformance.getGoogleConfigComponentExtensions' => 'getGoogleConfigComponent', + 'Archiver.addRecordBuilders' => 'addRecordBuilders' + ]; + } + public function addRecordBuilders(array &$recordBuilders): void + { + $idSite = \Piwik\Request::fromRequest()->getIntegerParameter('idSite', 0); + if (!$idSite) { + return; + } + $bingBuilder = Bing::make($idSite); + if (!empty($bingBuilder)) { + $recordBuilders[] = $bingBuilder; + } + $googleBuilders = Google::makeAll($idSite); + $recordBuilders = array_merge($recordBuilders, $googleBuilders); + $yandexBuilder = Yandex::make($idSite); + if (!empty($yandexBuilder)) { + $recordBuilders[] = $yandexBuilder; + } + } + /** + * Register the new tables, so Matomo knows about them. + * + * @param array $allTablesInstalled + */ + public function getTablesInstalled(&$allTablesInstalled) + { + $allTablesInstalled[] = Common::prefixTable('bing_stats'); + $allTablesInstalled[] = Common::prefixTable('google_stats'); + } + public function getIdSitesToArchiveWhenNoVisits(&$idSites) + { + $idSitesGoogle = ProviderGoogle::getInstance()->getConfiguredSiteIds(); + $idSitesBing = ProviderBing::getInstance()->getConfiguredSiteIds(); + $idSitesYandex = ProviderYandex::getInstance()->getConfiguredSiteIds(); + $idSites = array_unique(array_merge($idSites, array_keys($idSitesBing), array_keys($idSitesGoogle), array_keys($idSitesYandex))); + } + /** + * Remove `GetKeywords` report of `Referrers` plugin, as it will be replaced with an inherited one + * + * @see \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywordsReferrers + * + * @param $reports + */ + public function manipulateReports(&$reports) + { + $reportsToUnset = ['\\Piwik\\Plugins\\Referrers\\Reports\\GetKeywords']; + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + if (!$report->isBingEnabled() && !$report->isAnyGoogleTypeEnabled() && !$report->isYandexEnabled()) { + $reportsToUnset = [ + '\\Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Reports\\GetKeywords', + '\\Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Reports\\GetKeywordsReferrers' + ]; + } + foreach ($reportsToUnset as $unset) { + foreach ($reports as $key => $report) { + if ($report instanceof $unset) { + unset($reports[$key]); + break; + } + } + } + } + /** + * Manipulate some request so replaced reports look nice + * + * @param $module + * @param $action + * @param $parameters + */ + public function manipulateRequests(&$module, &$action, &$parameters) + { + # Search Engines subtable of Channel Type report is replaced with combined keywords report + # as combined keywords report only has visits column, ensure to always use simple table view + if ( + $module === 'Referrers' && $action === 'getReferrerType' + && Common::REFERRER_TYPE_SEARCH_ENGINE == Common::getRequestVar('idSubtable', '') + && 'tableAllColumns' == Common::getRequestVar('viewDataTable', '') + && !$this->shouldShowOriginalReports() + ) { + $_GET['viewDataTable'] = 'table'; + } + # Keywords subtable of Search Engines report for configured providers are replaced + # as those reports only has visits column, ensure to always use simple table view + # also disable row evolution as it can't work + if ('Referrers' === $module && 'getKeywordsFromSearchEngineId' === $action && !$this->shouldShowOriginalReports()) { + /** @var DataTable $dataTable */ + $dataTable = Request::processRequest('Referrers.getSearchEngines', ['idSubtable' => null, 'filter_limit' => -1, 'filter_offset' => 0]); + $row = $dataTable->getRowFromIdSubDataTable(Common::getRequestVar('idSubtable', '')); + if ($row) { + $label = $row->getColumn('label'); + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + if (strpos($label, 'Google') !== \false && $report->isAnyGoogleTypeEnabled()) { + $_GET['viewDataTable'] = 'table'; + $_GET['disable_row_evolution'] = 1; + } elseif ((strpos($label, 'Bing') !== \false || strpos($label, 'Yahoo') !== \false) && $report->isBingEnabled()) { + $_GET['viewDataTable'] = 'table'; + $_GET['disable_row_evolution'] = 1; + } elseif (strpos($label, 'Yandex') !== \false && $report->isYandexEnabled()) { + $_GET['viewDataTable'] = 'table'; + $_GET['disable_row_evolution'] = 1; + } + } + } + } + /** + * Manipulate some api requests to replace the result + * + * @param $returnedValue + * @param $finalParameters + * @param $pluginName + * @param $methodName + * @param $parametersRequest + */ + public function manipulateApiRequests(&$returnedValue, $finalParameters, $pluginName, $methodName, $parametersRequest = []) + { + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + # Replace Search Engines subtable of Channel Type report combined keywords report if any import is configured + if ('Referrers' === $pluginName && 'getReferrerType' === $methodName && !empty($finalParameters['idSubtable']) && Common::REFERRER_TYPE_SEARCH_ENGINE == $finalParameters['idSubtable']) { + if (!$report->isAnyGoogleTypeEnabled() && !$report->isBingEnabled() && !$report->isYandexEnabled()) { + return; + } + # leave report untouched if original report should be shown + if ($this->shouldShowOriginalReports()) { + return; + } + $returnedValue = Request::processRequest('SearchEngineKeywordsPerformance.getKeywords', ['idSubtable' => null, 'segment' => null], $finalParameters); + $returnedValue->filter('ColumnCallbackAddMetadata', ['label', 'imported', function () { + return \true; + }]); + return; + } + # + # If a import is configured manipulate subtable requests for aggregated engine rows to show imported keywords + # (@see manipulateSearchEnginesReport()) + # + if ('Referrers' === $pluginName && 'getKeywordsFromSearchEngineId' === $methodName) { + /** @var DataTable $dataTable */ + $dataTable = Request::processRequest('Referrers.getSearchEngines', [ + 'idSubtable' => null, + self::REQUEST_PARAM_ORIGINAL_REPORT => 1, + // needs to be loaded unexpanded as otherwise the row can't be found using the subtableid + 'expanded' => 0, + ], $finalParameters); + $row = $dataTable->getRowFromIdSubDataTable($finalParameters['idSubtable']); + if ($row) { + $label = $row->getColumn('label'); + if ($this->shouldShowOriginalReports()) { + // load report with subtables + $dataTable = Request::processRequest('Referrers.getSearchEngines', [ + 'idSubtable' => null, + self::REQUEST_PARAM_ORIGINAL_REPORT => 1, + // needs to be loaded expanded so we can merge the subtables to get them aggregated + 'expanded' => 1, + ], $finalParameters); + } + # If requesting a Google subtable and import is configured + if (strpos($label, 'Google') !== \false && $report->isAnyGoogleTypeEnabled()) { + # To show proper 'original' data for the aggregated row we need to combine all subtables of the aggregated rows + if ($this->shouldShowOriginalReports()) { + # remove all rows where label does not contain Google + $dataTable->disableRecursiveFilters(); + $dataTable->filter('ColumnCallbackDeleteRow', ['label', function ($label) { + return \false === strpos($label, 'Google'); + }]); + # combine subtables and group labels to get correct result + $returnedValue = $dataTable->mergeSubtables(); + $returnedValue->filter('GroupBy', ['label']); + $returnedValue->filter('Piwik\\Plugins\\Referrers\\DataTable\\Filter\\KeywordNotDefined'); + return; + } + # Return combined Google keywords + $returnedValue = Request::processRequest('SearchEngineKeywordsPerformance.getKeywordsGoogle', ['idSubtable' => null, 'segment' => null, 'filter_sort_column' => 'nb_clicks', 'filter_limit' => null]); + } elseif ((strpos($label, 'Bing') !== \false || strpos($label, 'Yahoo') !== \false) && $report->isBingEnabled()) { + # To show proper 'original' data for the aggregated row we need to combine all subtables of the aggregated rows + if ($this->shouldShowOriginalReports()) { + # remove all rows where label does not contain Bing or Yahoo + $dataTable->disableRecursiveFilters(); + $dataTable->filter('ColumnCallbackDeleteRow', ['label', function ($label) { + return \false === strpos($label, 'Bing') && \false === strpos($label, 'Yahoo'); + }]); + # combine subtables and group labels to get correct result + $returnedValue = $dataTable->mergeSubtables(); + $returnedValue->filter('GroupBy', ['label']); + $returnedValue->filter('Piwik\\Plugins\\Referrers\\DataTable\\Filter\\KeywordNotDefined'); + return; + } + # Return combined Bing & Yahoo! keywords + $returnedValue = Request::processRequest('SearchEngineKeywordsPerformance.getKeywordsBing', ['idSubtable' => null, 'segment' => null, 'filter_sort_column' => 'nb_clicks', 'filter_limit' => null]); + } elseif (strpos($label, 'Yandex') !== \false && $report->isYandexEnabled()) { + # To show proper 'original' data for the aggregated row we need to combine all subtables of the aggregated rows + if ($this->shouldShowOriginalReports()) { + # remove all rows where label does not contain Bing or Yahoo + $dataTable->disableRecursiveFilters(); + $dataTable->filter('ColumnCallbackDeleteRow', ['label', function ($label) { + return \false === strpos($label, 'Yandex'); + }]); + # combine subtables and group labels to get correct result + $returnedValue = $dataTable->mergeSubtables(); + $returnedValue->filter('GroupBy', ['label']); + $returnedValue->filter('Piwik\\Plugins\\Referrers\\DataTable\\Filter\\KeywordNotDefined'); + return; + } + # Return Yandex keywords + $returnedValue = Request::processRequest('SearchEngineKeywordsPerformance.getKeywordsYandex', ['idSubtable' => null, 'segment' => null, 'filter_sort_column' => 'nb_clicks', 'filter_limit' => null]); + } + } + # Adjust table so it only shows visits + $this->convertDataTableColumns($returnedValue, $dataTable); + } + } + public function manipulateAllReferrersReport(&$finalParameters) + { + # unset segment if default report is shown, as default `Referrers` report does not support segmentation + # as the imported keywords are hooked into the search engines subtable of `getReferrerType` report + if (!empty($finalParameters['segment']) && !$this->shouldShowOriginalReports()) { + $finalParameters['segment'] = \false; + } + } + public function manipulateSearchEnginesReportParameters(&$finalParameters) + { + # unset segment if default report is shown flattened, as `Search Engines` subtable reports do not support segmentation + # as the imported keywords are hooked into the search engines subtable of `getReferrerType` report + if (!empty($finalParameters['segment']) && !empty($finalParameters['flat']) && !$this->shouldShowOriginalReports()) { + $finalParameters['segment'] = \false; + } + } + public function manipulateSearchEnginesReport(&$returnedValue, $finalParameters) + { + # prevent replace for internal proposes + if ($this->shouldShowOriginalReports()) { + return; + } + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + $bingEnabled = $report->isBingEnabled(); + $googleEnabled = $report->isAnyGoogleTypeEnabled(); + $yandexEnabled = $report->isYandexEnabled(); + if (!$returnedValue instanceof DataTable\DataTableInterface || !$bingEnabled && !$googleEnabled && !$yandexEnabled) { + return; + } + # + # If any import is configured, rows of the `getSearchEngines` report will be aggregated into one row per imported engine + # e.g. `Google`, `Google Images`, and so on will be aggregated into a `Google` row. Same for Bing & Yahoo + # + $returnedValue->filter('GroupBy', ['label', function ($label) use ($bingEnabled, $googleEnabled, $yandexEnabled) { + if ($bingEnabled && (strpos($label, 'Yahoo') !== \false || strpos($label, 'Bing') !== \false)) { + return 'Bing & Yahoo!'; + } else { + if ($googleEnabled && strpos($label, 'Google') !== \false) { + return 'Google'; + } else { + if ($yandexEnabled && strpos($label, 'Yandex') !== \false) { + return 'Yandex'; + } + } + } + return $label; + }]); + if ($returnedValue instanceof DataTable\Map) { + $tablesToFilter = $returnedValue->getDataTables(); + } else { + $tablesToFilter = [$finalParameters['parameters']['date'] => $returnedValue]; + } + // replace numbers for aggregated rows if no segment was applied + if (empty($finalParameters['parameters']['segment']) && Common::getRequestVar('viewDataTable', '') !== 'tableGoals') { + foreach ($tablesToFilter as $label => $table) { + $table->filter(function (DataTable $dataTable) use ($googleEnabled, $bingEnabled, $yandexEnabled, $label, $finalParameters) { + // label should hold the period representation + if ($finalParameters['parameters']['period'] != 'range') { + try { + // date representation might be year or year-month only, so fill it up to a full date and + // cut after 10 chars, as it might be too log now, or was a period representation before + $date = substr($label . '-01-01', 0, 10); + // if date is valid use it as label, otherwise original label will be used + // which is the case for e.g. `yesterday` + if (Date::factory($date)->toString() == $date) { + $label = $date; + } + } catch (\Exception $e) { + } + } + if ($googleEnabled) { + $row = $dataTable->getRowFromLabel('Google'); + /** @var DataTable $subTable */ + $subTable = Request::processRequest('SearchEngineKeywordsPerformance.getKeywordsGoogle', ['idSite' => $finalParameters['parameters']['idSite'], 'date' => $label, 'period' => $finalParameters['parameters']['period']], []); + $totalVisits = 0; + foreach ($subTable->getRowsWithoutSummaryRow() as $tableRow) { + $totalVisits += $tableRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS); + } + // replace subtable with processed data + if ($row && $row->getIdSubDataTable()) { + if ($row->isSubtableLoaded()) { + $row->setSubtable($this->convertDataTableColumns($subTable, $dataTable)); + } + } + // add a new row if non exists yet and some data was imported + if ($totalVisits && !$row) { + $columns = ['label' => 'Google', \Piwik\Metrics::INDEX_NB_VISITS => $totalVisits]; + $row = new DataTable\Row([DataTable\Row::COLUMNS => $columns]); + $row->setMetadata('imported', \true); + $dataTable->addRow($row); + } + $dataTable->deleteColumn(\Piwik\Metrics::INDEX_NB_UNIQ_VISITORS); + } + if ($bingEnabled) { + $row = $dataTable->getRowFromLabel('Bing & Yahoo!'); + /** @var DataTable $subTable */ + $subTable = Request::processRequest('SearchEngineKeywordsPerformance.getKeywordsBing', ['idSite' => $finalParameters['parameters']['idSite'], 'date' => $label, 'period' => $finalParameters['parameters']['period']], []); + $totalVisits = 0; + foreach ($subTable->getRowsWithoutSummaryRow() as $tableRow) { + $totalVisits += $tableRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS); + } + // replace subtable with processed data + if ($row && $row->getIdSubDataTable()) { + if ($row->isSubtableLoaded()) { + $row->setSubtable($this->convertDataTableColumns($subTable, $dataTable)); + } + } + // add a new row if non exists yet and some data was imported + if ($totalVisits && !$row) { + $columns = ['label' => 'Bing & Yahoo!', \Piwik\Metrics::INDEX_NB_VISITS => $totalVisits]; + $row = new DataTable\Row([DataTable\Row::COLUMNS => $columns]); + $row->setMetadata('imported', \true); + $dataTable->addRow($row); + } + $dataTable->deleteColumn(\Piwik\Metrics::INDEX_NB_UNIQ_VISITORS); + } + if ($yandexEnabled) { + $row = $dataTable->getRowFromLabel('Yandex'); + /** @var DataTable $subTable */ + $subTable = Request::processRequest('SearchEngineKeywordsPerformance.getKeywordsYandex', ['idSite' => $finalParameters['parameters']['idSite'], 'date' => $label, 'period' => $finalParameters['parameters']['period']], []); + $totalVisits = 0; + foreach ($subTable->getRowsWithoutSummaryRow() as $tableRow) { + $totalVisits += $tableRow->getColumn(\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS); + } + // replace subtable with processed data + if ($row && $row->getIdSubDataTable()) { + if ($row->isSubtableLoaded()) { + $row->setSubtable($this->convertDataTableColumns($subTable, $dataTable)); + } + } + // add a new row if non exists yet and some data was imported + if ($totalVisits && !$row) { + $columns = ['label' => 'Yandex', \Piwik\Metrics::INDEX_NB_VISITS => $totalVisits]; + $row = new DataTable\Row([DataTable\Row::COLUMNS => $columns]); + $row->setMetadata('imported', \true); + $dataTable->addRow($row); + } + $dataTable->deleteColumn(\Piwik\Metrics::INDEX_NB_UNIQ_VISITORS); + } + }); + } + } + if ($bingEnabled || $googleEnabled || $yandexEnabled) { + $returnedValue->queueFilter('Sort', [reset($tablesToFilter)->getSortedByColumnName() ?: 'nb_visits']); + } + // needs to be done as queued filter as metadata will fail otherwise + if ($bingEnabled) { + $returnedValue->queueFilter(function (DataTable $datatable) { + $row = $datatable->getRowFromLabel('Bing & Yahoo!'); + if ($row) { + // rename column and fix metadata + $url = SearchEngine::getInstance()->getUrlFromName('Bing'); + $row->setMetadata('url', $url); + $row->setMetadata('logo', SearchEngine::getInstance()->getLogoFromUrl($url)); + $row->setMetadata('segment', 'referrerType==search;referrerName=@Bing,referrerName=@Yahoo'); + } + }); + } + if ($googleEnabled) { + $returnedValue->queueFilter(function (DataTable $datatable) { + $row = $datatable->getRowFromLabel('Google'); + if ($row) { + // rename column and fix metadata + $url = SearchEngine::getInstance()->getUrlFromName('Google'); + $row->setMetadata('url', $url); + $row->setMetadata('logo', SearchEngine::getInstance()->getLogoFromUrl($url)); + $row->setMetadata('segment', 'referrerType==search;referrerName=@Google'); + } + }); + } + if ($yandexEnabled) { + $returnedValue->queueFilter(function (DataTable $datatable) { + $row = $datatable->getRowFromLabel('Yandex'); + if ($row) { + // rename column and fix metadata + $url = SearchEngine::getInstance()->getUrlFromName('Yandex'); + $row->setMetadata('url', $url); + $row->setMetadata('logo', SearchEngine::getInstance()->getLogoFromUrl($url)); + $row->setMetadata('segment', 'referrerType==search;referrerName=@Yandex'); + } + }); + } + } + /** + * Manipulates the segment metadata of the aggregated columns in search engines report + * This needs to be done in `API.Referrers.getKeywordsFromSearchEngineId.end` event as the queued filters would + * otherwise be applied to early and segment metadata would be overwritten again + * + * @param mixed $returnedValue + * @param array $finalParameters + */ + public function manipulateSearchEnginesKeywordsReport(&$returnedValue, $finalParameters) + { + # only manipulate the original report with aggregated columns + if (!$this->shouldShowOriginalReports()) { + return; + } + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + /** @var DataTable $dataTable */ + $dataTable = Request::processRequest('Referrers.getSearchEngines', [ + 'idSubtable' => null, + self::REQUEST_PARAM_ORIGINAL_REPORT => 1, + // needs to be loaded unexpanded as otherwise the row can't be found using the subtableid + 'expanded' => 0, + ]); + $row = $dataTable->getRowFromIdSubDataTable($finalParameters['parameters']['idSubtable']); + if ($row) { + $label = $row->getColumn('label'); + # If requesting a Google subtable and import is configured + if (strpos($label, 'Google') !== \false && $report->isAnyGoogleTypeEnabled()) { + $returnedValue->queueFilter('ColumnCallbackDeleteMetadata', ['segment']); + $returnedValue->queueFilter('ColumnCallbackAddMetadata', ['label', 'segment', function ($label) { + if ($label == Referrers\API::getKeywordNotDefinedString()) { + return 'referrerKeyword==;referrerType==search;referrerName=@Google'; + } + return 'referrerKeyword==' . urlencode($label) . ';referrerType==search;referrerName=@Google'; + }]); + } elseif ((strpos($label, 'Bing') !== \false || strpos($label, 'Yahoo') !== \false) && $report->isBingEnabled()) { + $returnedValue->queueFilter('ColumnCallbackDeleteMetadata', ['segment']); + $returnedValue->queueFilter('ColumnCallbackAddMetadata', ['label', 'segment', function ($label) { + if ($label == Referrers\API::getKeywordNotDefinedString()) { + return 'referrerKeyword==;referrerType==search;referrerName=@Bing,referrerName=@Yahoo'; + } + return 'referrerKeyword==' . urlencode($label) . ';referrerType==search;referrerName=@Bing,referrerName=@Yahoo'; + }]); + } elseif (strpos($label, 'Yandex') !== \false && $report->isYandexEnabled()) { + $returnedValue->queueFilter('ColumnCallbackDeleteMetadata', ['segment']); + $returnedValue->queueFilter('ColumnCallbackAddMetadata', ['label', 'segment', function ($label) { + if ($label == Referrers\API::getKeywordNotDefinedString()) { + return 'referrerKeyword==;referrerType==search;referrerName=@Yandex'; + } + return 'referrerKeyword==' . urlencode($label) . ';referrerType==search;referrerName=@Yandex'; + }]); + } + } + } + public function configureViewDataTable(ViewDataTable $viewDataTable) + { + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + $bingEnabled = $report->isBingEnabled(); + $yandexEnabled = $report->isYandexEnabled(); + $googleEnabled = $report->isAnyGoogleTypeEnabled(); + # + # Add a header message to original referrer keywords reports if plugin is active but no import configured + # + if ($viewDataTable->requestConfig->apiMethodToRequestDataTable == 'Referrers.getKeywords') { + // Check if there have been any recent API errors and notify the customer accordingly. + self::displayNotificationIfRecentApiErrorsExist([ProviderGoogle::getInstance(), ProviderBing::getInstance(), ProviderYandex::getInstance()]); + if (Common::getRequestVar('widget', 0, 'int')) { + return; + } + if ($bingEnabled || $googleEnabled || $yandexEnabled) { + return; + } + $idSite = Common::getRequestVar('idSite', 0, 'int'); + if (WebsiteMeasurableType::ID !== Site::getTypeFor($idSite)) { + return; + } + $view = new View('@SearchEngineKeywordsPerformance/messageReferrerKeywordsReport'); + $view->hasAdminPriviliges = Piwik::isUserHasSomeAdminAccess(); + $message = $view->render(); + if (property_exists($viewDataTable->config, 'show_header_message')) { + $viewDataTable->config->show_header_message = $message; + } else { + $viewDataTable->config->show_footer_message .= $message; + } + } + # + # Add related reports and segment info to search engines subtable in `All Channels` report + # + if ('Referrers.getReferrerType' === $viewDataTable->requestConfig->apiMethodToRequestDataTable && !empty($viewDataTable->requestConfig->idSubtable) && Common::REFERRER_TYPE_SEARCH_ENGINE == $viewDataTable->requestConfig->idSubtable) { + if (!$bingEnabled && !$googleEnabled && !$yandexEnabled) { + return; + } + if ($this->shouldShowOriginalReports()) { + $viewDataTable->config->addRelatedReport('Referrers.getReferrerType', Piwik::translate('SearchEngineKeywordsPerformance_KeywordsSubtableImported'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 0]); + } else { + $viewDataTable->config->addRelatedReport('Referrers.getReferrerType', Piwik::translate('SearchEngineKeywordsPerformance_KeywordsSubtableOriginal'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 1]); + if ('' != Common::getRequestVar('segment', '')) { + $this->addSegmentNotSupportedMessage($viewDataTable); + } + } + } + # + # Add related reports and segment info to `Referrers` report + # + if ('Referrers.getAll' === $viewDataTable->requestConfig->apiMethodToRequestDataTable) { + if (!$bingEnabled && !$googleEnabled && !$yandexEnabled) { + return; + } + if ($this->shouldShowOriginalReports()) { + $viewDataTable->config->addRelatedReport('Referrers.getAll', Piwik::translate('SearchEngineKeywordsPerformance_AllReferrersImported'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 0]); + } else { + $viewDataTable->config->addRelatedReport('Referrers.getAll', Piwik::translate('SearchEngineKeywordsPerformance_AllReferrersOriginal'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 1]); + if ('' != Common::getRequestVar('segment', '')) { + $this->addSegmentNotSupportedMessage($viewDataTable); + } + } + } + # + # Add segment info to `Search Engines` report if it is flattened + # + if ('Referrers.getSearchEngines' === $viewDataTable->requestConfig->apiMethodToRequestDataTable) { + if ($viewDataTable->requestConfig->flat) { + if ($this->shouldShowOriginalReports()) { + $viewDataTable->config->addRelatedReport('Referrers.getSearchEngines', Piwik::translate('SearchEngineKeywordsPerformance_SearchEnginesImported'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 0]); + } else { + $viewDataTable->config->addRelatedReport('Referrers.getSearchEngines', Piwik::translate('SearchEngineKeywordsPerformance_SearchEnginesOriginal'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 1]); + if ('' != Common::getRequestVar('segment', '')) { + $this->addSegmentNotSupportedMessage($viewDataTable); + } + } + } + } + # + # Add related reports and segment info to keywords subtable in `Search Engines` report + # + if ('Referrers.getKeywordsFromSearchEngineId' === $viewDataTable->requestConfig->apiMethodToRequestDataTable) { + /** @var DataTable $dataTable */ + $dataTable = Request::processRequest('Referrers.getSearchEngines', ['idSubtable' => null, self::REQUEST_PARAM_ORIGINAL_REPORT => 1]); + $row = $dataTable->getRowFromIdSubDataTable($viewDataTable->requestConfig->idSubtable); + if ($row) { + $label = $row->getColumn('label'); + if ( + strpos($label, 'Google') !== \false && $report->isAnyGoogleTypeEnabled() + || strpos($label, 'Yandex') !== \false && $report->isYandexEnabled() + || (strpos($label, 'Bing') !== \false + || strpos($label, 'Yahoo') !== \false) && $report->isBingEnabled() + ) { + if ($this->shouldShowOriginalReports()) { + $viewDataTable->config->addRelatedReport('Referrers.getKeywordsFromSearchEngineId', Piwik::translate('SearchEngineKeywordsPerformance_KeywordsSubtableImported'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 0]); + } else { + $viewDataTable->config->addRelatedReport('Referrers.getKeywordsFromSearchEngineId', Piwik::translate('SearchEngineKeywordsPerformance_KeywordsSubtableOriginal'), [self::REQUEST_PARAM_ORIGINAL_REPORT => 1]); + if ('' != Common::getRequestVar('segment', '')) { + $this->addSegmentNotSupportedMessage($viewDataTable); + } + } + } + } + } + } + /** + * Removes all rows that does not have a single click, removes all other metrics than clicks, and renames clicks to visits + * + * @param $dataTable + * @param $parentTable + * @return mixed + */ + protected function convertDataTableColumns($dataTable, $parentTable = null) + { + if ($dataTable instanceof DataTable\DataTableInterface) { + $dataTable->deleteColumns([\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::POSITION, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_IMPRESSIONS, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::CTR]); + $dataTable->filter('ColumnCallbackDeleteRow', [\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS, function ($clicks) { + return $clicks === 0; + }]); + $dataTable->filter('ReplaceColumnNames', [[\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS => 'nb_visits']]); + if ($dataTable instanceof DataTable && $parentTable instanceof DataTable) { + $totals = $dataTable->getMetadata('totals'); + $parentTotals = $parentTable->getMetadata('totals'); + if (!empty($parentTotals['nb_visits']) && !empty($totals[\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS])) { + $totals['nb_visits'] = $parentTotals['nb_visits']; + unset($totals[\Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::NB_CLICKS]); + $dataTable->setMetadata('totals', $totals); + } + } + } + return $dataTable; + } + /** + * Returns whether the internal request parameter to prevent api manipulations was set + * + * @return bool + */ + protected function shouldShowOriginalReports() + { + return !!Common::getRequestVar(self::REQUEST_PARAM_ORIGINAL_REPORT, \false); + } + /** + * Adds a header (or footer) note to the view, that report does not support segmentation + * + * @param ViewDataTable $view + */ + protected function addSegmentNotSupportedMessage(ViewDataTable $view) + { + $message = '

' . Piwik::translate('SearchEngineKeywordsPerformance_NoSegmentation') . '

'; + if (property_exists($view->config, 'show_header_message')) { + $view->config->show_header_message = $message; + } else { + $view->config->show_footer_message .= $message; + } + } + public function getStylesheetFiles(&$stylesheets) + { + $stylesheets[] = "plugins/SearchEngineKeywordsPerformance/stylesheets/styles.less"; + $stylesheets[] = "plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.less"; + } + public function addDefaultMetricSemanticTypes(&$types): void + { + $types = array_merge($types, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::getMetricSemanticTypes()); + } + public function addMetricTranslations(&$translations) + { + $translations = array_merge($translations, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::getMetricsTranslations()); + } + public function addMetricDocumentationTranslations(&$translations) + { + $translations = array_merge($translations, \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::getMetricsDocumentation()); + } + public function checkIsLowerMetricValueBetter(&$isLowerBetter, $metric) + { + if ($metric === \Piwik\Plugins\SearchEngineKeywordsPerformance\Metrics::POSITION) { + $isLowerBetter = \true; + } + } + public function getClientSideTranslationKeys(&$translationKeys) + { + $translationKeys[] = "SearchEngineKeywordsPerformance_LinksToUrl"; + $translationKeys[] = "SearchEngineKeywordsPerformance_SitemapsContainingUrl"; + $translationKeys[] = 'SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConfigurationDescription'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ProviderListDescription'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ChangeConfiguration'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_SetupConfiguration'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_BingConfigurationTitle'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_BingConfigurationDescription'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConfigureMeasurables'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConfigureMeasurableBelow'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConfigRemovalConfirm'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_DomainProperty'; + $translationKeys[] = 'General_Measurable'; + $translationKeys[] = 'Mobile_Account'; + $translationKeys[] = 'Goals_URL'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_LastImport'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_NoWebsiteConfigured'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AddConfiguration'; + $translationKeys[] = 'CoreHome_ChooseX'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_UrlOfAccount'; + $translationKeys[] = 'General_Save'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ManageAPIKeys'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AccountRemovalConfirm'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AccountAddedBy'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_BingAccountError'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AccountNoAccess'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AvailableSites'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_UnverifiedSites'; + $translationKeys[] = 'General_Remove'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AddAPIKey'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_BingAPIKeyInstruction'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_APIKey'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GoogleConfigurationTitle'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GoogleConfigurationDescription'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_EnabledSearchTypes'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_KeywordTypeWeb'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_KeywordTypeImage'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_KeywordTypeVideo'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_KeywordTypeNews'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_DomainPropertyInfo'; + $translationKeys[] = 'General_Delete'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConnectGoogleAccounts'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConnectFirstAccount'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_OAuthError'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_AccountConnectionValidationError'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ReAddAccountIfPermanentError'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConnectAccount'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConnectAccountDescription'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_RequiredAccessTypes'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GoogleAccountAccessTypeSearchConsoleData'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GoogleAccountAccessTypeProfileInfo'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GoogleAccountAccessTypeOfflineAccess'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_StartOAuth'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_OAuthClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ClientId'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ClientSecret'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_HowToGetOAuthClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_VisitOAuthHowTo'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_UploadOAuthClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GoogleUploadOrPasteClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConfigurationFile'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_Configuration'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_CreatedBy'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_YandexConfigurationTitle'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_YandexConfigurationDescription'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConnectYandexAccounts'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ReAuthenticateIfPermanentError'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_OAuthAccessTimedOut'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_OAuthAccessWillTimeOutSoon'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_OAuthAccessWillTimeOut'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_Reauthenticate'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ConnectAccountYandex'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_SetUpOAuthClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_ProvideYandexClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_URLPrefixProperty'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_URLPrefixPropertyInfo'; + $translationKeys[] = "SearchEngineKeywordsPerformance_OAuthExampleText"; + $translationKeys[] = "SearchEngineKeywordsPerformance_GoogleAuthorizedJavaScriptOrigin"; + $translationKeys[] = "SearchEngineKeywordsPerformance_GoogleAuthorizedRedirectUri"; + $translationKeys[] = "SearchEngineKeywordsPerformance_YandexFieldUrlToAppSite"; + $translationKeys[] = "SearchEngineKeywordsPerformance_YandexFieldCallbackUri"; + $translationKeys[] = "SearchEngineKeywordsPerformance_RecentApiErrorsWarning"; + $translationKeys[] = "SearchEngineKeywordsPerformance_ConfigureTheImporterLabel1"; + $translationKeys[] = "SearchEngineKeywordsPerformance_ConfigureTheImporterLabel2"; + $translationKeys[] = "SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3"; + $translationKeys[] = "SearchEngineKeywordsPerformance_OauthFailedMessage"; + $translationKeys[] = "General_Upload"; + $translationKeys[] = 'SearchEngineKeywordsPerformance_Uploading'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_DeleteUploadedClientConfig'; + $translationKeys[] = 'SearchEngineKeywordsPerformance_GooglePendingConfigurationErrorMessage'; + if (Manager::getInstance()->isPluginActivated('ConnectAccounts')) { + $translationKeys[] = "ConnectAccounts_ConfigureGoogleAuthHelp1"; + $translationKeys[] = "ConnectAccounts_ConfigureGoogleAuthHelp2"; + $translationKeys[] = "ConnectAccounts_OptionQuickConnectWithGa"; + $translationKeys[] = "ConnectAccounts_OptionAdvancedConnectWithGa"; + $translationKeys[] = "ConnectAccounts_ConnectedWithBody"; + $translationKeys[] = "ConnectAccounts_ReAuthorizeBody"; + $translationKeys[] = "ConnectAccounts_ReAuthorizeBtnText"; + $translationKeys[] = "ConnectAccounts_ConnectedWithHeader"; + $translationKeys[] = "ConnectAccounts_ConnectedWithBody[beforeLink]"; + $translationKeys[] = "ConnectAccounts_ConnectedWithBody[linkText]"; + $translationKeys[] = "ConnectAccounts_GaImportBtn"; + } + } + /** + * Installation + */ + public function install() + { + GoogleModel::install(); + BingModel::install(); + YandexModel::install(); + } + public static function isGoogleForceEnabled($idSite) + { + return self::isSearchEngineForceEnabled('google', $idSite); + } + public static function isBingForceEnabled($idSite) + { + return self::isSearchEngineForceEnabled('bing', $idSite); + } + public static function isYandexForceEnabled($idSite) + { + return self::isSearchEngineForceEnabled('yandex', $idSite); + } + public static function isSearchEngineForceEnabled($searchEngine, $idSite) + { + if (!is_numeric($idSite) || $idSite <= 0) { + return \false; + } + $cache = Cache::getTransientCache(); + $cacheKey = 'SearchEngineKeywordsPerformance.isSearchEngineForceEnabled.' . $searchEngine . '.' . $idSite; + if ($cache->contains($cacheKey)) { + return $cache->fetch($cacheKey); + } + $result = \false; + /** + * @ignore + */ + Piwik::postEvent('SearchEngineKeywordsPerformance.isSearchEngineForceEnabled', [&$result, $searchEngine, $idSite]); + // force enable reports for rollups where child pages are configured + if (class_exists('\\Piwik\\Plugins\\RollUpReporting\\Type') && \Piwik\Plugins\RollUpReporting\Type::ID === Site::getTypeFor($idSite)) { + //Need to execute this as a superuser, since a user can have access to a rollup site but not all the child sites + Access::doAsSuperUser(function () use ($searchEngine, $idSite, &$result) { + $rollUpModel = new \Piwik\Plugins\RollUpReporting\Model(); + $childIdSites = $rollUpModel->getChildIdSites($idSite); + foreach ($childIdSites as $childIdSite) { + $measurableSettings = new \Piwik\Plugins\SearchEngineKeywordsPerformance\MeasurableSettings($childIdSite); + if ($searchEngine === 'google' && $measurableSettings->googleSearchConsoleUrl && $measurableSettings->googleSearchConsoleUrl->getValue()) { + $result = \true; + break; + } + if ($searchEngine === 'yandex' && $measurableSettings->yandexAccountAndHostId && $measurableSettings->yandexAccountAndHostId->getValue()) { + $result = \true; + break; + } + if ($searchEngine === 'bing' && $measurableSettings->bingSiteUrl && $measurableSettings->bingSiteUrl->getValue()) { + $result = \true; + break; + } + } + }); + } + $cache->save($cacheKey, $result); + return $result; + } + /** + * Take the list of providers and determine if any of them have had any recent API errors that need to be surfaced + * to the customer as a notification. If there are any, it generates the notification message and displays it. + * + * @param array $providers Collection of providers (like Google, Bing, ...) that extend the ProviderAbstract class. + * @return void + * @throws \Exception + */ + public static function displayNotificationIfRecentApiErrorsExist(array $providers): void + { + $recentErrorMessages = []; + foreach ($providers as $provider) { + $message = ''; + if ($provider->hasApiErrorWithinWeek()) { + $message = $provider->getRecentApiErrorMessage(); + } + if (!empty($message)) { + $recentErrorMessages[] = $message; + } + } + // Show notification if there have been errors + if (count($recentErrorMessages) > 0) { + $providerNameString = implode('
', $recentErrorMessages); + $notification = new Notification(Piwik::translate('SearchEngineKeywordsPerformance_RecentApiErrorsWarning', [$providerNameString])); + $notification->context = Notification::CONTEXT_WARNING; + $notification->raw = \true; + Notification\Manager::notify('sekp_api_errors', $notification); + } + } + public function getGoogleConfigComponent(&$componentExtensions) + { + $googleClient = ProviderGoogle::getInstance()->getClient(); + $clientConfigured = \true; + // try to configure client (which imports provided client configs) + try { + $googleClient->getConfiguredClient(''); + } catch (\Exception $e) { + // ignore errors + $clientConfigured = \false; + } + if (!$clientConfigured) { + // Only set index 0 if it hasn't already been set, since we want ConnectAccounts to take precedence + $componentExtensions[0] = $componentExtensions[0] ?? ['plugin' => 'SearchEngineKeywordsPerformance', 'component' => 'ConfigureConnection']; + } + return $componentExtensions; + } + + + public static function isReportEnabled($reportType, $googleType = '') + { + $report = new \Piwik\Plugins\SearchEngineKeywordsPerformance\Reports\GetKeywords(); + if ($reportType === 'Yandex') { + return $report->isYandexEnabled(); + } elseif ($reportType === 'Bing') { + return $report->isBingEnabled(); + } elseif ($reportType === 'Google' && !empty($googleType)) { + return $report->isGoogleEnabledForType($googleType); + } + + return false; + } + + public static function commonEmptyDataTable($period, $date) + { + if (Period::isMultiplePeriod($date, $period)) { + return new DataTable\Map(); + } + return new DataTable(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/SystemSettings.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/SystemSettings.php new file mode 100644 index 0000000..b38d3c5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/SystemSettings.php @@ -0,0 +1,41 @@ +roundKeywordPosition = $this->createRoundKeywordPosition(); + } + private function createRoundKeywordPosition() + { + return $this->makeSetting('roundKeywordPosition', $default = \true, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('SearchEngineKeywordsPerformance_RoundKeywordPosition'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + }); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Tasks.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Tasks.php new file mode 100644 index 0000000..b826484 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Tasks.php @@ -0,0 +1,101 @@ +getAllSitesId(); + foreach ($siteIds as $idSite) { + $setting = new \Piwik\Plugins\SearchEngineKeywordsPerformance\MeasurableSettings($idSite); + $searchConsoleUrl = $setting->googleSearchConsoleUrl; + if ($searchConsoleUrl && $searchConsoleUrl->getValue()) { + $this->daily('runImportsGoogle', $idSite); + } + $bingSiteUrl = $setting->bingSiteUrl; + if ($bingSiteUrl && $bingSiteUrl->getValue()) { + $this->daily('runImportsBing', $idSite); + } + $yandexConfig = $setting->yandexAccountAndHostId; + if ($yandexConfig && $yandexConfig->getValue()) { + $this->daily('runImportsYandex', $idSite); + } + } + } + /** + * Run Google importer for the last X available dates + * To calculate the amount of imported days a timestamp of the last run will be saved + * and checked how many days it was ago. This ensures dates will be imported even if + * the tasks doesn't run some days. And it also ensure that all available dates will be + * imported on the first run, as no last run has been saved before + * + * @param int $idSite + */ + public function runImportsGoogle($idSite) + { + $lastRun = Option::get('GoogleImporterTask_LastRun_' . $idSite); + $now = time(); + $limitDays = 0; + if ($lastRun) { + $difference = $now - $lastRun; + $limitDays = ceil($difference / (3600 * 24)); + } + $importer = new GoogleImporter($idSite); + $importer->importAllAvailableData($limitDays); + Option::set('GoogleImporterTask_LastRun_' . $idSite, $now); + } + /** + * Run Bing importer + * + * @param int $idSite + */ + public function runImportsBing($idSite) + { + $importer = new BingImporter($idSite); + $importer->importAllAvailableData(); + Option::set('BingImporterTask_LastRun_' . $idSite, time()); + } + /** + * Run Yandex importer + * + * @param int $idSite + */ + public function runImportsYandex($idSite) + { + $lastRun = Option::get('YandexImporterTask_LastRun_' . $idSite); + $now = time(); + $limitDays = 100; + // import 100 days initially + if ($lastRun) { + $difference = $now - $lastRun; + $limitDays = ceil($difference / (3600 * 24)) + 7; + } + $importer = new YandexImporter($idSite); + $importer->importAllAvailableData($limitDays); + Option::set('YandexImporterTask_LastRun_' . $idSite, time()); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Updates/3.5.0.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Updates/3.5.0.php new file mode 100644 index 0000000..99b14f7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Updates/3.5.0.php @@ -0,0 +1,45 @@ +migration = $factory; + } + public function getMigrations(Updater $updater) + { + $migrations = []; + $migrations[] = $this->migration->db->changeColumnType('bing_stats', 'type', 'VARCHAR(15)'); + $migrations[] = $this->migration->db->changeColumnType('bing_stats', 'url', 'VARCHAR(170)'); + $migrations[] = $this->migration->db->changeColumnType('google_stats', 'url', 'VARCHAR(170)'); + return $migrations; + } + public function doUpdate(Updater $updater) + { + $updater->executeMigrations(__FILE__, $this->getMigrations($updater)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Updates/4.1.0.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Updates/4.1.0.php new file mode 100644 index 0000000..4294903 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/Updates/4.1.0.php @@ -0,0 +1,30 @@ + \true, + 'Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Client\\Google' => \Piwik\DI::autowire(), + 'diagnostics.optional' => \Piwik\DI::add([ + \Piwik\DI::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Diagnostic\\BingAccountDiagnostic'), + \Piwik\DI::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Diagnostic\\GoogleAccountDiagnostic'), + \Piwik\DI::get('Piwik\\Plugins\\SearchEngineKeywordsPerformance\\Diagnostic\\YandexAccountDiagnostic') + ]), + // defines the number of days the plugin will try to import Google keywords for + // Google API itself currently supports up to 500 days in the past + 'SearchEngineKeywordsPerformance.Google.ImportLastDaysMax' => 365, + 'SearchEngineKeywordsPerformance.Google.googleClient' => function (\Piwik\Container\Container $c) { + $googleClient = new \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Client(); + $googleClient->addScope(\Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\SearchConsole::WEBMASTERS_READONLY); + $googleClient->addScope(\Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Oauth2::USERINFO_PROFILE); + $googleClient->setAccessType('offline'); + $googleClient->setApprovalPrompt('force'); + $redirectUrl = Url::getCurrentUrlWithoutQueryString() . '?module=SearchEngineKeywordsPerformance&action=processAuthCode'; + $googleClient->setRedirectUri($redirectUrl); + return $googleClient; + }, +]; diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/docs/index.md b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/docs/index.md new file mode 100644 index 0000000..f8e8d71 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/docs/index.md @@ -0,0 +1,3 @@ +## Documentation + +The [Search Engine Keywords Performance User Guide](https://matomo.org/docs/search-engine-keywords-performance/) and the [Search Engine Keywords Performance FAQ](https://matomo.org/faq/search-engine-keywords-performance/) cover how to get the most out of this plugin. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Bing.png b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Bing.png new file mode 100644 index 0000000..3436b29 Binary files /dev/null and b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Bing.png differ diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Google.png b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Google.png new file mode 100644 index 0000000..b0699bf Binary files /dev/null and b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Google.png differ diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Yahoo.png b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Yahoo.png new file mode 100644 index 0000000..ce31701 Binary files /dev/null and b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Yahoo.png differ diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Yandex.png b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Yandex.png new file mode 100644 index 0000000..4271c86 Binary files /dev/null and b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/images/Yandex.png differ diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/bg.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/bg.json new file mode 100644 index 0000000..75425f8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/bg.json @@ -0,0 +1,6 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "Добавено от %1$s на %2$s", + "AccountConnectionValidationError": "Възникна грешка при валидиране на връзката с акаунта:" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/cs.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/cs.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/cs.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/da.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/da.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/da.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/de.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/de.json new file mode 100644 index 0000000..ed91db3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/de.json @@ -0,0 +1,224 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "API-Key", + "AccountAddedBy": "Hinzugefügt von %1$s am %2$s", + "AccountConnectionValidationError": "Beim Überprüfen der Konto-Verknüpfung ist ein Fehler aufgetreten:", + "AccountDoesNotExist": "Das konfigurierte Konto %1$s existiert nicht mehr", + "AccountNoAccess": "Dieses Konto hat derzeit keinen Zugriff auf irgendeine Website.", + "AccountRemovalConfirm": "Sie sind im Begriff das Konto %1$s zu löschen. Dies deaktiviert den Import für all noch verknüpften Websites. Trotzdem fortfahren?", + "ActivityAccountAdded": "hat ein neues Konto für die Suchbegriff-Anbindung von %1$s hinzugefügt: %2$s", + "ActivityAccountRemoved": "hat ein Konto für die Suchbegriff-Anbindung von %1$s entfernt: %2$s", + "ActivityGoogleClientConfigChanged": "Hat die Google-Client Konfiguration geändert.", + "ActivityYandexClientConfigChanged": "Hat die Yandex-Client Konfiguration geändert.", + "AddAPIKey": "API-Key hinzufügen", + "AddConfiguration": "Konfiguration hinzufügen", + "AllReferrersImported": "Verweise (mit importierten Suchbegriffen)", + "AllReferrersOriginal": "Verweise (mit getrackten Suchbegriffen)", + "AvailableSites": "Für den Import verfügbare Websites:", + "BingAPIKeyInstruction": "Melden Sie sich bei den %1$sBing Webmaster Tools%2$s an, dann fügen Sie ihre Website zu Bing Webmaster hinzu. Sobald diese bestätigt wurde, können Sie %3$sihren API-Key kopieren%4$s.", + "BingAccountError": "Bei der Überprüfung des API-Keys ist ein Fehler aufgetreten: %1$s. Falls Sie diesen API-Key gerade erst in den Bing Webmaster Tools erzeugt haben, versuchen Sie es in einigen Minuten nochmal (API-Keys für die Bing Webmaster Tools benötigen eine Weile bis sie aktiviert sind).", + "BingAccountOk": "API-Key erfolgreich überprüft", + "BingConfigurationDescription": "Der Zugriff auf die Bing Webmaster Tools benötigt einen API-Key. Hier können Sie API-Keys hinzufügen, um auf die Daten Ihrer Website zuzugreifen.", + "BingConfigurationTitle": "Import über Bing Webmaster Tools konfigurieren", + "BingCrawlBlockedByRobotsTxt": "Robots.txt Ausnahmen", + "BingCrawlBlockedByRobotsTxtDesc": "URLs, deren Zugriff aktuell durch die robots.txt Ihrer Website verhindert wird.", + "BingCrawlConnectionTimeout": "Verbindungs-Timeouts ", + "BingCrawlConnectionTimeoutDesc": "Diese Zahl steht für aktuelle Ereignisse, bei denen Bing aufgrund von Verbindungsfehlern nicht auf Ihre Website zugreifen konnte. Dies könnte ein vorübergehendes Problem sein, aber Sie sollten Ihre Serverprotokolle überprüfen, um zu sehen, ob Anfragen unbeabsichtigt verloren gehen.", + "BingCrawlCrawledPages": "Gecrawlte Seiten", + "BingCrawlCrawledPagesDesc": "Anzahl der Seiten die der Bing Crawler abgerufen hat.", + "BingCrawlDNSFailures": "DNS Fehler", + "BingCrawlDNSFailuresDesc": "Dieser Fehlertyp katalogisiert aktuelle Fehler, die bei der Kommunikation mit dem DNS-Server aufgetreten sind, als der Bot versuchte, auf Ihre Seiten zuzugreifen. Möglicherweise war Ihr Server ausgefallen, oder es gab eine Fehlkonfiguration, die ein DNS-Routing verhinderte, z.B. wurde TTL auf 0 gesetzt.", + "BingCrawlErrors": "Crawlerfehler bei Bing", + "BingCrawlErrorsDesc": "Anzahl der aufgetretenen Fehler für den Bing-Crawler.", + "BingCrawlErrorsFromDateX": "Der Bericht zeigt Crawling-Fehler, die kürzlich von Bing gemeldet wurden. Er liefert keine historischen Daten. Zuletzt aktualisiert: %s", + "BingCrawlHttpStatus2xx": "HTTP-Status 200-299", + "BingCrawlHttpStatus2xxDesc": "Diese Codes treten auf, wenn der Server eine Seite erfolgreich bereitstellt", + "BingCrawlHttpStatus301": "HTTP-Status 301 (Dauerhaft verschoben)", + "BingCrawlHttpStatus301Desc": "Diese Codes treten auf, wenn Inhalte dauerhaft von einem Ort (URL) zu einem anderen verschoben wurden.", + "BingCrawlHttpStatus302": "HTTP-Status 302 (Temporär verschoben)", + "BingCrawlHttpStatus302Desc": "Diese Codes treten auf, wenn Sie Inhalte vorübergehend von einem Ort (URL) zu einem anderen verschoben haben.", + "BingCrawlHttpStatus4xx": "HTTP-Status 400-499 (Anfragefehler)", + "BingCrawlHttpStatus4xxDesc": "Diese Codes treten auf, wenn wahrscheinlich ein Fehler in der Anfrage vorlag, der den Server daran hinderte, sie zu verarbeiten.", + "BingCrawlHttpStatus5xx": "HTTP Code 500-599 (Interne Server-Fehler)", + "BingCrawlHttpStatus5xxDesc": "Diese Codes treten auf, wenn der Server eine scheinbar gültige Anforderung nicht beantworten konnte.", + "BingCrawlImportantBlockedByRobotsTxt": "Ausschluss einer wichtigen Seite durch robots.txt", + "BingCrawlInboundLink": "Eingehende Link insgesamt", + "BingCrawlInboundLinkDesc": "Eingehende Links, die Bing bekannt sind und auf URLs auf Ihrer Website verweisen. Dies sind Links von Websites außerhalb Ihrer eigenen, die auf Ihre Inhalte verweisen.", + "BingCrawlMalwareInfected": "Mit Malware infizierte Seiten", + "BingCrawlMalwareInfectedDesc": "Alle Seiten-URLs, die Bing gefunden hat und die infiziert sind oder mit Malware in Verbindung gebracht werden, werden in diesem Abschnitt zusammengefasst.", + "BingCrawlPagesInIndex": "Seiten insg. im Index", + "BingCrawlPagesInIndexDesc": "Gesamtzahl der Seiten die im Bing Index vorhanden sind", + "BingCrawlStatsOtherCodes": "Alle übrigen HTTP-Status", + "BingCrawlStatsOtherCodesDesc": "Gruppiert alle anderen Codes, die keinem anderen Wert entsprechen (z.B. 1xx oder Informationscodes).", + "BingCrawlingStats": "Crawl-Übersicht für Bing und Yahoo!", + "BingCrawlingStatsDocumentation": "Die Crawl-Übersicht ermöglicht es Ihnen, Informationen zum Crawlen anzuzeigen, wie z.B. Fehler, die der Suchbot beim Besuch einer Seite feststellt, Elemente, die durch Ihre robots.txt-Datei blockiert werden und URLs, die möglicherweise von Malware befallen sind.", + "BingKeywordImport": "Import von Suchbegriffen auf Bing", + "BingKeywords": "Suchbegriffe (auf Bing und Yahoo!)", + "BingKeywordsDocumentation": "Suchbegriffe, die in der Suche auf Bing oder Yahoo! verwendet wurden und Links zu Ihrer Website in der Suchergebnisliste generiert haben.", + "BingKeywordsNoRangeReports": "Keywords auf Bing und Yahoo! können nur für benutzerdefinierte Datumsbereiche mit vollständigen Wochen oder Monaten verarbeitet werden, da sie nicht als Tagesberichte verfügbar sind.", + "BingKeywordsNotDaily": "Keywords zu Bing und Yahoo! sind nur als Wochenberichte verfügbar. Es gibt keine Keyword-Daten für einzelne Tage.", + "BingWebmasterApiUrl": "Url für Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Geben Sie die URL an, mit der diese Website in Ihren Bing Webmaster Tools verfügbar ist", + "Category": "Kategorie", + "ChangeConfiguration": "Konfiguration ändern", + "Clicks": "Klicks", + "ClicksDocumentation": "Hier wird jeder Klick auf einen Link auf einer Suchergebnisseite gezählt, der zu Ihrer Website zeigt.", + "ClientConfigImported": "Client-Konfiguration wurde erfolgreich importiert!", + "ClientConfigSaveError": "Beim Speichern der Client-Konfiguration ist ein Fehler aufgetreten. Bitte überprüfen Sie, ob die angegebene Konfiguration gültig ist, und versuchen Sie es erneut.", + "ClientId": "Client-ID", + "ClientSecret": "Clientschlüssel", + "ConfigAvailableNoWebsiteConfigured": "Anbindung erfolgreich konfiguriert, allerdings sind derzeit keine Websites für den Import konfiguriert.", + "ConfigRemovalConfirm": "Sie sind dabei, die Konfiguration für %1$s zu entfernen. Der Import von Keywords für diese Website wird deaktiviert. Trotzdem fortfahren?", + "Configuration": "Konfiguration", + "ConfigurationDescription": "Dieses Plugin ermöglicht es Ihnen alle Suchbegriffe, nach denen Ihre Benutzer auf Suchmaschinen gesucht haben, direkt in Matomo zu importieren.", + "ConfigurationFile": "Konfigurationsdatei", + "ConfigurationValid": "Ihre OAuth Konfiguration ist gültig.", + "ConfigureMeasurableBelow": "Um eine Website zu konfigurieren, klicken Sie einfach den Button unterhalb oder konfigurieren Sie dies direkt in den Website-Einstellungen.", + "ConfigureMeasurables": "Websites konfigurieren", + "ConfiguredAccounts": "Konfigurierte Accounts", + "ConfiguredUrlNotAvailable": "Die konfigurierte URL steht für dieses Konto nicht zur Verfügung", + "ConnectAccount": "Konto verknüpfen", + "ConnectAccountDescription": "Bitte klicken Sie auf den folgenden Button. Sie werden dann zu %1$s weitergeleitet, um dem Zugriff zuzustimmen.", + "ConnectAccountYandex": "Die Authentifizierung für Yandex-Konten ist nur %1$s Tage lang gültig. Jedes Konto muss innerhalb dieser Zeit neu authentifiziert werden, damit Importe korrekt funktionieren.", + "ConnectFirstAccount": "Beginnen Sie, indem Sie Ihr erstes Konto verknüpfen.", + "ConnectGoogleAccounts": "Google Konten verknüpfen", + "ConnectYandexAccounts": "Yandex Konten verknüpfen", + "ContainingSitemaps": "Enthaltende Sitemaps", + "CrawlingErrors": "Crawling-Fehler", + "CrawlingOverview1": "Die Crawling-Übersicht enthält die wichtigsten Informationen darüber, wie die Suchmaschinen Ihre Websites crawlen. Diese Metriken werden etwa einmal pro Tag mit Daten aktualisiert, die von den Suchmaschinen bereitgestellt werden.", + "CrawlingStats": "Crawling Übersicht", + "Ctr": "CTR", + "CtrDocumentation": "Klickrate: Gibt das Verhältnis an wie häufig Benutzer, die einen Link auf Ihre Website auf einer Suchergebnisseite gesehen haben auch darauf geklickt haben.", + "CurrentlyConnectedAccounts": "Aktuell sind %1$s Konten verknüpft.", + "Domain": "Domain", + "DomainProperty": "Domain-Property", + "DomainPropertyInfo": "Enthält alle Subdomains (m, www etc.) und beide Protokolle (http, https).", + "EnabledSearchTypes": "Abzurufende Keyword-Arten", + "FetchImageKeyword": "Bilder-Keywords abrufen", + "FetchImageKeywordDesc": "Abrufen von Keywords welche in der Google Bildsuche verwendet wurden", + "FetchNewsKeyword": "News-Keywords abrufen", + "FetchNewsKeywordDesc": "Abrufen von Keywords welche in auf Google News verwendet wurden", + "FetchVideoKeyword": "Video-Keywords abrufen", + "FetchVideoKeywordDesc": "Abrufen von Keywords welche in der Google Videosuche verwendet wurden", + "FetchWebKeyword": "Web-Keywords abrufen", + "FetchWebKeywordDesc": "Abrufen von Keywords welche in der Google Websuche verwendet wurden", + "FirstDetected": "Zuerst erkannt", + "GoogleAccountAccessTypeOfflineAccess": "Offline Zugriff wird benötigt damit die Suchbegriffe auf dann im Hintergrund importiert werden können, wenn Sie gerade nicht aktiv eingeloggt sind.", + "GoogleAccountAccessTypeProfileInfo": "Personenbezogene Daten aufrufen wird verwendet, um den Namen der aktuell verbundenen Konten anzuzeigen.", + "GoogleAccountAccessTypeSearchConsoleData": "Search Console-Daten ist erforderlich, um Zugriff auf Ihre Google-Suchbegriffe zu erhalten.", + "GoogleAccountError": "Bei der Überprüfung des OAuth-Zugriffs ist ein Fehler aufgetreten: %1$s", + "GoogleAccountOk": "OAuth-Zugriff erfolgreich überprüft.", + "GoogleConfigurationDescription": "Google Search Console verwendet OAuth zur Authentifizierung und Autorisierung.", + "GoogleConfigurationTitle": "Import von Google Search Console konfigurieren", + "GoogleDataNotFinal": "Die Suchbegriffe in diesem Bericht enthalten möglicherweise noch nicht die endgültigen Daten. Google stellt endgültige Suchbegriffe mit einer Verzögerung von 2 Tagen bereit. Suchbegriffe für neuere Tage werden erneut importiert, bis sie als endgültig gemeldet werden.", + "GoogleDataProvidedWithDelay": "Google stellt Suchbegriffe mit einer Verzögerung zur Verfügung. Die Suchbegriffe für dieses Datum werden etwas später importiert.", + "GoogleKeywordImport": "Google Keyword Import", + "GoogleSearchConsoleUrl": "Url für Google Search Console", + "GoogleSearchConsoleUrlDescription": "Geben Sie die URL an, mit der diese Website in Ihrer Google Search Console verfügbar ist", + "GoogleUploadOrPasteClientConfig": "Bitte laden Sie Ihre Google OAuth Client-Konfiguration hoch oder fügen Sie sie in das untenstehende Feld ein.", + "HowToGetOAuthClientConfig": "Woher bekomme ich meine OAuth-Client Konfiguration", + "ImageKeywords": "Bilder Suchbegriffe auf Google", + "ImageKeywordsDocumentation": "Suchbegriffe, die in der Google-Bildersuche verwendet wurden und Links zu Ihrer Website in der Suchergebnisliste generiert haben.", + "Impressions": "Impressionen", + "ImpressionsDocumentation": "Als Impression zählt die Anzeige Ihrer Website auf einer Suchergebnisseite.", + "IntegrationConfigured": "Anbindung erfolgreich konfiguriert", + "IntegrationNotConfigured": "Anbindung noch nicht konfiguriert", + "KeywordStatistics": "Suchbegriffe", + "KeywordTypeImage": "Bild", + "KeywordTypeNews": "News", + "KeywordTypeVideo": "Video", + "KeywordTypeWeb": "Web", + "KeywordsCombined": "Suchbegriffe (kombiniert)", + "KeywordsCombinedDocumentation": "Bericht, der alle von Matomo erkannten und von Suchmaschinen importierten Keywords kombiniert. Dieser Bericht enthält nur die Besuchsmetrik. Sie können zu einem der zugehörigen Berichte wechseln, um detaillierte Kennzahlen zu erhalten.", + "KeywordsCombinedImported": "Importierte Suchbegriffe kombiniert", + "KeywordsCombinedImportedDocumentation": "Dieser Bericht zeigt alle Suchbegriffe die von allen konfigurierten Suchmaschinen importiert wurden.", + "KeywordsReferrers": "Suchbegriffe (inklusive nicht definierter)", + "KeywordsSubtableImported": "Importierte Keywords", + "KeywordsSubtableOriginal": "Tracked Keywords (inkl. nicht definierte)", + "LastCrawled": "Zuletzt gecrawlt", + "LastDetected": "Zuletzt erkannt", + "LastImport": "Letzter Import", + "LatestAvailableDate": "Die neuesten verfügbaren Keyword-Daten sind für %1$s", + "LinksToUrl": "Links auf %s", + "ManageAPIKeys": "API-Schlüssel verwalten", + "MeasurableConfig": "Konfigurierte Websites", + "NewsKeywords": "Suchbegriffe auf Google News", + "NewsKeywordsDocumentation": "Suchbegriffe, die in der Google-Newssuche verwendet wurden und Links zu Ihrer Website in der Suchergebnisliste generiert haben.", + "NoSegmentation": "Der Bericht unterstützt keine Segmentierung. Bei den angezeigten Daten handelt es sich um Ihre standardmäßigen, unsegmentierten Berichtsdaten.", + "NoWebsiteConfigured": "Es ist derzeit keine Website konfiguriert. Um den Import für eine Website zu aktivieren, konfigurieren Sie dies bitte hier.", + "NoWebsiteConfiguredWarning": "Import von %s nicht vollständig konfiguriert. Sie müssen eine Website konfigurieren, um den Import zu aktivieren.", + "NotAvailable": "Nicht verfügbar", + "OAuthAccessTimedOut": "Der OAuth-Zugang für dieses Konto hat möglicherweise sein Zeitlimit überschritten. Sie müssen sich neu authentifizieren, damit die Importe für dieses Konto wieder funktionieren.", + "OAuthAccessWillTimeOut": "Der OAuth-Zugang für dieses Konto läuft nach %1$s Tagen ab. Noch %2$s Tage verbleibend", + "OAuthAccessWillTimeOutSoon": "Der OAuth-Zugang für dieses Konto läuft in etwa %1$s Tagen ab. Bitte authentifizieren Sie sich erneut, um zu vermeiden, dass Importe für dieses Konto nicht mehr funktionieren.", + "OAuthClientConfig": "OAuth-Client Konfiguration", + "OAuthError": "Innerhalb des OAuth-Prozesses ist ein Fehler aufgetreten. Bitte versuchen Sie es erneut und stellen Sie sicher, dass Sie die angeforderten Berechtigungen akzeptieren.", + "Platform": "Plattform", + "Position": "durchschn. Position", + "PositionDocumentation": "Durchschnittliche Position Ihrer Website in der Suchergebnisliste (für diesen Suchbegriff).", + "ProvideYandexClientConfig": "Bitte fügen Sie Ihre Yandex OAuth-Client-Konfiguration ein.", + "ProviderBingDescription": "Importieren Sie alle Keywords, die verwendet werden, um Ihre Website bei Bing und Yahoo! zu finden.", + "ProviderBingNote": "Anmerkung: Microsoft stellt Suchbegriffe nur jeden Samstag für ganze Wochen zur Verfügung. Daher kann es ein paar Tage dauern bis die ersten Suchbegriffe in den Berichten angezeigt werden. Zudem stehen diese nur für Wochen-, Monats- sowie Jahres-Berichte zur Verfügung.", + "ProviderGoogleDescription": "Importieren Sie alle Keywords, mit denen Ihre Website in der Google-Suche gefunden wird. Berichte zeigen Ihre Keywords für jeden Suchtyp separat an (Web, Bilder und Videos).", + "ProviderGoogleNote": "Anmerkung: Google stellt finale Suchbegriffe mit einer Verzögerung von 2 Tagen zur Verfügung. Nicht endgültige Daten für neuere Tage werden bereits angezeigt, werden aber erneut importiert, bis sie endgültig sind. Der erste Import kann möglicherweise Ihre historischen Suchbegriffe der letzten bis zu 486 Tagen importieren.", + "ProviderListDescription": "Wenn Sie unten eine (oder mehrere) Suchmaschinen erfolgreich eingerichtet haben, können Sie konfigurieren, in welche Website(s) Matomo Ihre Suchbegriffe importieren soll.", + "ProviderXAccountWarning": "Probleme bei der Kontokonfiguration erkannt
Bitte überprüfen Sie die konfigurierten Konten für%s.", + "ProviderXSitesWarning": "Probleme bei der Website-Konfiguration erkannt
Bitte überprüfen Sie die konfigurierten Webseiten für %s.", + "ProviderYandexDescription": "Importieren Sie alle Suchbegriffe, mit denen Ihre Website in der Yandex-Suche gefunden wird.", + "ProviderYandexNote": "Anmerkung: Yandex stellt Suchbegriffe mit einem Versatz von bis zu 5 Tagen zur Verfügung. Beim ersten Import wird versucht, Ihre historischen Suchbegriffe der letzten bis zu 100 Tagen zu importieren.", + "ReAddAccountIfPermanentError": "Sollte dieser Fehler dauerhaft auftreten, entfernen Sie bitte das Konto und verknüpfen Sie es erneut.", + "ReAuthenticateIfPermanentError": "Sollte dieser Fehler dauerhaft auftreten, versuchen Sie, das Konto erneut zu authentifizieren oder es zu entfernen und erneut zu verbinden.", + "Reauthenticate": "Erneut authentifizieren", + "ReportShowMaximumValues": "Bei den angezeigten Werten handelt es sich um die Maximalwerte, die im gewählten Zeitraum auftraten.", + "RequiredAccessTypes": "Folgende Zugriffsrechte werden benötigt:", + "ResponseCode": "Response-Code", + "RoundKeywordPosition": "Runden der Keyword-Position", + "SearchEngineKeywordsPerformance": "Leistung von Suchmaschinen-Keywords", + "SearchEnginesImported": "Suchmaschinen (mit importierten Suchbegriffen)", + "SearchEnginesOriginal": "Suchmaschinen (mit getrackten Suchbegriffen)", + "SetUpOAuthClientConfig": "Einrichten Ihrer OAuth-Client-Konfiguration", + "SetupConfiguration": "Einrichten der Konfiguration", + "SitemapsContainingUrl": "Sitemaps die %s beinhalten", + "StartOAuth": "OAuth-Prozess starten", + "URLPrefix": "URL-Präfix", + "URLPrefixProperty": "URL-Präfix Property", + "URLPrefixPropertyInfo": "Enthält nur URLs mit exakt angegebenem Präfix, einschließlich Protokoll (http oder https). Wenn Ihre Property alle Protokolle oder Subdomains (http, https, www, m usw.) umfassen soll, können Sie stattdessen eine Domain-Property hinzufügen.", + "UnverifiedSites": "Unbestätigte Websites:", + "UploadOAuthClientConfig": "Laden Sie Ihre OAuth-Client Konfiguration hoch", + "UrlOfAccount": "URL (Konto)", + "VideoKeywords": "Video Suchbegriffe auf Google", + "VideoKeywordsDocumentation": "Suchbegriffe, die in der GoogleVideosuche verwendet wurden und Links zu Ihrer Website in der Suchergebnisliste generiert haben.", + "VisitOAuthHowTo": "Bitte besuchen Sie unseren %1$sOnline-Guide%2$s, um zu erfahren, wie Sie Ihre %3$s OAuth-Client-Konfiguration einrichten.", + "WebKeywords": "Web Suchbegriffe auf Google", + "WebKeywordsDocumentation": "Suchbegriffe, die in der Google-Websuche verwendet wurden und Links zu Ihrer Website in der Suchergebnisliste generiert haben.", + "WebsiteSuccessfulConfigured": "Herzlichen Glückwunsch!
Sie haben den Keywordimport für die Website %1$s erfolgreich konfiguriert.
Es kann einige Tage dauern, bis Ihre ersten Suchbegriffe importiert und in Referrers > Search Keywords angezeigt werden. Weitere Informationen über Verzögerungen und Einschränkungen beim Import von Keywords finden Sie in unseren %2$sFAQs%3$s.", + "WebsiteTypeUnsupported": "Die ausgewählte Messgröße %1$s kann nicht konfiguriert werden, da sie einen nicht unterstützten Typ hat. Es werden nur Messgrößen vom Typ 'Website' unterstützt.", + "WebsiteTypeUnsupportedRollUp": "Hinweis: Roll-Up-Sites kombinieren automatisch die importierten Daten aller ihrer Unterseiten", + "YandexConfigurationDescription": "Yandex verwendet OAuth zur Authentifizierung und Autorisierung.", + "YandexConfigurationTitle": "Import von Yandex Webmaster API konfigurieren", + "YandexCrawlAppearedPages": "In der Suche erschienene Seiten", + "YandexCrawlAppearedPagesDesc": "Seiten die neu in den Suchindex von Yandex aufgenommen wurden", + "YandexCrawlCrawledPages": "Gecrawlte Seiten", + "YandexCrawlCrawledPagesDesc": "Anzahl der Seiten die der Yandex Crawler abgerufen hat.", + "YandexCrawlErrors": "Andere Abfragefehler", + "YandexCrawlErrorsDesc": "Gecrawlte Seiten, die aus einem anderen Grund fehlgeschlagen sind", + "YandexCrawlHttpStatus2xx": "HTTP-Status 200-299", + "YandexCrawlHttpStatus2xxDesc": "Gecrawlte Seiten mit einem 2xx-Code", + "YandexCrawlHttpStatus3xx": "HTTP-Code 300-399 (verschobene Seiten)", + "YandexCrawlHttpStatus3xxDesc": "Gecrawlte Seiten mit einem 3xx-Code", + "YandexCrawlHttpStatus4xx": "HTTP-Status 400-499 (Anfragefehler)", + "YandexCrawlHttpStatus4xxDesc": "Gecrawlte Seiten mit einem 4xx-Code", + "YandexCrawlHttpStatus5xx": "HTTP Code 500-599 (Interne Server-Fehler)", + "YandexCrawlHttpStatus5xxDesc": "Gecrawlte Seiten mit einem 5xx-Code", + "YandexCrawlInIndex": "Seiten insg. im Index", + "YandexCrawlInIndexDesc": "Gesamtzahl der Seiten die im Yandex Suchindex vorhanden sind", + "YandexCrawlRemovedPages": "Aus der Suche entfernte Seiten", + "YandexCrawlRemovedPagesDesc": "Seiten die aus dem Suchindex von Yandex entfernt wurden", + "YandexCrawlingStats": "Crawl-Übersicht für Yandex!", + "YandexCrawlingStatsDocumentation": "In der Crawl-Übersicht können Sie Crawl-bezogene Informationen anzeigen, z. B. Fehler, auf die der Suchbot beim Besuch einer Seite stößt, durch Ihre robots.txt-Datei blockierte Elemente oder die Gesamtzahl der Seiten im Index.", + "YandexKeywords": "Suchbegriffe auf Yandex", + "YandexKeywordsDocumentation": "Suchbegriffe, die in der Suche auf Yandex verwendet wurden und Links zu Ihrer Website in der Suchergebnisliste generiert haben.", + "YandexWebmasterApiUrl": "Url für Yandex Webmaster Tools", + "YandexWebmasterApiUrlDescription": "Geben Sie die URL an, mit der diese Website in Ihren Yandex Webmaster Tools verfügbar ist" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/en.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/en.json new file mode 100644 index 0000000..06085fd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/en.json @@ -0,0 +1,240 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "Added by %1$s<\/em> on %2$s<\/em>", + "AccountConnectionValidationError": "An error occured while validating the account connection:", + "AccountDoesNotExist": "Configured account %1$s does not exist anymore", + "AccountNoAccess": "This account does not currently have access to any website.", + "AccountRemovalConfirm": "You are about to remove the account %1$s. This might disable the keywords import for any connected website(s). Proceed anyway?", + "ActivityAccountAdded": "added a new account for keyword provider %1$s: %2$s", + "ActivityAccountRemoved": "removed an account for keyword provider %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "changed the Google client configuration.", + "ActivityYandexClientConfigChanged": "changed the Yandex client configuration.", + "AddAPIKey": "Add API Key", + "AddConfiguration": "Add Configuration", + "AdminMenuTitle": "Search Performance", + "APIKey": "API Key", + "AvailableSites": "Websites available for import:", + "Domain": "Domain", + "DomainProperty": "Domain property", + "DomainPropertyInfo": "Includes all subdomains (m, www, and so on) and both protocols (http, https).", + "URLPrefix": "URL-prefix", + "URLPrefixProperty": "URL-prefix property", + "URLPrefixPropertyInfo": "Includes only URLs with the specified exact prefix, including the protocol (http\/https). If you want your property to match any protocol or subdomain (http\/https\/www.\/m. and so on), consider adding a Domain property instead.", + "BingAccountError": "An error occurred while validating the API Key: %1$s. If you have just generated this API key in Bing Webmaster Tools please try again in one or two minutes (API keys in Bing Webmaster Tools take a little while to be activated).", + "BingAccountOk": "API Key successfully checked", + "BingAPIKeyInstruction": "Sign in at %1$sBing Webmaster Tools%2$s, then add your website in Bing Webmaster. After you have validated it, you can %3$scopy your API key%4$s.", + "BingConfigurationDescription": "Bing Webmaster Tools needs an API key to be accessed. Here you can add API keys to access your websites data.", + "BingConfigurationTitle": "Configure import from Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Robots.txt exclusion", + "BingCrawlBlockedByRobotsTxtDesc": "URLs currently blocked by your site’s robots.txt.", + "BingCrawlConnectionTimeout": "Connection timeouts", + "BingCrawlConnectionTimeoutDesc": "This number represents recent occurences when Bing could not access your site due to connection errors. This could be a temporary issue but you should check your server logs to see if you are accidentally dropping requests.", + "BingCrawlCrawledPages": "Crawled pages", + "BingCrawlCrawledPagesDesc": "Number of pages the Bing crawler requested.", + "BingCrawlDNSFailures": "DNS failures", + "BingCrawlDNSFailuresDesc": "This issue type catalogs recent errors encountered trying to communicate with the DNS server when the bot tried to access your pages. Possibly your server was down, or there was a misconfiguration that prevented DNS routing, for example TTL was set to 0.", + "BingCrawlErrors": "Crawl errors on Bing", + "BingCrawlErrorsDesc": "Number of errors occured for the Bing crawler.", + "BingCrawlErrorsFromDateX": "The report show crawling errors recently reported by Bing. It does not provide any historical data. Last updated %s", + "BingCrawlHttpStatus2xx": "HTTP Code 200-299", + "BingCrawlHttpStatus2xxDesc": "These codes appear when the server serves a page successfully", + "BingCrawlHttpStatus301": "HTTP Code 301 (Permanently moved)", + "BingCrawlHttpStatus301Desc": "These codes appear when you have permanently moved content from one location (URL) to another.", + "BingCrawlHttpStatus302": "HTTP Code 302 (Temporarily moved)", + "BingCrawlHttpStatus302Desc": "These codes appear when you have temporarily moved content from one location (URL) to another.", + "BingCrawlHttpStatus4xx": "HTTP Code 400-499 (Request errors)", + "BingCrawlHttpStatus4xxDesc": "These codes appear when there was a likely an error in the request which prevented the server from being able to process it.", + "BingCrawlHttpStatus5xx": "HTTP Code 500-599 (Internal server errors)", + "BingCrawlHttpStatus5xxDesc": "These codes appear when the server failed to fulfill an apparently valid request.", + "BingCrawlImportantBlockedByRobotsTxt": "Robots.txt exclusion of important page", + "BingCrawlInboundLink": "Total inbound links", + "BingCrawlInboundLinkDesc": "Inbound links Bing is aware of, pointed at URLs on your website. These are links, from websites external of your own, that have been pointed towards your content.", + "BingCrawlingStats": "Crawl overview for Bing and Yahoo!", + "BingCrawlingStatsDocumentation": "The Crawl overview allows you to view crawl related information such as errors encountered by the search bot when visiting a page, items blocked by your robots.txt file and URLs potentially affected by malware.", + "BingCrawlMalwareInfected": "Malware infected websites", + "BingCrawlMalwareInfectedDesc": "Any page URLs that Bing found that are infected or associated with malware will be grouped in this section.", + "BingCrawlPagesInIndex": "Total pages in index", + "BingCrawlPagesInIndexDesc": "Total number of pages available in Bing index", + "BingCrawlStatsOtherCodes": "All other HTTP status codes", + "BingCrawlStatsOtherCodesDesc": "Groups all other codes that are not matched by any other value (such as 1xx or informational codes).", + "BingKeywordImport": "Bing keyword import", + "BingKeywords": "Keywords (on Bing and Yahoo!)", + "BingKeywordsDocumentation": "Keywords used in Bing or Yahoo! search that generated links to your website in the search results list.", + "BingKeywordsNoRangeReports": "Keywords on Bing and Yahoo! can only be processed for custom date ranges including full weeks or months as they are not available as daily reports.", + "BingKeywordsNotDaily": "Keywords on Bing and Yahoo! are only available as weekly reports. There is no keyword data for days periods.", + "BingWebmasterApiUrl": "Url for Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Provide the url this website is available in your Bing Webmaster Tools", + "Category": "Category", + "ChangeConfiguration": "Change configuration", + "Clicks": "Clicks", + "ClicksDocumentation": "A click is counted each time someone clicks on a link pointing to your website on a search engine results page.", + "ClientConfigImported": "Client config has been successfully imported!", + "ClientConfigSaveError": "An error occured while saving the client config. Please check if the config provided is valid, and try again.", + "ClientId": "Client id", + "ClientSecret": "Client secret", + "ConfigAvailableNoWebsiteConfigured": "Integration successfully configured, but currently no website configured for import.", + "ConfigRemovalConfirm": "You are about to remove the configuration for %1$s. Import of Keywords for that website will be disabled. Proceed anyway?", + "Configuration": "Configuration", + "ConfigurationDescription": "This plugin allows you to import directly into Matomo all keywords searched by your users on search engines.", + "ConfigurationFile": "Configuration file", + "ConfigurationValid": "Your OAuth configuration is valid.", + "ConfiguredAccounts": "configured accounts", + "ConfiguredUrlNotAvailable": "Configured URL is not available for this account", + "ConfigureMeasurableBelow": "To configure a website, simply click the button below or configure it directly in the website settings.", + "ConfigureMeasurables": "Configure websites", + "ConfigureTheImporterLabel1": "Import your Google Search Console keywords and analyse them using Matomo’s powerful analytics tools. Once you connect the importer, select which websites to import and Matomo will start importing keywords for them as part of the scheduled archiving process.", + "ConfigureTheImporterLabel2": "In order to import your data from Google Search Console, Matomo need access to this data.", + "ConfigureTheImporterLabel3": "To start, %1$sfollow our instructions to retrieve your OAuth Client configuration%2$s. Then upload the client configuration file using the button below.", + "ConnectAccount": "Connect Account", + "ConnectAccountDescription": "Please click on the button below to be redirected to %1$s where you need to grant access.", + "ConnectAccountYandex": "Authentication for Yandex accounts is only valid for %1$s days. Each account needs to be reauthenticated within that time to ensure imports work correctly.", + "ConnectFirstAccount": "Start by connecting your first account below.", + "ConnectGoogleAccounts": "Connect Google Account(s)", + "ContainingSitemaps": "Containing Sitemaps", + "CrawlingErrors": "Crawling errors", + "ConnectYandexAccounts": "Connect Yandex Account(s)", + "CrawlingStats": "Crawling overview", + "Ctr": "CTR", + "CtrDocumentation": "Clickthrough rate: A ratio showing how often people who see a search engine results page with a link to your website, end up clicking it.", + "CurrentlyConnectedAccounts": "There are currently %1$s accounts connected.", + "CreatedBy" : "Created By", + "DeleteUploadedClientConfig": "If you'd like to remove the uploaded client configuration, click below", + "EnabledSearchTypes": "Keyword types to fetch", + "FetchImageKeyword": "Fetch image keywords", + "FetchImageKeywordDesc": "Fetch keywords used in Google image search", + "FetchNewsKeyword": "Fetch news keywords", + "FetchNewsKeywordDesc": "Fetch keywords used in Google News", + "FetchVideoKeyword": "Fetch video keywords", + "FetchVideoKeywordDesc": "Fetch keywords used in Google video search", + "FetchWebKeyword": "Fetch web keywords", + "FetchWebKeywordDesc": "Fetch keywords used in Google web search", + "FirstDetected": "First detected", + "GoogleAccountAccessTypeOfflineAccess": "Offline access<\/strong> is required to be able to import your search keywords even when you are not currently logged in.", + "GoogleAccountAccessTypeProfileInfo": "Profile info<\/strong> is used to show the name of the account(s) currently connected.", + "GoogleAccountAccessTypeSearchConsoleData": "Search Console data<\/strong> is required to get access to your Google search keywords.", + "GoogleAccountError": "An error occurred while validating the OAuth access: %1$s", + "GoogleAccountOk": "OAuth access successfully checked.", + "GoogleAuthorizedJavaScriptOrigin": "Authorized JavaScript origin", + "GoogleAuthorizedRedirectUri": "Authorized redirect URI", + "GoogleConfigurationDescription": "Google Search Console uses OAuth for authentication and authorization.", + "GoogleConfigurationTitle": "Configure import from Google Search Console", + "GoogleDataProvidedWithDelay": "Google provides keywords data with a delay. Keywords for this date will be imported a bit later.", + "GoogleDataNotFinal": "The keywords data in this report may not yet contain the final data. Google provides final keywords data with a delay of 2 days. Keywords for more recent days will be re-imported until they are reported as final.", + "GoogleKeywordImport": "Google keyword import", + "GooglePendingConfigurationErrorMessage": "Configuration is pending. Please ask a super user to complete the configuration.", + "GoogleSearchConsoleUrl": "Url for Google Search Console", + "GoogleSearchConsoleUrlDescription": "Provide the url this website is available in your Google Search Console", + "GoogleUploadOrPasteClientConfig": "Please upload your Google OAuth client configuration, or paste it into the field below.", + "HowToGetOAuthClientConfig": "How to get your OAuth Client configuration", + "ImageKeywords": "Image keywords on Google", + "ImageKeywordsDocumentation": "Keywords used in Google image<\/b> search that generated links to your website in the search result list.", + "Impressions": "Impressions", + "ImpressionsDocumentation": "An impression is counted each time your website is displayed in a search engine results page.", + "IntegrationConfigured": "Integration successfully configured", + "IntegrationNotConfigured": "Integration not yet configured", + "InvalidRedirectUriInClientConfiguration": "Invalid redirect_uris, at least 1 uri should match the uri \"%1$s\" in the uploaded configuration file", + "KeywordsCombined": "Combined keywords", + "KeywordsCombinedDocumentation": "Report combining all keywords detected by Matomo and imported from search engines. This report only includes the visit metric. You can switch to one of the related report to get detailed metrics.", + "KeywordsCombinedImported": "Combined imported keywords", + "KeywordsCombinedImportedDocumentation": "Report showing all keywords imported from all configured search engines.", + "KeywordsReferrers": "Keywords (including not defined)", + "KeywordStatistics": "Search Keywords", + "KeywordTypeImage": "image", + "KeywordTypeVideo": "video", + "KeywordTypeWeb": "web", + "KeywordTypeNews": "news", + "LastCrawled": "Last crawled", + "LastDetected": "Last detected", + "LastImport": "Last Import", + "LatestAvailableDate": "Most recent keyword data available is for %1$s", + "LinksToUrl": "Links to %s", + "ManageAPIKeys": "Manage API Keys", + "MeasurableConfig": "configured websites", + "NoSegmentation": "Report does not support segmentation. The data displayed is your standard, unsegmented report data.", + "NotAvailable": "Not Available", + "NoWebsiteConfigured": "There is currently no website configured. To enable the import for a specific website, please set up the configuration here.", + "NoWebsiteConfiguredWarning": "Import for %s not fully configured. You need to configure some websites to enable the import.", + "OAuthAccessTimedOut": "The OAuth access for this account may have timed out. You will need to reauthenticate to get the imports working again for this account.", + "OAuthAccessWillTimeOutSoon": "The OAuth access for this account will time out in around %1$s days. Please reauthenticate to avoid any imports for this account to stop working.", + "OAuthAccessWillTimeOut": "The OAuth access for this account will time out after %1$s days. %2$s days left<\/strong>", + "OAuthClientConfig": "OAuth Client Configuration", + "OAuthError": "An error occurred within the OAuth process. Please try again and ensure you accept the requested permissions.", + "OAuthExampleText": "The configuration requires the fields listed below. Please use the values provided:", + "OauthFailedMessage": "We encountered an issue during the authorization process for your Google Search Console. To try again, please click the button below. If the problem persists, please contact our support team for assistance. They will assist you in resolving the issue and getting your Google Search Console keywords imported.", "Platform": "Platform", + "Position": "Avg. position", + "PositionDocumentation": "Average position of your website in the search engine results list (for this keyword).", + "ProviderBingDescription": "Import all keywords used to find your website on Bing<\/strong> and Yahoo!<\/strong> search.", + "ProviderBingNote": "Note:<\/u> Microsoft provides keywords data every saturday and only for whole weeks. As a result your keywords for Bing and Yahoo will take a few days to appear in your reports and will only be available when viewing weeks, months or years.", + "ProviderGoogleDescription": "Import all keywords used to find your website on Google<\/strong> search. Reports will show your keywords for each search type separately (Web, Images and Videos).", + "ProviderGoogleNote": "Note:<\/u> Google provides final keywords data with a delay of 2 days. Non final data for more recent days will already be shown, but will be re-imported until they are final. Your first import may be able to import your historical keyword data for up to the last 486 days.", + "ProviderListDescription": "When you have successfully setup one (or more) search engine below, you can configure into which website(s) should Matomo import your search keywords.", + "ProviderXAccountWarning": "Account configuration problems detected<\/strong>
Please check the configured accounts for %s<\/strong>.", + "ProviderXSitesWarning": "Website configuration problems detected<\/strong>
Please check the configured websites for %s<\/strong>.", + "ProviderYandexDescription": "Import all keywords used to find your website on Yandex<\/strong> search.", + "ProviderYandexNote": "Note:<\/u> Yandex provides the keywords with a delay of up to 5 days. The first import will try to import your historical keywords for up to the last 100 days.", + "ProvideYandexClientConfig": "Please insert your Yandex OAuth client configuration.", + "Reauthenticate": "Reauthenticate", + "ReAddAccountIfPermanentError": "If this is a permanent error, try removing the account and connect it again.", + "ReAuthenticateIfPermanentError": "If this is a permanent error, try to reauthenticate the account or remove and connect it again.", + "RecentApiErrorsWarning": "Keyword import errors detected<\/strong>

Please check the configurations for:
%s

If your configuration is correct and the errors persist, please contact support.", + "ReportShowMaximumValues": "Values displayed are the maximum values which occurred during this period.", + "RequiredAccessTypes": "These access types are required:", + "ResponseCode": "Response code", + "RoundKeywordPosition": "Round keyword position", + "SearchEngineKeywordsPerformance": "Search Engine Keywords Performance", + "SetupConfiguration": "Setup configuration", + "SitemapsContainingUrl": "Sitemaps containing %s", + "SetUpOAuthClientConfig": "Setup your OAuth client configuration", + "KeywordsSubtableOriginal": "Tracked keywords (including not defined)", + "KeywordsSubtableImported": "Imported keywords", + "AllReferrersOriginal": "Referrers (with tracked keywords)", + "AllReferrersImported": "Referrers (with imported keywords)", + "SearchEnginesOriginal": "Search Engines (with tracked keywords)", + "SearchEnginesImported": "Search Engines (with imported keywords)", + "StartOAuth": "Start OAuth Process", + "UnverifiedSites": "Unverified websites:", + "UploadOAuthClientConfig": "Upload your OAuth client configuration", + "Uploading": "Uploading...", + "UrlOfAccount": "URL (Account)", + "VideoKeywords": "Video keywords on Google", + "VideoKeywordsDocumentation": "Keywords used in Google video<\/b> search that generated links to your website in the search result list.", + "NewsKeywords": "News keywords on Google", + "NewsKeywordsDocumentation": "Keywords used in Google News<\/b> search that generated links to your website in the search result list.", + "VisitOAuthHowTo": "Please visit our %1$sonline guide%2$s to learn how to set up your %3$s OAuth client configuration.", + "WebKeywords": "Web keywords on Google", + "WebKeywordsDocumentation": "Keywords used in Google web<\/b> search that generated links to your website in the search result list.", + "WebsiteSuccessfulConfigured": "Congratulations!
You have successfully configured keyword import for the website %1$s.
It might take a few days until your first search keywords will be imported and displayed in Referrers > Search Keywords. You can find more information about keyword import delays and limitations in our %2$sFAQ%3$s", + "WebsiteTypeUnsupported": "The selected measurable %1$s can't be configured as it has an unsupported type. Only measurables of type 'website' are supported.", + "WebsiteTypeUnsupportedRollUp": "Note: Roll-Up sites will automatically combine the imported data of all their child sites", + "YandexConfigurationDescription": "Yandex Webmaster API uses OAuth for authentication and authorization.", + "YandexConfigurationTitle": "Configure import from Yandex Webmaster API", + "YandexCrawlingStats": "Crawl overview for Yandex!", + "YandexCrawlingStatsDocumentation": "The Crawl overview allows you to view crawl related information such as errors encountered by the search bot when visiting a page, items blocked by your robots.txt file and the total number of pages in index.", + "YandexCrawlHttpStatus2xx": "HTTP Code 200-299", + "YandexCrawlHttpStatus2xxDesc": "Crawled Pages with a 2xx code", + "YandexCrawlHttpStatus3xx": "HTTP Code 300-399 (Moved pages)", + "YandexCrawlHttpStatus3xxDesc": "Crawled Pages with a 3xx code", + "YandexCrawlHttpStatus4xx": "HTTP Code 400-499 (Request errors)", + "YandexCrawlHttpStatus4xxDesc": "Crawled Pages with a 4xx code", + "YandexCrawlHttpStatus5xx": "HTTP Code 500-599 (Internal server errors)", + "YandexCrawlHttpStatus5xxDesc": "Crawled Pages with a 5xx code", + "YandexCrawlErrors": "Other request errors", + "YandexCrawlErrorsDesc": "Crawled paged that failed for any other reason", + "YandexCrawlCrawledPages": "Crawled Pages", + "YandexCrawlCrawledPagesDesc": "Number of pages the Yandex crawler requested.", + "YandexCrawlInIndex": "Total pages in index", + "YandexCrawlInIndexDesc": "Total number of pages available in Yandex search index", + "YandexCrawlAppearedPages": "Pages appeared in search", + "YandexCrawlAppearedPagesDesc": "Pages that were newly added to Yandex search index", + "YandexCrawlRemovedPages": "Pages removed from search", + "YandexCrawlRemovedPagesDesc": "Pages that were removed from Yandex search index", + "YandexFieldCallbackUri": "Callback URI", + "YandexFieldUrlToAppSite": "URL to app site", + "YandexKeywords": "Keywords on Yandex", + "YandexKeywordsDocumentation": "Keywords used in Yandex search that generated links to your website in the search results list.", + "YandexWebmasterApiUrl": "Url for Yandex Webmaster Tools", + "YandexWebmasterApiUrlDescription": "Provide the url this website is available in your Yandex Webmaster Tools", + "CrawlingOverview1": "The Crawling overview reports all the most critical information about how Search Engines robots crawl your websites. These metrics are updated approximately once per day with data provided by the search engines.", + "OptionQuickConnectWithGoogle": "Quick connect with Google (recommended)" + } +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/es.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/es.json new file mode 100644 index 0000000..8da2b24 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/es.json @@ -0,0 +1,170 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "Clave API", + "AccountAddedBy": "Agregado por %1$s en %2$s", + "AccountConnectionValidationError": "Ocurrió un error al validar la conexión de la cuenta:", + "AccountDoesNotExist": "La cuenta configurada %1$s ya no existe más", + "AccountNoAccess": "Esta cuenta no tiene acceso a ningún sitio web.", + "AccountRemovalConfirm": "Estás a punto de eliminar la cuenta %1$s. Esto podría deshabilitar la importación de palabras clave para cualquiera de los sitio(s) web conectado(s). ¿Proceder de todas maneras?", + "ActivityAccountAdded": "agregó una nueva cuenta para el proveedor de palabras clave %1$s: %2$s", + "ActivityAccountRemoved": "eliminó una cuenta del proveedor de palabras clave %1$s:%2$s", + "ActivityGoogleClientConfigChanged": "cambió la configuración del cliente Google.", + "AddAPIKey": "Agregar clave API", + "AddConfiguration": "Agregar configuración", + "AdminMenuTitle": "Performance de la búsqueda", + "AvailableSites": "Sitios de internet disponibles para importar:", + "BingAccountError": "Se produjo un error al validar la clave API: %1$s. Si acaba de generar esta clave API en Bing Webmaster Tools, inténtelo nuevamente en uno o dos minutos (las claves API en Bing Webmaster Tools tardan un poco en ser activadas).", + "BingAccountOk": "Clave API verificada exitosamente", + "BingConfigurationDescription": "Bing Webmaster Tools necesita una clave API para poder acceder. Aquí puede agregar claves API para acceder a los datos de sus sitios web.", + "BingConfigurationTitle": "Configurar importación desde Bing Webmasters Tools", + "BingCrawlBlockedByRobotsTxt": "Exclusión Robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "URLs bloqueados actualmente por el archivo robots.txt de su sitio.", + "BingCrawlConnectionTimeout": "Tiempos de espera de conexión", + "BingCrawlConnectionTimeoutDesc": "Este número representa las incidencias recientes cuando Bing no pudo acceder a su sitio debido a errores de conexión. Esto podría ser un problema temporal, pero debe revisar los registros de su servidor para ver si está eliminando accidentalmente solicitudes.", + "BingCrawlCrawledPages": "Páginas rastreadas", + "BingCrawlCrawledPagesDesc": "Número de páginas solicitadas por el rastreador de Bing.", + "BingCrawlDNSFailures": "Fallos DNS", + "BingCrawlDNSFailuresDesc": "Este tipo de problema cataloga errores recientes encontrados al comunicarse con el servidor DNS cuando el bot intentaba acceder a sus páginas. Es posible que su servidor no funcionara o que hubiera una mala configuración que impidiera el enrutamiento de DNS, por ejemplo, TTL se estableció en 0.", + "BingCrawlErrors": "Errores de rastreo en Bing", + "BingCrawlErrorsDesc": "Número de errores ocurridos del rastreador Bing.", + "BingCrawlErrorsFromDateX": "El informe muestra errores de seguimiento recientemente reportados por Bing. No proporciona ningún dato histórico. Última actualización %s", + "BingCrawlHttpStatus2xx": "HTTP Código 200-299", + "BingCrawlHttpStatus2xxDesc": "Estos códigos aparecen cuando el servidor presenta una página exitosamente", + "BingCrawlHttpStatus301": "HTTP Código 301 (Movido temporariamente)", + "BingCrawlHttpStatus301Desc": "Estos códigos aparecen cuando ha mudado permanentemente el contenido de una ubicación (URL) a otra.", + "BingCrawlHttpStatus302": "HTTP Código 302 (Movido temporariamente)", + "BingCrawlHttpStatus302Desc": "Estos códigos aparecen cuando ha movido temporalmente el contenido de una ubicación (URL) a otra.", + "BingCrawlHttpStatus4xx": "HTTP Código 400-499 (Errores de solicitud)", + "BingCrawlHttpStatus4xxDesc": "Estos códigos aparecen probablemente cuando hubo un error en la solicitud que impidió que el servidor pudiera procesarlo.", + "BingCrawlHttpStatus5xx": "HTTP Código 500-599 (Errores internos del servidor)", + "BingCrawlHttpStatus5xxDesc": "Estos códigos aparecen cuando el servidor no cumple con una solicitud aparentemente válida.", + "BingCrawlImportantBlockedByRobotsTxt": "Exclusión Robots.txt de página destacada", + "BingCrawlInboundLink": "Total de enlaces entrantes", + "BingCrawlInboundLinkDesc": "Los enlaces entrantes que Bing conoce, apuntan a las URL de su sitio web. Estos son enlaces, desde sitios web externos a los suyos, que han sido apuntados hacia su contenido.", + "BingCrawlMalwareInfected": "Sitios de internet infectados con malware", + "BingCrawlMalwareInfectedDesc": "Cualquier dirección URL de página que Bing haya encontrado que esté infectada o asociada con malware se agrupará en esta sección.", + "BingCrawlPagesInIndex": "Páginas totales en el índice", + "BingCrawlPagesInIndexDesc": "Número total de páginas disponibles en el índice Bing", + "BingCrawlStatsOtherCodes": "Todos los códigos de estados HTTP", + "BingCrawlStatsOtherCodesDesc": "Agrupa todos los demás códigos que no coinciden con ningún otro valor (como 1xx o códigos informativos).", + "BingCrawlingStats": "Resumen de rastreo para Bing y Yahoo!", + "BingCrawlingStatsDocumentation": "El resumen de rastreo le permite ver información relacionada con el rastreo, tales como los errores encontrados por el robot de búsqueda al visitar una página, los elementos bloqueados por su archivo robots.txt y las URL potencialmente afectadas por malware.", + "BingKeywordImport": "Importar palabras clave Bing", + "BingKeywords": "Palabras claves (en Bing y Yahoo!)", + "BingKeywordsDocumentation": "Palabras clave utilizadas en las búsquedas de Bing o Yahoo! que generaron los enlaces a su sitio web en la lista de los resultados de la búsqueda", + "BingKeywordsNoRangeReports": "Palabras clave en Bing y Yahoo! solo se pueden utilizar para intervalos de fechas personalizados que incluyen semanas completas o meses, ya que no están disponibles como informes diarios.", + "BingKeywordsNotDaily": "Palabras clave en Bing y Yahoo! sólo están disponibles como informes semanales. No hay datos de palabras clave para períodos de días.", + "BingWebmasterApiUrl": "Url de Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Proporcione la dirección URL de este sitio web así está disponible en su Bing Webmaster Tools", + "Category": "Categoría", + "ChangeConfiguration": "Cambiar configuración", + "Clicks": "Clics", + "ClicksDocumentation": "Un clic se cuenta cada vez que alguien hace clic en un enlace que apunta a su sitio web en una página de resultados del motor de búsqueda.", + "ClientConfigImported": "La configuración del cliente ha sido importada con éxito!", + "ClientConfigSaveError": "Se produjo un error al guardar la configuración del cliente. Verifique si la configuración proporcionada es válida e intente nuevamente.", + "ClientId": "id de cliente", + "ClientSecret": "Cliente secreto", + "ConfigAvailableNoWebsiteConfigured": "Integración exitosamente configurada, pero actualmente no hay sitio web configurado para importar.", + "ConfigRemovalConfirm": "Está a punto de eliminar la configuración de %1$s. La importación de palabras clave para ese sitio web será deshabilitada. ¿Proceder de todas maneras?", + "Configuration": "Configuración", + "ConfigurationDescription": "Este complemento le permite directamente importar en Matomo todas las palabras claves buscadas por sus usuarios en los motores de búsqueda.", + "ConfigurationFile": "Archivo de configuración", + "ConfigurationValid": "Su configuración OAuth es válida.", + "ConfigureMeasurableBelow": "Para configurar un sitio web, simplemente haga clic en el botón a continuación o configúrelo directamente en la configuración del sitio web.", + "ConfigureMeasurables": "Configurar sitios de internet", + "ConfiguredAccounts": "cuentas configuradas", + "ConfiguredUrlNotAvailable": "La URL configurada no está disponible para esta cuenta", + "ConnectAccount": "Conectar cuenta", + "ConnectFirstAccount": "Comience por conectar su primera cuenta a continuación.", + "ConnectGoogleAccounts": "Conectar cuenta(s) Google", + "ContainingSitemaps": "Conteniendo mapas de sitio", + "CrawlingErrors": "Errores de rastreo", + "CrawlingStats": "Descripción de los rastreos", + "Ctr": "CTR", + "CtrDocumentation": "Porcentaje de clics: una proporción que muestra la frecuencia con la que las personas que ven una página de resultados vía motor de búsqueda con un enlace a su sitio web terminan haciendo clic en el mismo.", + "CurrentlyConnectedAccounts": "Actualmente hay %1$s cuentas conectadas.", + "Domain": "Dominio", + "DomainProperty": "Propiedades de dominio", + "DomainPropertyInfo": "Incluye todos los subdominios (m, www, etc.) y ambos protocolos (http y https).", + "EnabledSearchTypes": "Tipos de palabras clave a recolectar", + "FetchImageKeyword": "Recolectar palabras claves de las imágenes", + "FetchImageKeywordDesc": "Recolectar palabras claves usadas en la búsqueda de imágenes de Google", + "FetchVideoKeyword": "Recolectar palabras claves de los videos", + "FetchVideoKeywordDesc": "Recolectar palabras claves usadas en la búsqueda de videos de Google", + "FetchWebKeyword": "Recolectar palabras claves de la web", + "FetchWebKeywordDesc": "Recolectar palabras claves usadas en las búsquedas web de Google", + "FirstDetected": "Primera detectada", + "GoogleAccountAccessTypeOfflineAccess": "Acceso sin conexión es necesario para poder importar sus palabras clave de búsqueda incluso cuando no esté actualmente conectado.", + "GoogleAccountAccessTypeProfileInfo": "Información de perfil es usada para mostrar el nombre de las actuales cuenta(s) conectadas.", + "GoogleAccountAccessTypeSearchConsoleData": "Datos de la consola de búsqueda es necesaria para obtener acceso a sus palabras clave de búsqueda en Google", + "GoogleAccountError": "Se produjo un error al validar el acceso OAuth: %1$s", + "GoogleAccountOk": "Acceso OAuth verificado exitosamente.", + "GoogleConfigurationDescription": "Google Search Console usa OAuth para autenticación y autorización.", + "GoogleConfigurationTitle": "Configurar importación desde Google Search Console", + "GoogleKeywordImport": "Importar palabras clave Google", + "GoogleSearchConsoleUrl": "URL para la Google Search Console", + "GoogleSearchConsoleUrlDescription": "Proporcione la URL, este sitio web está disponible en su Consola de búsqueda de Google", + "GoogleUploadOrPasteClientConfig": "Por favor, suba la configuración de su cliente de Google OAuth o péguela a continuación en el campo.", + "HowToGetOAuthClientConfig": "Cómo obtener la configuración de su cliente OAuth", + "ImageKeywords": "Palabras clave de la imagen en Google", + "ImageKeywordsDocumentation": "Palabras clave en búsquedas de Google Imágenes que generaron enlace a su sitio web en la lista resultante de la búsqueda.", + "Impressions": "Impresiones", + "ImpressionsDocumentation": "Se contabiliza una impresión cada vez que se muestra su sitio web en una página de resultados del motor de búsqueda.", + "IntegrationConfigured": "Integración configurada exitosamente", + "IntegrationNotConfigured": "Integración aun no configurada", + "KeywordStatistics": "Buscar palabras claves", + "KeywordTypeImage": "imagen", + "KeywordTypeVideo": "video", + "KeywordTypeWeb": "web", + "KeywordsCombined": "Palabras claves combinadas", + "KeywordsCombinedDocumentation": "Informe que combina todas las palabras clave detectadas por Matomo e importadas desde los motores de búsqueda. Este informe solo incluye la métrica de la visita. Puede cambiar a uno de los informes relacionados para obtener métricas detalladas.", + "KeywordsCombinedImported": "Palabras clave importadas combinadas", + "KeywordsCombinedImportedDocumentation": "Informe que muestra todas las palabras clave importadas de todos los motores de búsqueda configurados.", + "KeywordsReferrers": "Palabras clave (incluyendo las no definidas)", + "LastCrawled": "Ultimo rastreo", + "LastDetected": "Ultima detectada", + "LastImport": "Ultima importación", + "LatestAvailableDate": "Los datos de palabras clave más recientes disponibles son para %1$s", + "LinksToUrl": "Enlaces a %s", + "ManageAPIKeys": "Administrar claves API", + "MeasurableConfig": "Sitios de internet configurados", + "NoSegmentation": "El informe no admite la segmentación. Los datos que se muestran son sus datos de informe estándar, no segmentados.", + "NoWebsiteConfigured": "Actualmente no hay ningún sitio web configurado. Para habilitar la importación de un sitio web específico, ajuste la configuración aquí.", + "NoWebsiteConfiguredWarning": "Importación para %s no está totalmente configurado. Es necesario ajustar algunos sitios web para habilitar la importación.", + "NotAvailable": "no disponible", + "OAuthClientConfig": "Configuración del cliente OAuth", + "OAuthError": "Un error ocurrió durante el proceso OAuth. Por favor inténtelo nuevamente y asegúrese de aceptar los permisos solicitados.", + "Platform": "Plataforma", + "Position": "Posición promedio", + "PositionDocumentation": "Posición promedio de su sitio web en la lista de resultados del motor de búsqueda (para esta palabra clave).", + "ProviderBingDescription": "Importar todas las palabras claves usadas para encontrar su sitio web en las búsquedas hechas por Bing y Yahoo.", + "ProviderBingNote": "Nota: Microsoft proporciona datos de palabras clave todos los sábados y solo durante semanas enteras. Como resultado, sus palabras clave para Bing y Yahoo tardarán unos días en aparecer en sus informes y solo estarán disponibles cuando las vea en semanas, meses o años.", + "ProviderGoogleDescription": "Importe todas las palabras clave utilizadas para encontrar su sitio web en la búsqueda de Google. Los informes mostrarán sus palabras clave para cada tipo de búsqueda por separado (Web, imágenes y videos).", + "ProviderListDescription": "Cuando haya configurado correctamente uno (o más) motores de búsqueda, puede configurar en qué sitios web(s) debe Matomo importar sus palabras clave de búsqueda.", + "ProviderXAccountWarning": "Problemas de configuración de la cuenta detectados
Por favor, compruebe las cuentas configuradas %s.", + "ProviderXSitesWarning": "Problemas de configuración del sitio web detectados
Por favor verifique los sitios web configurados %s.", + "ReAddAccountIfPermanentError": "Si este es un error permanente, intente eliminar la cuenta y conéctela nuevamente.", + "RequiredAccessTypes": "Estos tipos de acceso son necesarios:", + "ResponseCode": "Código de respuesta", + "RoundKeywordPosition": "Ronda de posición de palabras claves", + "SearchEngineKeywordsPerformance": "Rendimiento de las palabras claves en los motores de búsqueda", + "SetupConfiguration": "Ajustes de configuración", + "SitemapsContainingUrl": "Mapas de sitio conteniendo %s", + "StartOAuth": "Iniciar proceso OAuth", + "URLPrefix": "Prefijo de la URL", + "URLPrefixProperty": "Propiedades de prefijo de URL", + "URLPrefixPropertyInfo": "Incluye solo las URL con el prefijo exacto especificado, incluido el protocolo (http/https). Si quieres que tu propiedad abarque más protocolos o subdominios (http/https/www./m., etc.), quizás te interese más añadir una propiedad de dominio.", + "UnverifiedSites": "Sitios de internet sin verificar:", + "UploadOAuthClientConfig": "Cargue su configuración de cliente OAuth", + "UrlOfAccount": "URL (Cuenta)", + "VideoKeywords": "Palabras clave de videos en Google", + "VideoKeywordsDocumentation": "Palabras clave utilizadas en la búsqueda de videos de Google que generaron enlaces a su sitio web en la lista de resultados de búsqueda.", + "WebKeywords": "Palabras clave de la web en Google", + "WebKeywordsDocumentation": "Palabras clave utilizadas en la búsqueda web de Google que generaron enlaces a su sitio web en la lista de resultados de búsqueda.", + "WebsiteSuccessfulConfigured": "Felicidades!
Ha configurado correctamente la importación de palabras clave para el sitio web %1$s.
Es posible que pasen unos días hasta que sus primeras palabras clave de búsqueda se importen y se muestren en Referencias > Palabras clave de búsqueda. Puede encontrar más información sobre los retrasos y limitaciones de importación de palabras clave en nuestras %2$sPreguntas frecuentes%3$s", + "YandexCrawlHttpStatus2xx": "HTTP Código 200-299", + "YandexCrawlHttpStatus4xx": "HTTP Código 400-499 (Errores de solicitud)", + "YandexCrawlHttpStatus5xx": "HTTP Código 500-599 (Errores internos del servidor)", + "YandexCrawlInIndex": "Páginas totales en el índice" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/fi.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/fi.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/fi.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/fr.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/fr.json new file mode 100644 index 0000000..a33569f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/fr.json @@ -0,0 +1,241 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "Clé API", + "AccountAddedBy": "Ajouté par %1$s sur %2$s", + "AccountConnectionValidationError": "Une erreur s'est produite lors de la validation de la connexion du compte :", + "AccountDoesNotExist": "Le compte configuré %1$s n'existe plus", + "AccountNoAccess": "Ce compte n'a actuellement accès à aucun site web.", + "AccountRemovalConfirm": "Vous êtes sur le point de supprimer le compte %1$s. Cela pourrait désactiver l'importation de mots-clés pour tous les site(s) connecté(s). Souhaitez-vous poursuivre ?", + "ActivityAccountAdded": "a ajouté un nouveau compte pour le fournisseur de mots-clés %1$s : %2$s", + "ActivityAccountRemoved": "a supprimé un compte pour le fournisseur de mots-clés %1$s : %2$s", + "ActivityGoogleClientConfigChanged": "a modifié le fichier de configuration du client Google.", + "ActivityYandexClientConfigChanged": "a modifié le fichier de configuration du client Yandex.", + "AddAPIKey": "Ajouter la clé API", + "AddConfiguration": "Ajouter la configuration", + "AdminMenuTitle": "Performance de la recherche", + "AllReferrersImported": "Référents (avec mots-clés importés)", + "AllReferrersOriginal": "Référents (avec mots-clés suivis)", + "AvailableSites": "Sites disponibles pour l'import :", + "BingAPIKeyInstruction": "Connectez-vous à %1$sBing Webmaster Tools%2$s, puis ajoutez votre site Web dans Bing Webmaster Tools. Après l'avoir validé, vous pouvez %3$scopier votre clé API%4$s.", + "BingAccountError": "Une erreur s'est produite lors de la validation de la clé API : %1$s. Si vous venez de générer cette clé API dans le service Bing Webmaster Tools, veuillez réessayer dans une ou deux minutes (les clés API dans Bing Webmaster Tools mettent un peu de temps à s'activer).", + "BingAccountOk": "Clé API vérifiée avec succès", + "BingConfigurationDescription": "Bing Webmaster Tools nécessite une clé API pour être accessible. Vous pouvez ajouter ici des clés API pour accéder aux données de vos sites web.", + "BingConfigurationTitle": "Configurer l'import à partir de Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Exclusion du fichier Robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "Ces URLs sont actuellement bloquées par le fichier robots.txt de votre site.", + "BingCrawlConnectionTimeout": "Dépassement du délai de connexion", + "BingCrawlConnectionTimeoutDesc": "Ce nombre représente les occurrences récentes où Bing n'a pas pu accéder à votre site en raison d'erreurs de connexion. Il peut s'agir d'un problème temporaire, mais vous devriez vérifier les journaux de votre serveur pour voir si les requêtes ne sont pas accidentellement bloquées.", + "BingCrawlCrawledPages": "Pages crawlées", + "BingCrawlCrawledPagesDesc": "Nombre de pages parcourus par le crawler de Bing.", + "BingCrawlDNSFailures": "Erreurs DNS", + "BingCrawlDNSFailuresDesc": "Ce type de problème répertorie les erreurs récentes rencontrées lors de la tentative de communication avec le serveur DNS lorsque le robot a essayé d'accéder à vos pages. Il est possible que votre serveur soit en panne, ou qu'une mauvaise configuration empêche le routage DNS, par exemple, le TTL a été fixé à 0.", + "BingCrawlErrors": "Erreurs de crawl sur Bing", + "BingCrawlErrorsDesc": "Nombre d'erreurs survenues pour le crawler Bing.", + "BingCrawlErrorsFromDateX": "Le rapport montre les erreurs de crawl récemment rencontrées par Bing. Il ne fournit pas de données historiques. Dernière mise à jour %s", + "BingCrawlHttpStatus2xx": "Code HTTP 200-299", + "BingCrawlHttpStatus2xxDesc": "Ces codes apparaissent lorsque le serveur renvoi une page avec succès", + "BingCrawlHttpStatus301": "Code HTTP 301 (redirigé de façon permanente)", + "BingCrawlHttpStatus301Desc": "Ces codes apparaissent lorsque vous avez déplacé de façon permanente un contenu d'un emplacement (URL) à un autre.", + "BingCrawlHttpStatus302": "Code HTTP 302 (déplacé temporairement)", + "BingCrawlHttpStatus302Desc": "Ces codes apparaissent lorsque vous avez temporairement déplacé du contenu d'un emplacement (URL) à un autre.", + "BingCrawlHttpStatus4xx": "Code HTTP 400-499 (erreurs de requêtes)", + "BingCrawlHttpStatus4xxDesc": "Ces codes apparaissent lorsqu'il y a probablement une erreur dans la requête ce qui a empêché le serveur de la traiter.", + "BingCrawlHttpStatus5xx": "Code HTTP 500-599 (erreurs internes du serveur)", + "BingCrawlHttpStatus5xxDesc": "Ces codes apparaissent lorsque le serveur n'a pas réussi à satisfaire une demande apparemment valide.", + "BingCrawlImportantBlockedByRobotsTxt": "Exclusion d'une page importante dans le fichier Robots.txt", + "BingCrawlInboundLink": "Nombre total de liens entrants", + "BingCrawlInboundLinkDesc": "Liens entrants dont Bing a connaissance, pointant vers des URLs de votre site Web. Il s'agit de liens, provenant de sites Web extérieurs au vôtre, qui ont été dirigés vers votre contenu.", + "BingCrawlMalwareInfected": "Sites web infectés par des logiciels malveillants", + "BingCrawlMalwareInfectedDesc": "Toutes les URL de pages trouvées par Bing qui sont infectées ou associées à des logiciels malveillants seront regroupées dans cette section.", + "BingCrawlPagesInIndex": "Nombre total de pages dans l'index", + "BingCrawlPagesInIndexDesc": "Nombre total de pages disponibles dans l'index Bing", + "BingCrawlStatsOtherCodes": "Tous les autres codes d'état HTTP", + "BingCrawlStatsOtherCodesDesc": "Regroupe tous les autres codes qui ne correspondent à aucune autre valeur (tels que les codes 1xx ou informatifs).", + "BingCrawlingStats": "Aperçu des crawls pour Bing et Yahoo !", + "BingCrawlingStatsDocumentation": "La vue d'ensemble du crawl vous permet de visualiser les informations relatives au crawl, telles que les erreurs rencontrées par le robot de recherche lors de la visite d'une page, les éléments bloqués par votre fichier robots.txt et les URL potentiellement affectées par des logiciels malveillants.", + "BingKeywordImport": "Import des mots-clés Bing", + "BingKeywords": "Mots-clés (sur Bing et Yahoo !)", + "BingKeywordsDocumentation": "Mots clés utilisés dans la recherche Bing ou Yahoo ! qui ont généré des liens vers votre site web dans la liste des résultats de recherche.", + "BingKeywordsNoRangeReports": "Les mots-clés sur Bing et Yahoo ! ne peuvent être traités que pour des plages de dates personnalisées, y compris des semaines ou des mois entiers, car ils ne sont pas disponibles sous forme de rapports quotidiens.", + "BingKeywordsNotDaily": "Les mots-clés sur Bing et Yahoo ! ne sont disponibles que sous forme de rapports hebdomadaires. Il n'y a pas de données sur les mots-clés pour les périodes de plusieurs jours.", + "BingWebmasterApiUrl": "Url pour Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Fournissez l'url de ce site Web dans vos outils pour les webmasters de Bing", + "Category": "Catégorie", + "ChangeConfiguration": "Modifier la configuration", + "Clicks": "Clics", + "ClicksDocumentation": "Un clic est comptabilisé à chaque fois que quelqu'un clique sur un lien pointant vers votre site web lorsqu'il est sur une page de résultats d'un moteur de recherche.", + "ClientConfigImported": "La configuration du client a été importée avec succès !", + "ClientConfigSaveError": "Une erreur s'est produite lors de la sauvegarde de la configuration du client. Veuillez vérifier si la configuration fournie est valide, et réessayer.", + "ClientId": "id du client", + "ClientSecret": "Client secret", + "ConfigAvailableNoWebsiteConfigured": "L'intégration a été effectuée avec succès, mais aucun site web n'est actuellement configuré pour l'import.", + "ConfigRemovalConfirm": "Vous êtes sur le point de supprimer la configuration pour %1$s. L'import de mots-clés pour ce site Web sera désactivée. Souhaitez-vous continuer ?", + "Configuration": "Configuration", + "ConfigurationDescription": "Cette extension vous permet d'importer directement dans Matomo tous les mots-clés recherchés par vos utilisateurs sur les moteurs de recherche.", + "ConfigurationFile": "Fichier de configuration", + "ConfigurationValid": "Votre configuration OAuth est valide.", + "ConfigureMeasurableBelow": "Pour configurer un site web, il suffit de cliquer sur le bouton ci-dessous ou de le configurer directement dans les paramètres du site web.", + "ConfigureMeasurables": "Configurer les sites web", + "ConfigureTheImporterLabel1": "Importez vos mots-clés de Google Search Console et analysez-les à l'aide des puissants outils d'analyse de Matomo. Une fois l'importateur connecté, sélectionnez les sites web à importer, et Matomo commencera à importer les mots-clés pour eux dans le cadre du processus d'archivage planifié.", + "ConfigureTheImporterLabel2": "Afin d'importer vos données depuis Google Search Console, Matomo doit y avoir accès.", + "ConfigureTheImporterLabel3": "Pour commencer, %1$ssuivez nos instructions pour récupérer la configuration de votre client OAuth%2$s. Ensuite, téléversez le fichier de configuration du client en utilisant le bouton ci-dessous.", + "ConfiguredAccounts": "comptes configurés", + "ConfiguredUrlNotAvailable": "L'URL configurée n'est pas disponible pour ce compte", + "ConnectAccount": "Connecter le compte", + "ConnectAccountDescription": "Veuillez cliquer sur le bouton ci-dessous pour être redirigé vers %1$s où vous devez accorder l'accès.", + "ConnectAccountYandex": "L'authentification des comptes Yandex n'est valable que pendant %1$s jours. Chaque compte doit être réauthentifié dans ce délai pour que les imports fonctionnent correctement.", + "ConnectFirstAccount": "Commencez par connecter votre premier compte ci-dessous.", + "ConnectGoogleAccounts": "Connecter le(s) compte(s) Google", + "ConnectYandexAccounts": "Connecter le(s) compte(s) Yandex", + "ContainingSitemaps": "Qui contient les sitemaps", + "CrawlingErrors": "Erreurs de crawl", + "CrawlingOverview1": "Le récapitulatif d'exploration présente toutes les informations les plus importantes sur la façon dont les robots des moteurs de recherche explorent vos sites Web. Ces métriques sont mises à jour environ une fois par jour avec les données fournies par les moteurs de recherche.", + "CrawlingStats": "Vue d'ensemble du crawl", + "CreatedBy": "Créé par", + "Ctr": "CTR", + "CtrDocumentation": "Taux de clics (CTR) : Ratio montrant combien de fois les personnes qui voient une page de résultats de moteur de recherche avec un lien vers votre site web finissent par cliquer dessus.", + "CurrentlyConnectedAccounts": "Il y a actuellement %1$s comptes connectés.", + "DeleteUploadedClientConfig": "Si vous souhaitez supprimer la configuration du client téléversée, cliquez ci-dessous", + "Domain": "Domaine", + "DomainProperty": "Propriété de domaine", + "DomainPropertyInfo": "Comprend tous les sous-domaines (m, www, etc.) et les deux protocoles (http, https).", + "EnabledSearchTypes": "Types de mots-clés à récupérer", + "FetchImageKeyword": "Récupérer les mots-clés pour les images", + "FetchImageKeywordDesc": "Récupérer les mots-clés utilisés dans la recherche d'images sur Google", + "FetchNewsKeyword": "Récupérer les mots clés des actualités", + "FetchNewsKeywordDesc": "Récupérer les mots-clés utilisés dans Google News", + "FetchVideoKeyword": "Récupérer les mots-clés liés aux vidéos", + "FetchVideoKeywordDesc": "Récupérer les mots-clés utilisés dans la recherche de vidéos sur Google", + "FetchWebKeyword": "Récupérer les mots-clés du web", + "FetchWebKeywordDesc": "Récupérer les mots-clés utilisés dans les recherches sur le Web de Google", + "FirstDetected": "Premier détecté", + "GoogleAccountAccessTypeOfflineAccess": "L'accès hors ligne est nécessaire pour pouvoir importer vos mots-clés de recherche même si vous n'êtes pas actuellement connecté.", + "GoogleAccountAccessTypeProfileInfo": "Infos sur le profil est utilisé pour montrer le nom du ou des comptes actuellement connectés.", + "GoogleAccountAccessTypeSearchConsoleData": "Les données de la Search Console sont nécessaires pour avoir accès à vos mots-clés de recherche Google.", + "GoogleAccountError": "Une erreur s'est produite lors de la validation de l'accès OAuth : %1$s", + "GoogleAccountOk": "Accès OAuth vérifié avec succès.", + "GoogleAuthorizedJavaScriptOrigin": "Origine JavaScript autorisée", + "GoogleAuthorizedRedirectUri": "URI de redirection autorisée", + "GoogleConfigurationDescription": "La Google Search Console utilise OAuth pour l'authentification et l'autorisation.", + "GoogleConfigurationTitle": "Configurer l'import à partir de la Google Search Console", + "GoogleDataNotFinal": "Les données relatives aux mots-clés figurant dans ce rapport peuvent ne pas contenir les données définitives. Google fournit les données définitives des mots-clés avec un retard de 2 jours. Les mots-clés des jours plus récents seront réimportés jusqu'à ce qu'ils soient déclarés comme définitifs.", + "GoogleDataProvidedWithDelay": "Google fournit des données sur les mots-clés avec un certain délais. Les mots-clés pour cette date seront importés un peu plus tard.", + "GoogleKeywordImport": "Import de mots-clés Google", + "GooglePendingConfigurationErrorMessage": "La configuration est en attente. Veuillez demander à un super utilisateur de la compléter.", + "GoogleSearchConsoleUrl": "Url pour la Google Search Console", + "GoogleSearchConsoleUrlDescription": "Fournissez l'url de ce site web dans votre Google Search Console", + "GoogleUploadOrPasteClientConfig": "Veuillez télécharger votre configuration du client Google OAuth ou la coller dans le champ ci-dessous.", + "HowToGetOAuthClientConfig": "Comment obtenir la configuration de votre client OAuth", + "ImageKeywords": "Mots-clés de l'image sur Google", + "ImageKeywordsDocumentation": "Mots clés utilisés dans la recherche Google image qui ont généré des liens vers votre site web dans la liste des résultats de recherche.", + "Impressions": "Impressions", + "ImpressionsDocumentation": "Une impression est comptée chaque fois que votre site web est affiché dans une page de résultats d'un moteur de recherche.", + "IntegrationConfigured": "L'intégration a été configurée avec succès", + "IntegrationNotConfigured": "L'intégration n'a pas été encore configurée", + "InvalidRedirectUriInClientConfiguration": "URI de redirection invalides, au moins une URI doit correspondre à l'URI \"%1$s\" dans le fichier de configuration téléversé", + "KeywordStatistics": "Mots-clés de recherche", + "KeywordTypeImage": "image", + "KeywordTypeNews": "actualités", + "KeywordTypeVideo": "vidéo", + "KeywordTypeWeb": "web", + "KeywordsCombined": "Mots clés combinés", + "KeywordsCombinedDocumentation": "Rapport combinant tous les mots-clés détectés par Matomo et importés des moteurs de recherche. Ce rapport ne comprend que la métrique des visites. Vous pouvez passer à l'un des rapports connexes pour obtenir des mesures détaillées.", + "KeywordsCombinedImported": "Tous les mots-clés combinés importés", + "KeywordsCombinedImportedDocumentation": "Rapport montrant tous les mots-clés importés de tous les moteurs de recherche configurés.", + "KeywordsReferrers": "Mots-clés (y compris non définis)", + "KeywordsSubtableImported": "Mots clés importés", + "KeywordsSubtableOriginal": "Mots-clés suivis (y compris non définis)", + "LastCrawled": "Dernier crawlé", + "LastDetected": "Dernier détecté", + "LastImport": "Dernier import", + "LatestAvailableDate": "Les données de mots-clés les plus récentes sont celles de %1$s", + "LinksToUrl": "Liens vers %s", + "ManageAPIKeys": "Gérer les clés API", + "MeasurableConfig": "sites web configurés", + "NewsKeywords": "Mots clés Google Actualités", + "NewsKeywordsDocumentation": "Mots-clés utilisés dans la recherche Google Actualités qui ont généré des liens vers votre site web dans la liste des résultats de recherche.", + "NoSegmentation": "Le rapport ne prend pas en charge la segmentation. Les données affichées sont celles de votre rapport standard, non segmenté.", + "NoWebsiteConfigured": "Il n'y a actuellement aucun site web configuré. Pour activer l'import pour un site web spécifique, veuillez configurer la configuration ici.", + "NoWebsiteConfiguredWarning": "L'import pour %s n'est pas entièrement configuré. Vous devez configurer certains sites Web pour permettre l'importation.", + "NotAvailable": "Non disponible", + "OAuthAccessTimedOut": "L'accès OAuth pour ce compte a peut-être expiré. Vous devrez vous réauthentifier pour que les imports fonctionnent à nouveau pour ce compte.", + "OAuthAccessWillTimeOut": "L'accès OAuth pour ce compte expirera après %1$s jours. %2$s jours restants", + "OAuthAccessWillTimeOutSoon": "L'accès OAuth pour ce compte expirera dans environ %1$s jours. Veuillez vous réauthentifier pour éviter que ce compte ne cesse de fonctionner.", + "OAuthClientConfig": "Configuration du client OAuth", + "OAuthError": "Une erreur s'est produite dans le processus OAuth. Veuillez réessayer et vous assurer que vous acceptez les permissions demandées.", + "OAuthExampleText": "La configuration nécessite les champs listés ci-dessous. Veuillez utiliser les valeurs fournies :", + "OauthFailedMessage": "Nous avons rencontré un problème lors du processus d'autorisation pour votre Google Search Console. Pour réessayer, veuillez cliquer sur le bouton ci-dessous. Si le problème persiste, veuillez contacter notre équipe d'assistance. Elle vous aidera à résoudre le problème et à importer vos mots-clés de Google Search Console.", + "OptionQuickConnectWithGoogle": "Connexion rapide avec Google (recommandé)", + "Platform": "Plate-forme", + "Position": "Position moyenne", + "PositionDocumentation": "Position moyenne de votre site web dans la liste des résultats des moteurs de recherche (pour ce mot clé).", + "ProvideYandexClientConfig": "Veuillez insérer la configuration de votre client Yandex OAuth.", + "ProviderBingDescription": "Importer tous les mots clés utilisés pour trouver votre site web sur les moteurs de recherche Bing et Yahoo!.", + "ProviderBingNote": "Remarque: Microsoft fournit des données sur les mots-clés tous les samedis et uniquement pour des semaines entières. Par conséquent, vos mots-clés pour Bing et Yahoo mettront quelques jours à apparaître dans vos rapports et ne seront disponibles que lors de la consultation des semaines, mois ou années.", + "ProviderGoogleDescription": "Importez tous les mots-clés utilisés pour trouver votre site Web sur la recherche Google. Les rapports montreront vos mots-clés pour chaque type de recherche séparément (Web, Images et Vidéos).", + "ProviderGoogleNote": "Remarque: Google fournit les données définitives des mots-clés avec un retard de 2 jours. Les données non finales pour les jours plus récents seront déjà affichées, mais seront réimportées jusqu'à ce qu'elles soient définitives. Votre premier import peut permettre d'importer vos données historiques de mots-clés jusqu'aux 486 derniers jours.", + "ProviderListDescription": "Lorsque vous avez configuré avec succès un (ou plusieurs) moteur de recherche ci-dessous, vous pouvez configurer dans quel(s) site(s) web Matomo doit importer vos mots-clés de recherche.", + "ProviderXAccountWarning": "Problème de configuration de compte détecté
Veuillez vérifier les comptes configurés pour %s.", + "ProviderXSitesWarning": "Problèmes de configuration de site détectés
Veuillez vérifier la configuration des sites pour %s.", + "ProviderYandexDescription": "Importez tous les mots-clés utilisés pour trouver votre site web sur la recherche Yandex.", + "ProviderYandexNote": "Remarque: Yandex fournit les mots-clés avec un retard allant jusqu'à 5 jours. La première importation tentera d'importer vos mots-clés historiques jusqu'aux 100 derniers jours.", + "ReAddAccountIfPermanentError": "S'il s'agit d'une erreur permanente, essayez de supprimer le compte et de le connecter à nouveau.", + "ReAuthenticateIfPermanentError": "S'il s'agit d'une erreur permanente, essayez de réauthentifier le compte ou de le supprimer et de le connecter à nouveau.", + "Reauthenticate": "Réauthentification", + "RecentApiErrorsWarning": "Erreurs d'importation de mots-clés détectées

Veuillez vérifier les configurations pour :
%s

Si votre configuration est correcte et que les erreurs persistent, veuillez contacter notre support.", + "ReportShowMaximumValues": "Les valeurs affichées sont les valeurs maximales qui se sont produites pendant cette période.", + "RequiredAccessTypes": "Ces types d'accès sont nécessaires :", + "ResponseCode": "Code de réponse", + "RoundKeywordPosition": "Position arrondi des mots-clés", + "SearchEngineKeywordsPerformance": "Performance des mots-clés dans les moteurs de recherche", + "SearchEnginesImported": "Moteurs de recherche (avec mots-clés importés)", + "SearchEnginesOriginal": "Moteurs de recherche (avec mots-clés suivis)", + "SetUpOAuthClientConfig": "Configurer votre client OAuth", + "SetupConfiguration": "Configuration de l'installation", + "SitemapsContainingUrl": "Sitemaps contenant %s", + "StartOAuth": "Démarrer le processus OAuth", + "URLPrefix": "Préfixe de l'URL", + "URLPrefixProperty": "Propriété de préfixe d'URL", + "URLPrefixPropertyInfo": "Comprend uniquement les URL avec le préfixe exact indiqué, y compris le protocole (http/https). Si vous souhaitez que votre propriété corresponde à n'importe quel protocole ou sous-domaine (http/https/www/m, etc.), envisagez plutôt d'ajouter une propriété de domaine.", + "UnverifiedSites": "Sites web non vérifiés :", + "UploadOAuthClientConfig": "Téléversez la configuration de votre client OAuth", + "Uploading": "Téléversement en cours...", + "UrlOfAccount": "URL (Compte)", + "VideoKeywords": "Mots clés vidéo sur Google", + "VideoKeywordsDocumentation": "Mots-clés utilisés dans la recherche Google vidéo qui ont généré des liens vers votre site web dans la liste des résultats de recherche.", + "VisitOAuthHowTo": "Veuillez consulter notre guide %1$sen ligne%2$s pour savoir comment mettre en place votre configuration client OAuth %3$s.", + "WebKeywords": "Mots clés issus de la recherche Google Web", + "WebKeywordsDocumentation": "Mots-clés utilisés dans la recherche Google web qui ont généré des liens vers votre site web dans la liste des résultats de recherche.", + "WebsiteSuccessfulConfigured": "Félicitations!
Vous avez configuré avec succès l'import de mots-clés pour le site Web %1$s.
Il se peut que quelques jours s'écoulent avant que vos premiers mots-clés de recherche soient importés et affichés dans Référents > Mots-clés de recherche. Vous pouvez trouver plus d'informations sur les délais et les limitations de l'import de mots-clés dans notre %2$sFAQ%3$s", + "WebsiteTypeUnsupported": "L’élément mesurable sélectionné %1$s ne peut pas être configuré car il a un type non pris en charge. Seuls les éléments mesurables de type 'site web' sont supportés.", + "WebsiteTypeUnsupportedRollUp": "Remarque : les sites de type \"Roll-Up\" combinent automatiquement les données importées de tous leurs sites associés", + "YandexConfigurationDescription": "Yandex Webmaster API utilise OAuth pour l'authentification et l'autorisation.", + "YandexConfigurationTitle": "Configurer l'import à partir de Yandex Webmaster API", + "YandexCrawlAppearedPages": "Pages apparaissant dans la recherche", + "YandexCrawlAppearedPagesDesc": "Pages nouvellement ajoutées à l'index de recherche Yandex", + "YandexCrawlCrawledPages": "Pages explorées", + "YandexCrawlCrawledPagesDesc": "Nombre de pages demandées par le crawler Yandex.", + "YandexCrawlErrors": "Autres erreurs de requêtes", + "YandexCrawlErrorsDesc": "Pages explorées qui ont échoué pour une toute autre raison", + "YandexCrawlHttpStatus2xx": "Code HTTP 200-299", + "YandexCrawlHttpStatus2xxDesc": "Pages explorées avec un code 2xx", + "YandexCrawlHttpStatus3xx": "Code HTTP 300-399 (pages déplacées)", + "YandexCrawlHttpStatus3xxDesc": "Pages explorées avec un code 3xx", + "YandexCrawlHttpStatus4xx": "Code HTTP 400-499 (erreurs de requête)", + "YandexCrawlHttpStatus4xxDesc": "Pages explorées avec un code 4xx", + "YandexCrawlHttpStatus5xx": "Code HTTP 500-599 (erreurs internes du serveur)", + "YandexCrawlHttpStatus5xxDesc": "Pages explorées avec un code 5xx", + "YandexCrawlInIndex": "Nombre total de pages dans l'index", + "YandexCrawlInIndexDesc": "Nombre total de pages disponibles dans l'index de recherche Yandex", + "YandexCrawlRemovedPages": "Pages retirées de la recherche", + "YandexCrawlRemovedPagesDesc": "Pages retirées de l'index de recherche Yandex", + "YandexCrawlingStats": "Récapitulatif du crawl pour Yandex !", + "YandexCrawlingStatsDocumentation": "Le récapitulatif du crawl vous permet de visualiser les informations relatives au crawl, telles que les erreurs rencontrées par le robot de recherche lors de la visite d'une page, les éléments bloqués par votre fichier robots.txt et le nombre total de pages dans l'index.", + "YandexFieldCallbackUri": "URI de rappel", + "YandexFieldUrlToAppSite": "URL du site de l'application", + "YandexKeywords": "Mots clés sur Yandex", + "YandexKeywordsDocumentation": "Mots clés utilisés dans la recherche Yandex qui ont généré des liens vers votre site web dans la liste des résultats de recherche.", + "YandexWebmasterApiUrl": "Url pour Yandex Webmaster Tools", + "YandexWebmasterApiUrlDescription": "Fournissez l'url de ce site dans vos Yandex Webmaster Tools" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/hi.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/hi.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/hi.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/it.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/it.json new file mode 100644 index 0000000..5f1cff9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/it.json @@ -0,0 +1,225 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "Aggiunta da %1$s il %2$s", + "AccountConnectionValidationError": "Si è verificato un errore durante la convalida della connessione all'account:", + "AccountDoesNotExist": "L'account configurato %1$s non esiste più", + "AccountNoAccess": "Al momento questo account non ha accesso ad alcun sito web.", + "AccountRemovalConfirm": "Stai per rimuovere l'account %1$s. Ciò potrebbe disabilitare l'importazione delle parole chiave per tutti i siti web collegati. Vuoi procedere comunque?", + "ActivityAccountAdded": "aggiunto un nuovo account per il provider di parole chiave: %1$s: %2$s", + "ActivityAccountRemoved": "rimosso un account per il provider di parole chiave %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "configurazione del client di Google cambiata.", + "ActivityYandexClientConfigChanged": "configurazione client Yandex cambiata", + "AddAPIKey": "Aggiungi Chiave API", + "AddConfiguration": "Aggiungi Configurazione", + "AdminMenuTitle": "Rendimento Ricerca", + "APIKey": "Chiave API", + "AvailableSites": "Siti disponibili per l'importazione:", + "Domain": "Dominio", + "DomainProperty": "Proprietà dominio", + "DomainPropertyInfo": "Include tutti i sottodomini (m, www e così via) e entrambi i protocolli (http, https).", + "URLPrefix": "Prefisso URL", + "URLPrefixProperty": "Proprietà del prefisso URL", + "URLPrefixPropertyInfo": "Include solo gli URL con il prefisso esatto specificato, incluso il protocollo (http o https). Se vuoi che la tua proprietà corrisponda a un protocollo o a un sottodominio (http/https/www./m. e così via), prendi in considerazione l'aggiunta di una proprietà Dominio.", + "BingAccountError": "Si è verificato un errore durante la convalida della chiave API: %1$s. Se hai appena generato questa chiave API in Strumenti per Bing Webmaster Tools, riprova tra uno o due minuti (le chiavi API in Bing Webmaster Tools richiedono un po' di tempo per essere attivate).", + "BingAccountOk": "Chiave API verificata con successo", + "BingAPIKeyInstruction": "Accedi a %1$sBing Webmaster Tools%2$s, quindi aggiungi il tuo sito web a Bing Webmaster. Dopo averlo convalidato, puoi %3$scopiare la tua chiave API%4$s.", + "BingConfigurationDescription": "Bing Webmaster Tools richiede una chiave API per l'accesso. Qui puoi aggiungere le chiavi API per accedere ai dati dei tuoi siti web.", + "BingConfigurationTitle": "Configura l'importazione da Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Esclusioni tramite robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "URL attualmente bloccati dal file robots.txt del tuo sito.", + "BingCrawlConnectionTimeout": "Timeout della connessione", + "BingCrawlConnectionTimeoutDesc": "Questo numero rappresenta le occorrenze recenti quando Bing non ha potuto accedere al tuo sito a causa di errori di connessione. Questo potrebbe essere un problema temporaneo, ma è necessario controllare i log del server per vedere se si stanno accidentalmente perdendo le richieste.", + "BingCrawlCrawledPages": "Pagine esplorate", + "BingCrawlCrawledPagesDesc": "Numero di pagine richieste dal crawler di Bing.", + "BingCrawlDNSFailures": "Insuccessi DNS", + "BingCrawlDNSFailuresDesc": "Questo tipo di problema cataloga gli errori recenti riscontrati durante il tentativo di comunicare con il server DNS quando il bot ha tentato di accedere alle tue pagine. Forse il tuo server era inattivo, oppure c'era un errore di configurazione che impediva il routing DNS, ad esempio TTL era impostato a 0.", + "BingCrawlErrors": "Errori di scansione su Bing", + "BingCrawlErrorsDesc": "Numero di errori verificatisi per il crawler di Bing.", + "BingCrawlErrorsFromDateX": "Il report mostra errori di scansione recentemente segnalati da Bing. Non fornisce dati storici. Ultimo aggiornamento %s", + "BingCrawlHttpStatus2xx": "Codici HTTP 200-299", + "BingCrawlHttpStatus2xxDesc": "Questi codici vengono visualizzati quando il server presenta una pagina correttamente", + "BingCrawlHttpStatus301": "Codice HTTP 301 (Spostata definitivamente)", + "BingCrawlHttpStatus301Desc": "Questi codici vengono visualizzati quando si sposta permanentemente il contenuto da una posizione (URL) a un'altra.", + "BingCrawlHttpStatus302": "Codice HTTP 302 (Spostata temporaneamente)", + "BingCrawlHttpStatus302Desc": "Questi codici vengono visualizzati quando si sposta temporaneamente il contenuto da una posizione (URL) a un'altra.", + "BingCrawlHttpStatus4xx": "Codici HTTP 400-499 (Errori richiesta)", + "BingCrawlHttpStatus4xxDesc": "Questi codici vengono visualizzati quando c'è stato probabilmente un errore nella richiesta che ha impedito al server di elaborarla.", + "BingCrawlHttpStatus5xx": "Codici HTTP 500-599 (Errori interni al server)", + "BingCrawlHttpStatus5xxDesc": "Questi codici vengono visualizzati quando il server non è riuscito a soddisfare una richiesta apparentemente valida.", + "BingCrawlImportantBlockedByRobotsTxt": "Esclusione tramite robots.txt di una pagina importante", + "BingCrawlInboundLink": "Totale link in entrata", + "BingCrawlInboundLinkDesc": "I collegamenti in entrata di cui Bing è a conoscenza, hanno puntato agli URL sul tuo sito web. Questi sono collegamenti da siti web esterni al tuo che sono stati indirizzati verso i tuoi contenuti.", + "BingCrawlingStats": "Panoramica della scansione per Bing e Yahoo!", + "BingCrawlingStatsDocumentation": "La panoramica Scansione consente di visualizzare informazioni correlate alla ricerca per l'indicizzazione, quali errori riscontrati dal bot di ricerca quando visita una pagina, elementi bloccati dal proprio file robots.txt e URL potenzialmente interessati da malware.", + "BingCrawlMalwareInfected": "Siti web infettati da malware", + "BingCrawlMalwareInfectedDesc": "In questa sezione sono raggruppati gli URL delle pagine che Bing ha rilevato come infette o associate a malware.", + "BingCrawlPagesInIndex": "Totale delle pagine nell'indice", + "BingCrawlPagesInIndexDesc": "Numero totale delle pagine disponibili nell'indice di Bing", + "BingCrawlStatsOtherCodes": "Tutti gli altri codici di stato HTTP", + "BingCrawlStatsOtherCodesDesc": "Raggruppa tutti gli altri codici che non corrispondono a nessun altro valore (come 1xx o codici informativi).", + "BingKeywordImport": "Importazione di parole chiave Bing", + "BingKeywords": "Parole chiave (su Bing e Yahoo!)", + "BingKeywordsDocumentation": "Parole chiave utilizzate nella ricerca di Bing o Yahoo! che hanno generato collegamenti al tuo sito web nell'elenco dei risultati.", + "BingKeywordsNoRangeReports": "Parole chiave su Bing e Yahoo! che possono essere elaborate solo per intervalli di date personalizzati, comprese settimane o mesi interi in quanto non sono disponibili come rapporti giornalieri.", + "BingKeywordsNotDaily": "Parole chiave su Bing e Yahoo! che sono disponibili solo come rapporti settimanali. Non ci sono dati sulle parole chiave per i periodi di giorni.", + "BingWebmasterApiUrl": "Url di Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Fornisce l'url di questo sito Web disponibile in Bing Webmaster Tools", + "Category": "Categoria", + "ChangeConfiguration": "Cambia configurazione", + "Clicks": "Clicks", + "ClicksDocumentation": "Viene conteggiato un click ogni volta che un utente clicca su un link che punta al tuo sito web sulla pagina dei risultati di un motore di ricerca.", + "ClientConfigImported": "La configurazione del client è stata importata con successo!", + "ClientConfigSaveError": "Si è verificato un errore durante il salvataggio della configurazione del client. Si prega di verificare se la configurazione fornita è valida e poi riprovare.", + "ClientId": "Id client", + "ClientSecret": "Segreto del client", + "ConfigAvailableNoWebsiteConfigured": "Integrazione correttamente configurata, ma attualmente nessun sito web è configurato per l'importazione.", + "ConfigRemovalConfirm": "Stai per rimuovere la configurazione per %1$s. L'importazione di parole chiave per quel sito web sarà disabilitata. Procedere comunque?", + "Configuration": "Configurazione", + "ConfigurationDescription": "Questo plugin consente di importare direttamente in Matomo tutte le parole chiave cercate dagli utenti sui motori di ricerca.", + "ConfigurationFile": "File di configurazione", + "ConfigurationValid": "La tua configurazione OAuth è valida.", + "ConfiguredAccounts": "account configurati", + "ConfiguredUrlNotAvailable": "L'URL configurato non è disponibile per questo account", + "ConfigureMeasurableBelow": "Per configurare un sito Web, è sufficiente cliccare sul pulsante in basso o configurarlo direttamente nelle sue impostazioni.", + "ConfigureMeasurables": "Configura siti web", + "ConnectAccount": "Collega Account", + "ConnectAccountDescription": "Clicca sul pulsante in basso per essere reindirizzati a %1$s dove è necessario dare l'accesso.", + "ConnectAccountYandex": "L'autenticazione per gli account Yandex è valida solo per %1$s giorni. Ogni account deve essere nuovamente autenticato entro questo tempo per garantire che le importazioni funzionino correttamente.", + "ConnectFirstAccount": "Inizia collegando il tuo primo account qui sotto.", + "ConnectGoogleAccounts": "Collega Account di Google", + "ContainingSitemaps": "Contenenti Sitemap", + "CrawlingErrors": "Errori di scansione", + "ConnectYandexAccounts": "Collega account Yandex", + "CrawlingStats": "Panoramica scansione", + "Ctr": "Percentuale di clicks (CTR)", + "CtrDocumentation": "Percentuale di click: report che mostra la frequenza con cui le persone che vedono la pagina dei risultati di un motore di ricerca con un link al tuo sito web finiscono per cliccarci sopra.", + "CurrentlyConnectedAccounts": "Al momento sei collegato con %1$s accounts.", + "EnabledSearchTypes": "Tipi di parole chiave da recuperare", + "FetchImageKeyword": "Recupera parole chiave immagine", + "FetchImageKeywordDesc": "Recupera le parole chiave utilizzate nella ricerca immagini di Google", + "FetchNewsKeyword": "Recupera le parole chiave delle notizie", + "FetchNewsKeywordDesc": "Recupera le parole chiave usate in Google News", + "FetchVideoKeyword": "Recupera parole chiave video", + "FetchVideoKeywordDesc": "Recupera le parole chiave utilizzate nella ricerca video di Google", + "FetchWebKeyword": "Recupera parole chiave web", + "FetchWebKeywordDesc": "Recupera le parole chiave utilizzate nella ricerca web di Google", + "FirstDetected": "Prima individuata", + "GoogleAccountAccessTypeOfflineAccess": "È necessario l'Accesso offline per poter importare le parole chiave di ricerca anche quando non si è connessi.", + "GoogleAccountAccessTypeProfileInfo": "Le Informazioni del profilo vengono utilizzate per mostrare il nome degli account attualmente connessi.", + "GoogleAccountAccessTypeSearchConsoleData": "I Dati della Console di Ricerca sono necessari per ottenere l'accesso alle tue parole chiave di ricerca di Google.", + "GoogleAccountError": "Si è verificato un errore durante la convalida dell'accesso OAuth: %1$s", + "GoogleAccountOk": "Accesso OAuth verificato con successo.", + "GoogleConfigurationDescription": "La Console di Ricerca di Google utilizza OAuth per l'autenticazione e l'autorizzazione.", + "GoogleConfigurationTitle": "Configura l'importazione dalla Console di Ricerca di Google", + "GoogleDataProvidedWithDelay": "Google fornisce i dati delle parole chiave con un ritardo. Le parole chiave per questa data verranno importate un po' più tardi.", + "GoogleDataNotFinal": "I dati delle parole chiave in questo report potrebbero non contenere ancora i dati finali. Google fornisce i dati finali sulle parole chiave con un ritardo di 2 giorni. Le parole chiave per i giorni più recenti verranno reimportate fino a quando non verranno segnalate come definitive.", + "GoogleKeywordImport": "Importazione di parole chiave di Google", + "GoogleSearchConsoleUrl": "Url per la Console di Ricerca di Google", + "GoogleSearchConsoleUrlDescription": "Indica l'url per questo sito web disponibile nella tua Search Console di Google", + "GoogleUploadOrPasteClientConfig": "Carica la configurazione del client Google OAuth o incollala nel campo sottostante.", + "HowToGetOAuthClientConfig": "Come ottenere la configurazione del tuo client OAuth", + "ImageKeywords": "Parole chiave immagini su Google", + "ImageKeywordsDocumentation": "Parole chiave utilizzate nella ricerca per immagini di Google che hanno generato collegamenti al tuo sito web nell'elenco dei risultati della ricerca.", + "Impressions": "Impressioni", + "ImpressionsDocumentation": "Viene conteggiata un'impressione ogni volta che il tuo sito web viene visualizzato in una pagina dei risultati dei motori di ricerca.", + "IntegrationConfigured": "Integrazione configurata con successo", + "IntegrationNotConfigured": "Integrazione non ancora configurata", + "KeywordsCombined": "Keyword combinate", + "KeywordsCombinedDocumentation": "Report che combina tutte le parole chiave rilevate da Matomo e importate dai motori di ricerca. Questo report include solo la metrica visita. È possibile passare a uno dei report correlati per ottenere delle metriche dettagliate.", + "KeywordsCombinedImported": "Keyword importate combinate", + "KeywordsCombinedImportedDocumentation": "Segnala tutte le parole chiave importate da tutti i motori di ricerca configurati.", + "KeywordsReferrers": "Parole chiave (incluse quelle non definite)", + "KeywordStatistics": "Keywords di Ricerca", + "KeywordTypeImage": "immagine", + "KeywordTypeVideo": "video", + "KeywordTypeWeb": "web", + "KeywordTypeNews": "notizie", + "LastCrawled": "Ultima scansione", + "LastDetected": "Ultima rilevata", + "LastImport": "Ultima importazione", + "LatestAvailableDate": "Dati delle parole chiave più recenti disponibili per %1$s", + "LinksToUrl": "Collegamenti a %s", + "ManageAPIKeys": "Gestisci Chiavi API", + "MeasurableConfig": "siti configurati", + "NoSegmentation": "Il report non supporta la segmentazione. I dati visualizzati sono i dati del report standard non segmentati.", + "NotAvailable": "Non disponibile", + "NoWebsiteConfigured": "Al momento non ci sono siti web configurati. Per abilitare l'importazione per un sito web specifico, impostare qui la configurazione.", + "NoWebsiteConfiguredWarning": "Importazione per %s non completamente configurata. È necessario configurare alcuni siti web per abilitare l'importazione.", + "OAuthAccessTimedOut": "L'accesso OAuth per questo account potrebbe essere scaduto. Sarà necessario eseguire nuovamente l'autenticazione per ripristinare il funzionamento delle importazioni per questo account.", + "OAuthAccessWillTimeOutSoon": "L'accesso OAuth per questo account scadrà tra circa %1$s giorni. Esegui nuovamente l'autenticazione per evitare che le importazioni per questo account smettano di funzionare.", + "OAuthAccessWillTimeOut": "L'accesso OAuth per questo account scadrà dopo %1$s %2$s giorni. giorni rimasti", + "OAuthClientConfig": "Configurazione Client OAuth", + "OAuthError": "Si è verificato un errore all'interno del processo OAuth. Si prega di riprovare e di assicurarsi di accettare le autorizzazioni richieste.", + "Platform": "Piattaforma", + "Position": "Media della Posizione", + "PositionDocumentation": "Media della posizione del tuo sito web nell'elenco dei risultati dei motori di ricerca (per questa parola chiave).", + "ProviderBingDescription": "Importa tutte le keyword utilizzate per trovare il tuo sito web sulla ricerca di Bing e Yahoo!.", + "ProviderBingNote": "Nota: Microsoft fornisce dati sulle parole chiave ogni sabato e solo per settimane complete. Di conseguenza, le parole chiave per Bing e Yahoo impiegheranno alcuni giorni per comparire nei tuoi report e saranno disponibili solo durante la visualizzazione di settimane, mesi o anni.", + "ProviderGoogleDescription": "Importa tutte le parole chiave utilizzate per trovare il tuo sito web sulla ricerca di Google. I report mostreranno le tue parole chiave per ogni tipo di ricerca separatamente (Web, Immagini e Video).", + "ProviderGoogleNote": "Nota: Google fornisce i dati finali sulle parole chiave con un ritardo di 2 giorni. I dati non definitivi per i giorni più recenti verranno già visualizzati, ma verranno reimportati fino a quando non saranno definitivi. La tua prima importazione potrebbe essere in grado di importare i dati storici delle parole chiave fino agli ultimi 486 giorni.", + "ProviderListDescription": "Dopo avere impostato correttamente uno (o più) motori di ricerca qui di seguito, puoi configurare in quale sito (o siti) Matomo deve importare le tue parole chiave di ricerca.", + "ProviderXAccountWarning": "Rilevati problemi di configurazione dell'account
Si prega di verificare gli account configurati per %s.", + "ProviderXSitesWarning": "Rilevati problemi di configurazione di un sito web
Si prega di verificare i siti configurati per %s.", + "ProviderYandexDescription": "Importa tutte le parole chiave utilizzate per trovare il tuo sito web nella ricerca Yandex.", + "ProviderYandexNote": "Nota: Yandex fornisce le parole chiave con un ritardo fino a 5 giorni. La prima importazione proverà a importare le tue parole chiave storiche fino agli ultimi 100 giorni.", + "ProvideYandexClientConfig": "Inserisci la configurazione del tuo client OAuth Yandex.", + "Reauthenticate": "Autenticati di nuovo", + "ReAddAccountIfPermanentError": "Se questo è un errore permanente, prova a rimuovere l'account e a ricollegarlo.", + "ReAuthenticateIfPermanentError": "Se si tratta di un errore permanente, prova ad autenticare nuovamente l'account o rimuovilo e ricollegalo.", + "ReportShowMaximumValues": "I valori visualizzati sono i valori massimi che si sono verificati durante questo periodo.", + "RequiredAccessTypes": "Sono richiesti questi tipi di accesso:", + "ResponseCode": "Codice risposta", + "RoundKeywordPosition": "Posizione round keyword", + "SearchEngineKeywordsPerformance": "Rendimentodelle keyword dei motori di ricerca", + "SetupConfiguration": "Imposta configurazione", + "SitemapsContainingUrl": "Sitemap che contengono %s", + "SetUpOAuthClientConfig": "Imposta la configurazione del tuo client OAuth", + "KeywordsSubtableOriginal": "Keyword tracciate (incluse quelle non definite)", + "KeywordsSubtableImported": "Keyword importate", + "AllReferrersOriginal": "Referrer (con keyword tracciate)", + "AllReferrersImported": "Referrer (con keyword importate)", + "SearchEnginesOriginal": "Motori di ricerca (con keyword tracciate)", + "SearchEnginesImported": "Motori di ricerca (con keyword importate)", + "StartOAuth": "Inizia Processo OAuth", + "UnverifiedSites": "Siti non verificati:", + "UploadOAuthClientConfig": "Carica la configurazione del tuo client OAuth", + "UrlOfAccount": "URL (Account)", + "VideoKeywords": "Parole chiave per video su Google", + "VideoKeywordsDocumentation": "Parole chiave utilizzate nella ricerca video di Google che hanno generato collegamenti al tuo sito web nell'elenco dei risultati della ricerca.", + "NewsKeywords": "Parole chiave news su Google", + "NewsKeywordsDocumentation": "Parole chiave utilizzate nella ricerca di Google News che hanno generato collegamenti al tuo sito web nell'elenco dei risultati di ricerca.", + "VisitOAuthHowTo": "Visita la nostra %1$sguida in linea%2$s per scoprire come impostare la configurazione del tuo %3$s client OAuth.", + "WebKeywords": "Parole chiave web su Google", + "WebKeywordsDocumentation": "Parole chiave utilizzate nella ricerca web di Google che hanno generato collegamenti al tuo sito web nell'elenco dei risultati della ricerca.", + "WebsiteSuccessfulConfigured": "Congratulazioni!
Hai configurato correttamente l'importazione delle parole chiave per il sito web %1$s.
Potrebbero essere necessari alcuni giorni prima che le prime parole chiave di ricerca vengano importate e visualizzate in Referenti > Keywords di Ricerca. Puoi trovare ulteriori informazioni su ritardi e limitazioni delle importazioni delle parole chiave nelle nostre %2$sFAQ%3$s", + "WebsiteTypeUnsupported": "Il misurabile selezionato %1$s non può essere configurato perché è di un tipo non supportato. Sono supportati solamente i misurabili di tipo 'sito web'.", + "WebsiteTypeUnsupportedRollUp": "Nota: I siti Roll-Up combineranno automaticamente i dati importati di tutti i siti figlio", + "YandexConfigurationDescription": "L'API Webmaster di Yandex utilizza OAuth per l'autenticazione e l'autorizzazione.", + "YandexConfigurationTitle": "Configura l'importazione dall'API Webmaster di Yandex", + "YandexCrawlingStats": "Guarda una panoramica su Yandex!", + "YandexCrawlingStatsDocumentation": "La panoramica della Scansione ti consente di visualizzare le informazioni relative alla scansione come gli errori riscontrati dal bot di ricerca durante la visita di una pagina, gli elementi bloccati dal tuo file robots.txt e il numero totale di pagine nell'indice.", + "YandexCrawlHttpStatus2xx": "Codici HTTP 200-299", + "YandexCrawlHttpStatus2xxDesc": "Pagine con un codice 2xx esplorate", + "YandexCrawlHttpStatus3xx": "Codici HTTP 300-399 (Pagine spostate)", + "YandexCrawlHttpStatus3xxDesc": "Pagine con un codice 3xx esplorate", + "YandexCrawlHttpStatus4xx": "Codici HTTP 400-499 (Errori richiesta)", + "YandexCrawlHttpStatus4xxDesc": "Pagine con un codice 4xx esplorate", + "YandexCrawlHttpStatus5xx": "Codici HTTP 500-599 (Errori interni al server)", + "YandexCrawlHttpStatus5xxDesc": "Pagine con un codice 5xx esplorate", + "YandexCrawlErrors": "Altri errori richiesta", + "YandexCrawlErrorsDesc": "Pagine esplorate che hanno fallito per qualsiasi altra ragione", + "YandexCrawlCrawledPages": "Pagine Esplorate", + "YandexCrawlCrawledPagesDesc": "Numero di pagine richieste dal crawler Yandex", + "YandexCrawlInIndex": "Totale delle pagine nell'indice", + "YandexCrawlInIndexDesc": "Numero totale di pagine disponibili nell'indice di ricerca Yandex", + "YandexCrawlAppearedPages": "Pagine apparse nella ricerca", + "YandexCrawlAppearedPagesDesc": "Pagine che sono state appena aggiunte all'indice di ricerca Yandex", + "YandexCrawlRemovedPages": "Pagine rimosse dalla ricerca", + "YandexCrawlRemovedPagesDesc": "Pagine che sono state rimosse dall'indice di ricerca Yandex", + "YandexKeywords": "Parole chiave su Yandex", + "YandexKeywordsDocumentation": "Parole chiave utilizzate nella ricerca Yandex che hanno generato collegamenti al tuo sito Web nell'elenco dei risultati di ricerca.", + "YandexWebmasterApiUrl": "Url di Yandex Webmaster Tools", + "YandexWebmasterApiUrlDescription": "Fornisci l'url di questo sito web disponibile nei tuoi Strumenti per i Webmaster di Yandex", + "CrawlingOverview1": "La panoramica delle scansioni riporta tutte le informazioni più importanti su come i robot dei motori di ricerca eseguono la scansione dei tuoi siti web. Queste metriche vengono aggiornate circa una volta al giorno con i dati forniti dai motori di ricerca." + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ja.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ja.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ja.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/nb.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/nb.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/nb.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/nl.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/nl.json new file mode 100644 index 0000000..fb5a46c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/nl.json @@ -0,0 +1,183 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "Toegevoegd door %1$s<\/em> op %2$s<\/em>", + "AccountConnectionValidationError": "Er is een fout opgetreden tijdens het valideren van de connectie met het account:", + "AccountDoesNotExist": "Dit account %1$sbestaat niet meer.", + "AccountNoAccess": "Dit account heeft momenteel geen toegang tot een website.", + "AccountRemovalConfirm": "Je staat op het punt het account %1$s te verwijderen. Dit kan het importeren van zoekwoorden voor alle gekoppelde website(s) uitschakelen. Toch doorgaan?", + "ActivityAccountAdded": "een nieuw account voor keyword provider %1$s is toegevoegd: %2$s", + "ActivityAccountRemoved": "een account voor keyword provider %1$s is verwijderd: %2$s", + "ActivityGoogleClientConfigChanged": "de configuratie van de Google-client gewijzigd.", + "ActivityYandexClientConfigChanged": "de configuratie van de Yandex client gewijzigd.", + "AddAPIKey": "API Key toegevoegd", + "AddConfiguration": "Configuratie is toegevoegd", + "AdminMenuTitle": "Zoekprestaties", + "APIKey": "API Key", + "AvailableSites": "Beschikbare websites voor import:", + "Domain": "Domein", + "DomainProperty": "Domein property", + "DomainPropertyInfo": "Bevat alle subdomeinen (m, www, enzovoort) en beide protocollen (http, https).", + "URLPrefix": "URL-voorvoegsel", + "URLPrefixProperty": "Property met URL-voorvoegsel", + "URLPrefixPropertyInfo": "Bevat alleen URL's met het exact opgegeven voorvoegsel, inclusief het protocol (http\/https). Als je wilt dat je property overeenkomt met elk protocol of subdomein (http\/https\/www.\/m. enzovoort), overweeg dan een domein property toe te voegen.", + "BingAccountError": "Er is een fout opgetreden tijdens het valideren van de API Key: %1$s. Wanneer je de API Key zojuist heb gegenereerd in Bing Webmast Tools probeer het dan nog eens over één of twee minuten(API Keys in Bing Webmaster Tools hebben even tijd nodig om te worden geactiveerd)", + "BingAccountOk": "API Key is succesvol gecontroleerd", + "BingConfigurationDescription": "De Bing Webmaster Tools heeft een API Key nodig om te openen. Hier kan je je API Key toevoegen om toegang te krijgen tot je website data.", + "BingConfigurationTitle": "Configureer de import van Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Robots.txt uitgesloten", + "BingCrawlBlockedByRobotsTxtDesc": "URL's momenteel geblokkeerd door de websites robots.txt", + "BingCrawlConnectionTimeout": "Connectie time outs", + "BingCrawlConnectionTimeoutDesc": "Dit nummer toont het aantal recente keren dat Bing je website niet heeft kunnen benaderen door connectie problemen. Dit kan een tijdelijk probleem zijn maar je zou je server logs kunnen controleren om te zien of er verzoeken verloren gaan.", + "BingCrawlCrawledPages": "Doorzochte pagina's", + "BingCrawlCrawledPagesDesc": "Aantal pagina the Bing crawler heeft aangevraagd.", + "BingCrawlDNSFailures": "DNS storing", + "BingCrawlDNSFailuresDesc": "Dit issue type verzameld recente fouten die zijn tegen gekomen bij het communiceren met de DNS server wanneer de bot toegang tot je website probeerde te krijgen. Mogelijk stond de server uit, of de instellingen stonden niet goed waardoor DNS routing werd tegengehouden, bijvoorbeeld TTL stond op 0.", + "BingCrawlErrors": "Crawl errors op Bing", + "BingCrawlErrorsDesc": "Aantal foutmeldingen die voorkwamen bij de Bing crawler", + "BingCrawlErrorsFromDateX": "Dit rapport toont crawling fouten welke recent zijn gerapporteerd door Bing. Het toont geen historische data. Laatste update %s", + "BingCrawlHttpStatus2xx": "HTTP Code 200-299", + "BingCrawlHttpStatus2xxDesc": "Deze codes verschijnen wanneer de server een pagina succesvol laad", + "BingCrawlHttpStatus301": "HTTP Code 301 (Permanent verwijderd)", + "BingCrawlHttpStatus301Desc": "Deze codes verschijnen wanneer bepaalde content permanent is verplaatst van de ene locatie (URL) naar een andere.", + "BingCrawlHttpStatus302": "HTTP Code 302 (Tijdelijk verwijderd)", + "BingCrawlHttpStatus302Desc": "Deze codes verschijnen wanneer bepaalde content tijdelijk is verplaatst van de ene locatie (URL) naar een andere.", + "BingCrawlHttpStatus4xx": "HTTP Code 400-499 (Request errors)", + "BingCrawlHttpStatus4xxDesc": "Deze codes verschijnen wanneer er waarschijnlijk een fout was het verzoek welke ervoor zorgde dat de server het niet kon verwerken.", + "BingCrawlHttpStatus5xx": "HTTP Code 500-599 (Interne server errors)", + "BingCrawlHttpStatus5xxDesc": "Deze codes verschijnen wanneer het een server niet lukt om een schijnbaar geldig verzoek uit te voeren.", + "BingCrawlImportantBlockedByRobotsTxt": "Robots.txt uitsluiting van belangrijke pagina", + "BingCrawlInboundLink": "Totaal inbound links", + "BingCrawlInboundLinkDesc": "Inbound links waar Bing weet van heeft, gericht op URL's op jouw website. Deze links zijn, van externe websites of van jezelf, welke gelinkt zijn naar je content.", + "BingCrawlingStats": "Crawl overzicht voor Bing en Yahoo!", + "BingCrawlingStatsDocumentation": "Het crawl overzicht laat je crawl gerelateerde informatie zien zoals fouten die ondervonden zijn door zoek bot bij het bezoeken van een pagina, items geblokkeerd door je robots.txt bestand en URL's welke potentieel getroffen zijn door malware.", + "BingCrawlMalwareInfected": "Met malware geïnfecteerde websites", + "BingCrawlMalwareInfectedDesc": "Elke pagina URL die Bing heeft gevonden welke geïnfecteerd of geassocieerd worden met malware worden in dit deel gegroepeerd.", + "BingCrawlPagesInIndex": "Totaal pagina's in index", + "BingCrawlPagesInIndexDesc": "Totaal aantal pagina's beschikbaar in de Bing index", + "BingCrawlStatsOtherCodes": "Alle andere HTTP status codes", + "BingCrawlStatsOtherCodesDesc": "Overige groepen codes die niet overeenkomen met elke andere waarde (zoals 1xx of informatieve codes)", + "BingKeywordImport": "Bing zoekwoorden import", + "BingKeywords": "Zoekwoorden (on Bing en Yahoo!)", + "BingKeywordsDocumentation": "Zoekwoorden gebruikt in Bing of Yahoo! zoekmachine die gegenereerde links naar je website in het zoekresultaten overzicht tonen.", + "BingKeywordsNoRangeReports": "Zoekwoorden op Bing en Yahoo! kunnen alleen verwerkt worden voor aangepaste datum periodes inclusief volledige weken of maanden aangezien de dagelijkse rapporten niet beschikbaar zijn.", + "BingKeywordsNotDaily": "Zoekwoorden van Bing en Yahoo! zijn alleen beschikbaar als wekelijkse rapporten. Er is geen sleutelwoord data beschikbaar voor perioden van een dag.", + "BingWebmasterApiUrl": "URL voor Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Geef de URL voor deze website welke beschikbaar is in je Bing Webmaster Tools", + "Category": "Categorie", + "ChangeConfiguration": "Wijzig configuratie", + "Clicks": "Kliks", + "ClicksDocumentation": "Een klik wordt elke keer geteld wanneer iemand klikt op een link welke gericht is op jouw website vanaf een zoekmachine resultaat pagina.", + "ClientConfigImported": "Client configuratie is succesvol geïmporteerd!", + "ClientConfigSaveError": "Er is een fout opgetreden tijdens het opslaan van de client configuratie. Controleer of de configuratie goed is en probeer het dan nogmaals.", + "ClientId": "Client id", + "ClientSecret": "Client geheim", + "ConfigAvailableNoWebsiteConfigured": "De integratie is succesvol geconfigureerd. Er zijn nog geen websites geconfigureerd voor het importeren.", + "ConfigRemovalConfirm": "Je staat op het punt om de instellingen for %1$s te verwijderen. Het importeren van zoekwoorden voor die website zal worden uitgeschakeld. Toch doorgaan?", + "Configuration": "Configuratie", + "ConfigurationDescription": "Deze plugin geeft je de mogelijkheid om alle zoekwoorden ingevoerd door gebruikers op een zoekmachine direct te importeren in Matomo.", + "ConfigurationFile": "Configuratie bestand", + "ConfigurationValid": "De OAuth configuratie is geldig.", + "ConfiguredAccounts": "geconfigureerde accounts", + "ConfiguredUrlNotAvailable": "De geconfigureerde URL is niet beschikbaar voor dit account", + "ConfigureMeasurableBelow": "Om een website te configureren, klik daarvoor op de button hieronder of configureer het direct in de website instellingen.", + "ConfigureMeasurables": "Configureer websites", + "ConnectAccount": "Koppel account", + "ConnectFirstAccount": "Begin hieronder met het koppelen van je eerste account.", + "ConnectGoogleAccounts": "Koppel Google Account(s)", + "ContainingSitemaps": "Bevat Sitemaps", + "CrawlingErrors": "Crawling fouten", + "ConnectYandexAccounts": "Koppel Yandex Account(s)", + "CrawlingStats": "Crawling overzicht", + "Ctr": "CTR", + "CtrDocumentation": "Clickthrough rate: een ratio van hoe vaak mensen die vanaf een zoekmachine resultaten pagina met een link naar je website op je website terecht komen door op de link te klikken.", + "CurrentlyConnectedAccounts": "Er zijn momenteel %1$s accounts gekoppeld.", + "EnabledSearchTypes": "Zoekwoorden types om op te halen", + "FetchImageKeyword": "Opgehaalde plaatjes zoekwoorden", + "FetchImageKeywordDesc": "Opgehaalde zoekwoorden gebruikt in Google image search", + "FetchVideoKeyword": "Opgehaalde video zoekwoorden", + "FetchVideoKeywordDesc": "Opgehaalde zoekwoorden gebruikt in Google video search", + "FetchWebKeyword": "Ophalen web zoekwoorden", + "FetchWebKeywordDesc": "Opgehaalde zoekwoorden gebruikt in Google web search", + "FirstDetected": "Als eerst gevonden", + "GoogleAccountAccessTypeOfflineAccess": "Offline toegang<\/strong>is vereist om in staat te zijn om de zoekwoorden te importeren, zelfs wanneer je niet ingelogd bent.", + "GoogleAccountAccessTypeProfileInfo": "Profiel info<\/strong>wordt gebruikt om de namen van de account(s) te tonen die momenteel gekoppeld zijn.", + "GoogleAccountAccessTypeSearchConsoleData": "Search Console Data<\/strong>is vereist om toegang te krijgen tot je Google Search Keywords.", + "GoogleAccountError": "Er is een fout opgetreden tijdens het valideren van OAuth toegang: %1$s", + "GoogleAccountOk": "OAuth toegang is succesvol gecontroleerd.", + "GoogleConfigurationDescription": "Google Search Console gebruikt OAuth voor authenticate en autorisatie.", + "GoogleConfigurationTitle": "Configureer import van Google Search Console", + "GoogleKeywordImport": "Google zoekwoorden import", + "GoogleSearchConsoleUrl": "URL voor Google Search Console", + "GoogleSearchConsoleUrlDescription": "Verschaf de url voor deze website waarmee deze beschikbaar is in je Google Search Console", + "GoogleUploadOrPasteClientConfig": "Upload je Google OAuth configuratie, of plak het in het veld hieronder.", + "HowToGetOAuthClientConfig": "Waar vind je je OAuth Client configuratie", + "ImageKeywords": "Plaatjes zoekwoorden op Google", + "ImageKeywordsDocumentation": "Zoekwoorden gebruikt in Google image<\/b>search die een link hebben gegenereerd naar je website in het zoekresultaten overzicht.", + "Impressions": "Impressies", + "ImpressionsDocumentation": "Een impressie wordt geteld elke keer wanneer je website wordt getoond in een zoekmachine resultaat pagina.", + "IntegrationConfigured": "Integratie is succesvol geconfigureerd", + "IntegrationNotConfigured": "Integratie is nog niet geconfigureerd", + "KeywordsCombined": "Gecombineerde zoekwoorden", + "KeywordsCombinedDocumentation": "Het rapport combineert alle zoekwoorden gevonden door Matomo en geïmporteerd uit zoekmachines. Dit rapport bevat alleen de bezoekers statistieken. Je kan naar een ander rapport gaan om meer gedetailleerde statistieken te zien.", + "KeywordsCombinedImported": "Gecombineerde geïmporteerde zoekwoorden", + "KeywordsCombinedImportedDocumentation": "Het rapport toont alle zoekwoorden welke geïmporteerd zijn vanuit alle geconfigureerde zoekmachines.", + "KeywordsReferrers": "Sleutelwoorden (inclusief zoekwoord niet gedefinieerd)", + "KeywordStatistics": "Zoekwoorden", + "KeywordTypeImage": "plaatje", + "KeywordTypeVideo": "video", + "KeywordTypeWeb": "web", + "KeywordTypeNews": "nieuws", + "LastCrawled": "Laatst crawled", + "LastDetected": "Laatst gedetecteerde", + "LastImport": "Laatste import", + "LatestAvailableDate": "Meest recente zoekwoorden data is beschikbaar voor %1$s", + "LinksToUrl": "Links naar %s", + "ManageAPIKeys": "Beheer API Keys", + "MeasurableConfig": "geconfigureerde websites", + "NoSegmentation": "Het rapport ondersteund geen segmentatie. De data die getoond wordt is standaard, niet gesegmenteerde rapportage data.", + "NotAvailable": "Niet beschikbaar", + "NoWebsiteConfigured": "Er is momenteel geen website geconfigureerd. Om het importeren voor een specifieke website te activeren, stel hier je configuratie in.", + "NoWebsiteConfiguredWarning": "Import voor %s is niet volledig ingericht. Voor sommige website moeten de instellingen geconfigureerd worden om het importeren te activeren.", + "OAuthClientConfig": "OAuth Client Configuratie", + "OAuthError": "Er is een fout opgetreden in het OAuth proces. Probeer het nogmaals en zorg ervoor dat je de verzochte permissies accepteert.", + "Platform": "Platform", + "Position": "Gemiddelde positie", + "PositionDocumentation": "Gemiddelde positie van je website in de zoekresultaten pagina (voor dit zoekwoord).", + "ProviderBingDescription": "Importeer alle zoekwoorden die gebruikt zijn om je website te vinden via Bing<\/strong> en Yahoo! <\/strong>.", + "ProviderBingNote": "Let op: <\/u> Microsoft levert zoekwoorden data elke zaterdag en alleen voor een hele week. Dat heeft als gevolg dat de zoekwoorden van Bing en Yahoo! een aantal dagen nodig hebben om in het rapport te verschijnen en alleen zichtbaar zijn wanneer er weken, maanden of jaren als bereik zijn geselecteerd.", + "ProviderGoogleDescription": "Importeer all zoekwoorden die gebruikt zijn op de Google zoekmachine <\/strong>. De zoekwoorden worden onderverdeeld in het rapport onder de verschillende zoek opties (web, plaatjes en video's)", + "ProviderListDescription": "Wanneer je één )of meer) zoek machines succesvol hebt ingericht, kan je aangeven in welke website(s) Matomo de zoekwoorden moet importeren.", + "ProviderXAccountWarning": "Account configuratie probleem ontdekt <\/strong>
Controleer de geconfigureerde accounts voor %s<\/strong>.", + "ProviderXSitesWarning": "Website configuratie problemen ontdekt <\/strong>
Controleer de geconfigureerde accounts voor %s<\/strong>", + "ReAddAccountIfPermanentError": "Wanneer dit een permanente fout is, probeer dan het account te verwijderen en koppel het account opnieuw.", + "RequiredAccessTypes": "Deze toegangstypen zijn verplicht:", + "ResponseCode": "Reactie code", + "RoundKeywordPosition": "Round zoekwoord positie", + "SearchEngineKeywordsPerformance": "Zoekmachine zoekwoorden prestaties", + "SetupConfiguration": "Setup configuratie", + "SitemapsContainingUrl": "Sitemaps bevat %s", + "KeywordsSubtableOriginal": "Bijgehouden zoekwoorden (inclusief niet gedefinieerde)", + "KeywordsSubtableImported": "Geïmporteerde zoekwoorden", + "AllReferrersOriginal": "Referrers (met bijgehouden zoekwoorden)", + "AllReferrersImported": "Referrers (met geïmporteerde zoekwoorden)", + "SearchEnginesOriginal": "Zoekmachines (met bijgehouden zoekwoorden)", + "SearchEnginesImported": "Zoekmachines (met geïmporteerde zoekwoorden)", + "StartOAuth": "Start OAuth Proces", + "UnverifiedSites": "Niet gevalideerde websites:", + "UploadOAuthClientConfig": "Upload je OAuth client configuratie", + "UrlOfAccount": "URL (Account)", + "VideoKeywords": "Video zoekwoorden op Google", + "VideoKeywordsDocumentation": "Zoekwoorden die zijn gebruikt in de zoekfunctie van Google video<\/b> search die gegenereerde links naar je website in het zoekresultaten overzicht tonen.", + "NewsKeywords": "Nieuws zoekwoorden op Google", + "WebKeywords": "Web zoekwoorden op Google", + "WebKeywordsDocumentation": "Zoekwoorden die zijn gebruikt in de zoekfunctie van Google web<\/b> search die gegenereerde links naar je website in het zoekresultaten overzicht tonen.", + "WebsiteSuccessfulConfigured": "Gefeliciteerd!
Je hebt succesvol de zoekwoorden import voor website %1$s geconfigureerd.
Het kan een paar dagen duren voordat de eerste zoekwoorden worden geïmporteerd en getoond worden in Herkomst > Zoekwoorden. Meer informatie over de vertraging voor het importeren van zoekwoorden kan je vinden in onze %2$sFAQ%3$s", + "WebsiteTypeUnsupported": "De geselecteerde meetwaarde %1$s kan niet geconfigureerd worden aangezien het een niet ondersteunde type is. Alleen meetwaarde 'website' worden ondersteund.", + "WebsiteTypeUnsupportedRollUp": "Opmerking: Roll-Up sites combineert automatisch de geïmporteerde gegevens van al hun onderliggende sites", + "YandexCrawlingStats": "Crawl overzicht voor Yandex!", + "YandexCrawlHttpStatus2xx": "HTTP Code 200-299", + "YandexCrawlHttpStatus4xx": "HTTP Code 400-499 (Request errors)", + "YandexCrawlHttpStatus5xx": "HTTP Code 500-599 (Interne server errors)", + "YandexCrawlInIndex": "Totaal pagina's in index" + } +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/pl.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/pl.json new file mode 100644 index 0000000..771aa94 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/pl.json @@ -0,0 +1,178 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "Dodane przez %1$s<\/em>- %2$s<\/em>", + "AccountConnectionValidationError": "Wystąpił błąd podczas weryfikacji połączenia konta:", + "AccountDoesNotExist": "Skonfigurowane konto %1$s już nie istnieje", + "AccountNoAccess": "To konto nie posiada obecnie dostępu do żadnego serwisu.", + "AccountRemovalConfirm": "Zamierzasz usunąć konto %1$s. Może to spowodować niedostępność zaimportowanych słów kluczowych dla dowolnego połączonego z nim serwisu. Czy na pewno kontynuować?", + "ActivityAccountAdded": "dodano nowe konto dostawcy słów kluczowych %1$s: %2$s", + "ActivityAccountRemoved": "usunięto konto dostawcy słów kluczowych %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "zmodyfikowano konfigurację klienta Google.", + "AddAPIKey": "Dodaj klucz API", + "AddConfiguration": "Dodaj konfigurację", + "AdminMenuTitle": "Wydajność wyszukiwania", + "APIKey": "Klucz API", + "AvailableSites": "Serwisy dostępne do zaimportowania:", + "Domain": "Domena", + "DomainProperty": "Usługa domeny", + "DomainPropertyInfo": "Obejmuje wszystkie subdomeny (m, www itp.) i oba protokoły (http, https).", + "URLPrefix": "Prefiks adresu URL", + "URLPrefixProperty": "Usługa z prefiksem URL", + "URLPrefixPropertyInfo": "Obejmuje tylko adresy URL z dokładnie określonym prefiksem, w tym protokołem (http\/https). Jeśli chcesz, by usługa pasowała do dowolnego protokołu lub subdomeny (http\/https\/www.\/m. itp.), zamiast tej usługi dodaj usługę domeny.", + "BingAccountError": "Wystąpił błąd podczas weryfikacji klucza API: %1$s. Jeśli klucz został wygenerowany przed chwilą w Narzędziach Webmastera Bing, proszę spróbuj ponownie za minutę lub dwie (klucze API w tym narzędziu potrzebują chwilę na aktywację).", + "BingAccountOk": "Klucz API zweryfikowany pozytywnie", + "BingConfigurationDescription": "Narzędzia Webmastera Bing wymagają dostępowego klucza API. Tu możesz dodać klucz API, aby uzyskać dostęp do danych swoich serwisów.", + "BingConfigurationTitle": "Skonfiguruj import z Narzędzi dla Webmasterów Bing", + "BingCrawlBlockedByRobotsTxt": "Wykluczenia robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "Adresy URL obecnie blokowane przez plik robots.txt.", + "BingCrawlConnectionTimeout": "Wygaszone połączenia", + "BingCrawlConnectionTimeoutDesc": "Ta liczba prezentuje ostatnie próby połączenia, podczas których Bing nie było w stanie uzyskać dostępu do serwisu ze względu na błędy połączenia. Może to być sytuacja przejściowa, ale zalecamy weryfikację logów serwera pod kątem przypadkowo zerwanych połączeń.", + "BingCrawlCrawledPages": "Zindeksowane strony", + "BingCrawlCrawledPagesDesc": "Liczba odwiedzonych przez robota Bing stron.", + "BingCrawlDNSFailures": "Błędy DNS", + "BingCrawlDNSFailuresDesc": "Ten typ błędów zawiera błędy powstałe podczas próby rozwiązania adresu Twojego serwisu przy pomocy serwera DNS. Prawdopodobną przyczyną sytuacji mogło być wyłączenie serwera lub błędna konfiguracja serwera DNS uniemożliwiająca routing, jak na przykład ustawienie TTL na 0.", + "BingCrawlErrors": "Błędy indeksowania robota Bing", + "BingCrawlErrorsDesc": "Liczba błędów zauważonych przez robota Bing.", + "BingCrawlErrorsFromDateX": "Ten raport wskazuje błędy indeksowania zgłoszone przez robota Bing. Nie zawiera danych historycznych. Ostatnia aktualizacja %s", + "BingCrawlHttpStatus2xx": "Kody HTTP 200-299", + "BingCrawlHttpStatus2xxDesc": "Te kody są zwracane przez serwer, gdy strona zostanie wygenerowana poprawnie", + "BingCrawlHttpStatus301": "Kod HTTP 301 (Trwale przeniesiony)", + "BingCrawlHttpStatus301Desc": "Ten kod występuje gdy na stałe przeniesiesz zawartość z jednej lokalizacji (adresu URL) do innej.", + "BingCrawlHttpStatus302": "Kod HTTP 302 (Przeniesiony czasowo)", + "BingCrawlHttpStatus302Desc": "Ten kod jest zwracany przez serwer dla zawartości, którą czasowo przeniesiono z jednej lokalizacji (adres URL) do innej.", + "BingCrawlHttpStatus4xx": "Kody HTTP 400 - 499 (Błędy żądania)", + "BingCrawlHttpStatus4xxDesc": "Kody te są zwracane, gdy zaistnieje obawa, że żądanie wysłane do serwera było niepoprawne, co uniemożliwiło serwerowi jego przetworzenie.", + "BingCrawlHttpStatus5xx": "Kody HTTP 500 - 599 (Wewnętrzne błędy serwera)", + "BingCrawlHttpStatus5xxDesc": "Te kody zwracane są w sytuacji , gdy serwerowi nie uda się zwrócić odpowiedzi dla poprawnego żądania.", + "BingCrawlImportantBlockedByRobotsTxt": "Ważna strona wykluczona w pliku robots.txt", + "BingCrawlInboundLink": "Link wprowadzające", + "BingCrawlInboundLinkDesc": "Liczba linków postrzeganych przez Bing jako linki kierujące do wybranego serwisu. Są to linki z zewnętrznych stron, które wskazują na Twoje treści.", + "BingCrawlingStats": "Przegląd indeksowania Bing i Yahoo!", + "BingCrawlingStatsDocumentation": "Zestawienie indeksowania pozwala Ci zapoznać się z informacjami, które pochodzą z interfejsu robota takimi jak błędy indeksowania, elementy blokowane przez Twój plik robots.txt i adresu URL potencjalnie zainfekowane malware'm.", + "BingCrawlMalwareInfected": "Strony zainfekowane malware", + "BingCrawlMalwareInfectedDesc": "Dowolne strony, które Bing uzna za zainfekowane lub powiązane z malware zostaną zgrupowane w tej sekcji.", + "BingCrawlPagesInIndex": "Liczba zindeksowanych stron", + "BingCrawlPagesInIndexDesc": "Całkowita liczba stron dostępnych w indeksie Bing", + "BingCrawlStatsOtherCodes": "Pozostałe kody HTTP", + "BingCrawlStatsOtherCodesDesc": "Zawiera pozostałe kody, które nie zostały dopasowane (takie jak 1xx czy kody informacyjne).", + "BingKeywordImport": "Import słów kluczowych z Bing", + "BingKeywords": "Słowa kluczowe (Bing i Yahoo!)", + "BingKeywordsDocumentation": "Słowa kluczowe użyte w wyszukiwaniach Bing lub Yahoo!, które spowodowały wygenerowanie linków do Twojego serwisu na liście wyników.", + "BingKeywordsNoRangeReports": "Słowa kluczowe dla wyszukiwarek Bing lub Yahoo! mogą być przetwarzane jedynie w zakresie dat obejmujących pełne tygodnie lub miesiące, ponieważ nie są dostępne jako raporty dzienne.", + "BingKeywordsNotDaily": "Słowa kluczowe w Bing i Yahoo! dostępne są jedynie jako raporty tygodniowe. Nie występują tam zestawienia dzienne.", + "BingWebmasterApiUrl": "Adres Narzędzi Webmastera Bing", + "BingWebmasterApiUrlDescription": "Wprowadź adres serwisu dostępny w Twoich Narzędziach Webmastera Bing", + "Category": "Kategoria", + "ChangeConfiguration": "Zmiana konfiguracji", + "Clicks": "Kliknięcia", + "ClicksDocumentation": "Kliknięcie zaliczane jest za każdym razem, gdy odwiedzający kliknie w link prowadzący do Twojego serwisu ze strony wyników wyszukiwarki.", + "ClientConfigImported": "Konfiguracja klienta została poprawnie zaimportowana!", + "ClientConfigSaveError": "Wystąpił błąd podczas zapisu konfiguracji klienta. Proszę upewnij się, że podana konfiguracja jest poprawna i spróbuj ponownie.", + "ClientId": "ID klienta", + "ClientSecret": "Hasło klienta", + "ConfigAvailableNoWebsiteConfigured": "Integracja została poprawnie skonfigurowana, lecz nie skonfigurowano żadnego serwisu do importu.", + "ConfigRemovalConfirm": "Zamierzasz usunąć konfigurację dla %1$s. Import słów kluczowych dla tego serwisu zostanie wyłączony. Czy chcesz kontynuować?", + "Configuration": "Ustawienia", + "ConfigurationDescription": "Ta wtyczka pozwala Ci zaimportować bezpośrednio do Matomo wszystkie słowa kluczowe wyszukiwane przez Twoich odwiedzających w wyszukiwarkach.", + "ConfigurationFile": "Plik ustawień", + "ConfigurationValid": "Twoja konfiguracja OAuth jest prawidłowa.", + "ConfiguredAccounts": "ustawione konta", + "ConfiguredUrlNotAvailable": "Ustawiony adres URL nie jest dostępny dla tego konta", + "ConfigureMeasurableBelow": "Aby skonfigurować serwis, kliknij przycisk poniżej lub skonfiguruj go bezpośrednio w ustawieniach serwisu.", + "ConfigureMeasurables": "Skonfiguruj serwisy", + "ConnectAccount": "Podłącz konto", + "ConnectFirstAccount": "Zacznij od podłączenia poniżej pierwszego konta.", + "ConnectGoogleAccounts": "Połącz konto(a) Google", + "ContainingSitemaps": "Zawierające mapy strony", + "CrawlingErrors": "Błędy indeksowania", + "CrawlingStats": "Przegląd indeksowania", + "Ctr": "CTR", + "CtrDocumentation": "Współczynnik kliknięć: współczynnik pokazujący jak często użytkownicy wyszukiwarki klikają link do Twojego serwisu wyświetlany na stronie wyników.", + "CurrentlyConnectedAccounts": "Obecnie podłączone są %1$s konto\/a.", + "EnabledSearchTypes": "Przechwytywane słowa kluczowe", + "FetchImageKeyword": "Przechwytuj słowa kluczowe grafik", + "FetchImageKeywordDesc": "Przechwytuj słowa kluczowe użyte w wyszukiwarce grafik Google", + "FetchVideoKeyword": "Przechwytuj słowa kluczowe wideo", + "FetchVideoKeywordDesc": "Przechwytuj słowa kluczowe użyte w wyszukiwarce wideo Google", + "FetchWebKeyword": "Przechwytuj słowa kluczowe wyszukiwarki", + "FetchWebKeywordDesc": "Przechwytuj słowa kluczowe użyte w wyszukiwarce Google", + "FirstDetected": "Pierwsze wykryte", + "GoogleAccountAccessTypeOfflineAccess": "Dostęp offline<\/strong> jest wymagany do importu Twoich słów kluczowych podczas, gdy ty nie jesteś zalogowany\/a.", + "GoogleAccountAccessTypeProfileInfo": "Dane profilu<\/strong> wykorzystujemy do wyświetlenia nazwy obecnie podłączonego kont(a).", + "GoogleAccountAccessTypeSearchConsoleData": "Dane Konsoli Wyszukiwania<\/strong> są niezbędne do uzyskania dostępu do Twoich słów kluczowych w Google.", + "GoogleAccountError": "Wystąpił błąd podczas walidacji dostępu OAuth: %1$s", + "GoogleAccountOk": "Dostęp OAuth zweryfikowany poprawnie.", + "GoogleConfigurationDescription": "Konsola Wyszukiwania Google wykorzystuje OAuth do autentykacji i autoryzacji.", + "GoogleConfigurationTitle": "Skonfiguruj import z Konsoli Wyszukiwania Google", + "GoogleKeywordImport": "Import słów kluczowych Google", + "GoogleSearchConsoleUrl": "Adres Konsoli Wyszukiwania Google", + "GoogleSearchConsoleUrlDescription": "Wprowadź adres, pod którym ta strona dostępna jest w Twojej Konsoli Wyszukiwania Google", + "GoogleUploadOrPasteClientConfig": "Proszę prześlij swoją konfigurację klienta Google OAuth, lub wklej ją w pola poniżej.", + "HowToGetOAuthClientConfig": "Skąd pobrać konfigurację klienta OAuth", + "ImageKeywords": "Słowa kluczowe grafik w Google", + "ImageKeywordsDocumentation": "Słowa kluczowe użyte w wyszukiwarce grafik<\/b> Google, które na liście wyników wygenerowały linki do Twojego serwisu.", + "Impressions": "Dopasowania", + "ImpressionsDocumentation": "Dopasowanie zostanie zaliczone za każdym razem, gdy Twój serwis pojawi się na stronie wyników wyszukiwania wyszukiwarki.", + "IntegrationConfigured": "Integracja skonfigurowana pomyślnie", + "IntegrationNotConfigured": "Integracja jeszcze nie skonfigurowana", + "KeywordsCombined": "Skojarzone słowa kluczowe", + "KeywordsCombinedDocumentation": "Raport kojarzący wszystkie słowa kluczowe wykryte przez Matomo i zaimportowane z wyszukiwarki. Raport ten prezentuje jedynie wskaźniki odwiedzin. Możesz przełączyć się na powiązany raport, aby uzyskać więcej szczegółowych wskaźników.", + "KeywordsCombinedImported": "Skojarzone słowa kluczowe zaimportowane", + "KeywordsCombinedImportedDocumentation": "Raport prezentujący wszystkie zaimportowane słowa kluczowe ze wszystkich skonfigurowanych wyszukiwarek.", + "KeywordsReferrers": "Słowa kluczowe (włączając niezdefiniowane)", + "KeywordStatistics": "Wyszukiwane słowa kluczowe", + "KeywordTypeImage": "grafika", + "KeywordTypeVideo": "wideo", + "KeywordTypeWeb": "sieć", + "LastCrawled": "Ostatnia indeksacja", + "LastDetected": "Ostatnie sprawdzenie", + "LastImport": "Ostatni import", + "LatestAvailableDate": "Najświeższe słowa kluczowe dostępne dla %1$s", + "LinksToUrl": "Linkuje do %s", + "ManageAPIKeys": "Zarządzaj kluczami API", + "MeasurableConfig": "skonfigurowane serwisy", + "NoSegmentation": "Raport nie wspiera segmentacji. Dane wyświetlane są w standardowym, ciągłym raporcie.", + "NotAvailable": "Niedostępne", + "NoWebsiteConfigured": "Nie masz żadnego skonfigurowanego serwisu. Import dla wybranego serwisu możliwy jest dopiero po skonfigurowaniu go tu.", + "NoWebsiteConfiguredWarning": "Import dla %s nie jest w pełni skonfigurowany. Musisz skonfigurować serwis, aby umożliwić import.", + "OAuthClientConfig": "Konfiguracja klienta OAuth", + "OAuthError": "Wystąpił błąd podczas autentykacji OAuth. Proszę spróbuj ponownie i upewnij się, że zaakceptujesz wymagane uprawnienia.", + "Platform": "Platforma", + "Position": "Śr. pozycja", + "PositionDocumentation": "Średnia pozycja Twojego serwisu na liście wyników wyszukiwania (dla tego słowa kluczowego).", + "ProviderBingDescription": "Importuj wszystkie słowa kluczowe użyte do odnalezienia Twojego serwisu w Bing'u<\/strong> i Yahoo!<\/strong>.", + "ProviderBingNote": "Uwaga:<\/u> Microsoft dostarcza zestawienia słów kluczowych w każdą sobotę i tylko dla pełnych tygodni. W rezultacie Twoje słowa kluczowe z Bing i Yahoo! potrzebują paru dni, aby pojawić się w Twoich raportach i dostępne są tylko w widokach tygodniowych, miesięcznych i rocznych.", + "ProviderGoogleDescription": "Importuj wszystkie słowa kluczowe użyte do odnalezienia Twojego serwisu w Google<\/strong>. Raporty prezentują słowa kluczowe podzielone na typy wyszukiwań (sieć, grafika i wideo).", + "ProviderListDescription": "Po zakończeniu konfiguracji jednej (lub kilku) wyszukiwarek, możesz poniżej skonfigurować dla których serwisów Matomo będzie importowało słowa kluczowe.", + "ProviderXAccountWarning": "Wykryto błędy konfiguracji konta<\/strong>
Proszę sprawdź skonfigurowane serwisu pod kątem %s<\/strong>.", + "ProviderXSitesWarning": "Wykryto błędy konfiguracji serwisu<\/strong>
Proszę sprawdź skonfigurowane serwisy pod koątem %s<\/strong>.", + "ReAddAccountIfPermanentError": "Jeśli ten błąd będzie się powtarzał, spróbuj usunąć i ponownie dodać konto.", + "RequiredAccessTypes": "Wymagane typy dostępów:", + "ResponseCode": "Kod odpowiedzi", + "RoundKeywordPosition": "Przybliżona pozycja słowa kluczowego", + "SearchEngineKeywordsPerformance": "Wydajność wyszukiwania słów kluczowych", + "SetupConfiguration": "Rozpocznij konfigurację", + "SitemapsContainingUrl": "Mapy stron zawierają %s", + "KeywordsSubtableOriginal": "Śledzone słowa kluczowe (włączając niezdefiniowane)", + "KeywordsSubtableImported": "Zaimportowane słowa kluczowe", + "AllReferrersOriginal": "Odnośniki (ze śledzonymi słowa kluczowe)", + "AllReferrersImported": "Odnośniki (z zaimportowanymi słowa kluczowe)", + "SearchEnginesOriginal": "Wyszukiwarki (z śledzonymi słowami kluczowymi)", + "SearchEnginesImported": "Wyszukiwarki (z zaimportowanymi słowami kluczowymi)", + "StartOAuth": "Rozpocznij autoryzację OAuth", + "UnverifiedSites": "Niezweryfikowane serwisy:", + "UploadOAuthClientConfig": "Prześlij swoją konfigurację klienta OAuth", + "UrlOfAccount": "Adres (Konto)", + "VideoKeywords": "Słowa kluczowe w wynikach Google Wideo", + "VideoKeywordsDocumentation": "Słowa kluczowe użyte w wyszukiwarce Filmy<\/b> Google, które na liście wyników wygenerowały linki do Twojego serwisu.", + "WebKeywords": "Wszystkie słowa kluczowe Google", + "WebKeywordsDocumentation": "Słowa kluczowe użyte w wyszukiwarce Wszystko<\/b> Google, które na liście wyników wygenerowały linki do Twojego serwisu.", + "WebsiteSuccessfulConfigured": "Gratulacje!
Udało Ci się poprawnie skonfigurować import słów kluczowych dla serwisu %1$s.
Do importu i pojawienia się pierwszych słów kluczowych w Odnośniki > Słowa kluczowe może upłynąć kilka dni. Więcej informacji odnośnie opóźnień podczas importu słów kluczowych i ograniczeń znajdziesz w naszym %2$sFAQ%3$s", + "WebsiteTypeUnsupported": "Wybrany wskaźnik %1$s nie może zostać skonfigurowany ponieważ ma niewspierany typ. Tylko wskaźniki typu 'website' są wspierane.", + "WebsiteTypeUnsupportedRollUp": "Uwaga: Dla stron zbiorczych zaimportowane dane automatycznie zostaną połączone dla wszystkich podstron", + "YandexCrawlHttpStatus2xx": "Kody HTTP 200-299", + "YandexCrawlHttpStatus4xx": "Kody HTTP 400 - 499 (Błędy żądania)", + "YandexCrawlHttpStatus5xx": "Kody HTTP 500 - 599 (Wewnętrzne błędy serwera)", + "YandexCrawlInIndex": "Liczba zindeksowanych stron" + } +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/pt.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/pt.json new file mode 100644 index 0000000..5bcb03e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/pt.json @@ -0,0 +1,178 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "Adicionado por %1$s a %2$s", + "AccountConnectionValidationError": "Ocorreu um erro a validar a ligação à conta:", + "AccountDoesNotExist": "A conta configurada %1$s já não existe", + "AccountNoAccess": "Atualmente esta conta não tem acesso a qualquer site.", + "AccountRemovalConfirm": "Você vai remover a conta %1$s. Isto pode desativar a importação de palavras-chave para quaisquer sites ligados. Continuar mesmo assim?", + "ActivityAccountAdded": "foi adicionada uma nova conta para fornecimento de palavras-chave %1$s: %2$s", + "ActivityAccountRemoved": "removeu uma conta para fornecimento de palavras-chave %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "a configuração do cliente Google foi alterada.", + "AddAPIKey": "Adicionar uma chave da API", + "AddConfiguration": "Adicionar configuração", + "AdminMenuTitle": "Desempenho da pesquisa", + "APIKey": "Chave da API", + "AvailableSites": "Sites disponíveis para importação:", + "Domain": "Domínio", + "DomainProperty": "Propriedade do domínio", + "DomainPropertyInfo": "Inclui todos os subdomínios (m, www e assim por diante) e os ambos protocolos (http e https).", + "URLPrefix": "Prefixo do endereço", + "URLPrefixProperty": "Propriedade do prefixo do endereço", + "URLPrefixPropertyInfo": "Inclui somente endereços com o prefixo exato especificado, incluindo o protocolo (http/https). Se quiser que sua propriedade corresponda a qualquer protocolo ou subdomínio (http/https/www./m e assim por diante), adicione uma propriedade do domínio.", + "BingAccountError": "Ocorreu um erro ao validar a chave da API: %1$s. Se acabou de ferar esta chave da API nas Bing Webmaster Tools, por favor tente novamente dentro de um ou dois minutos (as chaves da API nas Bing Webmaster Tools demoram algum tempo até serem ativadas).", + "BingAccountOk": "Chave da API confirmada com sucesso", + "BingConfigurationDescription": "As Bing Webmaster Tools necessitam de uma chave da API para serem acedidas. Pode adicionar aqui chaves da API para aceder aos dados dos seus sites.", + "BingConfigurationTitle": "Configurar a importação das Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Exclusão do Robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "Endereços atualmente bloqueados pelo robots.txt do seu site.", + "BingCrawlConnectionTimeout": "Ligações expiradas", + "BingCrawlConnectionTimeoutDesc": "Este número representa ocorrências recentes quando o Bing não conseguiu aceder ao seu site devido a erros de ligação. Isto pode ser um problema temporário mas deve confirmar os registos do servidor para confirmar se está, acidentalmente, a perder pedidos.", + "BingCrawlCrawledPages": "Páginas indexadas", + "BingCrawlCrawledPagesDesc": "Número de páginas que o rastreador do Bing solicitou.", + "BingCrawlDNSFailures": "Falhas de DNS", + "BingCrawlDNSFailuresDesc": "Este tipo de problema cataloga erros recentes encontrados ao tentar comunicar com o servidor de DNS quando o bot tentou aceder às suas páginas. Possivelmente o servidor esteve em baixo ou ocorreu uma falha na configuração que impediu o encaminhamento DNS, por exemplo, o TTL foi definido como 0.", + "BingCrawlErrors": "Erros de indexação no Bing", + "BingCrawlErrorsDesc": "O número de erros que ocorreram para o indexador do Bing.", + "BingCrawlErrorsFromDateX": "O relatório mostra erros de indexação reportados recentemente pelo Bing. Não fornece qualquer dado histórico. Última atualização: %s", + "BingCrawlHttpStatus2xx": "Código HTTP 200-299", + "BingCrawlHttpStatus2xxDesc": "Estes códigos aparecem quando um servidor serve uma página com sucesso", + "BingCrawlHttpStatus301": "Código HTTP 301 (Movido de forma permanente)", + "BingCrawlHttpStatus301Desc": "Estes códigos aparecem quando moveu, de forma permanente, conteúdos de uma localização (endereço) para outra.", + "BingCrawlHttpStatus302": "Código HTTP 302 (Movido de forma temporária)", + "BingCrawlHttpStatus302Desc": "Estes códigos aparecem quando moveu, de forma temporária, conteúdos de uma localização (endereço) para outra.", + "BingCrawlHttpStatus4xx": "Código HTTP 400-499 (Erros de solicitação)", + "BingCrawlHttpStatus4xxDesc": "Estes erros aparecem quando provavelmente ocorreu um erro no pedido que impediu o servidor de o processar.", + "BingCrawlHttpStatus5xx": "Código HTTP 500-599 (Erros interno do servidor)", + "BingCrawlHttpStatus5xxDesc": "Estes códigos aparecem quando o servidor não conseguiu satisfazer um pedido aparentemente válido.", + "BingCrawlImportantBlockedByRobotsTxt": "Exclusão de uma página importante por parte do robots.txt", + "BingCrawlInboundLink": "Total de ligações de entrada", + "BingCrawlInboundLinkDesc": "Ligações de entrada que apontam para o seu site e que o Bing conhece. Estas são ligações que sites externos ao seu, apontam para o seu conteúdo.", + "BingCrawlingStats": "Visão geral da indexação para o Bing e Yahoo!", + "BingCrawlingStatsDocumentation": "A visão geral da indexação permite-lhe ver informação relacionada com o rastreamento, tais como erros encontrados pelo bot de pesquisa ao visitar uma página, itens bloqueados pelo seu ficheiro robots.txt e endereços potencialmente afetados por software malicioso.", + "BingCrawlMalwareInfected": "Sites infetados com software malicioso", + "BingCrawlMalwareInfectedDesc": "Quaisquer endereços de páginas que o Bing encontrou e que estão infetadas ou associadas a software malicioso serão agrupadas nesta secção.", + "BingCrawlPagesInIndex": "Total de páginas no índice", + "BingCrawlPagesInIndexDesc": "Número total de páginas disponíveis no índice do Bing", + "BingCrawlStatsOtherCodes": "Todos os outros códigos de estado HTTP", + "BingCrawlStatsOtherCodesDesc": "Agrupa todos os outros códigos que não coincidem com qualquer outro valor (tais como 1xx ou códigos de informação).", + "BingKeywordImport": "Importação de palavras-chave do Bing", + "BingKeywords": "Palavras-chave (no Bing e Yahoo!)", + "BingKeywordsDocumentation": "Palavras-chave utilizadas na pesquisa do Bing ou Yahoo! que geraram ligações para o seu site na listagem de resultados de pesquisa.", + "BingKeywordsNoRangeReports": "As palavras-chave no Bing e Yahoo! apenas podem ser processadas para intervalos de datas personalizados, incluindo semanas ou meses completos dado que não estão disponíveis como relatórios diários.", + "BingKeywordsNotDaily": "As palavras-chave no Bing e Yahoo! apenas estão disponíveis como relatórios semanais. Não existem dados de palavras-chave para períodos diários.", + "BingWebmasterApiUrl": "Endereço para as Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Forneça o endereço no qual este site está disponível nas suas Bing Webmaster Tools", + "Category": "Categoria", + "ChangeConfiguration": "Alterar configuração", + "Clicks": "Cliques", + "ClicksDocumentation": "É contabilizado um clique de cada vez que alguém clica numa ligação que aponta para o seu site numa página de resultados do motor de pesquisa.", + "ClientConfigImported": "A configuração do cliente foi importada com sucesso!", + "ClientConfigSaveError": "Ocorreu um erro ao guardar a configuração do cliente. Por favor, confirme se a configuração fornecida é válida e tente novamente.", + "ClientId": "ID do cliente", + "ClientSecret": "Segredo do cliente", + "ConfigAvailableNoWebsiteConfigured": "A integração foi configurada com sucesso, mas neste momento não existe nenhum site configurado para importação.", + "ConfigRemovalConfirm": "Você vai remover a configuração para %1$s. A importação de palavras-chave para esse site vai ser desativada. Continuar mesmo assim?", + "Configuration": "Configuração", + "ConfigurationDescription": "Esta extensão permite-lhe importar diretamente para o Matomo todas as palavras-chave pesquisadas pelos seus utilizadores em motores de pesquisa.", + "ConfigurationFile": "Ficheiro de configuração", + "ConfigurationValid": "A sua configuração OAuth é válida.", + "ConfiguredAccounts": "contas configuradas", + "ConfiguredUrlNotAvailable": "O endereço configurado não está disponível para esta conta", + "ConfigureMeasurableBelow": "Para configurar um site, simplesmente clique no botão abaixo ou configure o mesmo diretamente nas definições do site.", + "ConfigureMeasurables": "Configurar sites", + "ConnectAccount": "Associar conta", + "ConnectFirstAccount": "Comece por associar a sua primeira conta abaixo.", + "ConnectGoogleAccounts": "Associar Conta(s) Google", + "ContainingSitemaps": "Mapas do site incluídos", + "CrawlingErrors": "Erros de indexação", + "CrawlingStats": "Visão geral da indexação", + "Ctr": "CTR", + "CtrDocumentation": "Taxa de cliques CTR: Uma taxa que mostra com que frequência as pessoas que vêm uma página de resultados com uma ligação para o seu site, acabam por clicar na mesma.", + "CurrentlyConnectedAccounts": "Atualmente existem %1$s contas associadas.", + "EnabledSearchTypes": "Tipos de palavras-chave a obter", + "FetchImageKeyword": "Obter palavras-chave de imagens", + "FetchImageKeywordDesc": "Obter palavras-chave utilizadas na pesquisa de imagens do Google", + "FetchVideoKeyword": "Obter palavras-chave de vídeos", + "FetchVideoKeywordDesc": "Obter palavras-chave utilizadas na pesquisa de vídeos do Google", + "FetchWebKeyword": "Obter palavras-chave da web", + "FetchWebKeywordDesc": "Obter palavras-chave utilizadas na pesquisa web do Google", + "FirstDetected": "Detetado pela primeira vez", + "GoogleAccountAccessTypeOfflineAccess": "Acesso offline é necessário para ser possível importar palavras-chave mesmo quando não tem sessão iniciada.", + "GoogleAccountAccessTypeProfileInfo": "A informação do perfil é utilizada para mostrar o nome da(s) conta(s) atualmente associada(s).", + "GoogleAccountAccessTypeSearchConsoleData": "Dados da consola de pesquisa é necessário para obter acesso às suas palavras-chave da pesquisa do Google.", + "GoogleAccountError": "Ocorreu um erro ao validar o acesso OAuth: %1$s", + "GoogleAccountOk": "Acesso OAuth confirmado com sucesso.", + "GoogleConfigurationDescription": "A consola de pesquisa do Google utiliza o OAuth para autenticação e autorização.", + "GoogleConfigurationTitle": "Configurar a importação da consola de pesquisa do Google", + "GoogleKeywordImport": "Importação das palavras-chave do Google", + "GoogleSearchConsoleUrl": "Endereço para a consola de pesquisa do Google", + "GoogleSearchConsoleUrlDescription": "Forneça o endereço no qual este site está disponível na Consola de pesquisa do Google", + "GoogleUploadOrPasteClientConfig": "Por favor, envie a sua configuração do cliente Google OAuth ou insira a mesma no campo abaixo.", + "HowToGetOAuthClientConfig": "Como obter a sua configuração do cliente Google OAuth", + "ImageKeywords": "Palavras-chave de imagem no Google", + "ImageKeywordsDocumentation": "Palavras-chave utilizadas na pesquisa de imagens do Google que geraram ligações para o seu site na lista de resultados de pesquisa.", + "Impressions": "Impressões", + "ImpressionsDocumentation": "É contabillizada uma impressão sempre que o seu site é apresentado numa página de resultados de pesquisa.", + "IntegrationConfigured": "Integração configurada com sucesso", + "IntegrationNotConfigured": "Integração não configurada", + "KeywordsCombined": "Palavras-chave combinadas", + "KeywordsCombinedDocumentation": "Relatório que combina todas as palavras-chave detetadas pelo Matomo e importadas dos motores de pesquisa. Este relatório apenas inclui a métrica das visitas. Pode mudar para um dos relatórios relacionados para obter métricas detalhadas.", + "KeywordsCombinedImported": "Palavras-chaves importadas combinadas", + "KeywordsCombinedImportedDocumentation": "Relatório que mostra todas as palavras-chave importadas de todos os motores de pesquisa configurados.", + "KeywordsReferrers": "Palavras-chave (incluindo não definidas)", + "KeywordStatistics": "Palavras-chave de Pesquisa", + "KeywordTypeImage": "imagem", + "KeywordTypeVideo": "vídeo", + "KeywordTypeWeb": "web", + "LastCrawled": "Última indexação", + "LastDetected": "Última deteção", + "LastImport": "Última importação", + "LatestAvailableDate": "Os dados mais recentes de palavras-chave são para %1$s", + "LinksToUrl": "Ligações para %s", + "ManageAPIKeys": "Gerir Chaves da API", + "MeasurableConfig": "sites configurados", + "NoSegmentation": "O relatório não suporta segmentação. Os dados apresentados são os dados predefinidos e não-segmentados.", + "NotAvailable": "Não disponível", + "NoWebsiteConfigured": "Não existe atualmente nenhum site configurado. Para ativar a importação para um site específico, por favor, defina a configuração aqui.", + "NoWebsiteConfiguredWarning": "A importação para %s não está totalmente configurada. Necessita de configurar alguns sites para ativar a importação.", + "OAuthClientConfig": "Configuração do cliente OAuth", + "OAuthError": "Ocorreu um erro no processo OAuth. Por favor, tente novamente e garanta que aceita as permissões solicitadas.", + "Platform": "Plataforma", + "Position": "Posição média", + "PositionDocumentation": "Posição média do seu site na lista de resultados do motor de pesquisa (para esta palavra-chave).", + "ProviderBingDescription": "Importar todas as palavras-chave utilizadas para encontrar o seu site na pesquisa do Bing e Yahoo!.", + "ProviderBingNote": "Nota: A Microsoft fornece dados de palavras-chave todos os sábados e apenas para semanas inteiras. Como consequência, as suas palavras-chave do Bing e Yahoo irão demorar alguns dias a serem apresentadas nos seus relatórios e só estarão disponíveis quando visualizar semanas, meses ou anos.", + "ProviderGoogleDescription": "Importar todas as palavras-chave utilizadas para encontrar o seu site na pesquisa do Google. Os relatórios irão mostrar as suas palavras-chave separadamente para cada tipo de pesquisa (Web, Imagens e Vídeos).", + "ProviderListDescription": "Quando tiver configurado com sucesso um (ou mais) motor(es) de pesquisa em baixo, pode configurar para que site(s) da Web deverá o Matomo importar as suas palavras-chave de pesquisa.", + "ProviderXAccountWarning": "Detetados problemas de configuração de conta
Por favor, confirme as contas configuradas para %s.", + "ProviderXSitesWarning": "Detetados problemas de configuração do site da Web
Por favor, confirme os sites da Web configurados para %s.", + "ReAddAccountIfPermanentError": "Este é um erro permanente, tente remover a conta e associe a mesma novamente.", + "RequiredAccessTypes": "São necessários estes tipos de acesso:", + "ResponseCode": "Código de resposta", + "RoundKeywordPosition": "Posição arredondada da palavra-chave", + "SearchEngineKeywordsPerformance": "Desempenho das palavras chave no motor de pesquisa", + "SetupConfiguration": "Configuração", + "SitemapsContainingUrl": "Mapas de site que contêm %s", + "KeywordsSubtableOriginal": "Palavras chave rastreadas (incluindo não definidas)", + "KeywordsSubtableImported": "Palavras-chave importadas", + "AllReferrersOriginal": "Referentes (com palavras-chave rastreadas)", + "AllReferrersImported": "Referentes (com palavras-chave importadas)", + "SearchEnginesOriginal": "Motores de pesquisa (com palavras-chave rastreadas)", + "SearchEnginesImported": "Motores de pesquisa (com palavras-chave importadas)", + "StartOAuth": "Iniciar processo OAuth", + "UnverifiedSites": "Sites não-confirmados:", + "UploadOAuthClientConfig": "Enviar a configuração do cliente OAuth", + "UrlOfAccount": "Endereço (conta)", + "VideoKeywords": "Palavras-chave de vídeo no Google", + "VideoKeywordsDocumentation": "As palavras-chave utilizadas na pesquisa vídeo do Google que geraram ligações para o seu site na lista de resultados de pesquisa.", + "WebKeywords": "Palavras-chave da Web no Google", + "WebKeywordsDocumentation": "As palavras-chave utilizadas na pesquisa da Web do Google que geraram hiperligações para o seu site da Web na lista de resultados de pesquisa.", + "WebsiteSuccessfulConfigured": "Parabéns!
Configurou com sucesso a importação de palavras-chave para o site %1$s.
Pode demorar alguns dias até que as suas primeiras palavras-chave de pesquisa sejam importadas e apresentadas em Referentes > Palavras-chave de pesquisa. Pode encontrar mais informação sobre os atrasos e limitações na importação de palavras-chave na nossa %2$sFAQ%3$s", + "WebsiteTypeUnsupported": "A métrica %1$s selecionada não pode ser configurada dados que não é um tipo suportado. Apenas métricas do tipo 'site' são suportadas.", + "WebsiteTypeUnsupportedRollUp": "Nota: Sites agregados irão combinar automaticamente os dados importados de todos os respetivos sites descendentes.", + "YandexCrawlHttpStatus2xx": "Código HTTP 200-299", + "YandexCrawlHttpStatus4xx": "Código HTTP 400-499 (Erros de solicitação)", + "YandexCrawlHttpStatus5xx": "Código HTTP 500-599 (Erros interno do servidor)", + "YandexCrawlInIndex": "Total de páginas no índice" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ro.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ro.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ro.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ru.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ru.json new file mode 100644 index 0000000..d662b53 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/ru.json @@ -0,0 +1,81 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "API-ключ", + "AccountAddedBy": "Добавлено %1$s для %2$s", + "AccountConnectionValidationError": "Произошла ошибка при проверке подключения учетной записи:", + "AccountDoesNotExist": "Настроенный аккаунт %1$s больше не существует", + "AccountNoAccess": "У данной учётной записи сейчас нет доступа к какому либо веб-сайту.", + "AccountRemovalConfirm": "Вы собираетесь удалить аккаунт %1$s. Это может отключить импорт ключевых слов для любых подключенных веб-сайтов. Все равно продолжить?", + "ActivityAccountAdded": "добавлен новый аккаунт для провайдера ключевых слов %1$s: %2$s", + "ActivityAccountRemoved": "удалён аккаунт для провайдера ключевых слов %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "изменили конфигурацию клиента Google.", + "AddAPIKey": "Добавить API-ключ", + "AddConfiguration": "Добавить конфигурацию", + "AdminMenuTitle": "Поисковые фразы", + "AvailableSites": "Сайты, доступные для импорта:", + "BingAPIKeyInstruction": "Войдите в %1$sBing Webmaster Tools%2$s, затем добавьте свой сайт в Bing Webmaster. После его проверки вы можете %3$sскопировать свой API-ключ%4$s.", + "BingAccountError": "Произошла ошибка при проверке API-ключа: %1$s. Если вы только что сгенерировали этот API-ключ в Bing Webmaster Tools, повторите попытку через пару минут (для активации API-ключей в Bing Webmaster Tools требуется некоторое время).", + "BingAccountOk": "API-ключ успешно проверен", + "BingConfigurationDescription": "Для доступа к Bing Webmaster Tools необходим ключ API. Здесь вы можете добавить API-ключи для доступа к данным вашего сайта.", + "BingConfigurationTitle": "Настройка импорта из Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Исключение robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "URLы в настоящее время заблокированы в файле robots.txt.", + "BingCrawlConnectionTimeout": "Тайм-ауты соединения", + "BingCrawlConnectionTimeoutDesc": "Это число отражает недавние случаи, когда Bing не мог получить доступ к вашему сайту из-за ошибок подключения. Это может быть временная проблема, но вы должны проверить журналы вашего сервера, чтобы убедиться, что вы случайно не закрываете запросы.", + "BingCrawlCrawledPages": "Просканировано страниц", + "BingCrawlCrawledPagesDesc": "Количество страниц, просканированных Bing.", + "BingCrawlDNSFailures": "Сбои DNS", + "BingCrawlDNSFailuresDesc": "Этот тип проблемы каталогизирует недавние ошибки, возникающие при попытке связаться с DNS-сервером, когда бот пытался получить доступ к вашим страницам. Возможно, ваш сервер не работает или произошла неправильная конфигурация, которая препятствовала маршрутизации DNS, например, для TTL было установлено значение 0.", + "BingCrawlErrors": "Ошибки сканирования у Bing", + "BingCrawlErrorsDesc": "Количество ошибок, произошедших у сканера Bing.", + "BingCrawlErrorsFromDateX": "Отчет показывает ошибки сканирования, недавно обнаруженные Bing. Он не предоставляет никаких исторических данных. Последнее обновление %s", + "BingCrawlHttpStatus2xx": "HTTP код 200-299", + "BingCrawlHttpStatus2xxDesc": "Эти коды означают успешную загрузку страниц", + "BingCrawlHttpStatus301": "HTTP код 301 (постоянный редирект)", + "BingCrawlHttpStatus301Desc": "Этот код означает, что вы навсегда переместили контент из одного местоположения (URL-адрес) в другое.", + "BingCrawlHttpStatus302": "HTTP код 302 (временный редирект)", + "BingCrawlHttpStatus302Desc": "Этот код означает, что вы временно переместили контент из одного местоположения (URL-адрес) в другое.", + "BingCrawlHttpStatus4xx": "HTTP код 400-499 (ошибки запроса)", + "BingCrawlHttpStatus4xxDesc": "Эти коды означают, что в запросе, вероятно, произошла ошибка, из-за которой сервер не смог её обработать.", + "BingCrawlHttpStatus5xx": "HTTP код 500-599 (ошибки сервера)", + "BingCrawlHttpStatus5xxDesc": "Эти коды означают, когда сервер не в состоянии выполнить корректный запрос.", + "BingCrawlImportantBlockedByRobotsTxt": "Исключение важной страницы robots.txt", + "BingCrawlInboundLink": "Всего входящих ссылок", + "BingCrawlPagesInIndexDesc": "Общее количество страниц, доступных в индексе Bing", + "BingCrawlingStats": "Обзор сканирования для Bing и Yahoo!", + "BingKeywords": "Ключевые слова (на Bing и Yahoo!)", + "BingKeywordsNoRangeReports": "Ключевые слова на Bing и Yahoo! могут обрабатываться только для пользовательских диапазонов дат, включая полные недели или месяцы, поскольку они недоступны в качестве ежедневных отчётов.", + "BingWebmasterApiUrl": "URL для инструментов веб-мастеров Bing", + "ChangeConfiguration": "Изменить конфигурацию", + "ConfigureMeasurableBelow": "Чтобы настроить сайт, просто нажмите кнопку ниже или настройте его прямо в настройках сайта.", + "ConfigureMeasurables": "Настроить веб-сайты", + "ConnectAccount": "Подключить аккаунт", + "ConnectGoogleAccounts": "Подключить аккаунт(ы) Google", + "CrawlingErrors": "Ошибки сканирования", + "CrawlingStats": "Обзор сканирования", + "Domain": "Доменный ресурс", + "DomainProperty": "Доменный ресурс", + "DomainPropertyInfo": "Включает URL с любыми субдоменами (m, www и др.) и обоими префиксами протокола (http, https).", + "GoogleConfigurationTitle": "Настройка импорта из Google Search Console", + "GoogleSearchConsoleUrl": "URL для консоли поиска Google", + "ImageKeywords": "Ключевые слова изображений", + "KeywordsCombined": "Словосочетания", + "KeywordsCombinedImported": "Импортированные словосочетания", + "KeywordsReferrers": "Ключевые слова (исключая импорт)", + "ManageAPIKeys": "Управление API-ключами", + "ProviderBingDescription": "Импортируйте все ключевые слова, используемые для поиска вашего сайта в поиске Bing и Yahoo!.", + "ProviderBingNote": "Примечание: Microsoft предоставляет данные о ключевых словах каждую субботу и только неделей целиком. В результате ваши ключевые слова для Bing и Yahoo появятся в ваших отчётах через несколько дней и будут доступны только при просмотре недель, месяцев или лет.", + "ProviderGoogleDescription": "Импортируйте все ключевые слова, используемые для поиска вашего сайта в поиске Google. Отчёты будут показывать ваши ключевые слова для каждого типа поиска отдельно (общий топ, изображения или видео).", + "SearchEngineKeywordsPerformance": "Поисковые запросы и ключевые слова", + "SetupConfiguration": "Настройка конфигурации", + "URLPrefix": "Ресурс с префиксом в URL", + "URLPrefixProperty": "Ресурс с префиксом в URL", + "URLPrefixPropertyInfo": "Включает только URL с конкретным префиксом, в том числе указывающим на протокол (http или https). Если вам нужно, чтобы к ресурсу относились URL с любым префиксом протокола или субдоменом (http, https, www, m и т. д.), лучше добавить доменный ресурс.", + "VideoKeywords": "Ключевые слова видео", + "WebKeywords": "Ключевые слова общего топа", + "WebsiteSuccessfulConfigured": "Поздравляем!
Вы успешно настроили импорт ключевых слов для сайта %1$s.
Это может занять несколько дней, прежде чем ваши первые поисковые ключевые слова будут импортированы и отображены в меню Источники > Ключевые слова. Вы можете найти больше информации о задержках и ограничениях импорта ключевых слов в нашем %2$sFAQ%3$s", + "YandexCrawlHttpStatus2xx": "HTTP код 200-299", + "YandexCrawlHttpStatus4xx": "HTTP код 400-499 (ошибки запроса)", + "YandexCrawlHttpStatus5xx": "HTTP код 500-599 (ошибки сервера)" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/sq.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/sq.json new file mode 100644 index 0000000..99c1766 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/sq.json @@ -0,0 +1,240 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "Kyç API", + "AccountAddedBy": "Shtuar nga %1$s%2$s", + "AccountConnectionValidationError": "Ndodhi një gabim teksa vleftësohej lidhja e llogarisë:", + "AccountDoesNotExist": "Llogaria e formësuar %1$s s’ekziston më", + "AccountNoAccess": "Kjo llogari s’ka hyrje në ndonjë sajt.", + "AccountRemovalConfirm": "Ju ndan një hap nga heqja e kësaj llogarie %1$s. Kjo mund të sjellë çaktivizimin e importimit të fjalëkyçeve për cilindo sajte(e) të lidhur. Të vazhdohet sido qoftë?", + "ActivityAccountAdded": "u shtua llogari e re për furnizues fjalëkyçesh %1$s: %2$s", + "ActivityAccountRemoved": "u hoq llogari për furnizues fjalëkyçesh %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "ndryshoi formësimi për klientin Google.", + "ActivityYandexClientConfigChanged": "u ndryshua formësimi i klientit Yandex.", + "AddAPIKey": "Shtoni Kyç API", + "AddConfiguration": "Shtoni Formësim", + "AdminMenuTitle": "Funksionim Kërkimi", + "AllReferrersImported": "Referues (me fjalëkyçe të importuar)", + "AllReferrersOriginal": "Referues (me fjalëkyçe të ndjekur)", + "AvailableSites": "Sajte të gatshëm për import:", + "BingAPIKeyInstruction": "Bëni hyrjen që nga %1$sBing Webmaster Tools%2$s, mandej shtoni sajtin tuaj te Bing Webmaster. Pasi të jetë vlerësuar, mund të %3$skopjoni kyçin tuaj API%4$s.", + "BingAccountError": "Ndodhi një gabim teksa vleftësohej Kyçi API: %1$s. Nëse sapo e keni krijuar këtë kyç API te Bing Webmaster Tools, ju lutemi riprovoni pas një a dy minutash (kyçet API në Bing Webmaster Tools duan pakëz kohë të aktivizohen).", + "BingAccountOk": "Kyç API i kontrolluar me sukses", + "BingConfigurationDescription": "Bing Webmaster Tools lyp një kyç API, që të mund të përdoret. Këtu mund të shtoni kyçe API për hyrje te të dhënat e sajtit tuaj.", + "BingConfigurationTitle": "Formësoni importim prej Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Përjashtim nga robots.txt", + "BingCrawlBlockedByRobotsTxtDesc": "URL të bllokuara aktualisht nga robots.txt i sajtit tuaj.", + "BingCrawlConnectionTimeout": "Mbarim kohe për lidhjet", + "BingCrawlConnectionTimeoutDesc": "Ky numër përfaqëson rastet së fundi kur Bing s’u fut dot te sajti juaj për shkak gabimesh lidhjeje. Ky mund të jetë një problem i përkohshëm, por do të duhej të shihnit regjistrat e shërbyesit për të parë se s’jeni duke mos pranuar aksidentalisht kërkesa.", + "BingCrawlCrawledPages": "Faqe të indeksuara", + "BingCrawlCrawledPagesDesc": "Numër faqesh të kërkuara nga indeksuesi i Bing-ut.", + "BingCrawlDNSFailures": "Dështime DNS", + "BingCrawlDNSFailuresDesc": "Ky lloj problemi katalogon gabime së fundi, të hasura teksa bëheshin përpjekje për të komunikuar me shërbyesin DNS, kur roboti u përpoq të hynte në faqet tuaja. Ka gjasa që shërbyesi juaj të ishte jashtë funksionimi, ose pati një keqformësim i cili pengoi rrugëzim DNS, për shembull, TTL qe caktuar 0.", + "BingCrawlErrors": "Gabimi indeksimi në Bing", + "BingCrawlErrorsDesc": "Numër gabimesh të hasura nga indeksuesi i Bing-ut.", + "BingCrawlErrorsFromDateX": "Raporti shfaq gabime indeksimi të raportuara së fundi nga Bing-u. Nuk jep të dhëna historike. Përditësuar së fundi më %s", + "BingCrawlHttpStatus2xx": "Kod HTTP 200-299", + "BingCrawlHttpStatus2xxDesc": "Këto kode shfaqen kur shërbyesi e shërben me sukses një faqe", + "BingCrawlHttpStatus301": "Kod HTTP 301 (Lëvizur përgjithmonë)", + "BingCrawlHttpStatus301Desc": "Këto kode shfaqen kur keni lëvizur përgjithmonë lëndë nga një vendndodhje (URL) te një tjetër.", + "BingCrawlHttpStatus302": "Kod HTTP 302 (Lëvizur përkohësisht)", + "BingCrawlHttpStatus302Desc": "Këto kode shfaqen kur keni lëvizur përkohësisht lëndë nga një vendndodhje (URL) te një tjetër.", + "BingCrawlHttpStatus4xx": "Kod HTTP 400-499 (Gabime kërkese)", + "BingCrawlHttpStatus4xxDesc": "Këto kode shfaqen kur, sipas gjasash, pati një gabim te kërkesa, çka e pengoi shërbyesin të mundte ta përpunonte.", + "BingCrawlHttpStatus5xx": "Kod HTTP 500-599 (Gabime të brendshme shërbyesi)", + "BingCrawlHttpStatus5xxDesc": "Këto kode shfaqen kur shërbyesi s’arriti të plotësonte një kërkesë në dukje të vlefshme.", + "BingCrawlImportantBlockedByRobotsTxt": "Përjashtim nga robots.txt faqeje të rëndësishme", + "BingCrawlInboundLink": "Lidhje ardhëse gjithsej", + "BingCrawlInboundLinkDesc": "Lidhje ardhëse të njohura nga Bing, që shpien te URL në sajtin tuaj. Këto janë lidhje, prej sajtesh tjetër nga ai i juaji, që shpien te lëndë e juaja.", + "BingCrawlMalwareInfected": "Sajte të infektuar me “malware”", + "BingCrawlMalwareInfectedDesc": "Në këtë ndarje do të grupohen çfarëdo URL faqeje gjetur nga Bing-u, e cila është e infektuar ose e lidhur me malware.", + "BingCrawlPagesInIndex": "Faqe gjithsej në tregues", + "BingCrawlPagesInIndexDesc": "Numër faqesh gjithsej të pranishme në indeksin e Bing-ut", + "BingCrawlStatsOtherCodes": "Krejt kodet e tjera për gjendje HTTP", + "BingCrawlStatsOtherCodesDesc": "Grupon krejt kodet e tjerë që nuk kanë përputhje me ndonjë vlerë tjetër (bie fjala, 1xx ose kode informative).", + "BingCrawlingStats": "Përmbledhje indeksimi për Bing dhe Yahoo!", + "BingCrawlingStatsDocumentation": "Përmbledhja e indeksimit ju lejon të shihni informacion të lidhur me indeksimin, bie fjala, gabime të hasur nga roboti i kërkimeve kur vizitohet një faqe, objekte të bllokuar nga kartela juaj robots.txt dhe URL që mund të jenë prekur nga malware.", + "BingKeywordImport": "Importim fjalëkyçesh Bing", + "BingKeywords": "Fjalëkyçe (në Bing dhe Yahoo!)", + "BingKeywordsDocumentation": "Fjalëkyçe të përdorur në kërkime Bing ose Yahoo! që prodhojnë lidhje për te sajti juaj te lista e përfundimeve të kërkimit.", + "BingKeywordsNoRangeReports": "Fjalëkyçe në Bing dhe Yahoo! që mund të përpunohen vetëm për intervale vetjakë datash, përfshi javë ose muaj të plotë, meqë s’mund të kihen si raporte ditore.", + "BingKeywordsNotDaily": "Fjalëkyçe në Bing dhe Yahoo! mund të kihen vetëm si raporte ditore. S’ka të dhëna fjalëkyçesh për periudha ditësh.", + "BingWebmasterApiUrl": "Url për Bing Webmaster Tools", + "BingWebmasterApiUrlDescription": "Jepni URL-në te e cila gjendet ky sajt te Bing Webmaster Tools tuaja", + "Category": "Kategori", + "ChangeConfiguration": "Ndryshoni formësimin", + "Clicks": "Klikime", + "ClicksDocumentation": "Si klikim llogaritet sa herë që dikush klikon mbi një lidhje që shpie te sajti juaj, në një faqe përfundimesh motori kërkimesh.", + "ClientConfigImported": "Formësimi i klientit u importua me sukses!", + "ClientConfigSaveError": "Ndodhi një gabim teksa ruhej formësimi i klientit. Ju lutemi, kontrolloni nëse formësimi i dhënë është i vlefshëm dhe riprovoni.", + "ClientId": "ID klienti", + "ClientSecret": "E fshehtë klienti", + "ConfigAvailableNoWebsiteConfigured": "Integrimi i formësua me sukses, por aktualisht nuk ka sajt të formësuar për import.", + "ConfigRemovalConfirm": "Ju ndan një hap nga heqja e formësimit për %1$s. Importimi i Fjalëkyçeve për atë sajt do të çaktivizohet. Të veprohet, sido qoftë?", + "Configuration": "Formësim", + "ConfigurationDescription": "Kjo shtojcë ju lejon të importoni drejt e në Matomo krejt fjalëkyçet e kërkuar nga përdoruesit tuaj në motorë kërkimesh.", + "ConfigurationFile": "Kartelë formësimi", + "ConfigurationValid": "Formësimi juaj OAuth është i vlefshëm.", + "ConfigureMeasurableBelow": "Për të formësuar një sajt, thjesht klikoni mbi butonin më poshtë ose formësojeni drejt e te rregullimet e sajtit.", + "ConfigureMeasurables": "Formësoni sajte", + "ConfigureTheImporterLabel1": "Importoni fjalëkyçet tuaja Google Search Console dhe analizojini duke përdorur mjetet e fuqishme statistikore të Matomo-s. Pasi të lidhni importuesin, përzgjidhni cilët sajte të importohen dhe Matomo-ja do të nisë të importojë fjalëkyçe për ta, si pjesë e një procesi arkivimi të planifikuar.", + "ConfigureTheImporterLabel2": "Që të importoni të dhënat tuaja nga Konsolë Google Search, Matomo ka nevojë të hyjë në këto të dhëna.", + "ConfigureTheImporterLabel3": "Për t’ia filluar, %1$sndiqni udhëzimet tona për të marrë formësimin e Klientit tuaj OAuth%2$s. Mandej ngarkojeni kartelën e formësimit të klientit duke përdorur butonin më poshtë.", + "ConfiguredAccounts": "llogari të formësuara", + "ConfiguredUrlNotAvailable": "Për këtë llogari s’ka URL të formësuar", + "ConnectAccount": "Lidhni Llogari", + "ConnectAccountDescription": "Ju lutemi, klikoni mbi butonin më poshtë që të ridrejtoheni te %1$s, ku ju duhet të akordoni hyrje.", + "ConnectAccountYandex": "Mirëfilltësimi për llogari Yandex është i vlefshëm vetëm për %1$s ditë. Çdo llogari lypset të rimirëfilltësohet brenda asaj kohe, për të siguruar që importimet funksionojnë saktë.", + "ConnectFirstAccount": "Fillojani duke lidhur llogarinë tuaj të parë më poshtë.", + "ConnectGoogleAccounts": "Lidhni Llogari Google", + "ConnectYandexAccounts": "Lidhni Llogari Yandex", + "ContainingSitemaps": "Përmban Harta Sajtesh", + "CrawlingErrors": "Gabime indeksimi", + "CrawlingOverview1": "Përmbledhja e Indeksimit raporton informacionet më kritike rreth se si indeksojnë sajtet tuaj robotë Motorësh Kërkimi. Këto vlera përditësohen afërsisht një herë në ditë me të dhëna të furnizuara nga motorët e kërkimeve.", + "CrawlingStats": "Përmbledhje indeksimi", + "CreatedBy": "Krijuar Nga", + "Ctr": "CTR", + "CtrDocumentation": "Koeficient klikimi: Një përpjesëtim që shfaq se sa shpesh persona që shohin një faqe përfundimesh motori kërkimesh me një lidhje për te sajti juaj, e klikojnë atë.", + "CurrentlyConnectedAccounts": "Aktualisht ka %1$s llogari të lidhura.", + "DeleteUploadedClientConfig": "Nëse do të donit të hiqnit formësimin e ngarkuar të klientit, klikoni më poshtë", + "Domain": "Përkatësi", + "DomainProperty": "Veti përkatësie", + "DomainPropertyInfo": "Përfshin krejt nënpërkatësitë (m, www, e me radhë) dhe që të dy protokollet (http, https).", + "EnabledSearchTypes": "Lloje fjalëkyçesh për t’u sjellë", + "FetchImageKeyword": "Sill fjalëkyçe figurash", + "FetchImageKeywordDesc": "Sill fjalëkyçe të përdorur në kërkime figurash në Google", + "FetchNewsKeyword": "Sill fjalëkyçe të rinj", + "FetchNewsKeywordDesc": "Sill fjalëkyçe të përdorur në Google News", + "FetchVideoKeyword": "Sill fjalëkyçe video", + "FetchVideoKeywordDesc": "Sill fjalëkyçe të përdorur në kërkime videosh në Google", + "FetchWebKeyword": "Sill fjalëkyçe web", + "FetchWebKeywordDesc": "Sill fjalëkyçe të përdorur në kërkime web përmes Google-it", + "FirstDetected": "Pikasur së pari", + "GoogleAccountAccessTypeOfflineAccess": "Përdorimi jashtë linje është i domosdoshëm për të qenë në gjendje të importohen fjalëkyçet tuaj të kërkimit, edhe kur s’jeni i futur në llogarinë tuaj.", + "GoogleAccountAccessTypeProfileInfo": "Të dhëna profili përdoren për të shfaqur emrin e llogarisë(ve) të lidhura në atë çast.", + "GoogleAccountAccessTypeSearchConsoleData": "Të dhënat e Konsolës së Kërkimeve janë të domosdoshme për të pasur hyrje te fjalëkyçet tuaj të kërkimeve me Google.", + "GoogleAccountError": "Ndodhi një gabim teksa vleftësohej hyrje OAuth: %1$s", + "GoogleAccountOk": "Hyrja OAuth u kontrollua me sukses.", + "GoogleAuthorizedJavaScriptOrigin": "Origjinë JavaScript-i të autorizuar", + "GoogleAuthorizedRedirectUri": "URI ridrejtimi të autorizuar", + "GoogleConfigurationDescription": "Konsola e Kërkimeve me Google përdor OAuth për mirëfilltësim dhe autorizim.", + "GoogleConfigurationTitle": "Formësoni importim prej Konsolës së Kërkimeve me Google", + "GoogleDataNotFinal": "Të dhënat e këtij raporti për fjalëkyçet mund të mos përmbajnë ende të dhënat përfundimtare. Google i furnizon të dhënat përfundimtare të fjalëkyçeve me një vonesë prej 2 ditësh. Fjalëkyçet për ditë më të afërta do të riimportohen, deri sa të raportohen si përfundimtare.", + "GoogleDataProvidedWithDelay": "Google i furnizon të dhënat e fjalëkyçeve me një vonesë. Fjalëkyçet për këtë datë do të importohen pakëz më vonë.", + "GoogleKeywordImport": "Importim fjalëkyçesh Google", + "GooglePendingConfigurationErrorMessage": "Formësimi është pezull. Ju lutemi, kërkojini një superpërdoruesi të plotësojë formësimin.", + "GoogleSearchConsoleUrl": "Url për Konsol Kërkimesh me Google", + "GoogleSearchConsoleUrlDescription": "Jepni URL-në ku gjendet ky sajt te Konsola juaj e Kërkimeve me Google", + "GoogleUploadOrPasteClientConfig": "Ju lutemi, ngarkoni formësimin e klientit tuaj për Google OAuth, ose hidheni atë te fusha më poshtë.", + "HowToGetOAuthClientConfig": "Si të merrni formësimin tuaj për OAuth Client", + "ImageKeywords": "Fjalëkyçe figurash në Google", + "ImageKeywordsDocumentation": "Fjalëkyçe të përdorur në kërkime figurash me Google, të cilët prodhuan lidhje për te sajti juaj, te lista e përfundimeve të kërkimit.", + "Impressions": "Përshtypje", + "ImpressionsDocumentation": "Si përshtypje llogaritet çdo herë që sajti juaj është shfaqur në një faqe përfundimesh motori kërkimesh.", + "IntegrationConfigured": "Integrim i formësuar me sukses", + "IntegrationNotConfigured": "Integrim ende i paformësuar", + "InvalidRedirectUriInClientConfiguration": "redirect_uris të pavlefshëm, të paktën 1 URI duhet të ketë përputhje me URI-n “%1$s” te kartela e ngarkuar për formësimin", + "KeywordStatistics": "Fjalëkyçe Kërkimi", + "KeywordTypeImage": "figurë", + "KeywordTypeNews": "lajme", + "KeywordTypeVideo": "video", + "KeywordTypeWeb": "web", + "KeywordsCombined": "Fjalëkyçe gjithsej", + "KeywordsCombinedDocumentation": "Raport që ndërthur krejt fjalëkyçet e pikasur nga Matomo dhe importuar prej motorësh kërkimesh. Ky raport përfshin vetëm vlera për vizitat. Për të pasur vlera të hollësishme, mund të kaloni te një nga raportet përkatës.", + "KeywordsCombinedImported": "Fjalëkyçe të importuar gjithsej", + "KeywordsCombinedImportedDocumentation": "Raport që shfaq krejt fjalëkyçet e importuar prej krejt motorëve të kërkimit të formësuar.", + "KeywordsReferrers": "Fjalëkyçe (përfshi të papërkufizuarit)", + "KeywordsSubtableImported": "Fjalëkyçe të importuar", + "KeywordsSubtableOriginal": "Fjalëkyçe të ndjekur (përfshi të papërkufizuarit)", + "LastCrawled": "Indeksuar së fundi", + "LastDetected": "Pikasur së fundi", + "LastImport": "Importimi i Fundit", + "LatestAvailableDate": "Të dhënat më të freskëta që mund të kihen për fjalëkyçet janë për %1$s", + "LinksToUrl": "Lidhje për te %s", + "ManageAPIKeys": "Administroni Kyçe API", + "MeasurableConfig": "sajte të formësuar", + "NewsKeywords": "Fjalëkyçe lajmesh në Google", + "NewsKeywordsDocumentation": "Fjalëkyçe të përdorur në kërkime Lajme Google, të cilët kanë prodhuar lidhje për te sajti juaj, te lista e përfundimeve të kërkimit.", + "NoSegmentation": "Raporti nuk mbulon segmentim. Të dhënat e shfaqura janë të dhënat tuaja standarde, të pasegmentuara, të raportit.", + "NoWebsiteConfigured": "S’ka sajt të formësuar. Për të aktivizuar importimin për sajtin e dhënë, ju lutemi, ujdisni këtu formësimin.", + "NoWebsiteConfiguredWarning": "Importim për %s i paformësuar plotësisht. Lypset të formësoni disa sajte që të aktivizohet importimi.", + "NotAvailable": "S’ka", + "OAuthAccessTimedOut": "Hyrjes me mirëfilltësim OAuth për këtë llogari mund t’i ketë mbaruar koha. Do t’ju duhet të ribëni mirëfilltësimin, që të funksionojnë sërish importimet për këtë llogari.", + "OAuthAccessWillTimeOut": "Hyrjes me OAuth për këtë llogari do t’i mbarojë koha pas %1$s ditësh. Edhe %2$s ditë", + "OAuthAccessWillTimeOutSoon": "Hyrjes me OAuth për këtë llogari do t’i mbarojë koha pas rreth %1$s ditësh. Ju lutemi, ribëni mirëfilltësimin, për të shmangur ndaljen e çfarëdo importimesh për këtë llogari.", + "OAuthClientConfig": "Formësim Klienti OAuth", + "OAuthError": "Ndodhi një gabim brenda procesit OAuth. Ju lutemi, riprovoni dhe sigurohuni të pranoni lejet e domosdoshme.", + "OAuthExampleText": "Formësimi lyp fushat e treguara më poshtë. Ju lutemi, përdorni vlerat e dhëna:", + "OauthFailedMessage": "Hasëm një problem gjatë procesit të autorizimit për Konsolën tuaj Google Search. Që të riprovohet, ju lutemi, klikoni mbi butonin më poshtë. Nëse problemi vazhdon, ju lutemi, lidhuni me ekipin tonë të asistencës për ndihmë. Do t’ju ndihmojnë në zgjidhjen e problemit dhe importimin e fjalëkyçeve tuaj Google Search Console.", + "OptionQuickConnectWithGoogle": "Lidhuni shpejt, me Google (e rekomanduar)", + "Platform": "Platformë", + "Position": "Pozicion mesatar", + "PositionDocumentation": "Pozicioni mesatar i sajtit tuaj te lista e përfundimeve prej motorësh kërkimi (për këtë fjalëkyç).", + "ProvideYandexClientConfig": "Ju lutemi, jepni formësimin tuaj për klientit tuaj Yandex OAuth.", + "ProviderBingDescription": "Importoni krejt fjalëkyçet e përdorur për të gjetur sajtin tuaj në kërkime me Bing dhe Yahoo!.", + "ProviderBingNote": "Shënim: Microsoft-i furnizon fjalëkyçe çdo të shtunë dhe vetëm për javë të plota. Si rrjedhojë, fjalëkyçet tuaj për Bing-un dhe Yahoo-n do të duan disa ditë, para se të shfaqen në raportet tuaj dhe do të jenë vetëm për javë, muaj ose vite.", + "ProviderGoogleDescription": "Importoni krejt fjalëkyçet e përdorur për të gjetur sajtin tuaj përmes kërkimesh Google. Raportet do të shfaqin fjalëkyçet tuaj veçmas për çdo lloj kërkimi (Web, Figura dhe Video).", + "ProviderGoogleNote": "Shënim: Google furnizon të dhëna përfundimtare fjalëkyçesh me një vonesë prej 2 ditësh. Të dhëna përfundimtare për ditë më të afërta do të tregohen gjithashtu, por do të riimportohen, deri sa të jenë përfundimtare. Importimi juaj i parë mund të jetë në gjendje të importojë të dhënat tuaja historike mbi fjalëkyçet për deri 486 ditë më herët.", + "ProviderListDescription": "Kur keni ujdisur me sukses një (ose më tepër) motor kërkimi më poshtë, mund të formësoni në cilin sajt(e) duhet të importojë Matomo fjalëkyçet tuaj të kërkimit.", + "ProviderXAccountWarning": "U pikasën probleme formësimi llogarish
Ju lutemi, kontrolloni llogaritë e formësuara për %s.", + "ProviderXSitesWarning": "U pikasën probleme formësimi sajtesh
Ju lutemi, kontrolloni sajtet e formësuar për %s.", + "ProviderYandexDescription": "Importoni krejt fjalëkyçet e përdorur për të gjetur sajtin tuaj në kërkime me Yandex.", + "ProviderYandexNote": "Shënim: Yandex-i furnizon të dhëna fjalëkyçesh me një vonesë deri 5 ditësh. Importimi i parë do të provojë të importojë të dhënat tuaja historike mbi fjalëkyçet për deri 100 ditë e fundit.", + "ReAddAccountIfPermanentError": "Nëse ky është një gabim i vazhdueshëm, provoni ta hiqni llogarinë dhe ta rilidhni.", + "ReAuthenticateIfPermanentError": "Nëse ky është një gabim që nuk ikën, provoni të bëni rimirëfilltësimin e llogarisë ose ta hiqni dhe ta lidhini sërish.", + "Reauthenticate": "Ribëni mirëfilltësimin", + "RecentApiErrorsWarning": "U pikasën gabime importimi fjalëkyçesh

Ju lutemi, kontrolloni formësimet për:
%s

Nëse formësimi juaj është i saktë dhe gabimet vazhdojnë, ju lutemi, lidhuni me asistencën.", + "ReportShowMaximumValues": "Vlerat e shfaqura janë vlerat maksimum që u hasën gjatë kësaj periudhe.", + "RequiredAccessTypes": "Këto lloje hyrjeje janë të domosdoshëm:", + "ResponseCode": "Kod përgjigjeje", + "RoundKeywordPosition": "Pozicion i rrumbullakosur fjalëkyçi", + "SearchEngineKeywordsPerformance": "Funksionim Fjalëkyçesh Motori Kërkimesh", + "SearchEnginesImported": "Motorë Kërkimesh (me fjalëkyçe të importuar)", + "SearchEnginesOriginal": "Motorë Kërkimesh (me fjalëkyçe të ndjekur)", + "SetUpOAuthClientConfig": "Ujdisni formësimin e klientit tuaj OAuth", + "SetupConfiguration": "Formësim rregullimi", + "SitemapsContainingUrl": "Harta sajtesh që përmbajnë %s", + "StartOAuth": "Fillo Procesin OAuth", + "URLPrefix": "Prefiks URL-sh", + "URLPrefixProperty": "Veti prefiksi URLsh", + "URLPrefixPropertyInfo": "Përfshin vetëm URL-të me saktësisht prefiksin e treguar, përfshi protokollin (http/https). Nëse doni që vetia juaj të ketë përputhje me çfarëdo protokolli ose nënpërkatësie (http/https/www./m. e me radhë), shihni mundësinë e shtimit të një vetie Përkatësi.", + "UnverifiedSites": "Sajte të paverifikuar:", + "UploadOAuthClientConfig": "Ngarkoni formësimin e klientit tuaj OAuth", + "Uploading": "Po ngarkohet…", + "UrlOfAccount": "URL (Llogari)", + "VideoKeywords": "Fjalëkyçe video në Google", + "VideoKeywordsDocumentation": "Fjalëkyçe të përdorur në kërkime videosh me Google, të cilët kanë prodhuar lidhje për te sajti juaj, te lista e përfundimeve të kërkimit.", + "VisitOAuthHowTo": "Ju lutemi, vizitoni %1$sudhërrëfyesin tonë në internet%2$s që të mësoni se si të ujdisni formësimin e klientit tuaj OAuth%3$s.", + "WebKeywords": "Fjalëkyçe Web në Google", + "WebKeywordsDocumentation": "Fjalëkyçe të përdorur në kërkime web me Google, të cilët kanë prodhuar lidhje për te sajti juaj, te lista e përfundimeve të kërkimit.", + "WebsiteSuccessfulConfigured": "Përgëzime!
E formësuat me sukses importimin e fjalëkyçeve për sajtin %1$s.
Mund të duhen disa ditë derisa të importohen fjalëkyçet tuaj të parë të kërkimit dhe të shfaqen te Referues > Fjalëkyçe Kërkimesh. Te %2$sFAQ%3$s jonë mund të gjeni më tepër informacion mbi vonesa dhe kufizime importimi fjalëkyçesh", + "WebsiteTypeUnsupported": "Matja e përzgjedhur %1$s s’mund të formësohet, ngaqë është e një lloji të pambuluar. Mbulohen vetëm matje të llojit “sajt”.", + "WebsiteTypeUnsupportedRollUp": "Shënim: Sajtet Agregat do të ndërthurin automatikisht të dhënat e importuara të krejt sajteve pjella", + "YandexConfigurationDescription": "Yandex Webmaster API përdor OAuth për mirëfilltësim dhe autorizim.", + "YandexConfigurationTitle": "Formësoni importim prej Yandex Webmaster API", + "YandexCrawlAppearedPages": "Faqe të pranishme në kërkim", + "YandexCrawlAppearedPagesDesc": "Faqe që qenë shtuar rishtas te indeks kërkimesh Yandex", + "YandexCrawlCrawledPages": "Faqe të Indeksuara", + "YandexCrawlCrawledPagesDesc": "Numër faqesh të kërkuara nga indeksuesi i Yandex-it.", + "YandexCrawlErrors": "Gabime të tjera kërkesash", + "YandexCrawlErrorsDesc": "Faqe të indeksuara që dështuan për çfarëdo arsye tjetër", + "YandexCrawlHttpStatus2xx": "Kod HTTP 200-299", + "YandexCrawlHttpStatus2xxDesc": "Faqe të Indeksuara me një kod 2xx", + "YandexCrawlHttpStatus3xx": "Kod HTTP 300-399 (Faqe të lëvizura)", + "YandexCrawlHttpStatus3xxDesc": "Faqe të Indeksuara me një kod 3xx", + "YandexCrawlHttpStatus4xx": "Kod HTTP 400-499 (Gabime kërkese)", + "YandexCrawlHttpStatus4xxDesc": "Faqe të Indeksuara me një kod 4xx", + "YandexCrawlHttpStatus5xx": "Kod HTTP 500-599 (Gabime të brendshme shërbyesi)", + "YandexCrawlHttpStatus5xxDesc": "Faqe të Indeksuara me një kod 5xx", + "YandexCrawlInIndex": "Faqe gjithsej në tregues", + "YandexCrawlInIndexDesc": "Numër faqesh gjithsej të pranishme në indeks kërkimesh Yandex", + "YandexCrawlRemovedPages": "Faqe të hequra prej kërkimi", + "YandexCrawlRemovedPagesDesc": "Faqe që qenë hequr prej treguesi kërkimesh Yandex", + "YandexCrawlingStats": "Përmbledhje indeksimi për Yandex!", + "YandexCrawlingStatsDocumentation": "Përmbledhja e indeksimit ju lejon të shihni informacion të lidhur me indeksimin, bie fjala, gabime të hasur nga roboti i kërkimeve kur vizitohet një faqe, objekte të bllokuar nga kartela juaj robots.txt dhe numri gjithsej i faqeve në tregues.", + "YandexFieldUrlToAppSite": "URL për te sajt aplikacioni", + "YandexKeywords": "Fjalëkyçe në Yandex", + "YandexKeywordsDocumentation": "Fjalëkyçe të përdorur në kërkime Yandex që prodhojnë lidhje për te sajti juaj te lista e përfundimeve të kërkimit.", + "YandexWebmasterApiUrl": "Url për Yandex Webmaster Tools", + "YandexWebmasterApiUrlDescription": "Jepni URL-në te e cila gjendet ky sajt te Yandex Webmaster Tools tuajat" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/sv.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/sv.json new file mode 100644 index 0000000..d40ae7b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/sv.json @@ -0,0 +1,37 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "API-nyckel", + "AccountAddedBy": "Lades till av %1$s vid %2$s", + "AccountConnectionValidationError": "Ett fel inträffade när kontoanslutningen skulle valideras:", + "AccountDoesNotExist": "Konfigurerat konto %1$s existerar inte längre", + "AccountNoAccess": "Detta konto har för närvarande inte åtkomst till någon webbplats.", + "AccountRemovalConfirm": "Du är på väg att ta bort kontot %1$s. Detta kan inaktivera import av nyckelord för anslutna webbplats(er). Vill du fortsätta ändå?", + "ActivityAccountAdded": "la till ett nytt konto för leverans av nyckelord %1$s: %2$s", + "ActivityAccountRemoved": "tog bort ett konto för leverans av nyckelord %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "ändrade klientkonfigurationen för Google.", + "ActivityYandexClientConfigChanged": "ändrade klientkonfiguration för Yandex.", + "AddAPIKey": "Lägg till API-nyckel", + "AddConfiguration": "Lägg till konfiguration", + "AdminMenuTitle": "Sökprestation", + "AvailableSites": "Webbplatser som kan importeras:", + "BingAccountOk": "API-nyckel kontrollerad framgångsrikt", + "BingConfigurationDescription": "Bing Webmaster Tools behöver en API-nyckel för att gå att nå. Här kan du lägga till API-nycklar för åtkomst till din webbplats data.", + "BingConfigurationTitle": "Konfigurera import från Bing Webmaster Tools", + "BingCrawlBlockedByRobotsTxt": "Robots.txt exkludering", + "BingCrawlBlockedByRobotsTxtDesc": "URLar som för närvarande blockeras av din webbplats robots.txt.", + "BingCrawlConnectionTimeout": "Timeout för anslutning", + "BingCrawlCrawledPages": "Kravlade sidor", + "BingCrawlCrawledPagesDesc": "Antal sidor som Bings crawler anslöt till.", + "BingCrawlDNSFailures": "DNS-misslyckanden", + "BingCrawlErrorsDesc": "Antal fel som inträffade för Bings crawler.", + "BingCrawlHttpStatus2xx": "HTTP-kod 200-299", + "BingCrawlHttpStatus2xxDesc": "De här koderna visas när servern lyckades skicka webbsidan", + "BingCrawlHttpStatus301": "HTTP-kod 301 (Permanently moved)", + "BingCrawlHttpStatus301Desc": "Dessa koder visas när du permanent flyttat innehåll från en plats (URL) till en annan.", + "Domain": "Domän", + "DomainProperty": "Domänegendom", + "DomainPropertyInfo": "Inkluderar alla subdomäner (m, www, och så vidare) och båda protokoll (http, https).", + "URLPrefix": "URL-prefix", + "URLPrefixProperty": "URL-prefix för egendom" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/tr.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/tr.json new file mode 100644 index 0000000..94012ba --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/tr.json @@ -0,0 +1,241 @@ +{ + "SearchEngineKeywordsPerformance": { + "APIKey": "API anahtarı", + "AccountAddedBy": "%1$s tarafından %2$s zamanında eklendi", + "AccountConnectionValidationError": "Hesap bağlantısı doğrulanırken bir sorun çıktı:", + "AccountDoesNotExist": "Yapılandırılmış %1$s hesabı artık yok", + "AccountNoAccess": "Bu hesabın şu anda herhangi bir siteye erişimi yok.", + "AccountRemovalConfirm": "%1$s hesabını silmek üzeresiniz. Bu işlem bağlı sitelerden anahtar sözcüklerin içe aktarılmasını kullanımdan kaldırabilir. İlerlemek istediğinize emin misiniz?", + "ActivityAccountAdded": "yeni bir anahtar sözcük hizmeti sağlayıcısı hesabı ekledi %1$s: %2$s", + "ActivityAccountRemoved": "bir anahtar sözcük hizmeti sağlayıcısı hesabını sildi %1$s: %2$s", + "ActivityGoogleClientConfigChanged": "Google istemci yapılandırmasını değiştirdi.", + "ActivityYandexClientConfigChanged": "Yandex istemci yapılandırmasını değiştirdi.", + "AddAPIKey": "API anahtarı ekle", + "AddConfiguration": "Yapılandırma ekle", + "AdminMenuTitle": "Arama başarımı", + "AllReferrersImported": "Yönlendirenler (içe aktarılmış anahtar sözcükler ile)", + "AllReferrersOriginal": "Yönlendirenler (izlenen anahtar sözcükler ile)", + "AvailableSites": "İçe aktarma için kullanılabilecek siteler:", + "BingAPIKeyInstruction": "%1$sBing Webmaster Tools%2$s sitesinde bir hesap açın ve siteyi Bing Webmaster üzerine ekleyin. Siteyi doğruladıktan sonra %3$sAPI anahtarınızı kopyalayın%4$s.", + "BingAccountError": "API anahtarı doğrulanırken bir sorun çıktı: %1$s. Bing Webmaster Tools ile bu API anahtarını yeni oluşturduysanız bir kaç dakika sonra yeniden deneyin (Bing Webmaster Tools API anahtarlarının etkinleştirilmesi biraz zaman alabilir).", + "BingAccountOk": "API anahtarı doğrulandı", + "BingConfigurationDescription": "Bing Webmaster Tools kullanmak için bir API anahtarına gerek vardır. Sitelerinizin verilerine erişmek için gereken API anahtarlarını buradan ekleyebilirsiniz.", + "BingConfigurationTitle": "Bing Webmaster Tools üzerinden içe aktarmayı yapılandırın", + "BingCrawlBlockedByRobotsTxt": "Robots.txt katılmaması", + "BingCrawlBlockedByRobotsTxtDesc": "Sitenin robots.txt dosyasını engelleyen adresler.", + "BingCrawlConnectionTimeout": "Bağlantı zaman aşımları", + "BingCrawlConnectionTimeoutDesc": "Bu değer yakın zamanda bağlantı sorunları nedeniyle Bing tarafından sitenize erişilememe sayısını gösterir. Bu durum geçici bir sorundan kaynaklanıyor olabilir ancak istekleri kazara reddedip etmediğinizi öğrenmek için sunucu günlüğü kayıtlarını gözden geçirmeniz iyi olur.", + "BingCrawlCrawledPages": "Derlenen sayfa sayısı", + "BingCrawlCrawledPagesDesc": "Bing crawler tarafından istekte bulunulan sayfa sayısı.", + "BingCrawlDNSFailures": "DNS sorunları", + "BingCrawlDNSFailuresDesc": "Bu sorun türünde bot tarafından yakın zamanda sayfalarınıza erişmek için DNS sunucu ile iletişim kurulmaya çalışılırken yaşanan sorunlar görüntülenir. Sunucunuz çalışmıyor olabilir ya da TTL değerinin 0 olarak ayarlanması gibi DNS yöneltmesinin yapılmasını engelleyen bir yapılandırma hatası olabilir.", + "BingCrawlErrors": "Bing derleme sorunları", + "BingCrawlErrorsDesc": "Bing crawler tarafından karşılaşılan sorun sayısı.", + "BingCrawlErrorsFromDateX": "Bu rapor, yakın zamanda Bing tarafından karşılaşılan derleme sorunlarını içerir. Geçmişe dönük herhangi bir veri bulunmaz. Son güncelleme: %s", + "BingCrawlHttpStatus2xx": "HTTP Kodları 200-299", + "BingCrawlHttpStatus2xxDesc": "Sunucu sayfayı doğru olarak sunduğunda bu kodlar görüntülenir", + "BingCrawlHttpStatus301": "HTTP Kodu 301 (Kalıcı olarak taşındı)", + "BingCrawlHttpStatus301Desc": "İçerik bir konumdan (adres) başka bir konuma kalıcı olarak taşındığında bu kod görüntülenir.", + "BingCrawlHttpStatus302": "HTTP Kodu 302 (Geçici olarak taşındı)", + "BingCrawlHttpStatus302Desc": "İçerik bir konumdan (adres) başka bir konuma geçici olarak taşındığında bu kod görüntülenir.", + "BingCrawlHttpStatus4xx": "HTTP Kodları 400-499 (İstek sorunları)", + "BingCrawlHttpStatus4xxDesc": "Bu kodlar sunucunun yapılan isteklerde bulunan hatalar nedeniyle istekleri işleyememesi durumunda görüntülenir.", + "BingCrawlHttpStatus5xx": "HTTP Kodları 500-599 (İç sunucu sorunları)", + "BingCrawlHttpStatus5xxDesc": "Bu kodlar sunucunun açıkca geçerli olan istekleri karşılayamaması durumunda görüntülenir.", + "BingCrawlImportantBlockedByRobotsTxt": "Önemli sayfada robots.txt katılmaması", + "BingCrawlInboundLink": "Gelen bağlantı toplamı", + "BingCrawlInboundLinkDesc": "Gelen bağlantılar Bing tarafından algılanan sitenize yönelmiş adreslerdir. Bunlar, kendi sitenizden gelen ve içeriğinize işaret eden bağlantılardır.", + "BingCrawlMalwareInfected": "Zararlı yazılımdan etkilenmiş siteler", + "BingCrawlMalwareInfectedDesc": "Bing tarafından zararlı bir yazılımın bulaştığı ya da ilgisi olduğu anlaşılan sayfa adresleri bu bölümde görüntülenir.", + "BingCrawlPagesInIndex": "Dizindeki sayfa sayısı", + "BingCrawlPagesInIndexDesc": "Bing arama dizinindeki toplam sayfa sayısı", + "BingCrawlStatsOtherCodes": "Tüm diğer HTTP durum kodları", + "BingCrawlStatsOtherCodesDesc": "Başka değerler ile eşleşmeyen tüm diğer kodları bir araya getirir (1xx ya da bilgilendirme kodları gibi).", + "BingCrawlingStats": "Bing ve Yahoo! için derleme özeti", + "BingCrawlingStatsDocumentation": "Derleme özetinde bir sayfa ziyaret edildiğinde arama botu tarafından karşılaşılan sorunlar, robots.txt dosyanız tarafından engellenen ögeler ve zararlı yazılımlar tarafından etkilenmiş adresler gibi derleme ile ilgili bilgiler bulunur.", + "BingKeywordImport": "Bing anahtar sözcük içe aktarma", + "BingKeywords": "Anahtar sözcükler (Bing ve Yahoo! üzerinde)", + "BingKeywordsDocumentation": "Bing ya da Yahoo! arama sonuçlarında sitenize bağlantılar oluşturmak için kullanılan anahtar sözcükler.", + "BingKeywordsNoRangeReports": "Bing ve Yahoo! üzerindeki anahtar sözcükler günlük raporlar olarak kullanılamadığından yalnızca tam haftalar ya da aylar gibi özel tarih aralıkları için işlenebilir.", + "BingKeywordsNotDaily": "Bing ve Yahoo! üzerindeki anahtar sözcükler yalnızca haftalık raporlar olarak kullanılabilir. Anahtar sözcük verileri günlük olarak kullanılamaz.", + "BingWebmasterApiUrl": "Bing Webmaster Tools adresi", + "BingWebmasterApiUrlDescription": "Bu sitenin Bing Webmaster Tools üzerindeki adresini yazın", + "Category": "Kategori", + "ChangeConfiguration": "Yapılandırmayı değiştir", + "Clicks": "Tıklanma", + "ClicksDocumentation": "Birisi bir arama motorunun sonuç sayfasında siteyi gösteren bir bağlantıya tıkladığında bir tıklama sayılır.", + "ClientConfigImported": "İstemci yapılandırması içe aktarıldı!", + "ClientConfigSaveError": "İstemci yapılandırması içe aktarılırken bir sorun çıktı. Lütfen belirtilen yapılandırmanın geçerli olduğundan emin olduktan sonra yeniden deneyin.", + "ClientId": "İstemci kodu", + "ClientSecret": "İstemci parolası", + "ConfigAvailableNoWebsiteConfigured": "Bütünleştirme yapılandırması tamamlandı, ancak şu anda içe aktarılmak için bir site yapılandırılmamış.", + "ConfigRemovalConfirm": "%1$s yapılandırmasını silmek üzereseniz. Bu site için anahtar sözcükler içe aktarılmayacak. İlerlemek istiyor musunuz?", + "Configuration": "Yapılandırma", + "ConfigurationDescription": "Bu uygulama eki, sitenin kullanıcıları tarafından arama motorlarına sorulan anahtar sözcükleri doğrudan Matomo içine aktarır.", + "ConfigurationFile": "Yapılandırma dosyası", + "ConfigurationValid": "OAuth yapılandırmanız geçersiz.", + "ConfigureMeasurableBelow": "Bir siteyi yapılandırmak için aşağıdaki düğmeye tıklayın ya da doğrudan site ayarları bölümüne gidin.", + "ConfigureMeasurables": "Siteleri yapılandır", + "ConfigureTheImporterLabel1": "Google Search Console anahtar sözcüklerinizi içe aktarın ve güçlü Matomo analiz araçlarını kullanarak inceleyin. İçe aktarıcıyı bağlantısını kurduktan sonra, içe aktarılacak siteleri seçin. Matomo, programlanmış arşivleme sürecinin bir parçası olarak sitelerin anahtar sözcüklerini içe aktarmaya başlar.", + "ConfigureTheImporterLabel2": "Verilerinizi Google Search Console üzerinden içe aktarmak için Matomo bu verilere erişmelidir.", + "ConfigureTheImporterLabel3": "Başlamak için, %1$sOAuth İstemci yapılandırmanızı alma yönergelerini izleyin%2$s. Ardından, aşağıdaki düğmeyi kullanarak istemci yapılandırma dosyasını yükleyin.", + "ConfiguredAccounts": "yapılandırılmış hesaplar", + "ConfiguredUrlNotAvailable": "Bu hesabın yapılandırılmış adresine erişilemiyor", + "ConnectAccount": "Hesap bağla", + "ConnectAccountDescription": "Gerekli izinleri vermek için aşağıdaki düğme üzerine tıklayarak %1$s sitesine gidin.", + "ConnectAccountYandex": "Yandex hesapları için kimlik doğrulaması yalnızca %1$s gün süreyle geçerlidir. İçe aktarma işlemlerinin sorunsuz yapılabilmesi için her hesap kimliğinin bu süre içinde yeniden doğrulanması gerekir.", + "ConnectFirstAccount": "Aşağıdan ilk hesabınızı bağlayarak başlayın.", + "ConnectGoogleAccounts": "Google hesaplarını bağla", + "ConnectYandexAccounts": "Yandex hesaplarını bağla", + "ContainingSitemaps": "Site haritaları bulunan", + "CrawlingErrors": "Derleme sorunları", + "CrawlingOverview1": "Derleme özeti raporu, arama motoru robotlarının siteleri nasıl derlediği ile ilgili kritik bilgileri içerir. Bu ölçümler, aşağı yukarı her gün arama motorları tarafından sağlanan verilerle güncellenir.", + "CrawlingStats": "Derleme özeti", + "CreatedBy": "Oluşturan", + "Ctr": "Tıklayıp geçme oranı", + "CtrDocumentation": "Tıklayıp geçme oranı: Kişilerin ne sıklıkta arama sonuçları sayfasında sitenin bağlantısını görüp tıkladığının oranı.", + "CurrentlyConnectedAccounts": "Şu anda bağlı %1$s hesap var.", + "DeleteUploadedClientConfig": "Yüklenen istemci yapılandırmasını kaldırmak istiyorsanız aşağıya tıklayın", + "Domain": "Etki alanı", + "DomainProperty": "Etki alanı mülkü", + "DomainPropertyInfo": "Tüm alt etki alanlarını (m, www gibi) ve iki iletişim kuralını da (http, https) kapsar.", + "EnabledSearchTypes": "Alınacak anahtar sözcük türleri", + "FetchImageKeyword": "Görsel anahtar sözcükleri alınsın", + "FetchImageKeywordDesc": "Bu seçenek etkinleştirildiğinde, Google görsel aramasında kullanılan anahtar sözcükler alınır", + "FetchNewsKeyword": "Yeni anahtar sözcükler alınsın", + "FetchNewsKeywordDesc": "Bu seçenek etkinleştirildiğinde, Google Haberler için kullanılan anahtar sözcükler alınır", + "FetchVideoKeyword": "Görüntü anahtar sözcükleri alınsın", + "FetchVideoKeywordDesc": "Bu seçenek etkinleştirildiğinde, Google görüntü aramasında kullanılan anahtar sözcükler alınır", + "FetchWebKeyword": "Site anahtar sözcükleri alınsın", + "FetchWebKeywordDesc": "Bu seçenek etkinleştirildiğinde, Google site aramasında kullanılan anahtar sözcükler alınır", + "FirstDetected": "İlk algılanan", + "GoogleAccountAccessTypeOfflineAccess": "Şu anda oturum açmamış olsanız da arama anahtar sözcüklerini içe aktarmak için çevrinmdışı erişim gereklidir.", + "GoogleAccountAccessTypeProfileInfo": "Profil bilgileri şu anda bağlı olan hesapların adlarını görüntülemek için kullanılır.", + "GoogleAccountAccessTypeSearchConsoleData": "Konsol verilerinde arama Google arama anahtar sözcüklerini alabilmek için gereklidir.", + "GoogleAccountError": "OAuth erişimi doğrulanırken bir sorun çıktı: %1$s", + "GoogleAccountOk": "OAuth erişimi doğrulandı.", + "GoogleAuthorizedJavaScriptOrigin": "İzin verilen JavaScript kaynağı", + "GoogleAuthorizedRedirectUri": "İzin verilen yönlendirme adresi", + "GoogleConfigurationDescription": "Google arama konsolunda kimlik doğrulaması için OAuth kullanılır.", + "GoogleConfigurationTitle": "Google arama konsolundan içe aktarmayı yapılandır", + "GoogleDataNotFinal": "Bu rapordaki anahtar sözcükler henüz son verileri içermiyor olabilir. Google, son anahtar sözcükleri 2 gün gecikme ile sağlar. Daha yakın zamandaki anahtar sözcükler, son olarak bildirildiğinde yeniden içe aktarılır.", + "GoogleDataProvidedWithDelay": "Google, anahtar sözcük verilerini bir gecikme ile sağlar. Bu tarihteki anahtar sözcükler biraz daha sonra içe aktarılacak.", + "GoogleKeywordImport": "Google anahtar sözcükleri içe aktarma", + "GooglePendingConfigurationErrorMessage": "Yapılandırma bekliyor. Lütfen bir süper kullanıcıdan yapılandırmayı tamamlamasını isteyin.", + "GoogleSearchConsoleUrl": "Google arama konsolu adresi", + "GoogleSearchConsoleUrlDescription": "Bu sitenin Google arama konsolu üzerindeki adresini yazın", + "GoogleUploadOrPasteClientConfig": "Lütfen Google OAuth istemci yapılandırmanızı yükleyin ya da aşağıdaki alana yapıştırın.", + "HowToGetOAuthClientConfig": "OAuth istemci yapılandırmasını almak", + "ImageKeywords": "Google üzerindeki görsel anahtar sözcükleri", + "ImageKeywordsDocumentation": "Google görsel arama sonuçlarında sitenize bağlantılar oluşturmak için kullanılan anahtar sözcükler.", + "Impressions": "Gösterimler", + "ImpressionsDocumentation": "Bir arama motoru sonuç sayfasında siteyi görüntülediğinde bir gösterim sayılır.", + "IntegrationConfigured": "Bütünleştirme yapılandırılmış", + "IntegrationNotConfigured": "Bütünleştirme yapılandırılmamış", + "InvalidRedirectUriInClientConfiguration": "redirect_uris değeri geçersiz. En az 1 uri yüklenen yapılandırma dosyasındaki \"%1$s\" uri değeri ile eşleşmelidir", + "KeywordStatistics": "Arama anahtar sözcükleri", + "KeywordTypeImage": "görsel", + "KeywordTypeNews": "haberler", + "KeywordTypeVideo": "görüntü", + "KeywordTypeWeb": "site", + "KeywordsCombined": "Birleştirilmiş anahtar sözcükler", + "KeywordsCombinedDocumentation": "Bu rapor, Matomo tarafından algılanan ve arama motorlarından içe aktarılan tüm anahtar sözcüklerin birleştirilmiş görünümünü içerir. İçinde yalnızca ziyaret ölçümü bulunur. Daha ayrıntılı ölçümleri görebilmek için ilgili raporlardan birine geçebilirsiniz.", + "KeywordsCombinedImported": "Birleştirilmiş içe aktarılan sözcükler", + "KeywordsCombinedImportedDocumentation": "Yapılandırılmış tüm arama motorlarından içe aktarılan tüm anahtar sözcükleri görüntüleyen rapor.", + "KeywordsReferrers": "Anahtar sözcükler (tanımlanmamışlar dahil)", + "KeywordsSubtableImported": "İçe aktarılmış anahtar sözcükler", + "KeywordsSubtableOriginal": "İzlenen anahtar sözcükler (tanımlanmamışlar dahil)", + "LastCrawled": "Son derlenen", + "LastDetected": "Son algılanan", + "LastImport": "Son içe aktarma", + "LatestAvailableDate": "%1$s için kullanılabilecek son anahtar sözcük verileri", + "LinksToUrl": "%s adresine bağlanan", + "ManageAPIKeys": "API anahtarları yönetimi", + "MeasurableConfig": "yapılandırılmış siteler", + "NewsKeywords": "Google üzerindeki haber anahtar sözcükleri", + "NewsKeywordsDocumentation": "Google Haberler arama sonuçlarında sitenize bağlantılar oluşturmak için kullanılan anahtar sözcükler.", + "NoSegmentation": "Bu rapor dilimleri desteklemiyor. Standart, dilimlenmemiş veriler görüntüleniyor.", + "NoWebsiteConfigured": "Henüz yapılandırılmış bir site yok. Belirli bir sitenin içe aktarılmasını kullanıma almak için buradan yapılandırmayı tamamlayabilirsiniz.", + "NoWebsiteConfiguredWarning": "%s için içe aktarma tam olarak yapılandırılmamış. İçe aktarmayı kullanıma almak için bazı siteler yapılandırmalısınız.", + "NotAvailable": "Kullanılamaz", + "OAuthAccessTimedOut": "Bu hesap için OAuth erişiminin süresi dolmuş olabilir. Bu hesap ile içe aktarma işlemlerinin yapılabilmesi için kimliği yeniden doğrulamanız gerekecek.", + "OAuthAccessWillTimeOut": "Bu hesap için OAuth erişiminin süresi %1$s gün içinde dolacak. %2$s gün kaldı", + "OAuthAccessWillTimeOutSoon": "Bu hesap için OAuth erişiminin süresi %1$s gün içinde dolacak. Lütfen bu hesap ile içe aktarma işlemlerinin yapılabilmesi için kimliği yeniden doğrulayın.", + "OAuthClientConfig": "OAuth istemci yapılandırması", + "OAuthError": "OAuth işlemi sırasında bir sorun çıktı. Lütfen yeniden deneyin ve gerekli izinleri verdiğinizden emin olun.", + "OAuthExampleText": "Yapılandırma için aşağıdaki alanlar gereklidir. Lütfen belirtilen değerleri kullanın:", + "OauthFailedMessage": "Google Search Console için yetkilendirme işlemi sırasında bir sorunla karşılaştık. Lütfen yeniden denemek için aşağıdaki düğmeye tıklayın. Sorun sürerse, yardım almak için destek ekibimizle görüşün. Ekibimiz sorunu çözmenize ve Google Search Console anahjtar sözcüklerinizi içe aktarmanıza yardımcı olur.", + "OptionQuickConnectWithGoogle": "Google ile hızlı bağlan (önerilir)", + "Platform": "Platform", + "Position": "Ortalama konum", + "PositionDocumentation": "Arama sonuçlarında sitenin ortalama konumu (bu anahtar sözcük için).", + "ProvideYandexClientConfig": "Lütfen Yandex Oauth istemci yapılandırmanızı ekleyin.", + "ProviderBingDescription": "Bing ve Yahoo!, aramalarında siteyi bulmak için kullanılan tüm anahtar sözcükleri içe aktarır.", + "ProviderBingNote": "Not: Microsoft, anahtar sözcük verilerini her Cumartesi günü bir hafta süre ile yayınlar. Bunun sonucu olarak Bing ve Yahoo için anahtar sözcüklerinizin raporlara eklenmesi bir kaç gün sürer ve yalnızca haftalık, aylık ve yıllık aralıklarda görüntülenir.", + "ProviderGoogleDescription": "Google, aramalarında siteyi bulmak için kullanılan tüm anahtar sözcükleri içe aktarır. Raporlarda anahtar sözcükler her bir arama türüne göre ayrılarak görüntülenir (Site, Görsel ve Görüntü).", + "ProviderGoogleNote": "Not: Google son anahtar sözcük verilerini 2 gün gecikmeli olarak yayınlar. Daha yakın günlerdeki son olmayan veriler her zaman görüntülenir ancak son olarak bildirildiğinde yeniden içe aktarılır. İlk içe aktarımda anahtar sözcük verilerinin 486 güne kadar olan geçmişi de içe aktarılabilir.", + "ProviderListDescription": "Aşağıdaki bir (ya da bir kaç) arama motorunu ayarladığınızda, Matomo tarafından arama anahtar sözcüklerinin içe aktarılacağı siteleri yapılandırabilirsiniz.", + "ProviderXAccountWarning": "Hesap yapılandırma sorunları bulundu
Lütfen %s için yapılandırılmış hesapları denetleyin.", + "ProviderXSitesWarning": "Site yapılandırma sorunları bulundu
Lütfen %s için yapılandırılmış siteleri denetleyin.", + "ProviderYandexDescription": "Yandex aramalarında siteyi bulmak için kullanılan tüm anahtar sözcükleri içe aktarır.", + "ProviderYandexNote": "Not: Yandex anahtar sözcük verilerini 5 güne kadar gecikmeli olarak yayınlar. İlk içe aktarımda anahtar sözcük verilerinin 100 güne kadar olan geçmişi de içe aktarılabilir.", + "ReAddAccountIfPermanentError": "Sorun düzelmiyorsa hesabı kaldırıp bağlantıyı yeniden kurmayı deneyin.", + "ReAuthenticateIfPermanentError": "Sorun düzelmiyorsa kimliği yeniden doğrulamayı ya da hesabı kaldırıp bağlantıyı yeniden kurmayı deneyin.", + "Reauthenticate": "Kimliği yeniden doğrula", + "RecentApiErrorsWarning": "Anahtar sözcük içe aktarma sorunları bulundu

Lütfen şu yapılandırmaları denetleyin:
%s

Yapılandırmanız doğruysa ve sorun sürüyorsa, lütfen destek ekibiyle görüşün.", + "ReportShowMaximumValues": "Görüntülenen değerler bu aralıktaki en yüksek değerlerdir.", + "RequiredAccessTypes": "Şu erişim türleri gereklidir:", + "ResponseCode": "Yanıt kodu", + "RoundKeywordPosition": "Anahtar konumu yuvarlansın", + "SearchEngineKeywordsPerformance": "Arama motoru anahtar sözcük başarımı", + "SearchEnginesImported": "Arama motorları (içe aktarılmış anahtar sözcükler ile)", + "SearchEnginesOriginal": "Arama motorları (izlenen anahtar sözcükler ile)", + "SetUpOAuthClientConfig": "OAuth istemci yapılandırmanızı ayarlayın", + "SetupConfiguration": "Yapılandırma ayarları", + "SitemapsContainingUrl": "%s içeren site haritaları", + "StartOAuth": "OAuth işlemini başlat", + "URLPrefix": "Adres ön eki", + "URLPrefixProperty": "Adres ön eki mülkü", + "URLPrefixPropertyInfo": "Yalnızca iletişim kuralının da (http/https) bulunduğu belirtilen tam ön eki içeren adresleri kapsar. Mülkünüzün herhangi bir iletişim kuralı ya da alt etki alanı ile (http/https/www./m. gibi) eşleşmesini istiyorsanız bunun yerine bir etki alanı mülkü eklemeyi düşünebilirsiniz.", + "UnverifiedSites": "Doğrulanmamış siteler:", + "UploadOAuthClientConfig": "OAuth istemci yapılandırmanızı yükleyin", + "Uploading": "Yükleniyor...", + "UrlOfAccount": "Adres (hesap)", + "VideoKeywords": "Google üzerindeki görüntü anahtar sözcükleri", + "VideoKeywordsDocumentation": "Google görüntü arama sonuçlarında sitenize bağlantılar oluşturmak için kullanılan anahtar sözcükler.", + "VisitOAuthHowTo": "%3$s OAuth istemcinizin nasıl yapılandırılacağını öğrenmek için %1$sçevrimiçi rehberimize%2$s bakabilirsiniz.", + "WebKeywords": "Google üzerindeki site anahtar sözcükleri", + "WebKeywordsDocumentation": "Google site arama sonuçlarında sitenize bağlantılar oluşturmak için kullanılan anahtar sözcükler.", + "WebsiteSuccessfulConfigured": "Tebrikler!
%1$s sitesi için anahtar sözcükleri içe aktarma yapılandırmasını tamamladınız.
İlk arama sözcüklerinizin içe aktarılması ve Yönlendirenler > Arama anahtar sözcükleri bölümünde görüntülenmesi bir kaç gün alabilir. Anahtar sözcüklerin içe aktarılmasındaki gecikmeler ve sınırlamalar hakkında bilgi almak için %2$sSSS%3$s bölümüne bakabilirsiniz", + "WebsiteTypeUnsupported": "Seçilmiş ölçülebilir %1$s türü desteklenmediğinden yapılandırılamaz. Yalnızca 'site' türündeki ölçülebilirler desteklenir.", + "WebsiteTypeUnsupportedRollUp": "Not: Toplu rapor siteleri otomatik olarak alt sitelerindeki içe aktarılmış verileri derler", + "YandexConfigurationDescription": "Yandex Webmaster API kimlik doğrulaması için OAuth kullanır.", + "YandexConfigurationTitle": "Yandex Webmaster API üzerinden içe aktarmayı yapılandırın", + "YandexCrawlAppearedPages": "Aramada görüntülenen sayfalar", + "YandexCrawlAppearedPagesDesc": "Yandex arama dizinine yeni eklenmiş sayfalar", + "YandexCrawlCrawledPages": "Derlenmiş sayfalar", + "YandexCrawlCrawledPagesDesc": "Yandex crawler tarafından istekte bulunulan sayfa sayısı.", + "YandexCrawlErrors": "Diğer istek sorunları", + "YandexCrawlErrorsDesc": "Diğer sorunlar ile derlenmiş sayfalar", + "YandexCrawlHttpStatus2xx": "HTTP kodları 200-299", + "YandexCrawlHttpStatus2xxDesc": "2xx koduyla derlenmiş sayfalar", + "YandexCrawlHttpStatus3xx": "HTTP kodları 300-399 (Taşınmış sayfalar)", + "YandexCrawlHttpStatus3xxDesc": "3xx koduyla derlenmiş sayfalar", + "YandexCrawlHttpStatus4xx": "HTTP kodları 400-499 (İstek sorunları)", + "YandexCrawlHttpStatus4xxDesc": "4xx koduyla derlenmiş sayfalar", + "YandexCrawlHttpStatus5xx": "HTTP kodları 500-599 (İç sunucu sorunları)", + "YandexCrawlHttpStatus5xxDesc": "5xx koduyla derlenmiş sayfalar", + "YandexCrawlInIndex": "Dizindeki sayfa sayısı", + "YandexCrawlInIndexDesc": "Yandex arama dizinindeki toplam sayfa", + "YandexCrawlRemovedPages": "Aramadan kaldırılmış sayfalar", + "YandexCrawlRemovedPagesDesc": "Yandex arama dizininden kaldırılmış sayfalar", + "YandexCrawlingStats": "Yandex! için derleme özeti", + "YandexCrawlingStatsDocumentation": "Derleme özetinde bir sayfa ziyaret edildiğinde arama botu tarafından karşılaşılan sorunlar, robots.txt dosyanız tarafından engellenen ögeler ve dizine eklenmiş toplam sayfa sayısı gibi derleme ile ilgili bilgiler bulunur.", + "YandexFieldCallbackUri": "Geri dönüş adresi", + "YandexFieldUrlToAppSite": "Uygulama sitesinin adresi", + "YandexKeywords": "Yandex üzerindeki anahtar sözcükler", + "YandexKeywordsDocumentation": "Yandex arama sonuçlarında sitenize bağlantılar oluşturmak için kullanılan anahtar sözcükler.", + "YandexWebmasterApiUrl": "Yandex Webmaster Tools adresi", + "YandexWebmasterApiUrlDescription": "Bu sitenin Yandex Webmaster Tools üzerindeki adresini yazın" + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/uk.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/uk.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/uk.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/zh-cn.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/zh-cn.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/zh-cn.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/zh-tw.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/zh-tw.json new file mode 100644 index 0000000..4b6f47b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/lang/zh-tw.json @@ -0,0 +1,178 @@ +{ + "SearchEngineKeywordsPerformance": { + "AccountAddedBy": "由 %1$s<\/em> 新增於 %2$s<\/em>", + "AccountConnectionValidationError": "驗證帳戶連線時出現錯誤:", + "AccountDoesNotExist": "設置的帳戶 %1$s 已不存在", + "AccountNoAccess": "這個帳戶目前似乎沒有能存取的網站。", + "AccountRemovalConfirm": "你將要移除帳戶 %1$s。這將可能停止任何已連結網站的關鍵字匯入。確定要繼續?", + "ActivityAccountAdded": "為關鍵字提供商 %1$s 新增帳戶:%2$s", + "ActivityAccountRemoved": "為關鍵字提供商 %1$s 移除帳戶:%2$s", + "ActivityGoogleClientConfigChanged": "變更 Google 用戶端設定", + "AddAPIKey": "新增 API 金鑰", + "AddConfiguration": "新增設定", + "AdminMenuTitle": "搜尋關鍵字優化", + "APIKey": "API 金鑰", + "AvailableSites": "可匯入的網站:", + "Domain": "網域", + "DomainProperty": "網域資源", + "DomainPropertyInfo": "包含所有子網域 (m、www 等) 以及兩種通訊協定 (http、https)。", + "URLPrefix": "網址前置字元", + "URLPrefixProperty": "網址前置字元資源", + "URLPrefixPropertyInfo": "只包含具有指定前置字元 (包括 http\/https 通訊協定) 的網址。如果要讓您的資源涵蓋任何通訊協定或子網域 (http\/https\/www.\/m. 等),請考慮改為新增網域資源。", + "BingAccountError": "驗證 API 金鑰時發生錯誤:%1$s。如果你剛剛才在 Bing 網站管理員中產生這組 API 金鑰,請在 1~2 分鐘後再重試(Bing 網站管理員工具需要一點時間來啟用 API 金鑰)。", + "BingAccountOk": "API 金鑰成功完成檢查", + "BingConfigurationDescription": "Bing 網站管理員工具需要 API 金鑰來存取。你可以在這裡新增 API 金鑰來存取你的網站資料。", + "BingConfigurationTitle": "從 Bing 網站管理員工具匯入", + "BingCrawlBlockedByRobotsTxt": "Robots.txt 排除項目", + "BingCrawlBlockedByRobotsTxtDesc": "目前被你網站中 robots.txt 封鎖的網址。", + "BingCrawlConnectionTimeout": "連線逾時", + "BingCrawlConnectionTimeoutDesc": "這個數字為目前 Bing 因連線錯誤而無法存取你的網站的計數。這可能是暫時性的錯誤但你應該檢查你的伺服器紀錄檔來查看是否意外遺漏了請求。", + "BingCrawlCrawledPages": "已檢索網頁", + "BingCrawlCrawledPagesDesc": "Bing 爬蟲請求的網頁數量", + "BingCrawlDNSFailures": "DNS 失敗", + "BingCrawlDNSFailuresDesc": "這個項目列出最近機器人嘗試存取你的網頁並向 DNS 伺服器連線時所發生的錯誤。可能是你的伺服器出現問題,或有其他錯誤的設定防止了 DNS 路由,例如 TTL 設定成 0。", + "BingCrawlErrors": "Bing 檢索錯誤", + "BingCrawlErrorsDesc": "Bing 爬蟲遇到的錯誤數量", + "BingCrawlErrorsFromDateX": "這份報表顯示 Bing 最近的檢索錯誤。它不會提供任何歷史資料。最後更新於 %s", + "BingCrawlHttpStatus2xx": "HTTP 狀態碼 200-299", + "BingCrawlHttpStatus2xxDesc": "於伺服器提供網頁完成時所回傳的狀態碼", + "BingCrawlHttpStatus301": "HTTP 狀態碼 301(網頁已永久移動)", + "BingCrawlHttpStatus301Desc": "當內容已永久移動至其他位置(網址)時所回傳的狀態碼", + "BingCrawlHttpStatus302": "HTTP 狀態碼 302(網頁已暫時移動)", + "BingCrawlHttpStatus302Desc": "當內容暫時移動至其他位置(網址)時所回傳的狀態碼", + "BingCrawlHttpStatus4xx": "HTTP 狀態碼 400-499(要求錯誤)", + "BingCrawlHttpStatus4xxDesc": "當請求疑似發生錯誤,伺服器防止繼續處理時所回傳的狀態碼", + "BingCrawlHttpStatus5xx": "HTTP 狀態碼 500-599(內部伺服器錯誤)", + "BingCrawlHttpStatus5xxDesc": "當伺服器處理一個有效請求失敗時所回傳的狀態碼", + "BingCrawlImportantBlockedByRobotsTxt": "被 robots.txt 排除的重要網頁", + "BingCrawlInboundLink": "傳入連結總數", + "BingCrawlInboundLinkDesc": "傳入連結是 Bing 所察覺且指向你網站的網址。這些連結的來源是已指向你的內容且為你所擁有的外部網站。", + "BingCrawlingStats": "Bing 和 Yahoo! 的檢索總覽", + "BingCrawlingStatsDocumentation": "檢索總覽提供你查看檢索相關資訊,如搜尋引擎機器人訪問網頁或項目時遇到的錯誤,可能是被你的 robot.txt 檔案封鎖和網站可能被惡意程式碼感染。", + "BingCrawlMalwareInfected": "已感染惡意程式碼", + "BingCrawlMalwareInfectedDesc": "Bing 所發現受到惡意程式碼感染或有關聯的任何網頁會顯示於此群組。", + "BingCrawlPagesInIndex": "已索引總數", + "BingCrawlPagesInIndexDesc": "出現於 Bing 索引中的網頁計數", + "BingCrawlStatsOtherCodes": "其他 HTTP 狀態碼", + "BingCrawlStatsOtherCodesDesc": "集合其它未列出的狀態碼(如 1xx 或資訊狀態碼)。", + "BingKeywordImport": "Bing 關鍵字匯入", + "BingKeywords": "關鍵字(來自 Bing 和 Yahoo!)", + "BingKeywordsDocumentation": "使用於 Bing 或 Yahoo! 搜尋並於搜尋結果連結至你的網站的關鍵字。", + "BingKeywordsNoRangeReports": "Bing 和 Yahoo! 上的關鍵字只能在包含完整一周或一個月的自訂日期範圍內處理,因為它們不支援日報表。", + "BingKeywordsNotDaily": "Bing 和 Yahoo! 的關鍵字只適用於周報表。單日範圍內沒有關鍵字資料。", + "BingWebmasterApiUrl": "Bing 網站管理員工具網址", + "BingWebmasterApiUrlDescription": "提供 Bing 網站管理員工具中此網站的網址", + "Category": "分類", + "ChangeConfiguration": "變更設定", + "Clicks": "點擊", + "ClicksDocumentation": "每當有人透過搜尋結果頁面點擊連結進入你的網站時計算一次。", + "ClientConfigImported": "用戶端設定已成功匯入!", + "ClientConfigSaveError": "保存用戶端設定時發生錯誤。請檢查提供的設定是否有效並重試。", + "ClientId": "用戶端 ID", + "ClientSecret": "用戶端密碼", + "ConfigAvailableNoWebsiteConfigured": "整合已成功設定,但目前還沒有設定要匯入的網站。", + "ConfigRemovalConfirm": "你將要移除 %1$s 的設定。這將會停用該站匯入關鍵字。要繼續嗎?", + "Configuration": "設定", + "ConfigurationDescription": "這個外掛讓你可以直接將你的使用者在搜尋引擎中使用的關鍵字匯入 Matomo。", + "ConfigurationFile": "設定檔案", + "ConfigurationValid": "你的 OAuth 設定有效。", + "ConfiguredAccounts": "已設定帳戶", + "ConfiguredUrlNotAvailable": "設定的 URL 無法於這個帳戶使用", + "ConfigureMeasurableBelow": "點擊下方的按鈕來設置網站,也可以直接於網站設定中設置。", + "ConfigureMeasurables": "網站設置", + "ConnectAccount": "連結帳戶", + "ConnectFirstAccount": "連接你的第一個帳戶來開始。", + "ConnectGoogleAccounts": "連結 Google 帳戶", + "ContainingSitemaps": "包含 Sitemap", + "CrawlingErrors": "檢索錯誤", + "CrawlingStats": "檢索總覽", + "Ctr": "CTR", + "CtrDocumentation": "點擊率:顯示使用者於搜尋結果中看到你的網站連結後,最終點擊進入的比例。", + "CurrentlyConnectedAccounts": "目前已經連結了 %1$s 個帳戶。", + "EnabledSearchTypes": "收集的關鍵字類型", + "FetchImageKeyword": "收集圖片關鍵字", + "FetchImageKeywordDesc": "收集於 Google 圖片搜尋的關鍵字", + "FetchVideoKeyword": "收集影片關鍵字", + "FetchVideoKeywordDesc": "收集於 Google 影片搜尋的關鍵字", + "FetchWebKeyword": "收集網頁關鍵字", + "FetchWebKeywordDesc": "收集於 Google 網頁搜尋的關鍵字", + "FirstDetected": "首次偵測", + "GoogleAccountAccessTypeOfflineAccess": "離線存取<\/strong>為必要選項來在你為登入時也能匯入你的搜尋關鍵字。", + "GoogleAccountAccessTypeProfileInfo": "帳戶資料<\/strong>用來顯示目前已連結的帳戶名稱。", + "GoogleAccountAccessTypeSearchConsoleData": "Search Console 資料<\/strong>為必要選項來取得你的 Google 搜尋關鍵字。", + "GoogleAccountError": "驗證 OAuth 存取時發生錯誤:%1$s", + "GoogleAccountOk": "OAuth 存取成功完成檢查。", + "GoogleConfigurationDescription": "Google Search Console 使用 OAuth 來驗證和授權。", + "GoogleConfigurationTitle": "從 Google Search Console 匯入", + "GoogleKeywordImport": "Google 關鍵字匯入", + "GoogleSearchConsoleUrl": "Google Search Console 網址", + "GoogleSearchConsoleUrlDescription": "提供 Google Search Console 中此網站的網址", + "GoogleUploadOrPasteClientConfig": "請上傳你的 Google OAuth 用戶端設定,或將它貼至下方的文字框內。", + "HowToGetOAuthClientConfig": "如何取得你的 OAuth 用戶端設定", + "ImageKeywords": "來自 Google 的圖片關鍵字", + "ImageKeywordsDocumentation": "使用於 Google 圖片<\/b>搜尋並於搜尋結果連結至你的網站的關鍵字。", + "Impressions": "印象", + "ImpressionsDocumentation": "印象是每當你的網站出現於搜尋結果頁面中時計算一次。", + "IntegrationConfigured": "已成功完成整合設定", + "IntegrationNotConfigured": "尚未完成整合設定", + "KeywordsCombined": "綜合關鍵字", + "KeywordsCombinedDocumentation": "顯示所有於 Matomo 偵測到和從搜尋引擎匯入的全部關鍵字組合。這份報表只包含訪問數據。你可以切換至相關報表來取得詳細數據。", + "KeywordsCombinedImported": "綜合已匯入的關鍵字", + "KeywordsCombinedImportedDocumentation": "報表顯示所有設置的搜尋引擎所匯入的關鍵字。", + "KeywordsReferrers": "關鍵字(包含未定義)", + "KeywordStatistics": "搜尋關鍵字", + "KeywordTypeImage": "圖片", + "KeywordTypeVideo": "影片", + "KeywordTypeWeb": "網頁", + "LastCrawled": "最後檢索", + "LastDetected": "最後偵測", + "LastImport": "最後匯入", + "LatestAvailableDate": "最近可用的關鍵字資料日期為:%1$s", + "LinksToUrl": "連結至 %s", + "ManageAPIKeys": "管理 API 金鑰", + "MeasurableConfig": "已設置的網站", + "NoSegmentation": "報表不支援區隔。資料將以你的標準、未區隔資料顯示。", + "NotAvailable": "不啟用", + "NoWebsiteConfigured": "目前還沒有完成設定的網站。要為特定網站啟用匯入,請在此完成設定。", + "NoWebsiteConfiguredWarning": "%s 的匯入未設定完整。你必須設定一些網站來啟用匯入。", + "OAuthClientConfig": "OAuth 用戶端設定", + "OAuthError": "OAuth 過程發生錯誤。請重試並確定你允許請求的授權。", + "Platform": "平台", + "Position": "平均位置", + "PositionDocumentation": "你的網站於搜尋結果中出現的平均位置(針對這個關鍵字)。", + "ProviderBingDescription": "匯入所有常在 Bing<\/strong> 和 Yahoo!<\/strong> 搜尋中用來搜尋你的網站的關鍵字。", + "ProviderBingNote": "備註:<\/u>微軟於每周六提供當周的關鍵字資料。通常在 Bing 和 Yahoo 上搜尋的關鍵字會花幾天的時間才顯示於報表中,而且只會在查看周、月或年報表時才顯示。", + "ProviderGoogleDescription": "匯入所有常在 Google<\/strong> 搜尋中用來搜尋你的網站的關鍵字。報表中將會分別顯示不同搜尋類型(網頁、圖片和影片)的關鍵字。", + "ProviderListDescription": "當你於下方成功設定一個或多個搜尋引擎後,你可以選擇 Matomo 要將搜尋關鍵字匯入哪個網站。", + "ProviderXAccountWarning": "偵測到帳戶設定問題<\/strong>
請檢查 %s<\/strong> 的帳戶設定。", + "ProviderXSitesWarning": "偵測到網站設定問題<\/strong>
請檢查 %s<\/strong> 的網站設定。", + "ReAddAccountIfPermanentError": "如果這是常駐性的錯誤,請試著先將帳戶移除後重新連結。", + "RequiredAccessTypes": "這些授權類型為必要:", + "ResponseCode": "回應碼", + "RoundKeywordPosition": "將關鍵字位置四捨五入", + "SearchEngineKeywordsPerformance": "搜尋引擎關鍵字優化", + "SetupConfiguration": "開始設定", + "SitemapsContainingUrl": "Sitemaps 包含%s", + "KeywordsSubtableOriginal": "已追蹤關鍵字(包含未定義)", + "KeywordsSubtableImported": "已匯入關鍵字", + "AllReferrersOriginal": "參照連結(已追蹤的關鍵字)", + "AllReferrersImported": "參照連結(已匯入的關鍵字)", + "SearchEnginesOriginal": "搜尋引擎(已追蹤的關鍵字)", + "SearchEnginesImported": "搜尋引擎(已匯入的關鍵字)", + "StartOAuth": "開始 OAuth 驗證", + "UnverifiedSites": "未驗證網站:", + "UploadOAuthClientConfig": "上傳你的 OAuth 用戶端設定", + "UrlOfAccount": "網址(帳戶)", + "VideoKeywords": "來自 Google 的影片關鍵字", + "VideoKeywordsDocumentation": "使用於 Google 影片<\/b>搜尋並於搜尋結果連結至你的網站的關鍵字。", + "WebKeywords": "來自 Google 的網頁關鍵字", + "WebKeywordsDocumentation": "使用於 Google 網頁<\/b>搜尋並於搜尋結果連結至你的網站的關鍵字。", + "WebsiteSuccessfulConfigured": "恭喜!
你已經為網站 %1$s 成功設定關鍵字匯入。
你可能需要等待幾天的時間才能在收穫 > 搜尋引擎和關鍵字中看到關鍵字。你可以在我們的 %2$sFAQ%3$s 中查看更多關於關鍵字匯入延遲和限制的資訊。", + "WebsiteTypeUnsupported": "無法設定選擇的監測對象 %1$s,因為它包含了不支援的類型。只支援類型為「網站」的監測對象。", + "WebsiteTypeUnsupportedRollUp": "注意:彙整網站將會自動結合它們所有子網站所匯入的資料", + "YandexCrawlHttpStatus2xx": "HTTP 狀態碼 200-299", + "YandexCrawlHttpStatus4xx": "HTTP 狀態碼 400-499(要求錯誤)", + "YandexCrawlHttpStatus5xx": "HTTP 狀態碼 500-599(內部伺服器錯誤)", + "YandexCrawlInIndex": "已索引總數" + } +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/phpcs.xml b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/phpcs.xml new file mode 100644 index 0000000..d769944 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/phpcs.xml @@ -0,0 +1,41 @@ + + + + Matomo Coding Standard for SearchEngineKeywordsPerformance plugin + + + + . + + tests/javascript/* + */vendor/* + + + + + + + + tests/* + + + + + Updates/* + + + + + tests/* + + + + + tests/* + + + + + Monolog/Handler/SEKPSystemLogHandler.php + + \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/plugin.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/plugin.json new file mode 100644 index 0000000..97cc003 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/plugin.json @@ -0,0 +1,31 @@ +{ + "name": "SearchEngineKeywordsPerformance", + "version": "5.0.23", + "description": "All keywords searched by your users on search engines are now visible into your Referrers reports! The ultimate solution to 'Keyword not defined'.", + "theme": false, + "require": { + "matomo": ">=5.0.0-rc5,<6.0.0-b1" + }, + "authors": [ + { + "name": "InnoCraft", + "email": "contact@innocraft.com", + "homepage": "https://www.innocraft.com" + } + ], + "price": { + "base": 154 + }, + "homepage": "https://plugins.matomo.org/SearchEngineKeywordsPerformance", + "license": "InnoCraft EULA", + "keywords": [ + "Keyword", + "Crawling", + "Search", + "Google", + "Bing", + "Yahoo", + "Yandex", + "SEO" + ] +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/pull_request_template.md b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/pull_request_template.md new file mode 100644 index 0000000..e7d9cf5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/pull_request_template.md @@ -0,0 +1,26 @@ +## Description + + +## Issue No + + +## Steps to Replicate the Issue +1. +2. +3. + + + +## Checklist +- [✔/✖] Tested locally or on demo2/demo3? +- [✔/✖/NA] New test case added/updated? +- [✔/✖/NA] Are all newly added texts included via translation? +- [✔/✖/NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue) +- [✔/✖/NA] Version bumped? \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/scoper.inc.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/scoper.inc.php new file mode 100644 index 0000000..f79ced1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/scoper.inc.php @@ -0,0 +1,141 @@ +files() + ->in(__DIR__) + ->exclude('vendor') + ->exclude('node_modules') + ->exclude('lang') + ->exclude('javascripts') + ->exclude('vue') + ->notName(['scoper.inc.php', 'Controller.php']) + ->filter(function (\SplFileInfo $file) { + return !($file->isLink() && $file->isDir()); + }) + ->filter(function (\SplFileInfo $file) { + return !($file->isLink() && !$file->getRealPath()); + }), + ]; +} else { + $finders = array_map(function ($dependency) { + return Finder::create() + ->files() + ->in($dependency); + }, $dependenciesToPrefix); +} + +$namespacesToIncludeRegexes = array_map(function ($n) { + $n = rtrim($n, '\\'); + return '/^' . preg_quote($n) . '(?:\\\\|$)/'; +}, $namespacesToPrefix); + +return [ + 'expose-global-constants' => false, + 'expose-global-classes' => false, + 'expose-global-functions' => false, + 'force-no-global-alias' => $forceNoGlobalAlias, + 'prefix' => 'Matomo\\Dependencies\\' . $pluginName, + 'finders' => $finders, + 'patchers' => [ + // patcher for files that class_alias new namespaced classes with old un-namespaced classes + static function (string $filePath, string $prefix, string $content) use ($isRenamingReferences): string { + if ($isRenamingReferences) { + return $content; + } + + if ($filePath === __DIR__ . '/vendor/google/apiclient/src/Client.php') { + $content = str_replace( + [ + 'Monolog\Handler\StreamHandler', + 'Monolog\Handler\SyslogHandler', 'Monolog\Logger' + ], + [ + '\Piwik\Plugins\Monolog\Handler\FileHandler', + '\Piwik\Plugins\SearchEngineKeywordsPerformance\Monolog\Handler\SEKPSystemLogHandler', + '\Piwik\Log\Logger' + ], + $content + ); + } + + if ( + $filePath === __DIR__ . '/vendor/google/apiclient/src/aliases.php' + || $filePath === __DIR__ . '/vendor/google/apiclient-services/autoload.php' + ) { + $content = preg_replace_callback('/([\'"])Google_/', function ($matches) { + return $matches[1] . 'Matomo\\\\Dependencies\\\\SearchEngineKeywordsPerformance\\\\Google_'; + }, $content); + } + + if ($filePath === __DIR__ . '/vendor/google/apiclient/src/aliases.php') { + $content = preg_replace('/class Google_Task_Composer.*?}/', "if (!class_exists('Google_Task_Composer')) {\n$1\n}", $content); + } + + if ($filePath === __DIR__ . '/vendor/google/apiclient-services/autoload.php') { + // there is a core autoloader that will replace 'Matomo' in Matomo\Dependencies\... to Piwik\ if the + // Matomo\... class cannot be found. + // + // normally this wouldn't be an issue, but in the importer we will be unserializing classes that + // haven't been autoloaded, and some of those classes are handled by a special autoloader in one + // of google's libraries. this autoloader is called after the renaming autoloader changes the name to + // Piwik\Dependencies\..., so we need to be able to recognize both Matomo\ and Piwik\ there, or the + // target php file won't be loaded properly. + $replace = << $namespacesToIncludeRegexes, + 'exclude-namespaces' => $namespacesToExclude, + 'exclude-constants' => [ + 'PIWIK_TEST_MODE', + '/^self::/', // work around php-scoper bug + ], + 'exclude-functions' => ['Piwik_ShouldPrintBackTraceWithMessage'], +]; diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/stylesheets/styles.less b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/stylesheets/styles.less new file mode 100644 index 0000000..b94e333 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/stylesheets/styles.less @@ -0,0 +1,262 @@ +.keywordproviders, .accounts { + margin-top: 15px; + display: flex; + flex-wrap: wrap; +} + +.keywordprovider { + width: 300px; + float: left; + padding: 20px; + border: 1px solid #D73F36; + margin-right: 20px; + position: relative; + text-align: justify; + padding-bottom: 70px; + + .logo { + height: 200px; + line-height: 200px; + text-align: center; + + img { + text-align: center; + max-height: 200px; + max-width: 100%; + } + } + + .logo.double { + height: 100px; + line-height: 100px; + + img { + max-height: 100px; + } + } + + h3 { + margin-top: 15px; + } + + .cta { + text-align: center; + bottom: 20px; + position: absolute; + width: inherit; + margin-left: -20px; + } + + &.configured { + + border-color: #43a047; + + .cta button { + background-color: #43a047; + } + } + + &.warning { + + border-color: #DF9D27; + + .cta button { + background-color: #DF9D27; + } + } +} + +#content .keywordprovider .experimental { + right: 15px; + position: absolute; + top: 130px; + transform: rotate(-30deg); + color: red; + font-weight: bolder; + font-size: 2em; + text-shadow: -2px 0 #fff, 0 2px #fff, 2px 0 #fff, 0 -2px #fff; +} + +.websiteconfiguration, .clientconfiguration, .oauthconfiguration, .accountconfiguration { + + > .card { + border: 2px solid #D73F36; + } + + &.configured { + > .card { + border: inherit; + } + } + + .websites-list { + max-height: 175px; + overflow-y: auto; + } +} + +.websiteconfiguration { + .property-type { + font-style: italic; + line-height: 25px; + color: grey; + } + .icon-info { + position: relative; + top: 2px; + } +} + +.account { + width: 300px; + float: left; + padding: 20px; + border: 1px solid #43a047; + margin-right: 20px; + position: relative; + text-align: justify; + padding-bottom: 70px; + + .yandex & { + padding-bottom: 110px; + } + + h3 { + text-align: center; + } + + ul { + margin-bottom: 15px; + } + + &.add { + border: 1px solid #838383; + } + + &.invalid { + border: 1px solid #D73F36; + + .logo.icon-add { + color: #D73F36 + } + } + + .logo { + height: 100px; + line-height: 100px; + text-align: center; + + &.icon-warning { + font-size: 50px; + color: #D73F36; + } + + &.icon-add { + font-size: 50px; + color: #838383; + } + + &.icon-success { + font-size: 50px; + color: #43a047; + } + + img { + text-align: center; + max-height: 100px; + max-width: 100%; + } + } + + .cta { + text-align: center; + bottom: 20px; + position: absolute; + width: 100%; + margin-left: -20px; + + form+form { + padding-top: 10px; + } + } + + .accounterror { + color: #D73F36!important; + font-weight: bolder; + + .icon-warning { + display: block; + float: left; + font-size: 1.5em; + line-height: 2em; + padding-right: 5px; + } + } +} + +.configureMeasurableForm { + .form-group { + margin-top: 0; + margin-bottom: 0; + } + + input[type=submit] { + margin-top: 20px; + } + + .col { + padding: 0; + } + + label { + left: 0; + } +} + +.account-select .dropdown-content { + width: 250px!important; + word-break: break-all; +} + +table.measurableList { + + tr.error { + border: 2px solid #D73F36; + } + + .icon-error { + color: #D73F36; + } + + button.icon-delete { + line-height: inherit; + height: inherit; + } +} + +#googleurlinfo { + h2 { + word-break: break-all; + } + + ul, li { + list-style: disc outside; + padding-top: 6px; + margin-left: 10px; + word-break: break-all; + } +} + +// hides column values for imported rows on some reports +tr[data-row-metadata*='"imported":true,'] { + td.column { + .value, .ratio { + visibility: hidden; + } + } + td.label, td.label + td.column { + .value, &.highlight .ratio { + visibility: visible; + } + } +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/bing/configuration.twig b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/bing/configuration.twig new file mode 100644 index 0000000..8caaf50 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/bing/configuration.twig @@ -0,0 +1,24 @@ +{% extends 'admin.twig' %} + +{% set title %}{{ 'SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance'|translate }}{% endset %} + +{% block content %} + +
+ +{% endblock %} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/google/configuration.twig b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/google/configuration.twig new file mode 100644 index 0000000..507f7bc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/google/configuration.twig @@ -0,0 +1,32 @@ +{% extends 'admin.twig' %} + +{% set title %}{{ 'SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance'|translate }}{% endset %} + +{% block content %} + +
+ +{% endblock %} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/index.twig b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/index.twig new file mode 100644 index 0000000..eb185cb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/index.twig @@ -0,0 +1,12 @@ +{% extends 'admin.twig' %} + +{% set title %}{{ 'SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance'|translate }}{% endset %} + +{% block content %} + +
+ +{% endblock %} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/messageReferrerKeywordsReport.twig b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/messageReferrerKeywordsReport.twig new file mode 100644 index 0000000..66df0eb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/messageReferrerKeywordsReport.twig @@ -0,0 +1,10 @@ +

+ {% if not hasAdminPriviliges %} + Did you know?
+ An Admin or Super User can Configure Search Performance to import all your search keywords into Matomo. + {% else %} + Did you know?
+ You can Configure + Search Performance to import all your search keywords into Matomo. + {% endif %} +

\ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/yandex/configuration.twig b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/yandex/configuration.twig new file mode 100644 index 0000000..52d6f35 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/templates/yandex/configuration.twig @@ -0,0 +1,31 @@ +{% extends 'admin.twig' %} + +{% set title %}{{ 'SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance'|translate }}{% endset %} + +{% block content %} + +
+ +{% endblock %} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/autoload.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/autoload.php new file mode 100644 index 0000000..717d21e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/autoload.php @@ -0,0 +1,10 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-return array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/InstalledVersions.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/InstalledVersions.php new file mode 100644 index 0000000..c6b54af --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/InstalledVersions.php @@ -0,0 +1,352 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints($constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = require __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + $installed[] = self::$installed; + + return $installed; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_classmap.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..0fb0a2c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_classmap.php @@ -0,0 +1,10 @@ + $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_files.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_files.php new file mode 100644 index 0000000..5333040 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_files.php @@ -0,0 +1,16 @@ + $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', + '6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', + '1f87db08236948d07391152dccb70f04' => $vendorDir . '/google/apiclient-services/autoload.php', + 'decc78cc4436b1292c6c0d151b19445c' => $vendorDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', + 'a8d3953fd9959404dd22d3dfcd0a79f0' => $vendorDir . '/google/apiclient/src/aliases.php', +); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_namespaces.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..15a2ff3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($vendorDir . '/phpseclib/phpseclib/phpseclib'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'), + 'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'), + 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), + 'ParagonIE\\ConstantTime\\' => array($vendorDir . '/paragonie/constant_time_encoding/src'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), + 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), + 'Google\\Service\\' => array($vendorDir . '/google/apiclient-services/src'), + 'Google\\Auth\\' => array($vendorDir . '/google/auth/src'), + 'Google\\' => array($vendorDir . '/google/apiclient/src'), + 'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'), +); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_real.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_real.php new file mode 100644 index 0000000..2691ae8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_real.php @@ -0,0 +1,55 @@ +register(true); + + $includeFiles = \Composer\Autoload\ComposerStaticInita45dbc566c3f138ca6114173227009ed::$files; + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequirea45dbc566c3f138ca6114173227009ed($fileIdentifier, $file); + } + + return $loader; + } +} + +/** + * @param string $fileIdentifier + * @param string $file + * @return void + */ +function composerRequirea45dbc566c3f138ca6114173227009ed($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_static.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_static.php new file mode 100644 index 0000000..2bb076a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/autoload_static.php @@ -0,0 +1,105 @@ + + array ( + 'phpseclib3\\' => 11, + ), + 'P' => + array ( + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Http\\Client\\' => 16, + 'Psr\\Cache\\' => 10, + 'ParagonIE\\ConstantTime\\' => 23, + ), + 'G' => + array ( + 'GuzzleHttp\\Psr7\\' => 16, + 'GuzzleHttp\\Promise\\' => 19, + 'GuzzleHttp\\' => 11, + 'Google\\Service\\' => 15, + 'Google\\Auth\\' => 12, + 'Google\\' => 7, + ), + 'F' => + array ( + 'Firebase\\JWT\\' => 13, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'phpseclib3\\' => + array ( + 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', + ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-factory/src', + 1 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\Http\\Client\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-client/src', + ), + 'Psr\\Cache\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/cache/src', + ), + 'ParagonIE\\ConstantTime\\' => + array ( + 0 => __DIR__ . '/..' . '/paragonie/constant_time_encoding/src', + ), + 'GuzzleHttp\\Psr7\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'GuzzleHttp\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', + ), + 'GuzzleHttp\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/guzzle/src', + ), + 'Google\\Service\\' => + array ( + 0 => __DIR__ . '/..' . '/google/apiclient-services/src', + ), + 'Google\\Auth\\' => + array ( + 0 => __DIR__ . '/..' . '/google/auth/src', + ), + 'Google\\' => + array ( + 0 => __DIR__ . '/..' . '/google/apiclient/src', + ), + 'Firebase\\JWT\\' => + array ( + 0 => __DIR__ . '/..' . '/firebase/php-jwt/src', + ), + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInita45dbc566c3f138ca6114173227009ed::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInita45dbc566c3f138ca6114173227009ed::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInita45dbc566c3f138ca6114173227009ed::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/installed.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/installed.json new file mode 100644 index 0000000..ee778d0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/installed.json @@ -0,0 +1,1156 @@ +{ + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v6.10.0", + "version_normalized": "6.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", + "shasum": "" + }, + "require": { + "php": "^7.4||^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "ext-sodium": "Support EdDSA (Ed25519) signatures", + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "time": "2023-12-01T16:26:39+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" + }, + "install-path": "../firebase/php-jwt" + }, + { + "name": "google/apiclient", + "version": "v2.15.3", + "version_normalized": "2.15.3.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-api-php-client.git", + "reference": "e70273c06d18824de77e114247ae3102f8aec64d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/e70273c06d18824de77e114247ae3102f8aec64d", + "reference": "e70273c06d18824de77e114247ae3102f8aec64d", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~6.0", + "google/apiclient-services": "~0.200", + "google/auth": "^1.33", + "guzzlehttp/guzzle": "^6.5.8||^7.4.5", + "guzzlehttp/psr7": "^1.8.4||^2.2.1", + "monolog/monolog": "^2.9||^3.0", + "php": "^7.4|^8.0", + "phpseclib/phpseclib": "^3.0.34" + }, + "require-dev": { + "cache/filesystem-adapter": "^1.1", + "composer/composer": "^1.10.22", + "phpcompatibility/php-compatibility": "^9.2", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "^3.8", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1" + }, + "suggest": { + "cache/filesystem-adapter": "For caching certs and tokens (using Google\\Client::setCache)" + }, + "time": "2024-01-04T19:15:22+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/aliases.php" + ], + "psr-4": { + "Google\\": "src/" + }, + "classmap": [ + "src/aliases.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/google-api-php-client/issues", + "source": "https://github.com/googleapis/google-api-php-client/tree/v2.15.3" + }, + "install-path": "../google/apiclient" + }, + { + "name": "google/apiclient-services", + "version": "v0.224.1", + "version_normalized": "0.224.1.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-api-php-client-services.git", + "reference": "06e515176ebf32c3dcf7c01b3f377af6bfca6ae3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-api-php-client-services/zipball/06e515176ebf32c3dcf7c01b3f377af6bfca6ae3", + "reference": "06e515176ebf32c3dcf7c01b3f377af6bfca6ae3", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5.7||^8.5.13" + }, + "time": "2021-12-05T12:26:30+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "autoload.php" + ], + "psr-4": { + "Google\\Service\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Client library for Google APIs", + "homepage": "http://developers.google.com/api-client-library/php", + "keywords": [ + "google" + ], + "support": { + "issues": "https://github.com/googleapis/google-api-php-client-services/issues", + "source": "https://github.com/googleapis/google-api-php-client-services/tree/v0.224.1" + }, + "install-path": "../google/apiclient-services" + }, + { + "name": "google/auth", + "version": "v1.34.0", + "version_normalized": "1.34.0.0", + "source": { + "type": "git", + "url": "https://github.com/googleapis/google-auth-library-php.git", + "reference": "155daeadfd2f09743f611ea493b828d382519575" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/155daeadfd2f09743f611ea493b828d382519575", + "reference": "155daeadfd2f09743f611ea493b828d382519575", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "^6.0", + "guzzlehttp/guzzle": "^6.2.1|^7.0", + "guzzlehttp/psr7": "^2.4.5", + "php": "^7.4||^8.0", + "psr/cache": "^1.0||^2.0||^3.0", + "psr/http-message": "^1.1||^2.0" + }, + "require-dev": { + "guzzlehttp/promises": "^2.0", + "kelvinmo/simplejwt": "0.7.1", + "phpseclib/phpseclib": "^3.0", + "phpspec/prophecy-phpunit": "^2.0", + "phpunit/phpunit": "^9.0.0", + "sebastian/comparator": ">=1.2.3", + "squizlabs/php_codesniffer": "^3.5" + }, + "suggest": { + "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." + }, + "time": "2024-01-03T20:45:15+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "support": { + "docs": "https://googleapis.github.io/google-auth-library-php/main/", + "issues": "https://github.com/googleapis/google-auth-library-php/issues", + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.34.0" + }, + "install-path": "../google/auth" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.8.1", + "version_normalized": "7.8.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.5.3 || ^2.0.1", + "guzzlehttp/psr7": "^1.9.1 || ^2.5.1", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "time": "2023-12-03T20:35:24+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/guzzle" + }, + { + "name": "guzzlehttp/promises", + "version": "1.5.3", + "version_normalized": "1.5.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/67ab6e18aaa14d753cc148911d273f6e6cb6721e", + "reference": "67ab6e18aaa14d753cc148911d273f6e6cb6721e", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4 || ^5.1" + }, + "time": "2023-05-21T12:31:43+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/promises" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.5.1", + "version_normalized": "2.5.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "a0b3a03e8e8005257fbc408ce5f0fd0a8274dc7f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/a0b3a03e8e8005257fbc408ce5f0fd0a8274dc7f", + "reference": "a0b3a03e8e8005257fbc408ce5f0fd0a8274dc7f", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2023-08-03T15:02:42+00:00", + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.5.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "install-path": "../guzzlehttp/psr7" + }, + { + "name": "paragonie/constant_time_encoding", + "version": "v2.6.3", + "version_normalized": "2.6.3.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/constant_time_encoding.git", + "reference": "58c3f47f650c94ec05a151692652a868995d2938" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/58c3f47f650c94ec05a151692652a868995d2938", + "reference": "58c3f47f650c94ec05a151692652a868995d2938", + "shasum": "" + }, + "require": { + "php": "^7|^8" + }, + "require-dev": { + "phpunit/phpunit": "^6|^7|^8|^9", + "vimeo/psalm": "^1|^2|^3|^4" + }, + "time": "2022-06-14T06:56:20+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "ParagonIE\\ConstantTime\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com", + "role": "Maintainer" + }, + { + "name": "Steve 'Sc00bz' Thomas", + "email": "steve@tobtu.com", + "homepage": "https://www.tobtu.com", + "role": "Original Developer" + } + ], + "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)", + "keywords": [ + "base16", + "base32", + "base32_decode", + "base32_encode", + "base64", + "base64_decode", + "base64_encode", + "bin2hex", + "encoding", + "hex", + "hex2bin", + "rfc4648" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/constant_time_encoding/issues", + "source": "https://github.com/paragonie/constant_time_encoding" + }, + "install-path": "../paragonie/constant_time_encoding" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.100", + "version_normalized": "9.99.100.0", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a", + "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a", + "shasum": "" + }, + "require": { + "php": ">= 7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "time": "2020-10-15T08:29:30+00:00", + "type": "library", + "installation-source": "dist", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "support": { + "email": "info@paragonie.com", + "issues": "https://github.com/paragonie/random_compat/issues", + "source": "https://github.com/paragonie/random_compat" + }, + "install-path": "../paragonie/random_compat" + }, + { + "name": "phpseclib/phpseclib", + "version": "3.0.36", + "version_normalized": "3.0.36.0", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "c2fb5136162d4be18fdd4da9980696f3aee96d7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c2fb5136162d4be18fdd4da9980696f3aee96d7b", + "reference": "c2fb5136162d4be18fdd4da9980696f3aee96d7b", + "shasum": "" + }, + "require": { + "paragonie/constant_time_encoding": "^1|^2", + "paragonie/random_compat": "^1.4|^2.0|^9.99.99", + "php": ">=5.6.1" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "suggest": { + "ext-dom": "Install the DOM extension to load XML formatted public keys.", + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "time": "2024-02-26T05:13:14+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib3\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "support": { + "issues": "https://github.com/phpseclib/phpseclib/issues", + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.36" + }, + "funding": [ + { + "url": "https://github.com/terrafrost", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpseclib", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", + "type": "tidelift" + } + ], + "install-path": "../phpseclib/phpseclib" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T20:24:11+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "install-path": "../psr/cache" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "time": "2023-09-23T14:17:50+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "install-path": "../psr/http-client" + }, + { + "name": "psr/http-factory", + "version": "1.0.2", + "version_normalized": "1.0.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "e616d01114759c4c489f93b099585439f795fe35" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "time": "2023-04-10T20:10:41+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/1.0.2" + }, + "install-path": "../psr/http-factory" + }, + { + "name": "psr/http-message", + "version": "2.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "time": "2023-04-04T09:54:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "install-path": "../psr/http-message" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "time": "2019-03-08T08:55:37+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "install-path": "../ralouphie/getallheaders" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.4.0", + "version_normalized": "3.4.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "time": "2023-05-23T14:45:45+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "installation-source": "dist", + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "install-path": "../symfony/deprecation-contracts" + } + ], + "dev": true, + "dev-package-names": [] +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/installed.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/installed.php new file mode 100644 index 0000000..749765b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/composer/installed.php @@ -0,0 +1,197 @@ + array( + 'name' => '__root__', + 'pretty_version' => 'dev-5.x-dev', + 'version' => 'dev-5.x-dev', + 'reference' => 'c8681aedeabf58cf88284235a697df3ca885ff99', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + '__root__' => array( + 'pretty_version' => 'dev-5.x-dev', + 'version' => 'dev-5.x-dev', + 'reference' => 'c8681aedeabf58cf88284235a697df3ca885ff99', + 'type' => 'library', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'firebase/php-jwt' => array( + 'pretty_version' => 'v6.10.0', + 'version' => '6.10.0.0', + 'reference' => 'a49db6f0a5033aef5143295342f1c95521b075ff', + 'type' => 'library', + 'install_path' => __DIR__ . '/../firebase/php-jwt', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'google/apiclient' => array( + 'pretty_version' => 'v2.15.3', + 'version' => '2.15.3.0', + 'reference' => 'e70273c06d18824de77e114247ae3102f8aec64d', + 'type' => 'library', + 'install_path' => __DIR__ . '/../google/apiclient', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'google/apiclient-services' => array( + 'pretty_version' => 'v0.224.1', + 'version' => '0.224.1.0', + 'reference' => '06e515176ebf32c3dcf7c01b3f377af6bfca6ae3', + 'type' => 'library', + 'install_path' => __DIR__ . '/../google/apiclient-services', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'google/auth' => array( + 'pretty_version' => 'v1.34.0', + 'version' => '1.34.0.0', + 'reference' => '155daeadfd2f09743f611ea493b828d382519575', + 'type' => 'library', + 'install_path' => __DIR__ . '/../google/auth', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'guzzlehttp/guzzle' => array( + 'pretty_version' => '7.8.1', + 'version' => '7.8.1.0', + 'reference' => '41042bc7ab002487b876a0683fc8dce04ddce104', + 'type' => 'library', + 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'guzzlehttp/promises' => array( + 'pretty_version' => '1.5.3', + 'version' => '1.5.3.0', + 'reference' => '67ab6e18aaa14d753cc148911d273f6e6cb6721e', + 'type' => 'library', + 'install_path' => __DIR__ . '/../guzzlehttp/promises', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'guzzlehttp/psr7' => array( + 'pretty_version' => '2.5.1', + 'version' => '2.5.1.0', + 'reference' => 'a0b3a03e8e8005257fbc408ce5f0fd0a8274dc7f', + 'type' => 'library', + 'install_path' => __DIR__ . '/../guzzlehttp/psr7', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'monolog/monolog' => array( + 'dev_requirement' => false, + 'replaced' => array( + 0 => '*', + ), + ), + 'paragonie/constant_time_encoding' => array( + 'pretty_version' => 'v2.6.3', + 'version' => '2.6.3.0', + 'reference' => '58c3f47f650c94ec05a151692652a868995d2938', + 'type' => 'library', + 'install_path' => __DIR__ . '/../paragonie/constant_time_encoding', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'paragonie/random_compat' => array( + 'pretty_version' => 'v9.99.100', + 'version' => '9.99.100.0', + 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', + 'type' => 'library', + 'install_path' => __DIR__ . '/../paragonie/random_compat', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'phpseclib/phpseclib' => array( + 'pretty_version' => '3.0.36', + 'version' => '3.0.36.0', + 'reference' => 'c2fb5136162d4be18fdd4da9980696f3aee96d7b', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpseclib/phpseclib', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/cache' => array( + 'pretty_version' => '1.0.1', + 'version' => '1.0.1.0', + 'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/cache', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-client' => array( + 'pretty_version' => '1.0.3', + 'version' => '1.0.3.0', + 'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-client', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-client-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/http-factory' => array( + 'pretty_version' => '1.0.2', + 'version' => '1.0.2.0', + 'reference' => 'e616d01114759c4c489f93b099585439f795fe35', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-factory', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-factory-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/http-message' => array( + 'pretty_version' => '2.0', + 'version' => '2.0.0.0', + 'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71', + 'type' => 'library', + 'install_path' => __DIR__ . '/../psr/http-message', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'psr/http-message-implementation' => array( + 'dev_requirement' => false, + 'provided' => array( + 0 => '1.0', + ), + ), + 'psr/log' => array( + 'dev_requirement' => false, + 'replaced' => array( + 0 => '*', + ), + ), + 'ralouphie/getallheaders' => array( + 'pretty_version' => '3.0.3', + 'version' => '3.0.3.0', + 'reference' => '120b605dfeb996808c31b6477290a714d356e822', + 'type' => 'library', + 'install_path' => __DIR__ . '/../ralouphie/getallheaders', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'symfony/deprecation-contracts' => array( + 'pretty_version' => 'v3.4.0', + 'version' => '3.4.0.0', + 'reference' => '7c3aff79d10325257a001fcf92d991f24fc967cf', + 'type' => 'library', + 'install_path' => __DIR__ . '/../symfony/deprecation-contracts', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/LICENSE new file mode 100644 index 0000000..11c0146 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/LICENSE @@ -0,0 +1,30 @@ +Copyright (c) 2011, Neuman Vong + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of the copyright holder nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/BeforeValidException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/BeforeValidException.php new file mode 100644 index 0000000..abe5695 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/BeforeValidException.php @@ -0,0 +1,19 @@ +payload = $payload; + } + public function getPayload() : object + { + return $this->payload; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/CachedKeySet.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/CachedKeySet.php new file mode 100644 index 0000000..0c088e6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/CachedKeySet.php @@ -0,0 +1,226 @@ + + */ +class CachedKeySet implements ArrayAccess +{ + /** + * @var string + */ + private $jwksUri; + /** + * @var ClientInterface + */ + private $httpClient; + /** + * @var RequestFactoryInterface + */ + private $httpFactory; + /** + * @var CacheItemPoolInterface + */ + private $cache; + /** + * @var ?int + */ + private $expiresAfter; + /** + * @var ?CacheItemInterface + */ + private $cacheItem; + /** + * @var array> + */ + private $keySet; + /** + * @var string + */ + private $cacheKey; + /** + * @var string + */ + private $cacheKeyPrefix = 'jwks'; + /** + * @var int + */ + private $maxKeyLength = 64; + /** + * @var bool + */ + private $rateLimit; + /** + * @var string + */ + private $rateLimitCacheKey; + /** + * @var int + */ + private $maxCallsPerMinute = 10; + /** + * @var string|null + */ + private $defaultAlg; + public function __construct(string $jwksUri, ClientInterface $httpClient, RequestFactoryInterface $httpFactory, CacheItemPoolInterface $cache, int $expiresAfter = null, bool $rateLimit = \false, string $defaultAlg = null) + { + $this->jwksUri = $jwksUri; + $this->httpClient = $httpClient; + $this->httpFactory = $httpFactory; + $this->cache = $cache; + $this->expiresAfter = $expiresAfter; + $this->rateLimit = $rateLimit; + $this->defaultAlg = $defaultAlg; + $this->setCacheKeys(); + } + /** + * @param string $keyId + * @return Key + */ + public function offsetGet($keyId) : Key + { + if (!$this->keyIdExists($keyId)) { + throw new OutOfBoundsException('Key ID not found'); + } + return JWK::parseKey($this->keySet[$keyId], $this->defaultAlg); + } + /** + * @param string $keyId + * @return bool + */ + public function offsetExists($keyId) : bool + { + return $this->keyIdExists($keyId); + } + /** + * @param string $offset + * @param Key $value + */ + public function offsetSet($offset, $value) : void + { + throw new LogicException('Method not implemented'); + } + /** + * @param string $offset + */ + public function offsetUnset($offset) : void + { + throw new LogicException('Method not implemented'); + } + /** + * @return array + */ + private function formatJwksForCache(string $jwks) : array + { + $jwks = json_decode($jwks, \true); + if (!isset($jwks['keys'])) { + throw new UnexpectedValueException('"keys" member must exist in the JWK Set'); + } + if (empty($jwks['keys'])) { + throw new InvalidArgumentException('JWK Set did not contain any keys'); + } + $keys = []; + foreach ($jwks['keys'] as $k => $v) { + $kid = isset($v['kid']) ? $v['kid'] : $k; + $keys[(string) $kid] = $v; + } + return $keys; + } + private function keyIdExists(string $keyId) : bool + { + if (null === $this->keySet) { + $item = $this->getCacheItem(); + // Try to load keys from cache + if ($item->isHit()) { + // item found! retrieve it + $this->keySet = $item->get(); + // If the cached item is a string, the JWKS response was cached (previous behavior). + // Parse this into expected format array instead. + if (\is_string($this->keySet)) { + $this->keySet = $this->formatJwksForCache($this->keySet); + } + } + } + if (!isset($this->keySet[$keyId])) { + if ($this->rateLimitExceeded()) { + return \false; + } + $request = $this->httpFactory->createRequest('GET', $this->jwksUri); + $jwksResponse = $this->httpClient->sendRequest($request); + if ($jwksResponse->getStatusCode() !== 200) { + throw new UnexpectedValueException(sprintf('HTTP Error: %d %s for URI "%s"', $jwksResponse->getStatusCode(), $jwksResponse->getReasonPhrase(), $this->jwksUri), $jwksResponse->getStatusCode()); + } + $this->keySet = $this->formatJwksForCache((string) $jwksResponse->getBody()); + if (!isset($this->keySet[$keyId])) { + return \false; + } + $item = $this->getCacheItem(); + $item->set($this->keySet); + if ($this->expiresAfter) { + $item->expiresAfter($this->expiresAfter); + } + $this->cache->save($item); + } + return \true; + } + private function rateLimitExceeded() : bool + { + if (!$this->rateLimit) { + return \false; + } + $cacheItem = $this->cache->getItem($this->rateLimitCacheKey); + if (!$cacheItem->isHit()) { + $cacheItem->expiresAfter(1); + // # of calls are cached each minute + } + $callsPerMinute = (int) $cacheItem->get(); + if (++$callsPerMinute > $this->maxCallsPerMinute) { + return \true; + } + $cacheItem->set($callsPerMinute); + $this->cache->save($cacheItem); + return \false; + } + private function getCacheItem() : CacheItemInterface + { + if (\is_null($this->cacheItem)) { + $this->cacheItem = $this->cache->getItem($this->cacheKey); + } + return $this->cacheItem; + } + private function setCacheKeys() : void + { + if (empty($this->jwksUri)) { + throw new RuntimeException('JWKS URI is empty'); + } + // ensure we do not have illegal characters + $key = preg_replace('|[^a-zA-Z0-9_\\.!]|', '', $this->jwksUri); + // add prefix + $key = $this->cacheKeyPrefix . $key; + // Hash keys if they exceed $maxKeyLength of 64 + if (\strlen($key) > $this->maxKeyLength) { + $key = substr(hash('sha256', $key), 0, $this->maxKeyLength); + } + $this->cacheKey = $key; + if ($this->rateLimit) { + // add prefix + $rateLimitKey = $this->cacheKeyPrefix . 'ratelimit' . $key; + // Hash keys if they exceed $maxKeyLength of 64 + if (\strlen($rateLimitKey) > $this->maxKeyLength) { + $rateLimitKey = substr(hash('sha256', $rateLimitKey), 0, $this->maxKeyLength); + } + $this->rateLimitCacheKey = $rateLimitKey; + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/ExpiredException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/ExpiredException.php new file mode 100644 index 0000000..3525011 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/ExpiredException.php @@ -0,0 +1,19 @@ +payload = $payload; + } + public function getPayload() : object + { + return $this->payload; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWK.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWK.php new file mode 100644 index 0000000..680053c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWK.php @@ -0,0 +1,267 @@ + + * @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD + * @link https://github.com/firebase/php-jwt + */ +class JWK +{ + private const OID = '1.2.840.10045.2.1'; + private const ASN1_OBJECT_IDENTIFIER = 0x6; + private const ASN1_SEQUENCE = 0x10; + // also defined in JWT + private const ASN1_BIT_STRING = 0x3; + private const EC_CURVES = [ + 'P-256' => '1.2.840.10045.3.1.7', + // Len: 64 + 'secp256k1' => '1.3.132.0.10', + // Len: 64 + 'P-384' => '1.3.132.0.34', + ]; + // For keys with "kty" equal to "OKP" (Octet Key Pair), the "crv" parameter must contain the key subtype. + // This library supports the following subtypes: + private const OKP_SUBTYPES = ['Ed25519' => \true]; + /** + * Parse a set of JWK keys + * + * @param array $jwks The JSON Web Key Set as an associative array + * @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the + * JSON Web Key Set + * + * @return array An associative array of key IDs (kid) to Key objects + * + * @throws InvalidArgumentException Provided JWK Set is empty + * @throws UnexpectedValueException Provided JWK Set was invalid + * @throws DomainException OpenSSL failure + * + * @uses parseKey + */ + public static function parseKeySet(array $jwks, string $defaultAlg = null) : array + { + $keys = []; + if (!isset($jwks['keys'])) { + throw new UnexpectedValueException('"keys" member must exist in the JWK Set'); + } + if (empty($jwks['keys'])) { + throw new InvalidArgumentException('JWK Set did not contain any keys'); + } + foreach ($jwks['keys'] as $k => $v) { + $kid = isset($v['kid']) ? $v['kid'] : $k; + if ($key = self::parseKey($v, $defaultAlg)) { + $keys[(string) $kid] = $key; + } + } + if (0 === \count($keys)) { + throw new UnexpectedValueException('No supported algorithms found in JWK Set'); + } + return $keys; + } + /** + * Parse a JWK key + * + * @param array $jwk An individual JWK + * @param string $defaultAlg The algorithm for the Key object if "alg" is not set in the + * JSON Web Key Set + * + * @return Key The key object for the JWK + * + * @throws InvalidArgumentException Provided JWK is empty + * @throws UnexpectedValueException Provided JWK was invalid + * @throws DomainException OpenSSL failure + * + * @uses createPemFromModulusAndExponent + */ + public static function parseKey(array $jwk, string $defaultAlg = null) : ?Key + { + if (empty($jwk)) { + throw new InvalidArgumentException('JWK must not be empty'); + } + if (!isset($jwk['kty'])) { + throw new UnexpectedValueException('JWK must contain a "kty" parameter'); + } + if (!isset($jwk['alg'])) { + if (\is_null($defaultAlg)) { + // The "alg" parameter is optional in a KTY, but an algorithm is required + // for parsing in this library. Use the $defaultAlg parameter when parsing the + // key set in order to prevent this error. + // @see https://datatracker.ietf.org/doc/html/rfc7517#section-4.4 + throw new UnexpectedValueException('JWK must contain an "alg" parameter'); + } + $jwk['alg'] = $defaultAlg; + } + switch ($jwk['kty']) { + case 'RSA': + if (!empty($jwk['d'])) { + throw new UnexpectedValueException('RSA private keys are not supported'); + } + if (!isset($jwk['n']) || !isset($jwk['e'])) { + throw new UnexpectedValueException('RSA keys must contain values for both "n" and "e"'); + } + $pem = self::createPemFromModulusAndExponent($jwk['n'], $jwk['e']); + $publicKey = \openssl_pkey_get_public($pem); + if (\false === $publicKey) { + throw new DomainException('OpenSSL error: ' . \openssl_error_string()); + } + return new Key($publicKey, $jwk['alg']); + case 'EC': + if (isset($jwk['d'])) { + // The key is actually a private key + throw new UnexpectedValueException('Key data must be for a public key'); + } + if (empty($jwk['crv'])) { + throw new UnexpectedValueException('crv not set'); + } + if (!isset(self::EC_CURVES[$jwk['crv']])) { + throw new DomainException('Unrecognised or unsupported EC curve'); + } + if (empty($jwk['x']) || empty($jwk['y'])) { + throw new UnexpectedValueException('x and y not set'); + } + $publicKey = self::createPemFromCrvAndXYCoordinates($jwk['crv'], $jwk['x'], $jwk['y']); + return new Key($publicKey, $jwk['alg']); + case 'OKP': + if (isset($jwk['d'])) { + // The key is actually a private key + throw new UnexpectedValueException('Key data must be for a public key'); + } + if (!isset($jwk['crv'])) { + throw new UnexpectedValueException('crv not set'); + } + if (empty(self::OKP_SUBTYPES[$jwk['crv']])) { + throw new DomainException('Unrecognised or unsupported OKP key subtype'); + } + if (empty($jwk['x'])) { + throw new UnexpectedValueException('x not set'); + } + // This library works internally with EdDSA keys (Ed25519) encoded in standard base64. + $publicKey = JWT::convertBase64urlToBase64($jwk['x']); + return new Key($publicKey, $jwk['alg']); + default: + break; + } + return null; + } + /** + * Converts the EC JWK values to pem format. + * + * @param string $crv The EC curve (only P-256 & P-384 is supported) + * @param string $x The EC x-coordinate + * @param string $y The EC y-coordinate + * + * @return string + */ + private static function createPemFromCrvAndXYCoordinates(string $crv, string $x, string $y) : string + { + $pem = self::encodeDER(self::ASN1_SEQUENCE, self::encodeDER(self::ASN1_SEQUENCE, self::encodeDER(self::ASN1_OBJECT_IDENTIFIER, self::encodeOID(self::OID)) . self::encodeDER(self::ASN1_OBJECT_IDENTIFIER, self::encodeOID(self::EC_CURVES[$crv]))) . self::encodeDER(self::ASN1_BIT_STRING, \chr(0x0) . \chr(0x4) . JWT::urlsafeB64Decode($x) . JWT::urlsafeB64Decode($y))); + return sprintf("-----BEGIN PUBLIC KEY-----\n%s\n-----END PUBLIC KEY-----\n", wordwrap(base64_encode($pem), 64, "\n", \true)); + } + /** + * Create a public key represented in PEM format from RSA modulus and exponent information + * + * @param string $n The RSA modulus encoded in Base64 + * @param string $e The RSA exponent encoded in Base64 + * + * @return string The RSA public key represented in PEM format + * + * @uses encodeLength + */ + private static function createPemFromModulusAndExponent(string $n, string $e) : string + { + $mod = JWT::urlsafeB64Decode($n); + $exp = JWT::urlsafeB64Decode($e); + $modulus = \pack('Ca*a*', 2, self::encodeLength(\strlen($mod)), $mod); + $publicExponent = \pack('Ca*a*', 2, self::encodeLength(\strlen($exp)), $exp); + $rsaPublicKey = \pack('Ca*a*a*', 48, self::encodeLength(\strlen($modulus) + \strlen($publicExponent)), $modulus, $publicExponent); + // sequence(oid(1.2.840.113549.1.1.1), null)) = rsaEncryption. + $rsaOID = \pack('H*', '300d06092a864886f70d0101010500'); + // hex version of MA0GCSqGSIb3DQEBAQUA + $rsaPublicKey = \chr(0) . $rsaPublicKey; + $rsaPublicKey = \chr(3) . self::encodeLength(\strlen($rsaPublicKey)) . $rsaPublicKey; + $rsaPublicKey = \pack('Ca*a*', 48, self::encodeLength(\strlen($rsaOID . $rsaPublicKey)), $rsaOID . $rsaPublicKey); + return "-----BEGIN PUBLIC KEY-----\r\n" . \chunk_split(\base64_encode($rsaPublicKey), 64) . '-----END PUBLIC KEY-----'; + } + /** + * DER-encode the length + * + * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See + * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information. + * + * @param int $length + * @return string + */ + private static function encodeLength(int $length) : string + { + if ($length <= 0x7f) { + return \chr($length); + } + $temp = \ltrim(\pack('N', $length), \chr(0)); + return \pack('Ca*', 0x80 | \strlen($temp), $temp); + } + /** + * Encodes a value into a DER object. + * Also defined in Firebase\JWT\JWT + * + * @param int $type DER tag + * @param string $value the value to encode + * @return string the encoded object + */ + private static function encodeDER(int $type, string $value) : string + { + $tag_header = 0; + if ($type === self::ASN1_SEQUENCE) { + $tag_header |= 0x20; + } + // Type + $der = \chr($tag_header | $type); + // Length + $der .= \chr(\strlen($value)); + return $der . $value; + } + /** + * Encodes a string into a DER-encoded OID. + * + * @param string $oid the OID string + * @return string the binary DER-encoded OID + */ + private static function encodeOID(string $oid) : string + { + $octets = explode('.', $oid); + // Get the first octet + $first = (int) array_shift($octets); + $second = (int) array_shift($octets); + $oid = \chr($first * 40 + $second); + // Iterate over subsequent octets + foreach ($octets as $octet) { + if ($octet == 0) { + $oid .= \chr(0x0); + continue; + } + $bin = ''; + while ($octet) { + $bin .= \chr(0x80 | $octet & 0x7f); + $octet >>= 7; + } + $bin[0] = $bin[0] & \chr(0x7f); + // Convert to big endian if necessary + if (pack('V', 65534) == pack('L', 65534)) { + $oid .= strrev($bin); + } else { + $oid .= $bin; + } + } + return $oid; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWT.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWT.php new file mode 100644 index 0000000..32add50 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWT.php @@ -0,0 +1,572 @@ + + * @author Anant Narayanan + * @license http://opensource.org/licenses/BSD-3-Clause 3-clause BSD + * @link https://github.com/firebase/php-jwt + */ +class JWT +{ + private const ASN1_INTEGER = 0x2; + private const ASN1_SEQUENCE = 0x10; + private const ASN1_BIT_STRING = 0x3; + /** + * When checking nbf, iat or expiration times, + * we want to provide some extra leeway time to + * account for clock skew. + * + * @var int + */ + public static $leeway = 0; + /** + * Allow the current timestamp to be specified. + * Useful for fixing a value within unit testing. + * Will default to PHP time() value if null. + * + * @var ?int + */ + public static $timestamp = null; + /** + * @var array + */ + public static $supported_algs = ['ES384' => ['openssl', 'SHA384'], 'ES256' => ['openssl', 'SHA256'], 'ES256K' => ['openssl', 'SHA256'], 'HS256' => ['hash_hmac', 'SHA256'], 'HS384' => ['hash_hmac', 'SHA384'], 'HS512' => ['hash_hmac', 'SHA512'], 'RS256' => ['openssl', 'SHA256'], 'RS384' => ['openssl', 'SHA384'], 'RS512' => ['openssl', 'SHA512'], 'EdDSA' => ['sodium_crypto', 'EdDSA']]; + /** + * Decodes a JWT string into a PHP object. + * + * @param string $jwt The JWT + * @param Key|ArrayAccess|array $keyOrKeyArray The Key or associative array of key IDs + * (kid) to Key objects. + * If the algorithm used is asymmetric, this is + * the public key. + * Each Key object contains an algorithm and + * matching key. + * Supported algorithms are 'ES384','ES256', + * 'HS256', 'HS384', 'HS512', 'RS256', 'RS384' + * and 'RS512'. + * @param stdClass $headers Optional. Populates stdClass with headers. + * + * @return stdClass The JWT's payload as a PHP object + * + * @throws InvalidArgumentException Provided key/key-array was empty or malformed + * @throws DomainException Provided JWT is malformed + * @throws UnexpectedValueException Provided JWT was invalid + * @throws SignatureInvalidException Provided JWT was invalid because the signature verification failed + * @throws BeforeValidException Provided JWT is trying to be used before it's eligible as defined by 'nbf' + * @throws BeforeValidException Provided JWT is trying to be used before it's been created as defined by 'iat' + * @throws ExpiredException Provided JWT has since expired, as defined by the 'exp' claim + * + * @uses jsonDecode + * @uses urlsafeB64Decode + */ + public static function decode(string $jwt, $keyOrKeyArray, stdClass &$headers = null) : stdClass + { + // Validate JWT + $timestamp = \is_null(static::$timestamp) ? \time() : static::$timestamp; + if (empty($keyOrKeyArray)) { + throw new InvalidArgumentException('Key may not be empty'); + } + $tks = \explode('.', $jwt); + if (\count($tks) !== 3) { + throw new UnexpectedValueException('Wrong number of segments'); + } + list($headb64, $bodyb64, $cryptob64) = $tks; + $headerRaw = static::urlsafeB64Decode($headb64); + if (null === ($header = static::jsonDecode($headerRaw))) { + throw new UnexpectedValueException('Invalid header encoding'); + } + if ($headers !== null) { + $headers = $header; + } + $payloadRaw = static::urlsafeB64Decode($bodyb64); + if (null === ($payload = static::jsonDecode($payloadRaw))) { + throw new UnexpectedValueException('Invalid claims encoding'); + } + if (\is_array($payload)) { + // prevent PHP Fatal Error in edge-cases when payload is empty array + $payload = (object) $payload; + } + if (!$payload instanceof stdClass) { + throw new UnexpectedValueException('Payload must be a JSON object'); + } + $sig = static::urlsafeB64Decode($cryptob64); + if (empty($header->alg)) { + throw new UnexpectedValueException('Empty algorithm'); + } + if (empty(static::$supported_algs[$header->alg])) { + throw new UnexpectedValueException('Algorithm not supported'); + } + $key = self::getKey($keyOrKeyArray, property_exists($header, 'kid') ? $header->kid : null); + // Check the algorithm + if (!self::constantTimeEquals($key->getAlgorithm(), $header->alg)) { + // See issue #351 + throw new UnexpectedValueException('Incorrect key for this algorithm'); + } + if (\in_array($header->alg, ['ES256', 'ES256K', 'ES384'], \true)) { + // OpenSSL expects an ASN.1 DER sequence for ES256/ES256K/ES384 signatures + $sig = self::signatureToDER($sig); + } + if (!self::verify("{$headb64}.{$bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) { + throw new SignatureInvalidException('Signature verification failed'); + } + // Check the nbf if it is defined. This is the time that the + // token can actually be used. If it's not yet that time, abort. + if (isset($payload->nbf) && floor($payload->nbf) > $timestamp + static::$leeway) { + $ex = new BeforeValidException('Cannot handle token with nbf prior to ' . \date(DateTime::ISO8601, (int) $payload->nbf)); + $ex->setPayload($payload); + throw $ex; + } + // Check that this token has been created before 'now'. This prevents + // using tokens that have been created for later use (and haven't + // correctly used the nbf claim). + if (!isset($payload->nbf) && isset($payload->iat) && floor($payload->iat) > $timestamp + static::$leeway) { + $ex = new BeforeValidException('Cannot handle token with iat prior to ' . \date(DateTime::ISO8601, (int) $payload->iat)); + $ex->setPayload($payload); + throw $ex; + } + // Check if this token has expired. + if (isset($payload->exp) && $timestamp - static::$leeway >= $payload->exp) { + $ex = new ExpiredException('Expired token'); + $ex->setPayload($payload); + throw $ex; + } + return $payload; + } + /** + * Converts and signs a PHP array into a JWT string. + * + * @param array $payload PHP array + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key. + * @param string $alg Supported algorithms are 'ES384','ES256', 'ES256K', 'HS256', + * 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512' + * @param string $keyId + * @param array $head An array with header elements to attach + * + * @return string A signed JWT + * + * @uses jsonEncode + * @uses urlsafeB64Encode + */ + public static function encode(array $payload, $key, string $alg, string $keyId = null, array $head = null) : string + { + $header = ['typ' => 'JWT']; + if (isset($head) && \is_array($head)) { + $header = \array_merge($header, $head); + } + $header['alg'] = $alg; + if ($keyId !== null) { + $header['kid'] = $keyId; + } + $segments = []; + $segments[] = static::urlsafeB64Encode((string) static::jsonEncode($header)); + $segments[] = static::urlsafeB64Encode((string) static::jsonEncode($payload)); + $signing_input = \implode('.', $segments); + $signature = static::sign($signing_input, $key, $alg); + $segments[] = static::urlsafeB64Encode($signature); + return \implode('.', $segments); + } + /** + * Sign a string with a given key and algorithm. + * + * @param string $msg The message to sign + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key. + * @param string $alg Supported algorithms are 'EdDSA', 'ES384', 'ES256', 'ES256K', 'HS256', + * 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512' + * + * @return string An encrypted message + * + * @throws DomainException Unsupported algorithm or bad key was specified + */ + public static function sign(string $msg, $key, string $alg) : string + { + if (empty(static::$supported_algs[$alg])) { + throw new DomainException('Algorithm not supported'); + } + list($function, $algorithm) = static::$supported_algs[$alg]; + switch ($function) { + case 'hash_hmac': + if (!\is_string($key)) { + throw new InvalidArgumentException('key must be a string when using hmac'); + } + return \hash_hmac($algorithm, $msg, $key, \true); + case 'openssl': + $signature = ''; + $success = \openssl_sign($msg, $signature, $key, $algorithm); + // @phpstan-ignore-line + if (!$success) { + throw new DomainException('OpenSSL unable to sign data'); + } + if ($alg === 'ES256' || $alg === 'ES256K') { + $signature = self::signatureFromDER($signature, 256); + } elseif ($alg === 'ES384') { + $signature = self::signatureFromDER($signature, 384); + } + return $signature; + case 'sodium_crypto': + if (!\function_exists('sodium_crypto_sign_detached')) { + throw new DomainException('libsodium is not available'); + } + if (!\is_string($key)) { + throw new InvalidArgumentException('key must be a string when using EdDSA'); + } + try { + // The last non-empty line is used as the key. + $lines = array_filter(explode("\n", $key)); + $key = base64_decode((string) end($lines)); + if (\strlen($key) === 0) { + throw new DomainException('Key cannot be empty string'); + } + return sodium_crypto_sign_detached($msg, $key); + } catch (Exception $e) { + throw new DomainException($e->getMessage(), 0, $e); + } + } + throw new DomainException('Algorithm not supported'); + } + /** + * Verify a signature with the message, key and method. Not all methods + * are symmetric, so we must have a separate verify and sign method. + * + * @param string $msg The original message (header and body) + * @param string $signature The original signature + * @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $keyMaterial For Ed*, ES*, HS*, a string key works. for RS*, must be an instance of OpenSSLAsymmetricKey + * @param string $alg The algorithm + * + * @return bool + * + * @throws DomainException Invalid Algorithm, bad key, or OpenSSL failure + */ + private static function verify(string $msg, string $signature, $keyMaterial, string $alg) : bool + { + if (empty(static::$supported_algs[$alg])) { + throw new DomainException('Algorithm not supported'); + } + list($function, $algorithm) = static::$supported_algs[$alg]; + switch ($function) { + case 'openssl': + $success = \openssl_verify($msg, $signature, $keyMaterial, $algorithm); + // @phpstan-ignore-line + if ($success === 1) { + return \true; + } + if ($success === 0) { + return \false; + } + // returns 1 on success, 0 on failure, -1 on error. + throw new DomainException('OpenSSL error: ' . \openssl_error_string()); + case 'sodium_crypto': + if (!\function_exists('sodium_crypto_sign_verify_detached')) { + throw new DomainException('libsodium is not available'); + } + if (!\is_string($keyMaterial)) { + throw new InvalidArgumentException('key must be a string when using EdDSA'); + } + try { + // The last non-empty line is used as the key. + $lines = array_filter(explode("\n", $keyMaterial)); + $key = base64_decode((string) end($lines)); + if (\strlen($key) === 0) { + throw new DomainException('Key cannot be empty string'); + } + if (\strlen($signature) === 0) { + throw new DomainException('Signature cannot be empty string'); + } + return sodium_crypto_sign_verify_detached($signature, $msg, $key); + } catch (Exception $e) { + throw new DomainException($e->getMessage(), 0, $e); + } + case 'hash_hmac': + default: + if (!\is_string($keyMaterial)) { + throw new InvalidArgumentException('key must be a string when using hmac'); + } + $hash = \hash_hmac($algorithm, $msg, $keyMaterial, \true); + return self::constantTimeEquals($hash, $signature); + } + } + /** + * Decode a JSON string into a PHP object. + * + * @param string $input JSON string + * + * @return mixed The decoded JSON string + * + * @throws DomainException Provided string was invalid JSON + */ + public static function jsonDecode(string $input) + { + $obj = \json_decode($input, \false, 512, \JSON_BIGINT_AS_STRING); + if ($errno = \json_last_error()) { + self::handleJsonError($errno); + } elseif ($obj === null && $input !== 'null') { + throw new DomainException('Null result with non-null input'); + } + return $obj; + } + /** + * Encode a PHP array into a JSON string. + * + * @param array $input A PHP array + * + * @return string JSON representation of the PHP array + * + * @throws DomainException Provided object could not be encoded to valid JSON + */ + public static function jsonEncode(array $input) : string + { + if (\PHP_VERSION_ID >= 50400) { + $json = \json_encode($input, \JSON_UNESCAPED_SLASHES); + } else { + // PHP 5.3 only + $json = \json_encode($input); + } + if ($errno = \json_last_error()) { + self::handleJsonError($errno); + } elseif ($json === 'null') { + throw new DomainException('Null result with non-null input'); + } + if ($json === \false) { + throw new DomainException('Provided object could not be encoded to valid JSON'); + } + return $json; + } + /** + * Decode a string with URL-safe Base64. + * + * @param string $input A Base64 encoded string + * + * @return string A decoded string + * + * @throws InvalidArgumentException invalid base64 characters + */ + public static function urlsafeB64Decode(string $input) : string + { + return \base64_decode(self::convertBase64UrlToBase64($input)); + } + /** + * Convert a string in the base64url (URL-safe Base64) encoding to standard base64. + * + * @param string $input A Base64 encoded string with URL-safe characters (-_ and no padding) + * + * @return string A Base64 encoded string with standard characters (+/) and padding (=), when + * needed. + * + * @see https://www.rfc-editor.org/rfc/rfc4648 + */ + public static function convertBase64UrlToBase64(string $input) : string + { + $remainder = \strlen($input) % 4; + if ($remainder) { + $padlen = 4 - $remainder; + $input .= \str_repeat('=', $padlen); + } + return \strtr($input, '-_', '+/'); + } + /** + * Encode a string with URL-safe Base64. + * + * @param string $input The string you want encoded + * + * @return string The base64 encode of what you passed in + */ + public static function urlsafeB64Encode(string $input) : string + { + return \str_replace('=', '', \strtr(\base64_encode($input), '+/', '-_')); + } + /** + * Determine if an algorithm has been provided for each Key + * + * @param Key|ArrayAccess|array $keyOrKeyArray + * @param string|null $kid + * + * @throws UnexpectedValueException + * + * @return Key + */ + private static function getKey($keyOrKeyArray, ?string $kid) : Key + { + if ($keyOrKeyArray instanceof Key) { + return $keyOrKeyArray; + } + if (empty($kid) && $kid !== '0') { + throw new UnexpectedValueException('"kid" empty, unable to lookup correct key'); + } + if ($keyOrKeyArray instanceof CachedKeySet) { + // Skip "isset" check, as this will automatically refresh if not set + return $keyOrKeyArray[$kid]; + } + if (!isset($keyOrKeyArray[$kid])) { + throw new UnexpectedValueException('"kid" invalid, unable to lookup correct key'); + } + return $keyOrKeyArray[$kid]; + } + /** + * @param string $left The string of known length to compare against + * @param string $right The user-supplied string + * @return bool + */ + public static function constantTimeEquals(string $left, string $right) : bool + { + if (\function_exists('hash_equals')) { + return \hash_equals($left, $right); + } + $len = \min(self::safeStrlen($left), self::safeStrlen($right)); + $status = 0; + for ($i = 0; $i < $len; $i++) { + $status |= \ord($left[$i]) ^ \ord($right[$i]); + } + $status |= self::safeStrlen($left) ^ self::safeStrlen($right); + return $status === 0; + } + /** + * Helper method to create a JSON error. + * + * @param int $errno An error number from json_last_error() + * + * @throws DomainException + * + * @return void + */ + private static function handleJsonError(int $errno) : void + { + $messages = [\JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', \JSON_ERROR_STATE_MISMATCH => 'Invalid or malformed JSON', \JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', \JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', \JSON_ERROR_UTF8 => 'Malformed UTF-8 characters']; + throw new DomainException(isset($messages[$errno]) ? $messages[$errno] : 'Unknown JSON error: ' . $errno); + } + /** + * Get the number of bytes in cryptographic strings. + * + * @param string $str + * + * @return int + */ + private static function safeStrlen(string $str) : int + { + if (\function_exists('mb_strlen')) { + return \mb_strlen($str, '8bit'); + } + return \strlen($str); + } + /** + * Convert an ECDSA signature to an ASN.1 DER sequence + * + * @param string $sig The ECDSA signature to convert + * @return string The encoded DER object + */ + private static function signatureToDER(string $sig) : string + { + // Separate the signature into r-value and s-value + $length = max(1, (int) (\strlen($sig) / 2)); + list($r, $s) = \str_split($sig, $length); + // Trim leading zeros + $r = \ltrim($r, "\x00"); + $s = \ltrim($s, "\x00"); + // Convert r-value and s-value from unsigned big-endian integers to + // signed two's complement + if (\ord($r[0]) > 0x7f) { + $r = "\x00" . $r; + } + if (\ord($s[0]) > 0x7f) { + $s = "\x00" . $s; + } + return self::encodeDER(self::ASN1_SEQUENCE, self::encodeDER(self::ASN1_INTEGER, $r) . self::encodeDER(self::ASN1_INTEGER, $s)); + } + /** + * Encodes a value into a DER object. + * + * @param int $type DER tag + * @param string $value the value to encode + * + * @return string the encoded object + */ + private static function encodeDER(int $type, string $value) : string + { + $tag_header = 0; + if ($type === self::ASN1_SEQUENCE) { + $tag_header |= 0x20; + } + // Type + $der = \chr($tag_header | $type); + // Length + $der .= \chr(\strlen($value)); + return $der . $value; + } + /** + * Encodes signature from a DER object. + * + * @param string $der binary signature in DER format + * @param int $keySize the number of bits in the key + * + * @return string the signature + */ + private static function signatureFromDER(string $der, int $keySize) : string + { + // OpenSSL returns the ECDSA signatures as a binary ASN.1 DER SEQUENCE + list($offset, $_) = self::readDER($der); + list($offset, $r) = self::readDER($der, $offset); + list($offset, $s) = self::readDER($der, $offset); + // Convert r-value and s-value from signed two's compliment to unsigned + // big-endian integers + $r = \ltrim($r, "\x00"); + $s = \ltrim($s, "\x00"); + // Pad out r and s so that they are $keySize bits long + $r = \str_pad($r, $keySize / 8, "\x00", \STR_PAD_LEFT); + $s = \str_pad($s, $keySize / 8, "\x00", \STR_PAD_LEFT); + return $r . $s; + } + /** + * Reads binary DER-encoded data and decodes into a single object + * + * @param string $der the binary data in DER format + * @param int $offset the offset of the data stream containing the object + * to decode + * + * @return array{int, string|null} the new offset and the decoded object + */ + private static function readDER(string $der, int $offset = 0) : array + { + $pos = $offset; + $size = \strlen($der); + $constructed = \ord($der[$pos]) >> 5 & 0x1; + $type = \ord($der[$pos++]) & 0x1f; + // Length + $len = \ord($der[$pos++]); + if ($len & 0x80) { + $n = $len & 0x1f; + $len = 0; + while ($n-- && $pos < $size) { + $len = $len << 8 | \ord($der[$pos++]); + } + } + // Value + if ($type === self::ASN1_BIT_STRING) { + $pos++; + // Skip the first contents octet (padding indicator) + $data = \substr($der, $pos, $len - 1); + $pos += $len - 1; + } elseif (!$constructed) { + $data = \substr($der, $pos, $len); + $pos += $len; + } else { + $data = null; + } + return [$pos, $data]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php new file mode 100644 index 0000000..dcfc18f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php @@ -0,0 +1,20 @@ +keyMaterial = $keyMaterial; + $this->algorithm = $algorithm; + } + /** + * Return the algorithm valid for this key + * + * @return string + */ + public function getAlgorithm() : string + { + return $this->algorithm; + } + /** + * @return string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate + */ + public function getKeyMaterial() + { + return $this->keyMaterial; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/SignatureInvalidException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/SignatureInvalidException.php new file mode 100644 index 0000000..5c57363 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/firebase/php-jwt/src/SignatureInvalidException.php @@ -0,0 +1,7 @@ + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Client', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Resource' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Resource', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Model' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Model', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Collection' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Collection']; + foreach ($servicesClassMap as $alias => $class) { + \class_alias($class, $alias); + } + } +} +\spl_autoload_register(function ($class) { + $class = preg_replace('/^Piwik\\\\Dependencies\\\\/', 'Matomo\\Dependencies\\', $class); + + if (0 === \strpos($class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_')) { + // Autoload the new class, which will also create an alias for the + // old class by changing underscores to namespaces: + // Google_Service_Speech_Resource_Operations + // => Google\Service\Speech\Resource\Operations + $classExists = \class_exists($newClass = \str_replace('_', '\\', $class)); + if ($classExists) { + return \true; + } + } +}, \true, \true); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/renovate.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/renovate.json new file mode 100644 index 0000000..b31203b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/renovate.json @@ -0,0 +1,7 @@ +{ + "extends": [ + "config:base" + ], + "pinVersions": false, + "rebaseStalePrs": true +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2.php new file mode 100644 index 0000000..9d707d0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2.php @@ -0,0 +1,82 @@ + + * Obtains end-user authorization grants for use with other Google APIs.

+ * + *

+ * For more information about this service, see the API + * Documentation + *

+ * + * @author Google, Inc. + */ +class Oauth2 extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service +{ + /** View your email address. */ + const USERINFO_EMAIL = "https://www.googleapis.com/auth/userinfo.email"; + /** See your personal info, including any personal info you've made publicly available. */ + const USERINFO_PROFILE = "https://www.googleapis.com/auth/userinfo.profile"; + /** Associate you with your personal info on Google. */ + const OPENID = "openid"; + public $userinfo; + public $userinfo_v2_me; + private $base_methods; + /** + * Constructs the internal representation of the Oauth2 service. + * + * @param Client|array $clientOrConfig The client used to deliver requests, or a + * config array to pass to a new Client instance. + * @param string $rootUrl The root URL used for requests to the service. + */ + public function __construct($clientOrConfig = [], $rootUrl = null) + { + parent::__construct($clientOrConfig); + $this->rootUrl = $rootUrl ?: 'https://www.googleapis.com/'; + $this->servicePath = ''; + $this->batchPath = 'batch/oauth2/v2'; + $this->version = 'v2'; + $this->serviceName = 'oauth2'; + $this->userinfo = new Oauth2\Resource\Userinfo($this, $this->serviceName, 'userinfo', ['methods' => ['get' => ['path' => 'oauth2/v2/userinfo', 'httpMethod' => 'GET', 'parameters' => []]]]); + $this->userinfo_v2_me = new Oauth2\Resource\UserinfoV2Me($this, $this->serviceName, 'me', ['methods' => ['get' => ['path' => 'userinfo/v2/me', 'httpMethod' => 'GET', 'parameters' => []]]]); + $this->base_methods = new Resource($this, $this->serviceName, '', ['methods' => ['tokeninfo' => ['path' => 'oauth2/v2/tokeninfo', 'httpMethod' => 'POST', 'parameters' => ['access_token' => ['location' => 'query', 'type' => 'string'], 'id_token' => ['location' => 'query', 'type' => 'string']]]]]); + } + /** + * (tokeninfo) + * + * @param array $optParams Optional parameters. + * + * @opt_param string access_token + * @opt_param string id_token + * @return Tokeninfo + */ + public function tokeninfo($optParams = []) + { + $params = []; + $params = array_merge($params, $optParams); + return $this->base_methods->call('tokeninfo', [$params], Tokeninfo::class); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Oauth2::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Oauth2'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/Userinfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/Userinfo.php new file mode 100644 index 0000000..1c22318 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/Userinfo.php @@ -0,0 +1,45 @@ + + * $oauth2Service = new Google\Service\Oauth2(...); + * $userinfo = $oauth2Service->userinfo; + * + */ +class Userinfo extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ + /** + * (userinfo.get) + * + * @param array $optParams Optional parameters. + * @return UserinfoModel + */ + public function get($optParams = []) + { + $params = []; + $params = array_merge($params, $optParams); + return $this->call('get', [$params], UserinfoModel::class); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Userinfo::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Oauth2_Resource_Userinfo'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/UserinfoV2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/UserinfoV2.php new file mode 100644 index 0000000..7d62bf2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/UserinfoV2.php @@ -0,0 +1,32 @@ + + * $oauth2Service = new Google\Service\Oauth2(...); + * $v2 = $oauth2Service->v2; + * + */ +class UserinfoV2 extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UserinfoV2::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Oauth2_Resource_UserinfoV2'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/UserinfoV2Me.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/UserinfoV2Me.php new file mode 100644 index 0000000..40cf84c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Resource/UserinfoV2Me.php @@ -0,0 +1,45 @@ + + * $oauth2Service = new Google\Service\Oauth2(...); + * $me = $oauth2Service->me; + * + */ +class UserinfoV2Me extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ + /** + * (me.get) + * + * @param array $optParams Optional parameters. + * @return Userinfo + */ + public function get($optParams = []) + { + $params = []; + $params = array_merge($params, $optParams); + return $this->call('get', [$params], UserinfoModel::class); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UserinfoV2Me::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Oauth2_Resource_UserinfoV2Me'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Tokeninfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Tokeninfo.php new file mode 100644 index 0000000..0e1383c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Tokeninfo.php @@ -0,0 +1,88 @@ + "expires_in", "issuedTo" => "issued_to", "userId" => "user_id", "verifiedEmail" => "verified_email"]; + public $audience; + public $email; + public $expiresIn; + public $issuedTo; + public $scope; + public $userId; + public $verifiedEmail; + public function setAudience($audience) + { + $this->audience = $audience; + } + public function getAudience() + { + return $this->audience; + } + public function setEmail($email) + { + $this->email = $email; + } + public function getEmail() + { + return $this->email; + } + public function setExpiresIn($expiresIn) + { + $this->expiresIn = $expiresIn; + } + public function getExpiresIn() + { + return $this->expiresIn; + } + public function setIssuedTo($issuedTo) + { + $this->issuedTo = $issuedTo; + } + public function getIssuedTo() + { + return $this->issuedTo; + } + public function setScope($scope) + { + $this->scope = $scope; + } + public function getScope() + { + return $this->scope; + } + public function setUserId($userId) + { + $this->userId = $userId; + } + public function getUserId() + { + return $this->userId; + } + public function setVerifiedEmail($verifiedEmail) + { + $this->verifiedEmail = $verifiedEmail; + } + public function getVerifiedEmail() + { + return $this->verifiedEmail; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Tokeninfo::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Oauth2_Tokeninfo'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Userinfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Userinfo.php new file mode 100644 index 0000000..49f82aa --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/Oauth2/Userinfo.php @@ -0,0 +1,124 @@ + "family_name", "givenName" => "given_name", "verifiedEmail" => "verified_email"]; + public $email; + public $familyName; + public $gender; + public $givenName; + public $hd; + public $id; + public $link; + public $locale; + public $name; + public $picture; + public $verifiedEmail; + public function setEmail($email) + { + $this->email = $email; + } + public function getEmail() + { + return $this->email; + } + public function setFamilyName($familyName) + { + $this->familyName = $familyName; + } + public function getFamilyName() + { + return $this->familyName; + } + public function setGender($gender) + { + $this->gender = $gender; + } + public function getGender() + { + return $this->gender; + } + public function setGivenName($givenName) + { + $this->givenName = $givenName; + } + public function getGivenName() + { + return $this->givenName; + } + public function setHd($hd) + { + $this->hd = $hd; + } + public function getHd() + { + return $this->hd; + } + public function setId($id) + { + $this->id = $id; + } + public function getId() + { + return $this->id; + } + public function setLink($link) + { + $this->link = $link; + } + public function getLink() + { + return $this->link; + } + public function setLocale($locale) + { + $this->locale = $locale; + } + public function getLocale() + { + return $this->locale; + } + public function setName($name) + { + $this->name = $name; + } + public function getName() + { + return $this->name; + } + public function setPicture($picture) + { + $this->picture = $picture; + } + public function getPicture() + { + return $this->picture; + } + public function setVerifiedEmail($verifiedEmail) + { + $this->verifiedEmail = $verifiedEmail; + } + public function getVerifiedEmail() + { + return $this->verifiedEmail; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Userinfo::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Oauth2_Userinfo'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole.php new file mode 100644 index 0000000..076b9af --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole.php @@ -0,0 +1,67 @@ + + * The Search Console API provides access to both Search Console data (verified + * users only) and to public information on an URL basis (anyone)

+ * + *

+ * For more information about this service, see the API + * Documentation + *

+ * + * @author Google, Inc. + */ +class SearchConsole extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service +{ + /** View and manage Search Console data for your verified sites. */ + const WEBMASTERS = "https://www.googleapis.com/auth/webmasters"; + /** View Search Console data for your verified sites. */ + const WEBMASTERS_READONLY = "https://www.googleapis.com/auth/webmasters.readonly"; + public $searchanalytics; + public $sitemaps; + public $sites; + public $urlTestingTools_mobileFriendlyTest; + /** + * Constructs the internal representation of the SearchConsole service. + * + * @param Client|array $clientOrConfig The client used to deliver requests, or a + * config array to pass to a new Client instance. + * @param string $rootUrl The root URL used for requests to the service. + */ + public function __construct($clientOrConfig = [], $rootUrl = null) + { + parent::__construct($clientOrConfig); + $this->rootUrl = $rootUrl ?: 'https://searchconsole.googleapis.com/'; + $this->servicePath = ''; + $this->batchPath = 'batch'; + $this->version = 'v1'; + $this->serviceName = 'searchconsole'; + $this->searchanalytics = new SearchConsole\Resource\Searchanalytics($this, $this->serviceName, 'searchanalytics', ['methods' => ['query' => ['path' => 'webmasters/v3/sites/{siteUrl}/searchAnalytics/query', 'httpMethod' => 'POST', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true]]]]]); + $this->sitemaps = new SearchConsole\Resource\Sitemaps($this, $this->serviceName, 'sitemaps', ['methods' => ['delete' => ['path' => 'webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}', 'httpMethod' => 'DELETE', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'feedpath' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}', 'httpMethod' => 'GET', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'feedpath' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'webmasters/v3/sites/{siteUrl}/sitemaps', 'httpMethod' => 'GET', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'sitemapIndex' => ['location' => 'query', 'type' => 'string']]], 'submit' => ['path' => 'webmasters/v3/sites/{siteUrl}/sitemaps/{feedpath}', 'httpMethod' => 'PUT', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true], 'feedpath' => ['location' => 'path', 'type' => 'string', 'required' => \true]]]]]); + $this->sites = new SearchConsole\Resource\Sites($this, $this->serviceName, 'sites', ['methods' => ['add' => ['path' => 'webmasters/v3/sites/{siteUrl}', 'httpMethod' => 'PUT', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'delete' => ['path' => 'webmasters/v3/sites/{siteUrl}', 'httpMethod' => 'DELETE', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'get' => ['path' => 'webmasters/v3/sites/{siteUrl}', 'httpMethod' => 'GET', 'parameters' => ['siteUrl' => ['location' => 'path', 'type' => 'string', 'required' => \true]]], 'list' => ['path' => 'webmasters/v3/sites', 'httpMethod' => 'GET', 'parameters' => []]]]); + $this->urlTestingTools_mobileFriendlyTest = new SearchConsole\Resource\UrlTestingToolsMobileFriendlyTest($this, $this->serviceName, 'mobileFriendlyTest', ['methods' => ['run' => ['path' => 'v1/urlTestingTools/mobileFriendlyTest:run', 'httpMethod' => 'POST', 'parameters' => []]]]); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SearchConsole::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDataRow.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDataRow.php new file mode 100644 index 0000000..fc941c9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDataRow.php @@ -0,0 +1,70 @@ +clicks = $clicks; + } + public function getClicks() + { + return $this->clicks; + } + public function setCtr($ctr) + { + $this->ctr = $ctr; + } + public function getCtr() + { + return $this->ctr; + } + public function setImpressions($impressions) + { + $this->impressions = $impressions; + } + public function getImpressions() + { + return $this->impressions; + } + public function setKeys($keys) + { + $this->keys = $keys; + } + public function getKeys() + { + return $this->keys; + } + public function setPosition($position) + { + $this->position = $position; + } + public function getPosition() + { + return $this->position; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ApiDataRow::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_ApiDataRow'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDimensionFilter.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDimensionFilter.php new file mode 100644 index 0000000..f5c1305 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDimensionFilter.php @@ -0,0 +1,51 @@ +dimension = $dimension; + } + public function getDimension() + { + return $this->dimension; + } + public function setExpression($expression) + { + $this->expression = $expression; + } + public function getExpression() + { + return $this->expression; + } + public function setOperator($operator) + { + $this->operator = $operator; + } + public function getOperator() + { + return $this->operator; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ApiDimensionFilter::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_ApiDimensionFilter'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDimensionFilterGroup.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDimensionFilterGroup.php new file mode 100644 index 0000000..42b8c14 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ApiDimensionFilterGroup.php @@ -0,0 +1,50 @@ +filters = $filters; + } + /** + * @return ApiDimensionFilter[] + */ + public function getFilters() + { + return $this->filters; + } + public function setGroupType($groupType) + { + $this->groupType = $groupType; + } + public function getGroupType() + { + return $this->groupType; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ApiDimensionFilterGroup::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_ApiDimensionFilterGroup'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/BlockedResource.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/BlockedResource.php new file mode 100644 index 0000000..b974ae0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/BlockedResource.php @@ -0,0 +1,33 @@ +url = $url; + } + public function getUrl() + { + return $this->url; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(BlockedResource::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_BlockedResource'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Image.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Image.php new file mode 100644 index 0000000..b8ec4e4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Image.php @@ -0,0 +1,42 @@ +data = $data; + } + public function getData() + { + return $this->data; + } + public function setMimeType($mimeType) + { + $this->mimeType = $mimeType; + } + public function getMimeType() + { + return $this->mimeType; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Image::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_Image'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/MobileFriendlyIssue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/MobileFriendlyIssue.php new file mode 100644 index 0000000..e187f3c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/MobileFriendlyIssue.php @@ -0,0 +1,33 @@ +rule = $rule; + } + public function getRule() + { + return $this->rule; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(MobileFriendlyIssue::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_MobileFriendlyIssue'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Searchanalytics.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Searchanalytics.php new file mode 100644 index 0000000..8be08f1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Searchanalytics.php @@ -0,0 +1,54 @@ + + * $searchconsoleService = new Google\Service\SearchConsole(...); + * $searchanalytics = $searchconsoleService->searchanalytics; + * + */ +class Searchanalytics extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ + /** + * Query your data with filters and parameters that you define. Returns zero or + * more rows grouped by the row keys that you define. You must define a date + * range of one or more days. When date is one of the group by values, any days + * without data are omitted from the result list. If you need to know which days + * have data, issue a broad date range query grouped by date for any metric, and + * see which day rows are returned. (searchanalytics.query) + * + * @param string $siteUrl The site's URL, including protocol. For example: + * `http://www.example.com/`. + * @param SearchAnalyticsQueryRequest $postBody + * @param array $optParams Optional parameters. + * @return SearchAnalyticsQueryResponse + */ + public function query($siteUrl, SearchAnalyticsQueryRequest $postBody, $optParams = []) + { + $params = ['siteUrl' => $siteUrl, 'postBody' => $postBody]; + $params = array_merge($params, $optParams); + return $this->call('query', [$params], SearchAnalyticsQueryResponse::class); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Searchanalytics::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_Resource_Searchanalytics'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Sitemaps.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Sitemaps.php new file mode 100644 index 0000000..5708dc8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Sitemaps.php @@ -0,0 +1,99 @@ + + * $searchconsoleService = new Google\Service\SearchConsole(...); + * $sitemaps = $searchconsoleService->sitemaps; + * + */ +class Sitemaps extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ + /** + * Deletes a sitemap from this site. (sitemaps.delete) + * + * @param string $siteUrl The site's URL, including protocol. For example: + * `http://www.example.com/`. + * @param string $feedpath The URL of the actual sitemap. For example: + * `http://www.example.com/sitemap.xml`. + * @param array $optParams Optional parameters. + */ + public function delete($siteUrl, $feedpath, $optParams = []) + { + $params = ['siteUrl' => $siteUrl, 'feedpath' => $feedpath]; + $params = array_merge($params, $optParams); + return $this->call('delete', [$params]); + } + /** + * Retrieves information about a specific sitemap. (sitemaps.get) + * + * @param string $siteUrl The site's URL, including protocol. For example: + * `http://www.example.com/`. + * @param string $feedpath The URL of the actual sitemap. For example: + * `http://www.example.com/sitemap.xml`. + * @param array $optParams Optional parameters. + * @return WmxSitemap + */ + public function get($siteUrl, $feedpath, $optParams = []) + { + $params = ['siteUrl' => $siteUrl, 'feedpath' => $feedpath]; + $params = array_merge($params, $optParams); + return $this->call('get', [$params], WmxSitemap::class); + } + /** + * Lists the [sitemaps-entries](/webmaster-tools/v3/sitemaps) submitted for this + * site, or included in the sitemap index file (if `sitemapIndex` is specified + * in the request). (sitemaps.listSitemaps) + * + * @param string $siteUrl The site's URL, including protocol. For example: + * `http://www.example.com/`. + * @param array $optParams Optional parameters. + * + * @opt_param string sitemapIndex A URL of a site's sitemap index. For example: + * `http://www.example.com/sitemapindex.xml`. + * @return SitemapsListResponse + */ + public function listSitemaps($siteUrl, $optParams = []) + { + $params = ['siteUrl' => $siteUrl]; + $params = array_merge($params, $optParams); + return $this->call('list', [$params], SitemapsListResponse::class); + } + /** + * Submits a sitemap for a site. (sitemaps.submit) + * + * @param string $siteUrl The site's URL, including protocol. For example: + * `http://www.example.com/`. + * @param string $feedpath The URL of the actual sitemap. For example: + * `http://www.example.com/sitemap.xml`. + * @param array $optParams Optional parameters. + */ + public function submit($siteUrl, $feedpath, $optParams = []) + { + $params = ['siteUrl' => $siteUrl, 'feedpath' => $feedpath]; + $params = array_merge($params, $optParams); + return $this->call('submit', [$params]); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Sitemaps::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_Resource_Sitemaps'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Sites.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Sites.php new file mode 100644 index 0000000..24b5934 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/Sites.php @@ -0,0 +1,86 @@ + + * $searchconsoleService = new Google\Service\SearchConsole(...); + * $sites = $searchconsoleService->sites; + * + */ +class Sites extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ + /** + * Adds a site to the set of the user's sites in Search Console. (sites.add) + * + * @param string $siteUrl The URL of the site to add. + * @param array $optParams Optional parameters. + */ + public function add($siteUrl, $optParams = []) + { + $params = ['siteUrl' => $siteUrl]; + $params = array_merge($params, $optParams); + return $this->call('add', [$params]); + } + /** + * Removes a site from the set of the user's Search Console sites. + * (sites.delete) + * + * @param string $siteUrl The URI of the property as defined in Search Console. + * **Examples:** `http://www.example.com/` or `sc-domain:example.com`. + * @param array $optParams Optional parameters. + */ + public function delete($siteUrl, $optParams = []) + { + $params = ['siteUrl' => $siteUrl]; + $params = array_merge($params, $optParams); + return $this->call('delete', [$params]); + } + /** + * Retrieves information about specific site. (sites.get) + * + * @param string $siteUrl The URI of the property as defined in Search Console. + * **Examples:** `http://www.example.com/` or `sc-domain:example.com`. + * @param array $optParams Optional parameters. + * @return WmxSite + */ + public function get($siteUrl, $optParams = []) + { + $params = ['siteUrl' => $siteUrl]; + $params = array_merge($params, $optParams); + return $this->call('get', [$params], WmxSite::class); + } + /** + * Lists the user's Search Console sites. (sites.listSites) + * + * @param array $optParams Optional parameters. + * @return SitesListResponse + */ + public function listSites($optParams = []) + { + $params = []; + $params = array_merge($params, $optParams); + return $this->call('list', [$params], SitesListResponse::class); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(Sites::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_Resource_Sites'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/UrlTestingTools.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/UrlTestingTools.php new file mode 100644 index 0000000..9e022ce --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/UrlTestingTools.php @@ -0,0 +1,32 @@ + + * $searchconsoleService = new Google\Service\SearchConsole(...); + * $urlTestingTools = $searchconsoleService->urlTestingTools; + * + */ +class UrlTestingTools extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UrlTestingTools::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_Resource_UrlTestingTools'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/UrlTestingToolsMobileFriendlyTest.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/UrlTestingToolsMobileFriendlyTest.php new file mode 100644 index 0000000..0d43a14 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/Resource/UrlTestingToolsMobileFriendlyTest.php @@ -0,0 +1,47 @@ + + * $searchconsoleService = new Google\Service\SearchConsole(...); + * $mobileFriendlyTest = $searchconsoleService->mobileFriendlyTest; + * + */ +class UrlTestingToolsMobileFriendlyTest extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource +{ + /** + * Runs Mobile-Friendly Test for a given URL. (mobileFriendlyTest.run) + * + * @param RunMobileFriendlyTestRequest $postBody + * @param array $optParams Optional parameters. + * @return RunMobileFriendlyTestResponse + */ + public function run(RunMobileFriendlyTestRequest $postBody, $optParams = []) + { + $params = ['postBody' => $postBody]; + $params = array_merge($params, $optParams); + return $this->call('run', [$params], RunMobileFriendlyTestResponse::class); + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(UrlTestingToolsMobileFriendlyTest::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_Resource_UrlTestingToolsMobileFriendlyTest'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ResourceIssue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ResourceIssue.php new file mode 100644 index 0000000..1484a00 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/ResourceIssue.php @@ -0,0 +1,40 @@ +blockedResource = $blockedResource; + } + /** + * @return BlockedResource + */ + public function getBlockedResource() + { + return $this->blockedResource; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(ResourceIssue::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_ResourceIssue'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestRequest.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestRequest.php new file mode 100644 index 0000000..bec92cc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestRequest.php @@ -0,0 +1,42 @@ +requestScreenshot = $requestScreenshot; + } + public function getRequestScreenshot() + { + return $this->requestScreenshot; + } + public function setUrl($url) + { + $this->url = $url; + } + public function getUrl() + { + return $this->url; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RunMobileFriendlyTestRequest::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_RunMobileFriendlyTestRequest'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestResponse.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestResponse.php new file mode 100644 index 0000000..6f16f10 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestResponse.php @@ -0,0 +1,98 @@ +mobileFriendliness = $mobileFriendliness; + } + public function getMobileFriendliness() + { + return $this->mobileFriendliness; + } + /** + * @param MobileFriendlyIssue[] + */ + public function setMobileFriendlyIssues($mobileFriendlyIssues) + { + $this->mobileFriendlyIssues = $mobileFriendlyIssues; + } + /** + * @return MobileFriendlyIssue[] + */ + public function getMobileFriendlyIssues() + { + return $this->mobileFriendlyIssues; + } + /** + * @param ResourceIssue[] + */ + public function setResourceIssues($resourceIssues) + { + $this->resourceIssues = $resourceIssues; + } + /** + * @return ResourceIssue[] + */ + public function getResourceIssues() + { + return $this->resourceIssues; + } + /** + * @param Image + */ + public function setScreenshot(Image $screenshot) + { + $this->screenshot = $screenshot; + } + /** + * @return Image + */ + public function getScreenshot() + { + return $this->screenshot; + } + /** + * @param TestStatus + */ + public function setTestStatus(TestStatus $testStatus) + { + $this->testStatus = $testStatus; + } + /** + * @return TestStatus + */ + public function getTestStatus() + { + return $this->testStatus; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(RunMobileFriendlyTestResponse::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_RunMobileFriendlyTestResponse'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryRequest.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryRequest.php new file mode 100644 index 0000000..ad7a15e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryRequest.php @@ -0,0 +1,122 @@ +aggregationType = $aggregationType; + } + public function getAggregationType() + { + return $this->aggregationType; + } + public function setDataState($dataState) + { + $this->dataState = $dataState; + } + public function getDataState() + { + return $this->dataState; + } + /** + * @param ApiDimensionFilterGroup[] + */ + public function setDimensionFilterGroups($dimensionFilterGroups) + { + $this->dimensionFilterGroups = $dimensionFilterGroups; + } + /** + * @return ApiDimensionFilterGroup[] + */ + public function getDimensionFilterGroups() + { + return $this->dimensionFilterGroups; + } + public function setDimensions($dimensions) + { + $this->dimensions = $dimensions; + } + public function getDimensions() + { + return $this->dimensions; + } + public function setEndDate($endDate) + { + $this->endDate = $endDate; + } + public function getEndDate() + { + return $this->endDate; + } + public function setRowLimit($rowLimit) + { + $this->rowLimit = $rowLimit; + } + public function getRowLimit() + { + return $this->rowLimit; + } + public function setSearchType($searchType) + { + $this->searchType = $searchType; + } + public function getSearchType() + { + return $this->searchType; + } + public function setStartDate($startDate) + { + $this->startDate = $startDate; + } + public function getStartDate() + { + return $this->startDate; + } + public function setStartRow($startRow) + { + $this->startRow = $startRow; + } + public function getStartRow() + { + return $this->startRow; + } + public function setType($type) + { + $this->type = $type; + } + public function getType() + { + return $this->type; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SearchAnalyticsQueryRequest::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_SearchAnalyticsQueryRequest'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryResponse.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryResponse.php new file mode 100644 index 0000000..40f4dbd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryResponse.php @@ -0,0 +1,50 @@ +responseAggregationType = $responseAggregationType; + } + public function getResponseAggregationType() + { + return $this->responseAggregationType; + } + /** + * @param ApiDataRow[] + */ + public function setRows($rows) + { + $this->rows = $rows; + } + /** + * @return ApiDataRow[] + */ + public function getRows() + { + return $this->rows; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SearchAnalyticsQueryResponse::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_SearchAnalyticsQueryResponse'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SitemapsListResponse.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SitemapsListResponse.php new file mode 100644 index 0000000..3a8e4f8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SitemapsListResponse.php @@ -0,0 +1,41 @@ +sitemap = $sitemap; + } + /** + * @return WmxSitemap[] + */ + public function getSitemap() + { + return $this->sitemap; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SitemapsListResponse::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_SitemapsListResponse'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SitesListResponse.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SitesListResponse.php new file mode 100644 index 0000000..794bac0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/SitesListResponse.php @@ -0,0 +1,41 @@ +siteEntry = $siteEntry; + } + /** + * @return WmxSite[] + */ + public function getSiteEntry() + { + return $this->siteEntry; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(SitesListResponse::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_SitesListResponse'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/TestStatus.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/TestStatus.php new file mode 100644 index 0000000..f542027 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/TestStatus.php @@ -0,0 +1,42 @@ +details = $details; + } + public function getDetails() + { + return $this->details; + } + public function setStatus($status) + { + $this->status = $status; + } + public function getStatus() + { + return $this->status; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(TestStatus::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_TestStatus'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSite.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSite.php new file mode 100644 index 0000000..40b9f4d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSite.php @@ -0,0 +1,42 @@ +permissionLevel = $permissionLevel; + } + public function getPermissionLevel() + { + return $this->permissionLevel; + } + public function setSiteUrl($siteUrl) + { + $this->siteUrl = $siteUrl; + } + public function getSiteUrl() + { + return $this->siteUrl; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WmxSite::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_WmxSite'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSitemap.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSitemap.php new file mode 100644 index 0000000..babe038 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSitemap.php @@ -0,0 +1,113 @@ +contents = $contents; + } + /** + * @return WmxSitemapContent[] + */ + public function getContents() + { + return $this->contents; + } + public function setErrors($errors) + { + $this->errors = $errors; + } + public function getErrors() + { + return $this->errors; + } + public function setIsPending($isPending) + { + $this->isPending = $isPending; + } + public function getIsPending() + { + return $this->isPending; + } + public function setIsSitemapsIndex($isSitemapsIndex) + { + $this->isSitemapsIndex = $isSitemapsIndex; + } + public function getIsSitemapsIndex() + { + return $this->isSitemapsIndex; + } + public function setLastDownloaded($lastDownloaded) + { + $this->lastDownloaded = $lastDownloaded; + } + public function getLastDownloaded() + { + return $this->lastDownloaded; + } + public function setLastSubmitted($lastSubmitted) + { + $this->lastSubmitted = $lastSubmitted; + } + public function getLastSubmitted() + { + return $this->lastSubmitted; + } + public function setPath($path) + { + $this->path = $path; + } + public function getPath() + { + return $this->path; + } + public function setType($type) + { + $this->type = $type; + } + public function getType() + { + return $this->type; + } + public function setWarnings($warnings) + { + $this->warnings = $warnings; + } + public function getWarnings() + { + return $this->warnings; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WmxSitemap::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_WmxSitemap'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSitemapContent.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSitemapContent.php new file mode 100644 index 0000000..cb500e8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/src/SearchConsole/WmxSitemapContent.php @@ -0,0 +1,51 @@ +indexed = $indexed; + } + public function getIndexed() + { + return $this->indexed; + } + public function setSubmitted($submitted) + { + $this->submitted = $submitted; + } + public function getSubmitted() + { + return $this->submitted; + } + public function setType($type) + { + $this->type = $type; + } + public function getType() + { + return $this->type; + } +} +// Adding a class alias for backwards compatibility with the previous class name. +class_alias(WmxSitemapContent::class, 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_SearchConsole_WmxSitemapContent'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/synth.metadata b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/synth.metadata new file mode 100644 index 0000000..ccae829 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/synth.metadata @@ -0,0 +1,18 @@ +{ + "sources": [ + { + "git": { + "name": ".", + "remote": "https://github.com/googleapis/google-api-php-client-services.git", + "sha": "6056867755775c54a179bc49f29028c76b7ae0c2" + } + }, + { + "git": { + "name": "discovery-artifact-manager", + "remote": "https://github.com/googleapis/discovery-artifact-manager.git", + "sha": "4052db7ca555cbaf48bfaf93f32e575d7a3ff1d5" + } + } + ] +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/synth.py b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/synth.py new file mode 100644 index 0000000..5dd63e2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient-services/synth.py @@ -0,0 +1,119 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +from synthtool.__main__ import extra_args +from synthtool import log, shell +from synthtool.sources import git +import logging +from os import path, remove +from pathlib import Path +import glob +import json +import re +import sys +from packaging import version + +logging.basicConfig(level=logging.DEBUG) + +VERSION_REGEX = r"([^\.]*)\.(.+)\.json$" + +TEMPLATE_VERSIONS = [ + "default", +] +discovery_url = "https://github.com/googleapis/discovery-artifact-manager.git" + +repository = Path('.') + +log.debug(f"Cloning {discovery_url}.") +discovery = git.clone(discovery_url) + +log.debug("Cleaning output directory.") +shell.run("rm -rf .cache".split(), cwd=repository) + +log.debug("Installing dependencies.") +shell.run( + "python2 -m pip install -e generator/ --user".split(), + cwd=repository +) + +def generate_service(disco: str): + m = re.search(VERSION_REGEX, disco) + name = m.group(1) + version = m.group(2) + template = TEMPLATE_VERSIONS[-1] # Generate for latest version + + log.info(f"Generating {name} {version} ({template}).") + + output_dir = repository / ".cache" / name / version + input_file = discovery / "discoveries" / disco + + command = ( + f"python2 -m googleapis.codegen --output_dir={output_dir}" + + f" --input={input_file} --language=php --language_variant={template}" + + f" --package_path=api/services" + ) + + shell.run(f"mkdir -p {output_dir}".split(), cwd=repository / "generator") + shell.run(command.split(), cwd=repository, hide_output=False) + + s.copy(output_dir, f"src") + +def all_discoveries(skip=None, prefer=None): + """Returns a map of API IDs to Discovery document filenames. + + Args: + skip (list, optional): a list of API IDs to skip. + prefer (list, optional): a list of API IDs to include. + + Returns: + list(string): A list of Discovery document filenames. + """ + discos = {} + for file in sorted(glob.glob(str(discovery / 'discoveries/*.*.json'))): + api_id = None + with open(file) as api_file: + api_id = json.load(api_file)['id'] + # If an API has already been visited, skip it. + if api_id in discos: + continue + # Skip APIs explicitly listed in "skip" arg + if skip and api_id in skip: + continue + discos[api_id] = path.basename(file) + + # Skip APIs not preferred in index.json and not listed in "prefer" arg + index = {} + with open(str(discovery / 'discoveries/index.json')) as file: + index = json.load(file) + for api in index['items']: + api_id = api['id'] + if prefer and api_id in prefer: + continue + if api['preferred']: + continue + discos.pop(api_id, None) + + return discos.values() + +def generate_services(services): + for service in services: + generate_service(service) + +skip = ['discovery:v1', 'websecurityscanner:v1'] +prefer = ['admin:directory_v1', 'admin:datatransfer_v1'] +discoveries = all_discoveries(skip, prefer) +generate_services(discoveries) diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/LICENSE new file mode 100644 index 0000000..a148ba5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/LICENSE @@ -0,0 +1,203 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AccessToken/Revoke.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AccessToken/Revoke.php new file mode 100644 index 0000000..9ac4da2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AccessToken/Revoke.php @@ -0,0 +1,65 @@ +http = $http; + } + /** + * Revoke an OAuth2 access token or refresh token. This method will revoke the current access + * token, if a token isn't provided. + * + * @param string|array $token The token (access token or a refresh token) that should be revoked. + * @return boolean Returns True if the revocation was successful, otherwise False. + */ + public function revokeToken($token) + { + if (is_array($token)) { + if (isset($token['refresh_token'])) { + $token = $token['refresh_token']; + } else { + $token = $token['access_token']; + } + } + $body = Psr7\Utils::streamFor(http_build_query(['token' => $token])); + $request = new Request('POST', Client::OAUTH2_REVOKE_URI, ['Cache-Control' => 'no-store', 'Content-Type' => 'application/x-www-form-urlencoded'], $body); + $httpHandler = HttpHandlerFactory::build($this->http); + $response = $httpHandler($request); + return $response->getStatusCode() == 200; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AccessToken/Verify.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AccessToken/Verify.php new file mode 100644 index 0000000..7793e4d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AccessToken/Verify.php @@ -0,0 +1,217 @@ +http = $http; + $this->cache = $cache; + $this->jwt = $jwt ?: $this->getJwtService(); + } + /** + * Verifies an id token and returns the authenticated apiLoginTicket. + * Throws an exception if the id token is not valid. + * The audience parameter can be used to control which id tokens are + * accepted. By default, the id token must have been issued to this OAuth2 client. + * + * @param string $idToken the ID token in JWT format + * @param string $audience Optional. The audience to verify against JWt "aud" + * @return array|false the token payload, if successful + */ + public function verifyIdToken($idToken, $audience = null) + { + if (empty($idToken)) { + throw new LogicException('id_token cannot be null'); + } + // set phpseclib constants if applicable + $this->setPhpsecConstants(); + // Check signature + $certs = $this->getFederatedSignOnCerts(); + foreach ($certs as $cert) { + try { + $args = [$idToken]; + $publicKey = $this->getPublicKey($cert); + if (class_exists(Key::class)) { + $args[] = new Key($publicKey, 'RS256'); + } else { + $args[] = $publicKey; + $args[] = ['RS256']; + } + $payload = \call_user_func_array([$this->jwt, 'decode'], $args); + if (property_exists($payload, 'aud')) { + if ($audience && $payload->aud != $audience) { + return \false; + } + } + // support HTTP and HTTPS issuers + // @see https://developers.google.com/identity/sign-in/web/backend-auth + $issuers = [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS]; + if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) { + return \false; + } + return (array) $payload; + } catch (ExpiredException $e) { + // @phpstan-ignore-line + return \false; + } catch (ExpiredExceptionV3 $e) { + return \false; + } catch (SignatureInvalidException $e) { + // continue + } catch (DomainException $e) { + // continue + } + } + return \false; + } + private function getCache() + { + return $this->cache; + } + /** + * Retrieve and cache a certificates file. + * + * @param string $url location + * @throws \Google\Exception + * @return array certificates + */ + private function retrieveCertsFromLocation($url) + { + // If we're retrieving a local file, just grab it. + if (0 !== strpos($url, 'http')) { + if (!($file = file_get_contents($url))) { + throw new GoogleException("Failed to retrieve verification certificates: '" . $url . "'."); + } + return json_decode($file, \true); + } + // @phpstan-ignore-next-line + $response = $this->http->get($url); + if ($response->getStatusCode() == 200) { + return json_decode((string) $response->getBody(), \true); + } + throw new GoogleException(sprintf('Failed to retrieve verification certificates: "%s".', $response->getBody()->getContents()), $response->getStatusCode()); + } + // Gets federated sign-on certificates to use for verifying identity tokens. + // Returns certs as array structure, where keys are key ids, and values + // are PEM encoded certificates. + private function getFederatedSignOnCerts() + { + $certs = null; + if ($cache = $this->getCache()) { + $cacheItem = $cache->getItem('federated_signon_certs_v3'); + $certs = $cacheItem->get(); + } + if (!$certs) { + $certs = $this->retrieveCertsFromLocation(self::FEDERATED_SIGNON_CERT_URL); + if ($cache) { + $cacheItem->expiresAt(new DateTime('+1 hour')); + $cacheItem->set($certs); + $cache->save($cacheItem); + } + } + if (!isset($certs['keys'])) { + throw new InvalidArgumentException('federated sign-on certs expects "keys" to be set'); + } + return $certs['keys']; + } + private function getJwtService() + { + $jwt = new JWT(); + if ($jwt::$leeway < 1) { + // Ensures JWT leeway is at least 1 + // @see https://github.com/google/google-api-php-client/issues/827 + $jwt::$leeway = 1; + } + return $jwt; + } + private function getPublicKey($cert) + { + $modulus = new BigInteger($this->jwt->urlsafeB64Decode($cert['n']), 256); + $exponent = new BigInteger($this->jwt->urlsafeB64Decode($cert['e']), 256); + $component = ['n' => $modulus, 'e' => $exponent]; + $loader = PublicKeyLoader::load($component); + return $loader->toString('PKCS8'); + } + /** + * phpseclib calls "phpinfo" by default, which requires special + * whitelisting in the AppEngine VM environment. This function + * sets constants to bypass the need for phpseclib to check phpinfo + * + * @see phpseclib/Math/BigInteger + * @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85 + */ + private function setPhpsecConstants() + { + if (filter_var(getenv('GAE_VM'), \FILTER_VALIDATE_BOOLEAN)) { + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\MATH_BIGINTEGER_OPENSSL_ENABLED')) { + define('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\MATH_BIGINTEGER_OPENSSL_ENABLED', \true); + } + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\CRYPT_RSA_MODE')) { + define('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\CRYPT_RSA_MODE', AES::ENGINE_OPENSSL); + } + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AuthHandler/AuthHandlerFactory.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AuthHandler/AuthHandlerFactory.php new file mode 100644 index 0000000..efd004f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AuthHandler/AuthHandlerFactory.php @@ -0,0 +1,47 @@ +cache = $cache; + $this->cacheConfig = $cacheConfig; + } + public function attachCredentials(ClientInterface $http, CredentialsLoader $credentials, callable $tokenCallback = null) + { + // use the provided cache + if ($this->cache) { + $credentials = new FetchAuthTokenCache($credentials, $this->cacheConfig, $this->cache); + } + return $this->attachCredentialsCache($http, $credentials, $tokenCallback); + } + public function attachCredentialsCache(ClientInterface $http, FetchAuthTokenCache $credentials, callable $tokenCallback = null) + { + // if we end up needing to make an HTTP request to retrieve credentials, we + // can use our existing one, but we need to throw exceptions so the error + // bubbles up. + $authHttp = $this->createAuthHttp($http); + $authHttpHandler = HttpHandlerFactory::build($authHttp); + $middleware = new AuthTokenMiddleware($credentials, $authHttpHandler, $tokenCallback); + $config = $http->getConfig(); + $config['handler']->remove('google_auth'); + $config['handler']->push($middleware, 'google_auth'); + $config['auth'] = 'google_auth'; + $http = new Client($config); + return $http; + } + public function attachToken(ClientInterface $http, array $token, array $scopes) + { + $tokenFunc = function ($scopes) use($token) { + return $token['access_token']; + }; + $middleware = new ScopedAccessTokenMiddleware($tokenFunc, $scopes, $this->cacheConfig, $this->cache); + $config = $http->getConfig(); + $config['handler']->remove('google_auth'); + $config['handler']->push($middleware, 'google_auth'); + $config['auth'] = 'scoped'; + $http = new Client($config); + return $http; + } + public function attachKey(ClientInterface $http, $key) + { + $middleware = new SimpleMiddleware(['key' => $key]); + $config = $http->getConfig(); + $config['handler']->remove('google_auth'); + $config['handler']->push($middleware, 'google_auth'); + $config['auth'] = 'simple'; + $http = new Client($config); + return $http; + } + private function createAuthHttp(ClientInterface $http) + { + return new Client(['http_errors' => \true] + $http->getConfig()); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php new file mode 100644 index 0000000..967861a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php @@ -0,0 +1,25 @@ +config = array_merge([ + 'application_name' => '', + // Don't change these unless you're working against a special development + // or testing environment. + 'base_path' => self::API_BASE_PATH, + // https://developers.google.com/console + 'client_id' => '', + 'client_secret' => '', + // Can be a path to JSON credentials or an array representing those + // credentials (@see Google\Client::setAuthConfig), or an instance of + // Google\Auth\CredentialsLoader. + 'credentials' => null, + // @see Google\Client::setScopes + 'scopes' => null, + // Sets X-Goog-User-Project, which specifies a user project to bill + // for access charges associated with the request + 'quota_project' => null, + 'redirect_uri' => null, + 'state' => null, + // Simple API access key, also from the API console. Ensure you get + // a Server key, and not a Browser key. + 'developer_key' => '', + // For use with Google Cloud Platform + // fetch the ApplicationDefaultCredentials, if applicable + // @see https://developers.google.com/identity/protocols/application-default-credentials + 'use_application_default_credentials' => \false, + 'signing_key' => null, + 'signing_algorithm' => null, + 'subject' => null, + // Other OAuth2 parameters. + 'hd' => '', + 'prompt' => '', + 'openid.realm' => '', + 'include_granted_scopes' => null, + 'login_hint' => '', + 'request_visible_actions' => '', + 'access_type' => 'online', + 'approval_prompt' => 'auto', + // Task Runner retry configuration + // @see Google\Task\Runner + 'retry' => [], + 'retry_map' => null, + // Cache class implementing Psr\Cache\CacheItemPoolInterface. + // Defaults to Google\Auth\Cache\MemoryCacheItemPool. + 'cache' => null, + // cache config for downstream auth caching + 'cache_config' => [], + // function to be called when an access token is fetched + // follows the signature function ($cacheKey, $accessToken) + 'token_callback' => null, + // Service class used in Google\Client::verifyIdToken. + // Explicitly pass this in to avoid setting JWT::$leeway + 'jwt' => null, + // Setting api_format_v2 will return more detailed error messages + // from certain APIs. + 'api_format_v2' => \false, + ], $config); + if (!is_null($this->config['credentials'])) { + if ($this->config['credentials'] instanceof CredentialsLoader) { + $this->credentials = $this->config['credentials']; + } else { + $this->setAuthConfig($this->config['credentials']); + } + unset($this->config['credentials']); + } + if (!is_null($this->config['scopes'])) { + $this->setScopes($this->config['scopes']); + unset($this->config['scopes']); + } + // Set a default token callback to update the in-memory access token + if (is_null($this->config['token_callback'])) { + $this->config['token_callback'] = function ($cacheKey, $newAccessToken) { + $this->setAccessToken([ + 'access_token' => $newAccessToken, + 'expires_in' => 3600, + // Google default + 'created' => time(), + ]); + }; + } + if (!is_null($this->config['cache'])) { + $this->setCache($this->config['cache']); + unset($this->config['cache']); + } + } + /** + * Get a string containing the version of the library. + * + * @return string + */ + public function getLibraryVersion() + { + return self::LIBVER; + } + /** + * For backwards compatibility + * alias for fetchAccessTokenWithAuthCode + * + * @param string $code string code from accounts.google.com + * @return array access token + * @deprecated + */ + public function authenticate($code) + { + return $this->fetchAccessTokenWithAuthCode($code); + } + /** + * Attempt to exchange a code for an valid authentication token. + * Helper wrapped around the OAuth 2.0 implementation. + * + * @param string $code code from accounts.google.com + * @param string $codeVerifier the code verifier used for PKCE (if applicable) + * @return array access token + */ + public function fetchAccessTokenWithAuthCode($code, $codeVerifier = null) + { + if (strlen($code) == 0) { + throw new InvalidArgumentException("Invalid code"); + } + $auth = $this->getOAuth2Service(); + $auth->setCode($code); + $auth->setRedirectUri($this->getRedirectUri()); + if ($codeVerifier) { + $auth->setCodeVerifier($codeVerifier); + } + $httpHandler = HttpHandlerFactory::build($this->getHttpClient()); + $creds = $auth->fetchAuthToken($httpHandler); + if ($creds && isset($creds['access_token'])) { + $creds['created'] = time(); + $this->setAccessToken($creds); + } + return $creds; + } + /** + * For backwards compatibility + * alias for fetchAccessTokenWithAssertion + * + * @return array access token + * @deprecated + */ + public function refreshTokenWithAssertion() + { + return $this->fetchAccessTokenWithAssertion(); + } + /** + * Fetches a fresh access token with a given assertion token. + * @param ClientInterface $authHttp optional. + * @return array access token + */ + public function fetchAccessTokenWithAssertion(ClientInterface $authHttp = null) + { + if (!$this->isUsingApplicationDefaultCredentials()) { + throw new DomainException('set the JSON service account credentials using' . ' Google\\Client::setAuthConfig or set the path to your JSON file' . ' with the "GOOGLE_APPLICATION_CREDENTIALS" environment variable' . ' and call Google\\Client::useApplicationDefaultCredentials to' . ' refresh a token with assertion.'); + } + $this->getLogger()->log('info', 'OAuth2 access token refresh with Signed JWT assertion grants.'); + $credentials = $this->createApplicationDefaultCredentials(); + $httpHandler = HttpHandlerFactory::build($authHttp); + $creds = $credentials->fetchAuthToken($httpHandler); + if ($creds && isset($creds['access_token'])) { + $creds['created'] = time(); + $this->setAccessToken($creds); + } + return $creds; + } + /** + * For backwards compatibility + * alias for fetchAccessTokenWithRefreshToken + * + * @param string $refreshToken + * @return array access token + */ + public function refreshToken($refreshToken) + { + return $this->fetchAccessTokenWithRefreshToken($refreshToken); + } + /** + * Fetches a fresh OAuth 2.0 access token with the given refresh token. + * @param string $refreshToken + * @return array access token + */ + public function fetchAccessTokenWithRefreshToken($refreshToken = null) + { + if (null === $refreshToken) { + if (!isset($this->token['refresh_token'])) { + throw new LogicException('refresh token must be passed in or set as part of setAccessToken'); + } + $refreshToken = $this->token['refresh_token']; + } + $this->getLogger()->info('OAuth2 access token refresh'); + $auth = $this->getOAuth2Service(); + $auth->setRefreshToken($refreshToken); + $httpHandler = HttpHandlerFactory::build($this->getHttpClient()); + $creds = $auth->fetchAuthToken($httpHandler); + if ($creds && isset($creds['access_token'])) { + $creds['created'] = time(); + if (!isset($creds['refresh_token'])) { + $creds['refresh_token'] = $refreshToken; + } + $this->setAccessToken($creds); + } + return $creds; + } + /** + * Create a URL to obtain user authorization. + * The authorization endpoint allows the user to first + * authenticate, and then grant/deny the access request. + * @param string|array $scope The scope is expressed as an array or list of space-delimited strings. + * @param array $queryParams Querystring params to add to the authorization URL. + * @return string + */ + public function createAuthUrl($scope = null, array $queryParams = []) + { + if (empty($scope)) { + $scope = $this->prepareScopes(); + } + if (is_array($scope)) { + $scope = implode(' ', $scope); + } + // only accept one of prompt or approval_prompt + $approvalPrompt = $this->config['prompt'] ? null : $this->config['approval_prompt']; + // include_granted_scopes should be string "true", string "false", or null + $includeGrantedScopes = $this->config['include_granted_scopes'] === null ? null : var_export($this->config['include_granted_scopes'], \true); + $params = array_filter(['access_type' => $this->config['access_type'], 'approval_prompt' => $approvalPrompt, 'hd' => $this->config['hd'], 'include_granted_scopes' => $includeGrantedScopes, 'login_hint' => $this->config['login_hint'], 'openid.realm' => $this->config['openid.realm'], 'prompt' => $this->config['prompt'], 'redirect_uri' => $this->config['redirect_uri'], 'response_type' => 'code', 'scope' => $scope, 'state' => $this->config['state']]) + $queryParams; + // If the list of scopes contains plus.login, add request_visible_actions + // to auth URL. + $rva = $this->config['request_visible_actions']; + if (strlen($rva) > 0 && \false !== strpos($scope, 'plus.login')) { + $params['request_visible_actions'] = $rva; + } + $auth = $this->getOAuth2Service(); + return (string) $auth->buildFullAuthorizationUri($params); + } + /** + * Adds auth listeners to the HTTP client based on the credentials + * set in the Google API Client object + * + * @param ClientInterface $http the http client object. + * @return ClientInterface the http client object + */ + public function authorize(ClientInterface $http = null) + { + $http = $http ?: $this->getHttpClient(); + $authHandler = $this->getAuthHandler(); + // These conditionals represent the decision tree for authentication + // 1. Check if a Google\Auth\CredentialsLoader instance has been supplied via the "credentials" option + // 2. Check for Application Default Credentials + // 3a. Check for an Access Token + // 3b. If access token exists but is expired, try to refresh it + // 4. Check for API Key + if ($this->credentials) { + return $authHandler->attachCredentials($http, $this->credentials, $this->config['token_callback']); + } + if ($this->isUsingApplicationDefaultCredentials()) { + $credentials = $this->createApplicationDefaultCredentials(); + return $authHandler->attachCredentialsCache($http, $credentials, $this->config['token_callback']); + } + if ($token = $this->getAccessToken()) { + $scopes = $this->prepareScopes(); + // add refresh subscriber to request a new token + if (isset($token['refresh_token']) && $this->isAccessTokenExpired()) { + $credentials = $this->createUserRefreshCredentials($scopes, $token['refresh_token']); + return $authHandler->attachCredentials($http, $credentials, $this->config['token_callback']); + } + return $authHandler->attachToken($http, $token, (array) $scopes); + } + if ($key = $this->config['developer_key']) { + return $authHandler->attachKey($http, $key); + } + return $http; + } + /** + * Set the configuration to use application default credentials for + * authentication + * + * @see https://developers.google.com/identity/protocols/application-default-credentials + * @param boolean $useAppCreds + */ + public function useApplicationDefaultCredentials($useAppCreds = \true) + { + $this->config['use_application_default_credentials'] = $useAppCreds; + } + /** + * To prevent useApplicationDefaultCredentials from inappropriately being + * called in a conditional + * + * @see https://developers.google.com/identity/protocols/application-default-credentials + */ + public function isUsingApplicationDefaultCredentials() + { + return $this->config['use_application_default_credentials']; + } + /** + * Set the access token used for requests. + * + * Note that at the time requests are sent, tokens are cached. A token will be + * cached for each combination of service and authentication scopes. If a + * cache pool is not provided, creating a new instance of the client will + * allow modification of access tokens. If a persistent cache pool is + * provided, in order to change the access token, you must clear the cached + * token by calling `$client->getCache()->clear()`. (Use caution in this case, + * as calling `clear()` will remove all cache items, including any items not + * related to Google API PHP Client.) + * + * @param string|array $token + * @throws InvalidArgumentException + */ + public function setAccessToken($token) + { + if (is_string($token)) { + if ($json = json_decode($token, \true)) { + $token = $json; + } else { + // assume $token is just the token string + $token = ['access_token' => $token]; + } + } + if ($token == null) { + throw new InvalidArgumentException('invalid json token'); + } + if (!isset($token['access_token'])) { + throw new InvalidArgumentException("Invalid token format"); + } + $this->token = $token; + } + public function getAccessToken() + { + return $this->token; + } + /** + * @return string|null + */ + public function getRefreshToken() + { + if (isset($this->token['refresh_token'])) { + return $this->token['refresh_token']; + } + return null; + } + /** + * Returns if the access_token is expired. + * @return bool Returns True if the access_token is expired. + */ + public function isAccessTokenExpired() + { + if (!$this->token) { + return \true; + } + $created = 0; + if (isset($this->token['created'])) { + $created = $this->token['created']; + } elseif (isset($this->token['id_token'])) { + // check the ID token for "iat" + // signature verification is not required here, as we are just + // using this for convenience to save a round trip request + // to the Google API server + $idToken = $this->token['id_token']; + if (substr_count($idToken, '.') == 2) { + $parts = explode('.', $idToken); + $payload = json_decode(base64_decode($parts[1]), \true); + if ($payload && isset($payload['iat'])) { + $created = $payload['iat']; + } + } + } + if (!isset($this->token['expires_in'])) { + // if the token does not have an "expires_in", then it's considered expired + return \true; + } + // If the token is set to expire in the next 30 seconds. + return $created + ($this->token['expires_in'] - 30) < time(); + } + /** + * @deprecated See UPGRADING.md for more information + */ + public function getAuth() + { + throw new BadMethodCallException('This function no longer exists. See UPGRADING.md for more information'); + } + /** + * @deprecated See UPGRADING.md for more information + */ + public function setAuth($auth) + { + throw new BadMethodCallException('This function no longer exists. See UPGRADING.md for more information'); + } + /** + * Set the OAuth 2.0 Client ID. + * @param string $clientId + */ + public function setClientId($clientId) + { + $this->config['client_id'] = $clientId; + } + public function getClientId() + { + return $this->config['client_id']; + } + /** + * Set the OAuth 2.0 Client Secret. + * @param string $clientSecret + */ + public function setClientSecret($clientSecret) + { + $this->config['client_secret'] = $clientSecret; + } + public function getClientSecret() + { + return $this->config['client_secret']; + } + /** + * Set the OAuth 2.0 Redirect URI. + * @param string $redirectUri + */ + public function setRedirectUri($redirectUri) + { + $this->config['redirect_uri'] = $redirectUri; + } + public function getRedirectUri() + { + return $this->config['redirect_uri']; + } + /** + * Set OAuth 2.0 "state" parameter to achieve per-request customization. + * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-22#section-3.1.2.2 + * @param string $state + */ + public function setState($state) + { + $this->config['state'] = $state; + } + /** + * @param string $accessType Possible values for access_type include: + * {@code "offline"} to request offline access from the user. + * {@code "online"} to request online access from the user. + */ + public function setAccessType($accessType) + { + $this->config['access_type'] = $accessType; + } + /** + * @param string $approvalPrompt Possible values for approval_prompt include: + * {@code "force"} to force the approval UI to appear. + * {@code "auto"} to request auto-approval when possible. (This is the default value) + */ + public function setApprovalPrompt($approvalPrompt) + { + $this->config['approval_prompt'] = $approvalPrompt; + } + /** + * Set the login hint, email address or sub id. + * @param string $loginHint + */ + public function setLoginHint($loginHint) + { + $this->config['login_hint'] = $loginHint; + } + /** + * Set the application name, this is included in the User-Agent HTTP header. + * @param string $applicationName + */ + public function setApplicationName($applicationName) + { + $this->config['application_name'] = $applicationName; + } + /** + * If 'plus.login' is included in the list of requested scopes, you can use + * this method to define types of app activities that your app will write. + * You can find a list of available types here: + * @link https://developers.google.com/+/api/moment-types + * + * @param array $requestVisibleActions Array of app activity types + */ + public function setRequestVisibleActions($requestVisibleActions) + { + if (is_array($requestVisibleActions)) { + $requestVisibleActions = implode(" ", $requestVisibleActions); + } + $this->config['request_visible_actions'] = $requestVisibleActions; + } + /** + * Set the developer key to use, these are obtained through the API Console. + * @see http://code.google.com/apis/console-help/#generatingdevkeys + * @param string $developerKey + */ + public function setDeveloperKey($developerKey) + { + $this->config['developer_key'] = $developerKey; + } + /** + * Set the hd (hosted domain) parameter streamlines the login process for + * Google Apps hosted accounts. By including the domain of the user, you + * restrict sign-in to accounts at that domain. + * @param string $hd the domain to use. + */ + public function setHostedDomain($hd) + { + $this->config['hd'] = $hd; + } + /** + * Set the prompt hint. Valid values are none, consent and select_account. + * If no value is specified and the user has not previously authorized + * access, then the user is shown a consent screen. + * @param string $prompt + * {@code "none"} Do not display any authentication or consent screens. Must not be specified with other values. + * {@code "consent"} Prompt the user for consent. + * {@code "select_account"} Prompt the user to select an account. + */ + public function setPrompt($prompt) + { + $this->config['prompt'] = $prompt; + } + /** + * openid.realm is a parameter from the OpenID 2.0 protocol, not from OAuth + * 2.0. It is used in OpenID 2.0 requests to signify the URL-space for which + * an authentication request is valid. + * @param string $realm the URL-space to use. + */ + public function setOpenidRealm($realm) + { + $this->config['openid.realm'] = $realm; + } + /** + * If this is provided with the value true, and the authorization request is + * granted, the authorization will include any previous authorizations + * granted to this user/application combination for other scopes. + * @param bool $include the URL-space to use. + */ + public function setIncludeGrantedScopes($include) + { + $this->config['include_granted_scopes'] = $include; + } + /** + * sets function to be called when an access token is fetched + * @param callable $tokenCallback - function ($cacheKey, $accessToken) + */ + public function setTokenCallback(callable $tokenCallback) + { + $this->config['token_callback'] = $tokenCallback; + } + /** + * Revoke an OAuth2 access token or refresh token. This method will revoke the current access + * token, if a token isn't provided. + * + * @param string|array|null $token The token (access token or a refresh token) that should be revoked. + * @return boolean Returns True if the revocation was successful, otherwise False. + */ + public function revokeToken($token = null) + { + $tokenRevoker = new Revoke($this->getHttpClient()); + return $tokenRevoker->revokeToken($token ?: $this->getAccessToken()); + } + /** + * Verify an id_token. This method will verify the current id_token, if one + * isn't provided. + * + * @throws LogicException If no token was provided and no token was set using `setAccessToken`. + * @throws UnexpectedValueException If the token is not a valid JWT. + * @param string|null $idToken The token (id_token) that should be verified. + * @return array|false Returns the token payload as an array if the verification was + * successful, false otherwise. + */ + public function verifyIdToken($idToken = null) + { + $tokenVerifier = new Verify($this->getHttpClient(), $this->getCache(), $this->config['jwt']); + if (null === $idToken) { + $token = $this->getAccessToken(); + if (!isset($token['id_token'])) { + throw new LogicException('id_token must be passed in or set as part of setAccessToken'); + } + $idToken = $token['id_token']; + } + return $tokenVerifier->verifyIdToken($idToken, $this->getClientId()); + } + /** + * Set the scopes to be requested. Must be called before createAuthUrl(). + * Will remove any previously configured scopes. + * @param string|array $scope_or_scopes, ie: + * array( + * 'https://www.googleapis.com/auth/plus.login', + * 'https://www.googleapis.com/auth/moderator' + * ); + */ + public function setScopes($scope_or_scopes) + { + $this->requestedScopes = []; + $this->addScope($scope_or_scopes); + } + /** + * This functions adds a scope to be requested as part of the OAuth2.0 flow. + * Will append any scopes not previously requested to the scope parameter. + * A single string will be treated as a scope to request. An array of strings + * will each be appended. + * @param string|string[] $scope_or_scopes e.g. "profile" + */ + public function addScope($scope_or_scopes) + { + if (is_string($scope_or_scopes) && !in_array($scope_or_scopes, $this->requestedScopes)) { + $this->requestedScopes[] = $scope_or_scopes; + } elseif (is_array($scope_or_scopes)) { + foreach ($scope_or_scopes as $scope) { + $this->addScope($scope); + } + } + } + /** + * Returns the list of scopes requested by the client + * @return array the list of scopes + * + */ + public function getScopes() + { + return $this->requestedScopes; + } + /** + * @return string|null + * @visible For Testing + */ + public function prepareScopes() + { + if (empty($this->requestedScopes)) { + return null; + } + return implode(' ', $this->requestedScopes); + } + /** + * Helper method to execute deferred HTTP requests. + * + * @template T + * @param RequestInterface $request + * @param class-string|false|null $expectedClass + * @throws \Google\Exception + * @return mixed|T|ResponseInterface + */ + public function execute(RequestInterface $request, $expectedClass = null) + { + $request = $request->withHeader('User-Agent', sprintf('%s %s%s', $this->config['application_name'], self::USER_AGENT_SUFFIX, $this->getLibraryVersion()))->withHeader('x-goog-api-client', sprintf('gl-php/%s gdcl/%s', phpversion(), $this->getLibraryVersion())); + if ($this->config['api_format_v2']) { + $request = $request->withHeader('X-GOOG-API-FORMAT-VERSION', '2'); + } + // call the authorize method + // this is where most of the grunt work is done + $http = $this->authorize(); + return REST::execute($http, $request, $expectedClass, $this->config['retry'], $this->config['retry_map']); + } + /** + * Declare whether batch calls should be used. This may increase throughput + * by making multiple requests in one connection. + * + * @param boolean $useBatch True if the batch support should + * be enabled. Defaults to False. + */ + public function setUseBatch($useBatch) + { + // This is actually an alias for setDefer. + $this->setDefer($useBatch); + } + /** + * Are we running in Google AppEngine? + * return bool + */ + public function isAppEngine() + { + return isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine') !== \false; + } + public function setConfig($name, $value) + { + $this->config[$name] = $value; + } + public function getConfig($name, $default = null) + { + return isset($this->config[$name]) ? $this->config[$name] : $default; + } + /** + * For backwards compatibility + * alias for setAuthConfig + * + * @param string $file the configuration file + * @throws \Google\Exception + * @deprecated + */ + public function setAuthConfigFile($file) + { + $this->setAuthConfig($file); + } + /** + * Set the auth config from new or deprecated JSON config. + * This structure should match the file downloaded from + * the "Download JSON" button on in the Google Developer + * Console. + * @param string|array $config the configuration json + * @throws \Google\Exception + */ + public function setAuthConfig($config) + { + if (is_string($config)) { + if (!file_exists($config)) { + throw new InvalidArgumentException(sprintf('file "%s" does not exist', $config)); + } + $json = file_get_contents($config); + if (!($config = json_decode($json, \true))) { + throw new LogicException('invalid json for auth config'); + } + } + $key = isset($config['installed']) ? 'installed' : 'web'; + if (isset($config['type']) && $config['type'] == 'service_account') { + // application default credentials + $this->useApplicationDefaultCredentials(); + // set the information from the config + $this->setClientId($config['client_id']); + $this->config['client_email'] = $config['client_email']; + $this->config['signing_key'] = $config['private_key']; + $this->config['signing_algorithm'] = 'HS256'; + } elseif (isset($config[$key])) { + // old-style + $this->setClientId($config[$key]['client_id']); + $this->setClientSecret($config[$key]['client_secret']); + if (isset($config[$key]['redirect_uris'])) { + $this->setRedirectUri($config[$key]['redirect_uris'][0]); + } + } else { + // new-style + $this->setClientId($config['client_id']); + $this->setClientSecret($config['client_secret']); + if (isset($config['redirect_uris'])) { + $this->setRedirectUri($config['redirect_uris'][0]); + } + } + } + /** + * Use when the service account has been delegated domain wide access. + * + * @param string $subject an email address account to impersonate + */ + public function setSubject($subject) + { + $this->config['subject'] = $subject; + } + /** + * Declare whether making API calls should make the call immediately, or + * return a request which can be called with ->execute(); + * + * @param boolean $defer True if calls should not be executed right away. + */ + public function setDefer($defer) + { + $this->deferExecution = $defer; + } + /** + * Whether or not to return raw requests + * @return boolean + */ + public function shouldDefer() + { + return $this->deferExecution; + } + /** + * @return OAuth2 implementation + */ + public function getOAuth2Service() + { + if (!isset($this->auth)) { + $this->auth = $this->createOAuth2Service(); + } + return $this->auth; + } + /** + * create a default google auth object + */ + protected function createOAuth2Service() + { + $auth = new OAuth2(['clientId' => $this->getClientId(), 'clientSecret' => $this->getClientSecret(), 'authorizationUri' => self::OAUTH2_AUTH_URL, 'tokenCredentialUri' => self::OAUTH2_TOKEN_URI, 'redirectUri' => $this->getRedirectUri(), 'issuer' => $this->config['client_id'], 'signingKey' => $this->config['signing_key'], 'signingAlgorithm' => $this->config['signing_algorithm']]); + return $auth; + } + /** + * Set the Cache object + * @param CacheItemPoolInterface $cache + */ + public function setCache(CacheItemPoolInterface $cache) + { + $this->cache = $cache; + } + /** + * @return CacheItemPoolInterface + */ + public function getCache() + { + if (!$this->cache) { + $this->cache = $this->createDefaultCache(); + } + return $this->cache; + } + /** + * @param array $cacheConfig + */ + public function setCacheConfig(array $cacheConfig) + { + $this->config['cache_config'] = $cacheConfig; + } + /** + * Set the Logger object + * @param LoggerInterface $logger + */ + public function setLogger(LoggerInterface $logger) + { + $this->logger = $logger; + } + /** + * @return LoggerInterface + */ + public function getLogger() + { + if (!isset($this->logger)) { + $this->logger = $this->createDefaultLogger(); + } + return $this->logger; + } + protected function createDefaultLogger() + { + $logger = new Logger('google-api-php-client'); + if ($this->isAppEngine()) { + $handler = new MonologSyslogHandler('app', \LOG_USER, Logger::NOTICE); + } else { + $handler = new MonologStreamHandler('php://stderr', Logger::NOTICE); + } + $logger->pushHandler($handler); + return $logger; + } + protected function createDefaultCache() + { + return new MemoryCacheItemPool(); + } + /** + * Set the Http Client object + * @param ClientInterface $http + */ + public function setHttpClient(ClientInterface $http) + { + $this->http = $http; + } + /** + * @return ClientInterface + */ + public function getHttpClient() + { + if (null === $this->http) { + $this->http = $this->createDefaultHttpClient(); + } + return $this->http; + } + /** + * Set the API format version. + * + * `true` will use V2, which may return more useful error messages. + * + * @param bool $value + */ + public function setApiFormatV2($value) + { + $this->config['api_format_v2'] = (bool) $value; + } + protected function createDefaultHttpClient() + { + $guzzleVersion = null; + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientInterface::MAJOR_VERSION')) { + $guzzleVersion = ClientInterface::MAJOR_VERSION; + } elseif (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientInterface::VERSION')) { + $guzzleVersion = (int) substr(ClientInterface::VERSION, 0, 1); + } + if (5 === $guzzleVersion) { + $options = ['base_url' => $this->config['base_path'], 'defaults' => ['exceptions' => \false]]; + if ($this->isAppEngine()) { + if (class_exists(StreamHandler::class)) { + // set StreamHandler on AppEngine by default + $options['handler'] = new StreamHandler(); + $options['defaults']['verify'] = '/etc/ca-certificates.crt'; + } + } + } elseif (6 === $guzzleVersion || 7 === $guzzleVersion) { + // guzzle 6 or 7 + $options = ['base_uri' => $this->config['base_path'], 'http_errors' => \false]; + } else { + throw new LogicException('Could not find supported version of Guzzle.'); + } + return new GuzzleClient($options); + } + /** + * @return FetchAuthTokenCache + */ + private function createApplicationDefaultCredentials() + { + $scopes = $this->prepareScopes(); + $sub = $this->config['subject']; + $signingKey = $this->config['signing_key']; + // create credentials using values supplied in setAuthConfig + if ($signingKey) { + $serviceAccountCredentials = ['client_id' => $this->config['client_id'], 'client_email' => $this->config['client_email'], 'private_key' => $signingKey, 'type' => 'service_account', 'quota_project_id' => $this->config['quota_project']]; + $credentials = CredentialsLoader::makeCredentials($scopes, $serviceAccountCredentials); + } else { + // When $sub is provided, we cannot pass cache classes to ::getCredentials + // because FetchAuthTokenCache::setSub does not exist. + // The result is when $sub is provided, calls to ::onGce are not cached. + $credentials = ApplicationDefaultCredentials::getCredentials($scopes, null, $sub ? null : $this->config['cache_config'], $sub ? null : $this->getCache(), $this->config['quota_project']); + } + // for service account domain-wide authority (impersonating a user) + // @see https://developers.google.com/identity/protocols/OAuth2ServiceAccount + if ($sub) { + if (!$credentials instanceof ServiceAccountCredentials) { + throw new DomainException('domain-wide authority requires service account credentials'); + } + $credentials->setSub($sub); + } + // If we are not using FetchAuthTokenCache yet, create it now + if (!$credentials instanceof FetchAuthTokenCache) { + $credentials = new FetchAuthTokenCache($credentials, $this->config['cache_config'], $this->getCache()); + } + return $credentials; + } + protected function getAuthHandler() + { + // Be very careful using the cache, as the underlying auth library's cache + // implementation is naive, and the cache keys do not account for user + // sessions. + // + // @see https://github.com/google/google-api-php-client/issues/821 + return AuthHandlerFactory::build($this->getCache(), $this->config['cache_config']); + } + private function createUserRefreshCredentials($scope, $refreshToken) + { + $creds = array_filter(['client_id' => $this->getClientId(), 'client_secret' => $this->getClientSecret(), 'refresh_token' => $refreshToken]); + return new UserRefreshCredentials($scope, $creds); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Collection.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Collection.php new file mode 100644 index 0000000..83fd2c7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Collection.php @@ -0,0 +1,104 @@ +{$this->collection_key}) && is_array($this->{$this->collection_key})) { + reset($this->{$this->collection_key}); + } + } + /** @return mixed */ + #[\ReturnTypeWillChange] + public function current() + { + $this->coerceType($this->key()); + if (is_array($this->{$this->collection_key})) { + return current($this->{$this->collection_key}); + } + } + /** @return mixed */ + #[\ReturnTypeWillChange] + public function key() + { + if (isset($this->{$this->collection_key}) && is_array($this->{$this->collection_key})) { + return key($this->{$this->collection_key}); + } + } + /** @return mixed */ + #[\ReturnTypeWillChange] + public function next() + { + return next($this->{$this->collection_key}); + } + /** @return bool */ + #[\ReturnTypeWillChange] + public function valid() + { + $key = $this->key(); + return $key !== null && $key !== \false; + } + /** @return int */ + #[\ReturnTypeWillChange] + public function count() + { + if (!isset($this->{$this->collection_key})) { + return 0; + } + return count($this->{$this->collection_key}); + } + /** @return bool */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + if (!is_numeric($offset)) { + return parent::offsetExists($offset); + } + return isset($this->{$this->collection_key}[$offset]); + } + /** @return mixed */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + if (!is_numeric($offset)) { + return parent::offsetGet($offset); + } + $this->coerceType($offset); + return $this->{$this->collection_key}[$offset]; + } + /** @return void */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (!is_numeric($offset)) { + parent::offsetSet($offset, $value); + } + $this->{$this->collection_key}[$offset] = $value; + } + /** @return void */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + if (!is_numeric($offset)) { + parent::offsetUnset($offset); + } + unset($this->{$this->collection_key}[$offset]); + } + private function coerceType($offset) + { + $keyType = $this->keyType($this->collection_key); + if ($keyType && !is_object($this->{$this->collection_key}[$offset])) { + $this->{$this->collection_key}[$offset] = new $keyType($this->{$this->collection_key}[$offset]); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Exception.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Exception.php new file mode 100644 index 0000000..462066e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Exception.php @@ -0,0 +1,23 @@ +client = $client; + $this->boundary = $boundary ?: mt_rand(); + $this->rootUrl = rtrim($rootUrl ?: $this->client->getConfig('base_path'), '/'); + $this->batchPath = $batchPath ?: self::BATCH_PATH; + } + public function add(RequestInterface $request, $key = \false) + { + if (\false == $key) { + $key = mt_rand(); + } + $this->requests[$key] = $request; + } + public function execute() + { + $body = ''; + $classes = []; + $batchHttpTemplate = <<requests as $key => $request) { + $firstLine = sprintf('%s %s HTTP/%s', $request->getMethod(), $request->getRequestTarget(), $request->getProtocolVersion()); + $content = (string) $request->getBody(); + $headers = ''; + foreach ($request->getHeaders() as $name => $values) { + $headers .= sprintf("%s:%s\r\n", $name, implode(', ', $values)); + } + $body .= sprintf($batchHttpTemplate, $this->boundary, $key, $firstLine, $headers, $content ? "\n" . $content : ''); + $classes['response-' . $key] = $request->getHeaderLine('X-Php-Expected-Class'); + } + $body .= "--{$this->boundary}--"; + $body = trim($body); + $url = $this->rootUrl . '/' . $this->batchPath; + $headers = ['Content-Type' => sprintf('multipart/mixed; boundary=%s', $this->boundary), 'Content-Length' => (string) strlen($body)]; + $request = new Request('POST', $url, $headers, $body); + $response = $this->client->execute($request); + return $this->parseResponse($response, $classes); + } + public function parseResponse(ResponseInterface $response, $classes = []) + { + $contentType = $response->getHeaderLine('content-type'); + $contentType = explode(';', $contentType); + $boundary = \false; + foreach ($contentType as $part) { + $part = explode('=', $part, 2); + if (isset($part[0]) && 'boundary' == trim($part[0])) { + $boundary = $part[1]; + } + } + $body = (string) $response->getBody(); + if (!empty($body)) { + $body = str_replace("--{$boundary}--", "--{$boundary}", $body); + $parts = explode("--{$boundary}", $body); + $responses = []; + $requests = array_values($this->requests); + foreach ($parts as $i => $part) { + $part = trim($part); + if (!empty($part)) { + list($rawHeaders, $part) = explode("\r\n\r\n", $part, 2); + $headers = $this->parseRawHeaders($rawHeaders); + $status = substr($part, 0, strpos($part, "\n")); + $status = explode(" ", $status); + $status = $status[1]; + list($partHeaders, $partBody) = $this->parseHttpResponse($part, 0); + $response = new Response((int) $status, $partHeaders, Psr7\Utils::streamFor($partBody)); + // Need content id. + $key = $headers['content-id']; + try { + $response = REST::decodeHttpResponse($response, $requests[$i - 1]); + } catch (GoogleServiceException $e) { + // Store the exception as the response, so successful responses + // can be processed. + $response = $e; + } + $responses[$key] = $response; + } + } + return $responses; + } + return null; + } + private function parseRawHeaders($rawHeaders) + { + $headers = []; + $responseHeaderLines = explode("\r\n", $rawHeaders); + foreach ($responseHeaderLines as $headerLine) { + if ($headerLine && strpos($headerLine, ':') !== \false) { + list($header, $value) = explode(': ', $headerLine, 2); + $header = strtolower($header); + if (isset($headers[$header])) { + $headers[$header] = array_merge((array) $headers[$header], (array) $value); + } else { + $headers[$header] = $value; + } + } + } + return $headers; + } + /** + * Used by the IO lib and also the batch processing. + * + * @param string $respData + * @param int $headerSize + * @return array + */ + private function parseHttpResponse($respData, $headerSize) + { + // check proxy header + foreach (self::$CONNECTION_ESTABLISHED_HEADERS as $established_header) { + if (stripos($respData, $established_header) !== \false) { + // existed, remove it + $respData = str_ireplace($established_header, '', $respData); + // Subtract the proxy header size unless the cURL bug prior to 7.30.0 + // is present which prevented the proxy header size from being taken into + // account. + // @TODO look into this + // if (!$this->needsQuirk()) { + // $headerSize -= strlen($established_header); + // } + break; + } + } + if ($headerSize) { + $responseBody = substr($respData, $headerSize); + $responseHeaders = substr($respData, 0, $headerSize); + } else { + $responseSegments = explode("\r\n\r\n", $respData, 2); + $responseHeaders = $responseSegments[0]; + $responseBody = isset($responseSegments[1]) ? $responseSegments[1] : null; + } + $responseHeaders = $this->parseRawHeaders($responseHeaders); + return [$responseHeaders, $responseBody]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Http/MediaFileUpload.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Http/MediaFileUpload.php new file mode 100644 index 0000000..eaae907 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Http/MediaFileUpload.php @@ -0,0 +1,273 @@ +client = $client; + $this->request = $request; + $this->mimeType = $mimeType; + $this->data = $data; + $this->resumable = $resumable; + $this->chunkSize = $chunkSize; + $this->progress = 0; + $this->process(); + } + /** + * Set the size of the file that is being uploaded. + * @param int $size - int file size in bytes + */ + public function setFileSize($size) + { + $this->size = $size; + } + /** + * Return the progress on the upload + * @return int progress in bytes uploaded. + */ + public function getProgress() + { + return $this->progress; + } + /** + * Send the next part of the file to upload. + * @param string|bool $chunk Optional. The next set of bytes to send. If false will + * use $data passed at construct time. + */ + public function nextChunk($chunk = \false) + { + $resumeUri = $this->getResumeUri(); + if (\false == $chunk) { + $chunk = substr($this->data, $this->progress, $this->chunkSize); + } + $lastBytePos = $this->progress + strlen($chunk) - 1; + $headers = ['content-range' => "bytes {$this->progress}-{$lastBytePos}/{$this->size}", 'content-length' => (string) strlen($chunk), 'expect' => '']; + $request = new Request('PUT', $resumeUri, $headers, Psr7\Utils::streamFor($chunk)); + return $this->makePutRequest($request); + } + /** + * Return the HTTP result code from the last call made. + * @return int code + */ + public function getHttpResultCode() + { + return $this->httpResultCode; + } + /** + * Sends a PUT-Request to google drive and parses the response, + * setting the appropiate variables from the response() + * + * @param RequestInterface $request the Request which will be send + * + * @return false|mixed false when the upload is unfinished or the decoded http response + * + */ + private function makePutRequest(RequestInterface $request) + { + $response = $this->client->execute($request); + $this->httpResultCode = $response->getStatusCode(); + if (308 == $this->httpResultCode) { + // Track the amount uploaded. + $range = $response->getHeaderLine('range'); + if ($range) { + $range_array = explode('-', $range); + $this->progress = (int) $range_array[1] + 1; + } + // Allow for changing upload URLs. + $location = $response->getHeaderLine('location'); + if ($location) { + $this->resumeUri = $location; + } + // No problems, but upload not complete. + return \false; + } + return REST::decodeHttpResponse($response, $this->request); + } + /** + * Resume a previously unfinished upload + * @param string $resumeUri the resume-URI of the unfinished, resumable upload. + */ + public function resume($resumeUri) + { + $this->resumeUri = $resumeUri; + $headers = ['content-range' => "bytes */{$this->size}", 'content-length' => '0']; + $httpRequest = new Request('PUT', $this->resumeUri, $headers); + return $this->makePutRequest($httpRequest); + } + /** + * @return RequestInterface + * @visible for testing + */ + private function process() + { + $this->transformToUploadUrl(); + $request = $this->request; + $postBody = ''; + $contentType = \false; + $meta = json_decode((string) $request->getBody(), \true); + $uploadType = $this->getUploadType($meta); + $request = $request->withUri(Uri::withQueryValue($request->getUri(), 'uploadType', $uploadType)); + $mimeType = $this->mimeType ?: $request->getHeaderLine('content-type'); + if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) { + $contentType = $mimeType; + $postBody = is_string($meta) ? $meta : json_encode($meta); + } elseif (self::UPLOAD_MEDIA_TYPE == $uploadType) { + $contentType = $mimeType; + $postBody = $this->data; + } elseif (self::UPLOAD_MULTIPART_TYPE == $uploadType) { + // This is a multipart/related upload. + $boundary = $this->boundary ?: mt_rand(); + $boundary = str_replace('"', '', $boundary); + $contentType = 'multipart/related; boundary=' . $boundary; + $related = "--{$boundary}\r\n"; + $related .= "Content-Type: application/json; charset=UTF-8\r\n"; + $related .= "\r\n" . json_encode($meta) . "\r\n"; + $related .= "--{$boundary}\r\n"; + $related .= "Content-Type: {$mimeType}\r\n"; + $related .= "Content-Transfer-Encoding: base64\r\n"; + $related .= "\r\n" . base64_encode($this->data) . "\r\n"; + $related .= "--{$boundary}--"; + $postBody = $related; + } + $request = $request->withBody(Psr7\Utils::streamFor($postBody)); + if ($contentType) { + $request = $request->withHeader('content-type', $contentType); + } + return $this->request = $request; + } + /** + * Valid upload types: + * - resumable (UPLOAD_RESUMABLE_TYPE) + * - media (UPLOAD_MEDIA_TYPE) + * - multipart (UPLOAD_MULTIPART_TYPE) + * @param string|false $meta + * @return string + * @visible for testing + */ + public function getUploadType($meta) + { + if ($this->resumable) { + return self::UPLOAD_RESUMABLE_TYPE; + } + if (\false == $meta && $this->data) { + return self::UPLOAD_MEDIA_TYPE; + } + return self::UPLOAD_MULTIPART_TYPE; + } + public function getResumeUri() + { + if (null === $this->resumeUri) { + $this->resumeUri = $this->fetchResumeUri(); + } + return $this->resumeUri; + } + private function fetchResumeUri() + { + $body = $this->request->getBody(); + $headers = ['content-type' => 'application/json; charset=UTF-8', 'content-length' => $body->getSize(), 'x-upload-content-type' => $this->mimeType, 'x-upload-content-length' => $this->size, 'expect' => '']; + foreach ($headers as $key => $value) { + $this->request = $this->request->withHeader($key, $value); + } + $response = $this->client->execute($this->request, \false); + $location = $response->getHeaderLine('location'); + $code = $response->getStatusCode(); + if (200 == $code && \true == $location) { + return $location; + } + $message = $code; + $body = json_decode((string) $this->request->getBody(), \true); + if (isset($body['error']['errors'])) { + $message .= ': '; + foreach ($body['error']['errors'] as $error) { + $message .= "{$error['domain']}, {$error['message']};"; + } + $message = rtrim($message, ';'); + } + $error = "Failed to start the resumable upload (HTTP {$message})"; + $this->client->getLogger()->error($error); + throw new GoogleException($error); + } + private function transformToUploadUrl() + { + $parts = parse_url((string) $this->request->getUri()); + if (!isset($parts['path'])) { + $parts['path'] = ''; + } + $parts['path'] = '/upload' . $parts['path']; + $uri = Uri::fromParts($parts); + $this->request = $this->request->withUri($uri); + } + public function setChunkSize($chunkSize) + { + $this->chunkSize = $chunkSize; + } + public function getRequest() + { + return $this->request; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Http/REST.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Http/REST.php new file mode 100644 index 0000000..0160b0f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Http/REST.php @@ -0,0 +1,153 @@ +|false|null $expectedClass + * @param array $config + * @param array $retryMap + * @return mixed|T|null + * @throws \Google\Service\Exception on server side error (ie: not authenticated, + * invalid or malformed post body, invalid url) + */ + public static function execute(ClientInterface $client, RequestInterface $request, $expectedClass = null, $config = [], $retryMap = null) + { + $runner = new Runner($config, sprintf('%s %s', $request->getMethod(), (string) $request->getUri()), [self::class, 'doExecute'], [$client, $request, $expectedClass]); + if (null !== $retryMap) { + $runner->setRetryMap($retryMap); + } + return $runner->run(); + } + /** + * Executes a Psr\Http\Message\RequestInterface + * + * @template T + * @param ClientInterface $client + * @param RequestInterface $request + * @param class-string|false|null $expectedClass + * @return mixed|T|null + * @throws \Google\Service\Exception on server side error (ie: not authenticated, + * invalid or malformed post body, invalid url) + */ + public static function doExecute(ClientInterface $client, RequestInterface $request, $expectedClass = null) + { + try { + $httpHandler = HttpHandlerFactory::build($client); + $response = $httpHandler($request); + } catch (RequestException $e) { + // if Guzzle throws an exception, catch it and handle the response + if (!$e->hasResponse()) { + throw $e; + } + $response = $e->getResponse(); + // specific checking for Guzzle 5: convert to PSR7 response + if (interface_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Message\\ResponseInterface') && $response instanceof \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Message\ResponseInterface) { + $response = new Response($response->getStatusCode(), $response->getHeaders() ?: [], $response->getBody(), $response->getProtocolVersion(), $response->getReasonPhrase()); + } + } + return self::decodeHttpResponse($response, $request, $expectedClass); + } + /** + * Decode an HTTP Response. + * @static + * + * @template T + * @param RequestInterface $response The http response to be decoded. + * @param ResponseInterface $response + * @param class-string|false|null $expectedClass + * @return mixed|T|null + * @throws \Google\Service\Exception + */ + public static function decodeHttpResponse(ResponseInterface $response, RequestInterface $request = null, $expectedClass = null) + { + $code = $response->getStatusCode(); + // retry strategy + if (intVal($code) >= 400) { + // if we errored out, it should be safe to grab the response body + $body = (string) $response->getBody(); + // Check if we received errors, and add those to the Exception for convenience + throw new GoogleServiceException($body, $code, null, self::getResponseErrors($body)); + } + // Ensure we only pull the entire body into memory if the request is not + // of media type + $body = self::decodeBody($response, $request); + if ($expectedClass = self::determineExpectedClass($expectedClass, $request)) { + $json = json_decode($body, \true); + return new $expectedClass($json); + } + return $response; + } + private static function decodeBody(ResponseInterface $response, RequestInterface $request = null) + { + if (self::isAltMedia($request)) { + // don't decode the body, it's probably a really long string + return ''; + } + return (string) $response->getBody(); + } + private static function determineExpectedClass($expectedClass, RequestInterface $request = null) + { + // "false" is used to explicitly prevent an expected class from being returned + if (\false === $expectedClass) { + return null; + } + // if we don't have a request, we just use what's passed in + if (null === $request) { + return $expectedClass; + } + // return what we have in the request header if one was not supplied + return $expectedClass ?: $request->getHeaderLine('X-Php-Expected-Class'); + } + private static function getResponseErrors($body) + { + $json = json_decode($body, \true); + if (isset($json['error']['errors'])) { + return $json['error']['errors']; + } + return null; + } + private static function isAltMedia(RequestInterface $request = null) + { + if ($request && ($qs = $request->getUri()->getQuery())) { + parse_str($qs, $query); + if (isset($query['alt']) && $query['alt'] == 'media') { + return \true; + } + } + return \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Model.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Model.php new file mode 100644 index 0000000..3c8ac56 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Model.php @@ -0,0 +1,301 @@ +mapTypes($array); + } + $this->gapiInit(); + } + /** + * Getter that handles passthrough access to the data array, and lazy object creation. + * @param string $key Property name. + * @return mixed The value if any, or null. + */ + public function __get($key) + { + $keyType = $this->keyType($key); + $keyDataType = $this->dataType($key); + if ($keyType && !isset($this->processed[$key])) { + if (isset($this->modelData[$key])) { + $val = $this->modelData[$key]; + } elseif ($keyDataType == 'array' || $keyDataType == 'map') { + $val = []; + } else { + $val = null; + } + if ($this->isAssociativeArray($val)) { + if ($keyDataType && 'map' == $keyDataType) { + foreach ($val as $arrayKey => $arrayItem) { + $this->modelData[$key][$arrayKey] = new $keyType($arrayItem); + } + } else { + $this->modelData[$key] = new $keyType($val); + } + } elseif (is_array($val)) { + $arrayObject = []; + foreach ($val as $arrayIndex => $arrayItem) { + $arrayObject[$arrayIndex] = new $keyType($arrayItem); + } + $this->modelData[$key] = $arrayObject; + } + $this->processed[$key] = \true; + } + return isset($this->modelData[$key]) ? $this->modelData[$key] : null; + } + /** + * Initialize this object's properties from an array. + * + * @param array $array Used to seed this object's properties. + * @return void + */ + protected function mapTypes($array) + { + // Hard initialise simple types, lazy load more complex ones. + foreach ($array as $key => $val) { + if ($keyType = $this->keyType($key)) { + $dataType = $this->dataType($key); + if ($dataType == 'array' || $dataType == 'map') { + $this->{$key} = []; + foreach ($val as $itemKey => $itemVal) { + if ($itemVal instanceof $keyType) { + $this->{$key}[$itemKey] = $itemVal; + } else { + $this->{$key}[$itemKey] = new $keyType($itemVal); + } + } + } elseif ($val instanceof $keyType) { + $this->{$key} = $val; + } else { + $this->{$key} = new $keyType($val); + } + unset($array[$key]); + } elseif (property_exists($this, $key)) { + $this->{$key} = $val; + unset($array[$key]); + } elseif (property_exists($this, $camelKey = $this->camelCase($key))) { + // This checks if property exists as camelCase, leaving it in array as snake_case + // in case of backwards compatibility issues. + $this->{$camelKey} = $val; + } + } + $this->modelData = $array; + } + /** + * Blank initialiser to be used in subclasses to do post-construction initialisation - this + * avoids the need for subclasses to have to implement the variadics handling in their + * constructors. + */ + protected function gapiInit() + { + return; + } + /** + * Create a simplified object suitable for straightforward + * conversion to JSON. This is relatively expensive + * due to the usage of reflection, but shouldn't be called + * a whole lot, and is the most straightforward way to filter. + */ + public function toSimpleObject() + { + $object = new stdClass(); + // Process all other data. + foreach ($this->modelData as $key => $val) { + $result = $this->getSimpleValue($val); + if ($result !== null) { + $object->{$key} = $this->nullPlaceholderCheck($result); + } + } + // Process all public properties. + $reflect = new ReflectionObject($this); + $props = $reflect->getProperties(ReflectionProperty::IS_PUBLIC); + foreach ($props as $member) { + $name = $member->getName(); + $result = $this->getSimpleValue($this->{$name}); + if ($result !== null) { + $name = $this->getMappedName($name); + $object->{$name} = $this->nullPlaceholderCheck($result); + } + } + return $object; + } + /** + * Handle different types of values, primarily + * other objects and map and array data types. + */ + private function getSimpleValue($value) + { + if ($value instanceof Model) { + return $value->toSimpleObject(); + } elseif (is_array($value)) { + $return = []; + foreach ($value as $key => $a_value) { + $a_value = $this->getSimpleValue($a_value); + if ($a_value !== null) { + $key = $this->getMappedName($key); + $return[$key] = $this->nullPlaceholderCheck($a_value); + } + } + return $return; + } + return $value; + } + /** + * Check whether the value is the null placeholder and return true null. + */ + private function nullPlaceholderCheck($value) + { + if ($value === self::NULL_VALUE) { + return null; + } + return $value; + } + /** + * If there is an internal name mapping, use that. + */ + private function getMappedName($key) + { + if (isset($this->internal_gapi_mappings, $this->internal_gapi_mappings[$key])) { + $key = $this->internal_gapi_mappings[$key]; + } + return $key; + } + /** + * Returns true only if the array is associative. + * @param array $array + * @return bool True if the array is associative. + */ + protected function isAssociativeArray($array) + { + if (!is_array($array)) { + return \false; + } + $keys = array_keys($array); + foreach ($keys as $key) { + if (is_string($key)) { + return \true; + } + } + return \false; + } + /** + * Verify if $obj is an array. + * @throws \Google\Exception Thrown if $obj isn't an array. + * @param array $obj Items that should be validated. + * @param string $method Method expecting an array as an argument. + */ + public function assertIsArray($obj, $method) + { + if ($obj && !is_array($obj)) { + throw new GoogleException("Incorrect parameter type passed to {$method}(). Expected an array."); + } + } + /** @return bool */ + #[\ReturnTypeWillChange] + public function offsetExists($offset) + { + return isset($this->{$offset}) || isset($this->modelData[$offset]); + } + /** @return mixed */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return isset($this->{$offset}) ? $this->{$offset} : $this->__get($offset); + } + /** @return void */ + #[\ReturnTypeWillChange] + public function offsetSet($offset, $value) + { + if (property_exists($this, $offset)) { + $this->{$offset} = $value; + } else { + $this->modelData[$offset] = $value; + $this->processed[$offset] = \true; + } + } + /** @return void */ + #[\ReturnTypeWillChange] + public function offsetUnset($offset) + { + unset($this->modelData[$offset]); + } + protected function keyType($key) + { + $keyType = $key . "Type"; + // ensure keyType is a valid class + if (property_exists($this, $keyType) && $this->{$keyType} !== null && class_exists($this->{$keyType})) { + return $this->{$keyType}; + } + } + protected function dataType($key) + { + $dataType = $key . "DataType"; + if (property_exists($this, $dataType)) { + return $this->{$dataType}; + } + } + public function __isset($key) + { + return isset($this->modelData[$key]); + } + public function __unset($key) + { + unset($this->modelData[$key]); + } + /** + * Convert a string to camelCase + * @param string $value + * @return string + */ + private function camelCase($value) + { + $value = ucwords(str_replace(['-', '_'], ' ', $value)); + $value = str_replace(' ', '', $value); + $value[0] = strtolower($value[0]); + return $value; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service.php new file mode 100644 index 0000000..531cbc9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service.php @@ -0,0 +1,63 @@ +client = $clientOrConfig; + } elseif (is_array($clientOrConfig)) { + $this->client = new Client($clientOrConfig ?: []); + } else { + $errorMessage = 'constructor must be array or instance of Google\\Client'; + if (class_exists('TypeError')) { + throw new TypeError($errorMessage); + } + trigger_error($errorMessage, \E_USER_ERROR); + } + } + /** + * Return the associated Google\Client class. + * @return \Google\Client + */ + public function getClient() + { + return $this->client; + } + /** + * Create a new HTTP Batch handler for this service + * + * @return Batch + */ + public function createBatch() + { + return new Batch($this->client, \false, $this->rootUrl, $this->batchPath); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service/Exception.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service/Exception.php new file mode 100644 index 0000000..2b7b708 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service/Exception.php @@ -0,0 +1,65 @@ +>|null $errors List of errors returned in an HTTP + * response or null. Defaults to []. + */ + public function __construct($message, $code = 0, Exception $previous = null, $errors = []) + { + if (version_compare(\PHP_VERSION, '5.3.0') >= 0) { + parent::__construct($message, $code, $previous); + } else { + parent::__construct($message, $code); + } + $this->errors = $errors; + } + /** + * An example of the possible errors returned. + * + * [ + * { + * "domain": "global", + * "reason": "authError", + * "message": "Invalid Credentials", + * "locationType": "header", + * "location": "Authorization", + * } + * ] + * + * @return array>|null List of errors returned in an HTTP response or null. + */ + public function getErrors() + { + return $this->errors; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service/Resource.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service/Resource.php new file mode 100644 index 0000000..a7578a9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Service/Resource.php @@ -0,0 +1,214 @@ + ['type' => 'string', 'location' => 'query'], 'fields' => ['type' => 'string', 'location' => 'query'], 'trace' => ['type' => 'string', 'location' => 'query'], 'userIp' => ['type' => 'string', 'location' => 'query'], 'quotaUser' => ['type' => 'string', 'location' => 'query'], 'data' => ['type' => 'string', 'location' => 'body'], 'mimeType' => ['type' => 'string', 'location' => 'header'], 'uploadType' => ['type' => 'string', 'location' => 'query'], 'mediaUpload' => ['type' => 'complex', 'location' => 'query'], 'prettyPrint' => ['type' => 'string', 'location' => 'query']]; + /** @var string $rootUrl */ + private $rootUrl; + /** @var \Google\Client $client */ + private $client; + /** @var string $serviceName */ + private $serviceName; + /** @var string $servicePath */ + private $servicePath; + /** @var string $resourceName */ + private $resourceName; + /** @var array $methods */ + private $methods; + public function __construct($service, $serviceName, $resourceName, $resource) + { + $this->rootUrl = $service->rootUrl; + $this->client = $service->getClient(); + $this->servicePath = $service->servicePath; + $this->serviceName = $serviceName; + $this->resourceName = $resourceName; + $this->methods = is_array($resource) && isset($resource['methods']) ? $resource['methods'] : [$resourceName => $resource]; + } + /** + * TODO: This function needs simplifying. + * + * @template T + * @param string $name + * @param array $arguments + * @param class-string $expectedClass - optional, the expected class name + * @return mixed|T|ResponseInterface|RequestInterface + * @throws \Google\Exception + */ + public function call($name, $arguments, $expectedClass = null) + { + if (!isset($this->methods[$name])) { + $this->client->getLogger()->error('Service method unknown', ['service' => $this->serviceName, 'resource' => $this->resourceName, 'method' => $name]); + throw new GoogleException("Unknown function: " . "{$this->serviceName}->{$this->resourceName}->{$name}()"); + } + $method = $this->methods[$name]; + $parameters = $arguments[0]; + // postBody is a special case since it's not defined in the discovery + // document as parameter, but we abuse the param entry for storing it. + $postBody = null; + if (isset($parameters['postBody'])) { + if ($parameters['postBody'] instanceof Model) { + // In the cases the post body is an existing object, we want + // to use the smart method to create a simple object for + // for JSONification. + $parameters['postBody'] = $parameters['postBody']->toSimpleObject(); + } elseif (is_object($parameters['postBody'])) { + // If the post body is another kind of object, we will try and + // wrangle it into a sensible format. + $parameters['postBody'] = $this->convertToArrayAndStripNulls($parameters['postBody']); + } + $postBody = (array) $parameters['postBody']; + unset($parameters['postBody']); + } + // TODO: optParams here probably should have been + // handled already - this may well be redundant code. + if (isset($parameters['optParams'])) { + $optParams = $parameters['optParams']; + unset($parameters['optParams']); + $parameters = array_merge($parameters, $optParams); + } + if (!isset($method['parameters'])) { + $method['parameters'] = []; + } + $method['parameters'] = array_merge($this->stackParameters, $method['parameters']); + foreach ($parameters as $key => $val) { + if ($key != 'postBody' && !isset($method['parameters'][$key])) { + $this->client->getLogger()->error('Service parameter unknown', ['service' => $this->serviceName, 'resource' => $this->resourceName, 'method' => $name, 'parameter' => $key]); + throw new GoogleException("({$name}) unknown parameter: '{$key}'"); + } + } + foreach ($method['parameters'] as $paramName => $paramSpec) { + if (isset($paramSpec['required']) && $paramSpec['required'] && !isset($parameters[$paramName])) { + $this->client->getLogger()->error('Service parameter missing', ['service' => $this->serviceName, 'resource' => $this->resourceName, 'method' => $name, 'parameter' => $paramName]); + throw new GoogleException("({$name}) missing required param: '{$paramName}'"); + } + if (isset($parameters[$paramName])) { + $value = $parameters[$paramName]; + $parameters[$paramName] = $paramSpec; + $parameters[$paramName]['value'] = $value; + unset($parameters[$paramName]['required']); + } else { + // Ensure we don't pass nulls. + unset($parameters[$paramName]); + } + } + $this->client->getLogger()->info('Service Call', ['service' => $this->serviceName, 'resource' => $this->resourceName, 'method' => $name, 'arguments' => $parameters]); + // build the service uri + $url = $this->createRequestUri($method['path'], $parameters); + // NOTE: because we're creating the request by hand, + // and because the service has a rootUrl property + // the "base_uri" of the Http Client is not accounted for + $request = new Request($method['httpMethod'], $url, $postBody ? ['content-type' => 'application/json'] : [], $postBody ? json_encode($postBody) : ''); + // support uploads + if (isset($parameters['data'])) { + $mimeType = isset($parameters['mimeType']) ? $parameters['mimeType']['value'] : 'application/octet-stream'; + $data = $parameters['data']['value']; + $upload = new MediaFileUpload($this->client, $request, $mimeType, $data); + // pull down the modified request + $request = $upload->getRequest(); + } + // if this is a media type, we will return the raw response + // rather than using an expected class + if (isset($parameters['alt']) && $parameters['alt']['value'] == 'media') { + $expectedClass = null; + } + // if the client is marked for deferring, rather than + // execute the request, return the response + if ($this->client->shouldDefer()) { + // @TODO find a better way to do this + $request = $request->withHeader('X-Php-Expected-Class', $expectedClass); + return $request; + } + return $this->client->execute($request, $expectedClass); + } + protected function convertToArrayAndStripNulls($o) + { + $o = (array) $o; + foreach ($o as $k => $v) { + if ($v === null) { + unset($o[$k]); + } elseif (is_object($v) || is_array($v)) { + $o[$k] = $this->convertToArrayAndStripNulls($o[$k]); + } + } + return $o; + } + /** + * Parse/expand request parameters and create a fully qualified + * request uri. + * @static + * @param string $restPath + * @param array $params + * @return string $requestUrl + */ + public function createRequestUri($restPath, $params) + { + // Override the default servicePath address if the $restPath use a / + if ('/' == substr($restPath, 0, 1)) { + $requestUrl = substr($restPath, 1); + } else { + $requestUrl = $this->servicePath . $restPath; + } + // code for leading slash + if ($this->rootUrl) { + if ('/' !== substr($this->rootUrl, -1) && '/' !== substr($requestUrl, 0, 1)) { + $requestUrl = '/' . $requestUrl; + } + $requestUrl = $this->rootUrl . $requestUrl; + } + $uriTemplateVars = []; + $queryVars = []; + foreach ($params as $paramName => $paramSpec) { + if ($paramSpec['type'] == 'boolean') { + $paramSpec['value'] = $paramSpec['value'] ? 'true' : 'false'; + } + if ($paramSpec['location'] == 'path') { + $uriTemplateVars[$paramName] = $paramSpec['value']; + } elseif ($paramSpec['location'] == 'query') { + if (is_array($paramSpec['value'])) { + foreach ($paramSpec['value'] as $value) { + $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value)); + } + } else { + $queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value'])); + } + } + } + if (count($uriTemplateVars)) { + $uriTemplateParser = new UriTemplate(); + $requestUrl = $uriTemplateParser->parse($requestUrl, $uriTemplateVars); + } + if (count($queryVars)) { + $requestUrl .= '?' . implode('&', $queryVars); + } + return $requestUrl; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Task/Composer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Task/Composer.php new file mode 100644 index 0000000..5cb3190 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Task/Composer.php @@ -0,0 +1,77 @@ +getComposer(); + $extra = $composer->getPackage()->getExtra(); + $servicesToKeep = isset($extra['google/apiclient-services']) ? $extra['google/apiclient-services'] : []; + if ($servicesToKeep) { + $vendorDir = $composer->getConfig()->get('vendor-dir'); + $serviceDir = sprintf('%s/google/apiclient-services/src/Google/Service', $vendorDir); + if (!is_dir($serviceDir)) { + // path for google/apiclient-services >= 0.200.0 + $serviceDir = sprintf('%s/google/apiclient-services/src', $vendorDir); + } + self::verifyServicesToKeep($serviceDir, $servicesToKeep); + $finder = self::getServicesToRemove($serviceDir, $servicesToKeep); + $filesystem = $filesystem ?: new Filesystem(); + if (0 !== ($count = count($finder))) { + $event->getIO()->write(sprintf('Removing %s google services', $count)); + foreach ($finder as $file) { + $realpath = $file->getRealPath(); + $filesystem->remove($realpath); + $filesystem->remove($realpath . '.php'); + } + } + } + } + /** + * @throws InvalidArgumentException when the service doesn't exist + */ + private static function verifyServicesToKeep($serviceDir, array $servicesToKeep) + { + $finder = (new Finder())->directories()->depth('== 0'); + foreach ($servicesToKeep as $service) { + if (!preg_match('/^[a-zA-Z0-9]*$/', $service)) { + throw new InvalidArgumentException(sprintf('Invalid Google service name "%s"', $service)); + } + try { + $finder->in($serviceDir . '/' . $service); + } catch (InvalidArgumentException $e) { + throw new InvalidArgumentException(sprintf('Google service "%s" does not exist or was removed previously', $service)); + } + } + } + private static function getServicesToRemove($serviceDir, array $servicesToKeep) + { + // find all files in the current directory + return (new Finder())->directories()->depth('== 0')->in($serviceDir)->exclude($servicesToKeep); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Task/Exception.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Task/Exception.php new file mode 100644 index 0000000..5cc4c37 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Task/Exception.php @@ -0,0 +1,23 @@ + self::TASK_RETRY_ALWAYS, + '503' => self::TASK_RETRY_ALWAYS, + 'rateLimitExceeded' => self::TASK_RETRY_ALWAYS, + 'userRateLimitExceeded' => self::TASK_RETRY_ALWAYS, + 6 => self::TASK_RETRY_ALWAYS, + // CURLE_COULDNT_RESOLVE_HOST + 7 => self::TASK_RETRY_ALWAYS, + // CURLE_COULDNT_CONNECT + 28 => self::TASK_RETRY_ALWAYS, + // CURLE_OPERATION_TIMEOUTED + 35 => self::TASK_RETRY_ALWAYS, + // CURLE_SSL_CONNECT_ERROR + 52 => self::TASK_RETRY_ALWAYS, + // CURLE_GOT_NOTHING + 'lighthouseError' => self::TASK_RETRY_NEVER, + ]; + /** + * Creates a new task runner with exponential backoff support. + * + * @param array $config The task runner config + * @param string $name The name of the current task (used for logging) + * @param callable $action The task to run and possibly retry + * @param array $arguments The task arguments + * @throws \Google\Task\Exception when misconfigured + */ + // @phpstan-ignore-next-line + public function __construct($config, $name, $action, array $arguments = []) + { + if (isset($config['initial_delay'])) { + if ($config['initial_delay'] < 0) { + throw new GoogleTaskException('Task configuration `initial_delay` must not be negative.'); + } + $this->delay = $config['initial_delay']; + } + if (isset($config['max_delay'])) { + if ($config['max_delay'] <= 0) { + throw new GoogleTaskException('Task configuration `max_delay` must be greater than 0.'); + } + $this->maxDelay = $config['max_delay']; + } + if (isset($config['factor'])) { + if ($config['factor'] <= 0) { + throw new GoogleTaskException('Task configuration `factor` must be greater than 0.'); + } + $this->factor = $config['factor']; + } + if (isset($config['jitter'])) { + if ($config['jitter'] <= 0) { + throw new GoogleTaskException('Task configuration `jitter` must be greater than 0.'); + } + $this->jitter = $config['jitter']; + } + if (isset($config['retries'])) { + if ($config['retries'] < 0) { + throw new GoogleTaskException('Task configuration `retries` must not be negative.'); + } + $this->maxAttempts += $config['retries']; + } + if (!is_callable($action)) { + throw new GoogleTaskException('Task argument `$action` must be a valid callable.'); + } + $this->action = $action; + $this->arguments = $arguments; + } + /** + * Checks if a retry can be attempted. + * + * @return boolean + */ + public function canAttempt() + { + return $this->attempts < $this->maxAttempts; + } + /** + * Runs the task and (if applicable) automatically retries when errors occur. + * + * @return mixed + * @throws \Google\Service\Exception on failure when no retries are available. + */ + public function run() + { + while ($this->attempt()) { + try { + return call_user_func_array($this->action, $this->arguments); + } catch (GoogleServiceException $exception) { + $allowedRetries = $this->allowedRetries($exception->getCode(), $exception->getErrors()); + if (!$this->canAttempt() || !$allowedRetries) { + throw $exception; + } + if ($allowedRetries > 0) { + $this->maxAttempts = min($this->maxAttempts, $this->attempts + $allowedRetries); + } + } + } + } + /** + * Runs a task once, if possible. This is useful for bypassing the `run()` + * loop. + * + * NOTE: If this is not the first attempt, this function will sleep in + * accordance to the backoff configurations before running the task. + * + * @return boolean + */ + public function attempt() + { + if (!$this->canAttempt()) { + return \false; + } + if ($this->attempts > 0) { + $this->backOff(); + } + $this->attempts++; + return \true; + } + /** + * Sleeps in accordance to the backoff configurations. + */ + private function backOff() + { + $delay = $this->getDelay(); + usleep((int) ($delay * 1000000)); + } + /** + * Gets the delay (in seconds) for the current backoff period. + * + * @return int + */ + private function getDelay() + { + $jitter = $this->getJitter(); + $factor = $this->attempts > 1 ? $this->factor + $jitter : 1 + abs($jitter); + return $this->delay = min($this->maxDelay, $this->delay * $factor); + } + /** + * Gets the current jitter (random number between -$this->jitter and + * $this->jitter). + * + * @return float + */ + private function getJitter() + { + return $this->jitter * 2 * mt_rand() / mt_getrandmax() - $this->jitter; + } + /** + * Gets the number of times the associated task can be retried. + * + * NOTE: -1 is returned if the task can be retried indefinitely + * + * @return integer + */ + public function allowedRetries($code, $errors = []) + { + if (isset($this->retryMap[$code])) { + return $this->retryMap[$code]; + } + if (!empty($errors) && isset($errors[0]['reason'], $this->retryMap[$errors[0]['reason']])) { + return $this->retryMap[$errors[0]['reason']]; + } + return 0; + } + public function setRetryMap($retryMap) + { + $this->retryMap = $retryMap; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Utils/UriTemplate.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Utils/UriTemplate.php new file mode 100644 index 0000000..611b907 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/Utils/UriTemplate.php @@ -0,0 +1,264 @@ + "reserved", "/" => "segments", "." => "dotprefix", "#" => "fragment", ";" => "semicolon", "?" => "form", "&" => "continuation"]; + /** + * @var array + * These are the characters which should not be URL encoded in reserved + * strings. + */ + private $reserved = ["=", ",", "!", "@", "|", ":", "/", "?", "#", "[", "]", '$', "&", "'", "(", ")", "*", "+", ";"]; + private $reservedEncoded = ["%3D", "%2C", "%21", "%40", "%7C", "%3A", "%2F", "%3F", "%23", "%5B", "%5D", "%24", "%26", "%27", "%28", "%29", "%2A", "%2B", "%3B"]; + public function parse($string, array $parameters) + { + return $this->resolveNextSection($string, $parameters); + } + /** + * This function finds the first matching {...} block and + * executes the replacement. It then calls itself to find + * subsequent blocks, if any. + */ + private function resolveNextSection($string, $parameters) + { + $start = strpos($string, "{"); + if ($start === \false) { + return $string; + } + $end = strpos($string, "}"); + if ($end === \false) { + return $string; + } + $string = $this->replace($string, $start, $end, $parameters); + return $this->resolveNextSection($string, $parameters); + } + private function replace($string, $start, $end, $parameters) + { + // We know a data block will have {} round it, so we can strip that. + $data = substr($string, $start + 1, $end - $start - 1); + // If the first character is one of the reserved operators, it effects + // the processing of the stream. + if (isset($this->operators[$data[0]])) { + $op = $this->operators[$data[0]]; + $data = substr($data, 1); + $prefix = ""; + $prefix_on_missing = \false; + switch ($op) { + case "reserved": + // Reserved means certain characters should not be URL encoded + $data = $this->replaceVars($data, $parameters, ",", null, \true); + break; + case "fragment": + // Comma separated with fragment prefix. Bare values only. + $prefix = "#"; + $prefix_on_missing = \true; + $data = $this->replaceVars($data, $parameters, ",", null, \true); + break; + case "segments": + // Slash separated data. Bare values only. + $prefix = "/"; + $data = $this->replaceVars($data, $parameters, "/"); + break; + case "dotprefix": + // Dot separated data. Bare values only. + $prefix = "."; + $prefix_on_missing = \true; + $data = $this->replaceVars($data, $parameters, "."); + break; + case "semicolon": + // Semicolon prefixed and separated. Uses the key name + $prefix = ";"; + $data = $this->replaceVars($data, $parameters, ";", "=", \false, \true, \false); + break; + case "form": + // Standard URL format. Uses the key name + $prefix = "?"; + $data = $this->replaceVars($data, $parameters, "&", "="); + break; + case "continuation": + // Standard URL, but with leading ampersand. Uses key name. + $prefix = "&"; + $data = $this->replaceVars($data, $parameters, "&", "="); + break; + } + // Add the initial prefix character if data is valid. + if ($data || $data !== \false && $prefix_on_missing) { + $data = $prefix . $data; + } + } else { + // If no operator we replace with the defaults. + $data = $this->replaceVars($data, $parameters); + } + // This is chops out the {...} and replaces with the new section. + return substr($string, 0, $start) . $data . substr($string, $end + 1); + } + private function replaceVars($section, $parameters, $sep = ",", $combine = null, $reserved = \false, $tag_empty = \false, $combine_on_empty = \true) + { + if (strpos($section, ",") === \false) { + // If we only have a single value, we can immediately process. + return $this->combine($section, $parameters, $sep, $combine, $reserved, $tag_empty, $combine_on_empty); + } else { + // If we have multiple values, we need to split and loop over them. + // Each is treated individually, then glued together with the + // separator character. + $vars = explode(",", $section); + return $this->combineList( + $vars, + $sep, + $parameters, + $combine, + $reserved, + \false, + // Never emit empty strings in multi-param replacements + $combine_on_empty + ); + } + } + public function combine($key, $parameters, $sep, $combine, $reserved, $tag_empty, $combine_on_empty) + { + $length = \false; + $explode = \false; + $skip_final_combine = \false; + $value = \false; + // Check for length restriction. + if (strpos($key, ":") !== \false) { + list($key, $length) = explode(":", $key); + } + // Check for explode parameter. + if ($key[strlen($key) - 1] == "*") { + $explode = \true; + $key = substr($key, 0, -1); + $skip_final_combine = \true; + } + // Define the list separator. + $list_sep = $explode ? $sep : ","; + if (isset($parameters[$key])) { + $data_type = $this->getDataType($parameters[$key]); + switch ($data_type) { + case self::TYPE_SCALAR: + $value = $this->getValue($parameters[$key], $length); + break; + case self::TYPE_LIST: + $values = []; + foreach ($parameters[$key] as $pkey => $pvalue) { + $pvalue = $this->getValue($pvalue, $length); + if ($combine && $explode) { + $values[$pkey] = $key . $combine . $pvalue; + } else { + $values[$pkey] = $pvalue; + } + } + $value = implode($list_sep, $values); + if ($value == '') { + return ''; + } + break; + case self::TYPE_MAP: + $values = []; + foreach ($parameters[$key] as $pkey => $pvalue) { + $pvalue = $this->getValue($pvalue, $length); + if ($explode) { + $pkey = $this->getValue($pkey, $length); + $values[] = $pkey . "=" . $pvalue; + // Explode triggers = combine. + } else { + $values[] = $pkey; + $values[] = $pvalue; + } + } + $value = implode($list_sep, $values); + if ($value == '') { + return \false; + } + break; + } + } elseif ($tag_empty) { + // If we are just indicating empty values with their key name, return that. + return $key; + } else { + // Otherwise we can skip this variable due to not being defined. + return \false; + } + if ($reserved) { + $value = str_replace($this->reservedEncoded, $this->reserved, $value); + } + // If we do not need to include the key name, we just return the raw + // value. + if (!$combine || $skip_final_combine) { + return $value; + } + // Else we combine the key name: foo=bar, if value is not the empty string. + return $key . ($value != '' || $combine_on_empty ? $combine . $value : ''); + } + /** + * Return the type of a passed in value + */ + private function getDataType($data) + { + if (is_array($data)) { + reset($data); + if (key($data) !== 0) { + return self::TYPE_MAP; + } + return self::TYPE_LIST; + } + return self::TYPE_SCALAR; + } + /** + * Utility function that merges multiple combine calls + * for multi-key templates. + */ + private function combineList($vars, $sep, $parameters, $combine, $reserved, $tag_empty, $combine_on_empty) + { + $ret = []; + foreach ($vars as $var) { + $response = $this->combine($var, $parameters, $sep, $combine, $reserved, $tag_empty, $combine_on_empty); + if ($response === \false) { + continue; + } + $ret[] = $response; + } + return implode($sep, $ret); + } + /** + * Utility function to encode and trim values + */ + private function getValue($value, $length) + { + if ($length) { + $value = substr($value, 0, $length); + } + $value = rawurlencode($value); + return $value; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/aliases.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/aliases.php new file mode 100644 index 0000000..2591fb0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/apiclient/src/aliases.php @@ -0,0 +1,80 @@ + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Client', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AccessToken\\Revoke' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AccessToken_Revoke', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AccessToken\\Verify' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AccessToken_Verify', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Model' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Model', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Utils\\UriTemplate' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Utils_UriTemplate', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\Guzzle6AuthHandler' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_Guzzle6AuthHandler', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\Guzzle7AuthHandler' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_Guzzle7AuthHandler', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\AuthHandlerFactory' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_AuthHandlerFactory', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\Batch' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_Batch', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\MediaFileUpload' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_MediaFileUpload', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\REST' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_REST', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Retryable' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Retryable', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Exception' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Exception', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Runner' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Runner', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Collection' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Collection', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Exception' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Exception', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Resource' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Resource', 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Exception' => 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Exception']; +foreach ($classMap as $class => $alias) { + \class_alias($class, $alias); +} +/** + * This class needs to be defined explicitly as scripts must be recognized by + * the autoloader. + */ +class Google_Task_Composer extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Task\Composer +{ +} +/** @phpstan-ignore-next-line */ +if (\false) { + class Google_AccessToken_Revoke extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\AccessToken\Revoke + { + } + class Google_AccessToken_Verify extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\AccessToken\Verify + { + } + class Google_AuthHandler_AuthHandlerFactory extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\AuthHandler\AuthHandlerFactory + { + } + class Google_AuthHandler_Guzzle6AuthHandler extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\AuthHandler\Guzzle6AuthHandler + { + } + class Google_AuthHandler_Guzzle7AuthHandler extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\AuthHandler\Guzzle7AuthHandler + { + } + class Google_Client extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Client + { + } + class Google_Collection extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Collection + { + } + class Google_Exception extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Exception + { + } + class Google_Http_Batch extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Http\Batch + { + } + class Google_Http_MediaFileUpload extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Http\MediaFileUpload + { + } + class Google_Http_REST extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Http\REST + { + } + class Google_Model extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Model + { + } + class Google_Service extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service + { + } + class Google_Service_Exception extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Exception + { + } + class Google_Service_Resource extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Service\Resource + { + } + class Google_Task_Exception extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Task\Exception + { + } + interface Google_Task_Retryable extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Task\Retryable + { + } + class Google_Task_Runner extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Task\Runner + { + } + class Google_Utils_UriTemplate extends \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Utils\UriTemplate + { + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/COPYING b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/COPYING new file mode 100644 index 0000000..b5d5055 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/COPYING @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2015 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/LICENSE new file mode 100644 index 0000000..a148ba5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/LICENSE @@ -0,0 +1,203 @@ +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, +and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by +the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all +other entities that control, are controlled by, or are under common +control with that entity. For the purposes of this definition, +"control" means (i) the power, direct or indirect, to cause the +direction or management of such entity, whether by contract or +otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity +exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, +including but not limited to software source code, documentation +source, and configuration files. + +"Object" form shall mean any form resulting from mechanical +transformation or translation of a Source form, including but +not limited to compiled object code, generated documentation, +and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or +Object form, made available under the License, as indicated by a +copyright notice that is included in or attached to the work +(an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object +form, that is based on (or derived from) the Work and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. For the purposes +of this License, Derivative Works shall not include works that remain +separable from, or merely link (or bind by name) to the interfaces of, +the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including +the original version of the Work and any modifications or additions +to that Work or Derivative Works thereof, that is intentionally +submitted to Licensor for inclusion in the Work by the copyright owner +or by an individual or Legal Entity authorized to submit on behalf of +the copyright owner. For the purposes of this definition, "submitted" +means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, +and issue tracking systems that are managed by, or on behalf of, the +Licensor for the purpose of discussing and improving the Work, but +excluding communication that is conspicuously marked or otherwise +designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity +on behalf of whom a Contribution has been received by Licensor and +subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +copyright license to reproduce, prepare Derivative Works of, +publicly display, publicly perform, sublicense, and distribute the +Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of +this License, each Contributor hereby grants to You a perpetual, +worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except as stated in this section) patent license to make, have made, +use, offer to sell, sell, import, and otherwise transfer the Work, +where such license applies only to those patent claims licensable +by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) +with the Work to which such Contribution(s) was submitted. If You +institute patent litigation against any entity (including a +cross-claim or counterclaim in a lawsuit) alleging that the Work +or a Contribution incorporated within the Work constitutes direct +or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate +as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the +Work or Derivative Works thereof in any medium, with or without +modifications, and in Source or Object form, provided that You +meet the following conditions: + +(a) You must give any other recipients of the Work or +Derivative Works a copy of this License; and + +(b) You must cause any modified files to carry prominent notices +stating that You changed the files; and + +(c) You must retain, in the Source form of any Derivative Works +that You distribute, all copyright, patent, trademark, and +attribution notices from the Source form of the Work, +excluding those notices that do not pertain to any part of +the Derivative Works; and + +(d) If the Work includes a "NOTICE" text file as part of its +distribution, then any Derivative Works that You distribute must +include a readable copy of the attribution notices contained +within such NOTICE file, excluding those notices that do not +pertain to any part of the Derivative Works, in at least one +of the following places: within a NOTICE text file distributed +as part of the Derivative Works; within the Source form or +documentation, if provided along with the Derivative Works; or, +within a display generated by the Derivative Works, if and +wherever such third-party notices normally appear. The contents +of the NOTICE file are for informational purposes only and +do not modify the License. You may add Your own attribution +notices within Derivative Works that You distribute, alongside +or as an addendum to the NOTICE text from the Work, provided +that such additional attribution notices cannot be construed +as modifying the License. + +You may add Your own copyright statement to Your modifications and +may provide additional or different license terms and conditions +for use, reproduction, or distribution of Your modifications, or +for any such Derivative Works as a whole, provided Your use, +reproduction, and distribution of the Work otherwise complies with +the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, +any Contribution intentionally submitted for inclusion in the Work +by You to the Licensor shall be under the terms and conditions of +this License, without any additional terms or conditions. +Notwithstanding the above, nothing herein shall supersede or modify +the terms of any separate license agreement you may have executed +with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade +names, trademarks, service marks, or product names of the Licensor, +except as required for reasonable and customary use in describing the +origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or +agreed to in writing, Licensor provides the Work (and each +Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +implied, including, without limitation, any warranties or conditions +of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any +risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, +whether in tort (including negligence), contract, or otherwise, +unless required by applicable law (such as deliberate and grossly +negligent acts) or agreed to in writing, shall any Contributor be +liable to You for damages, including any direct, indirect, special, +incidental, or consequential damages of any character arising as a +result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, +work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses), even if such Contributor +has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing +the Work or Derivative Works thereof, You may choose to offer, +and charge a fee for, acceptance of support, warranty, indemnity, +or other liability obligations and/or rights consistent with this +License. However, in accepting such obligations, You may act only +on Your own behalf and on Your sole responsibility, not on behalf +of any other Contributor, and only if You agree to indemnify, +defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason +of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + +To apply the Apache License to your work, attach the following +boilerplate notice, with the fields enclosed by brackets "[]" +replaced with your own identifying information. (Don't include +the brackets!) The text should be enclosed in the appropriate +comment syntax for the file format. We also recommend that a +file or class name and description of purpose be included on the +same "printed page" as the copyright notice for easier +identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/VERSION b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/VERSION new file mode 100644 index 0000000..7aa332e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/VERSION @@ -0,0 +1 @@ +1.33.0 diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/autoload.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/autoload.php new file mode 100644 index 0000000..621f00e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/autoload.php @@ -0,0 +1,35 @@ + 3) { + // Maximum class file path depth in this project is 3. + $classPath = \array_slice($classPath, 0, 3); + } + $filePath = \dirname(__FILE__) . '/src/' . \implode('/', $classPath) . '.php'; + if (\file_exists($filePath)) { + require_once $filePath; + } +} +\spl_autoload_register('oauth2client_php_autoload'); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/AccessToken.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/AccessToken.php new file mode 100644 index 0000000..d7906c3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/AccessToken.php @@ -0,0 +1,430 @@ +httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + $this->cache = $cache ?: new MemoryCacheItemPool(); + } + /** + * Verifies an id token and returns the authenticated apiLoginTicket. + * Throws an exception if the id token is not valid. + * The audience parameter can be used to control which id tokens are + * accepted. By default, the id token must have been issued to this OAuth2 client. + * + * @param string $token The JSON Web Token to be verified. + * @param array $options [optional] { + * Configuration options. + * @type string $audience The indended recipient of the token. + * @type string $issuer The intended issuer of the token. + * @type string $cacheKey The cache key of the cached certs. Defaults to + * the sha1 of $certsLocation if provided, otherwise is set to + * "federated_signon_certs_v3". + * @type string $certsLocation The location (remote or local) from which + * to retrieve certificates, if not cached. This value should only be + * provided in limited circumstances in which you are sure of the + * behavior. + * @type bool $throwException Whether the function should throw an + * exception if the verification fails. This is useful for + * determining the reason verification failed. + * } + * @return array|false the token payload, if successful, or false if not. + * @throws InvalidArgumentException If certs could not be retrieved from a local file. + * @throws InvalidArgumentException If received certs are in an invalid format. + * @throws InvalidArgumentException If the cert alg is not supported. + * @throws RuntimeException If certs could not be retrieved from a remote location. + * @throws UnexpectedValueException If the token issuer does not match. + * @throws UnexpectedValueException If the token audience does not match. + */ + public function verify($token, array $options = []) + { + $audience = $options['audience'] ?? null; + $issuer = $options['issuer'] ?? null; + $certsLocation = $options['certsLocation'] ?? self::FEDERATED_SIGNON_CERT_URL; + $cacheKey = $options['cacheKey'] ?? $this->getCacheKeyFromCertLocation($certsLocation); + $throwException = $options['throwException'] ?? \false; + // for backwards compatibility + // Check signature against each available cert. + $certs = $this->getCerts($certsLocation, $cacheKey, $options); + $alg = $this->determineAlg($certs); + if (!in_array($alg, ['RS256', 'ES256'])) { + throw new InvalidArgumentException('unrecognized "alg" in certs, expected ES256 or RS256'); + } + try { + if ($alg == 'RS256') { + return $this->verifyRs256($token, $certs, $audience, $issuer); + } + return $this->verifyEs256($token, $certs, $audience, $issuer); + } catch (ExpiredException $e) { + // firebase/php-jwt 5+ + } catch (SignatureInvalidException $e) { + // firebase/php-jwt 5+ + } catch (InvalidTokenException $e) { + // simplejwt + } catch (InvalidArgumentException $e) { + } catch (UnexpectedValueException $e) { + } + if ($throwException) { + throw $e; + } + return \false; + } + /** + * Identifies the expected algorithm to verify by looking at the "alg" key + * of the provided certs. + * + * @param array $certs Certificate array according to the JWK spec (see + * https://tools.ietf.org/html/rfc7517). + * @return string The expected algorithm, such as "ES256" or "RS256". + */ + private function determineAlg(array $certs) + { + $alg = null; + foreach ($certs as $cert) { + if (empty($cert['alg'])) { + throw new InvalidArgumentException('certs expects "alg" to be set'); + } + $alg = $alg ?: $cert['alg']; + if ($alg != $cert['alg']) { + throw new InvalidArgumentException('More than one alg detected in certs'); + } + } + return $alg; + } + /** + * Verifies an ES256-signed JWT. + * + * @param string $token The JSON Web Token to be verified. + * @param array $certs Certificate array according to the JWK spec (see + * https://tools.ietf.org/html/rfc7517). + * @param string|null $audience If set, returns false if the provided + * audience does not match the "aud" claim on the JWT. + * @param string|null $issuer If set, returns false if the provided + * issuer does not match the "iss" claim on the JWT. + * @return array the token payload, if successful, or false if not. + */ + private function verifyEs256($token, array $certs, $audience = null, $issuer = null) + { + $this->checkSimpleJwt(); + $jwkset = new KeySet(); + foreach ($certs as $cert) { + $jwkset->add(KeyFactory::create($cert, 'php')); + } + // Validate the signature using the key set and ES256 algorithm. + $jwt = $this->callSimpleJwtDecode([$token, $jwkset, 'ES256']); + $payload = $jwt->getClaims(); + if ($audience) { + if (!isset($payload['aud']) || $payload['aud'] != $audience) { + throw new UnexpectedValueException('Audience does not match'); + } + } + // @see https://cloud.google.com/iap/docs/signed-headers-howto#verifying_the_jwt_payload + $issuer = $issuer ?: self::IAP_ISSUER; + if (!isset($payload['iss']) || $payload['iss'] !== $issuer) { + throw new UnexpectedValueException('Issuer does not match'); + } + return $payload; + } + /** + * Verifies an RS256-signed JWT. + * + * @param string $token The JSON Web Token to be verified. + * @param array $certs Certificate array according to the JWK spec (see + * https://tools.ietf.org/html/rfc7517). + * @param string|null $audience If set, returns false if the provided + * audience does not match the "aud" claim on the JWT. + * @param string|null $issuer If set, returns false if the provided + * issuer does not match the "iss" claim on the JWT. + * @return array the token payload, if successful, or false if not. + */ + private function verifyRs256($token, array $certs, $audience = null, $issuer = null) + { + $this->checkAndInitializePhpsec(); + $keys = []; + foreach ($certs as $cert) { + if (empty($cert['kid'])) { + throw new InvalidArgumentException('certs expects "kid" to be set'); + } + if (empty($cert['n']) || empty($cert['e'])) { + throw new InvalidArgumentException('RSA certs expects "n" and "e" to be set'); + } + $publicKey = $this->loadPhpsecPublicKey($cert['n'], $cert['e']); + // create an array of key IDs to certs for the JWT library + $keys[$cert['kid']] = new Key($publicKey, 'RS256'); + } + $payload = $this->callJwtStatic('decode', [$token, $keys]); + if ($audience) { + if (!property_exists($payload, 'aud') || $payload->aud != $audience) { + throw new UnexpectedValueException('Audience does not match'); + } + } + // support HTTP and HTTPS issuers + // @see https://developers.google.com/identity/sign-in/web/backend-auth + $issuers = $issuer ? [$issuer] : [self::OAUTH2_ISSUER, self::OAUTH2_ISSUER_HTTPS]; + if (!isset($payload->iss) || !in_array($payload->iss, $issuers)) { + throw new UnexpectedValueException('Issuer does not match'); + } + return (array) $payload; + } + /** + * Revoke an OAuth2 access token or refresh token. This method will revoke the current access + * token, if a token isn't provided. + * + * @param string|array $token The token (access token or a refresh token) that should be revoked. + * @param array $options [optional] Configuration options. + * @return bool Returns True if the revocation was successful, otherwise False. + */ + public function revoke($token, array $options = []) + { + if (is_array($token)) { + if (isset($token['refresh_token'])) { + $token = $token['refresh_token']; + } else { + $token = $token['access_token']; + } + } + $body = Utils::streamFor(http_build_query(['token' => $token])); + $request = new Request('POST', self::OAUTH2_REVOKE_URI, ['Cache-Control' => 'no-store', 'Content-Type' => 'application/x-www-form-urlencoded'], $body); + $httpHandler = $this->httpHandler; + $response = $httpHandler($request, $options); + return $response->getStatusCode() == 200; + } + /** + * Gets federated sign-on certificates to use for verifying identity tokens. + * Returns certs as array structure, where keys are key ids, and values + * are PEM encoded certificates. + * + * @param string $location The location from which to retrieve certs. + * @param string $cacheKey The key under which to cache the retrieved certs. + * @param array $options [optional] Configuration options. + * @return array + * @throws InvalidArgumentException If received certs are in an invalid format. + */ + private function getCerts($location, $cacheKey, array $options = []) + { + $cacheItem = $this->cache->getItem($cacheKey); + $certs = $cacheItem ? $cacheItem->get() : null; + $expireTime = null; + if (!$certs) { + list($certs, $expireTime) = $this->retrieveCertsFromLocation($location, $options); + } + if (!isset($certs['keys'])) { + if ($location !== self::IAP_CERT_URL) { + throw new InvalidArgumentException('federated sign-on certs expects "keys" to be set'); + } + throw new InvalidArgumentException('certs expects "keys" to be set'); + } + // Push caching off until after verifying certs are in a valid format. + // Don't want to cache bad data. + if ($expireTime) { + $cacheItem->expiresAt(new DateTime($expireTime)); + $cacheItem->set($certs); + $this->cache->save($cacheItem); + } + return $certs['keys']; + } + /** + * Retrieve and cache a certificates file. + * + * @param string $url location + * @param array $options [optional] Configuration options. + * @return array{array, string} + * @throws InvalidArgumentException If certs could not be retrieved from a local file. + * @throws RuntimeException If certs could not be retrieved from a remote location. + */ + private function retrieveCertsFromLocation($url, array $options = []) + { + // If we're retrieving a local file, just grab it. + $expireTime = '+1 hour'; + if (strpos($url, 'http') !== 0) { + if (!file_exists($url)) { + throw new InvalidArgumentException(sprintf('Failed to retrieve verification certificates from path: %s.', $url)); + } + return [json_decode((string) file_get_contents($url), \true), $expireTime]; + } + $httpHandler = $this->httpHandler; + $response = $httpHandler(new Request('GET', $url), $options); + if ($response->getStatusCode() == 200) { + if ($cacheControl = $response->getHeaderLine('Cache-Control')) { + array_map(function ($value) use(&$expireTime) { + list($key, $value) = explode('=', $value) + [null, null]; + if (trim($key) == 'max-age') { + $expireTime = '+' . $value . ' seconds'; + } + }, explode(',', $cacheControl)); + } + return [json_decode((string) $response->getBody(), \true), $expireTime]; + } + throw new RuntimeException(sprintf('Failed to retrieve verification certificates: "%s".', $response->getBody()->getContents()), $response->getStatusCode()); + } + /** + * @return void + */ + private function checkAndInitializePhpsec() + { + if (!$this->checkAndInitializePhpsec2() && !$this->checkPhpsec3()) { + throw new RuntimeException('Please require phpseclib/phpseclib v2 or v3 to use this utility.'); + } + } + /** + * @return string + * @throws TypeError If the key cannot be initialized to a string. + */ + private function loadPhpsecPublicKey(string $modulus, string $exponent) : string + { + if (class_exists(RSA::class) && class_exists(BigInteger2::class)) { + $key = new RSA(); + $key->loadKey(['n' => new BigInteger2($this->callJwtStatic('urlsafeB64Decode', [$modulus]), 256), 'e' => new BigInteger2($this->callJwtStatic('urlsafeB64Decode', [$exponent]), 256)]); + return $key->getPublicKey(); + } + $key = PublicKeyLoader::load(['n' => new BigInteger3($this->callJwtStatic('urlsafeB64Decode', [$modulus]), 256), 'e' => new BigInteger3($this->callJwtStatic('urlsafeB64Decode', [$exponent]), 256)]); + $formattedPublicKey = $key->toString('PKCS8'); + if (!is_string($formattedPublicKey)) { + throw new TypeError('Failed to initialize the key'); + } + return $formattedPublicKey; + } + /** + * @return bool + */ + private function checkAndInitializePhpsec2() : bool + { + if (!class_exists('phpseclib\\Crypt\\RSA')) { + return \false; + } + /** + * phpseclib calls "phpinfo" by default, which requires special + * whitelisting in the AppEngine VM environment. This function + * sets constants to bypass the need for phpseclib to check phpinfo + * + * @see phpseclib/Math/BigInteger + * @see https://github.com/GoogleCloudPlatform/getting-started-php/issues/85 + * @codeCoverageIgnore + */ + if (filter_var(getenv('GAE_VM'), \FILTER_VALIDATE_BOOLEAN)) { + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\MATH_BIGINTEGER_OPENSSL_ENABLED')) { + define('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\MATH_BIGINTEGER_OPENSSL_ENABLED', \true); + } + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\CRYPT_RSA_MODE')) { + define('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\CRYPT_RSA_MODE', RSA::MODE_OPENSSL); + } + } + return \true; + } + /** + * @return bool + */ + private function checkPhpsec3() : bool + { + return class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA'); + } + /** + * @return void + */ + private function checkSimpleJwt() + { + // @codeCoverageIgnoreStart + if (!class_exists(SimpleJwt::class)) { + throw new RuntimeException('Please require kelvinmo/simplejwt ^0.2 to use this utility.'); + } + // @codeCoverageIgnoreEnd + } + /** + * Provide a hook to mock calls to the JWT static methods. + * + * @param string $method + * @param array $args + * @return mixed + */ + protected function callJwtStatic($method, array $args = []) + { + return call_user_func_array([JWT::class, $method], $args); + // @phpstan-ignore-line + } + /** + * Provide a hook to mock calls to the JWT static methods. + * + * @param array $args + * @return mixed + */ + protected function callSimpleJwtDecode(array $args = []) + { + return call_user_func_array([SimpleJwt::class, 'decode'], $args); + } + /** + * Generate a cache key based on the cert location using sha1 with the + * exception of using "federated_signon_certs_v3" to preserve BC. + * + * @param string $certsLocation + * @return string + */ + private function getCacheKeyFromCertLocation($certsLocation) + { + $key = $certsLocation === self::FEDERATED_SIGNON_CERT_URL ? 'federated_signon_certs_v3' : sha1($certsLocation); + return 'google_auth_certs_cache|' . $key; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ApplicationDefaultCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ApplicationDefaultCredentials.php new file mode 100644 index 0000000..ab9b094 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ApplicationDefaultCredentials.php @@ -0,0 +1,301 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * ``` + */ +class ApplicationDefaultCredentials +{ + /** + * @deprecated + * + * Obtains an AuthTokenSubscriber that uses the default FetchAuthTokenInterface + * implementation to use in this environment. + * + * If supplied, $scope is used to in creating the credentials instance if + * this does not fallback to the compute engine defaults. + * + * @param string|string[] $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return AuthTokenSubscriber + * @throws DomainException if no implementation can be obtained. + */ + public static function getSubscriber( + // @phpstan-ignore-line + $scope = null, + callable $httpHandler = null, + array $cacheConfig = null, + CacheItemPoolInterface $cache = null + ) + { + $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache); + /** @phpstan-ignore-next-line */ + return new AuthTokenSubscriber($creds, $httpHandler); + } + /** + * Obtains an AuthTokenMiddleware that uses the default FetchAuthTokenInterface + * implementation to use in this environment. + * + * If supplied, $scope is used to in creating the credentials instance if + * this does not fallback to the compute engine defaults. + * + * @param string|string[] $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @param string $quotaProject specifies a project to bill for access + * charges associated with the request. + * @return AuthTokenMiddleware + * @throws DomainException if no implementation can be obtained. + */ + public static function getMiddleware($scope = null, callable $httpHandler = null, array $cacheConfig = null, CacheItemPoolInterface $cache = null, $quotaProject = null) + { + $creds = self::getCredentials($scope, $httpHandler, $cacheConfig, $cache, $quotaProject); + return new AuthTokenMiddleware($creds, $httpHandler); + } + /** + * Obtains the default FetchAuthTokenInterface implementation to use + * in this environment. + * + * @param string|string[] $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @param string $quotaProject specifies a project to bill for access + * charges associated with the request. + * @param string|string[] $defaultScope The default scope to use if no + * user-defined scopes exist, expressed either as an Array or as a + * space-delimited string. + * @param string $universeDomain Specifies a universe domain to use for the + * calling client library + * + * @return FetchAuthTokenInterface + * @throws DomainException if no implementation can be obtained. + */ + public static function getCredentials($scope = null, callable $httpHandler = null, array $cacheConfig = null, CacheItemPoolInterface $cache = null, $quotaProject = null, $defaultScope = null, string $universeDomain = null) + { + $creds = null; + $jsonKey = CredentialsLoader::fromEnv() ?: CredentialsLoader::fromWellKnownFile(); + $anyScope = $scope ?: $defaultScope; + if (!$httpHandler) { + if (!($client = HttpClientCache::getHttpClient())) { + $client = new Client(); + HttpClientCache::setHttpClient($client); + } + $httpHandler = HttpHandlerFactory::build($client); + } + if (is_null($quotaProject)) { + // if a quota project isn't specified, try to get one from the env var + $quotaProject = CredentialsLoader::quotaProjectFromEnv(); + } + if (!is_null($jsonKey)) { + if ($quotaProject) { + $jsonKey['quota_project_id'] = $quotaProject; + } + if ($universeDomain) { + $jsonKey['universe_domain'] = $universeDomain; + } + $creds = CredentialsLoader::makeCredentials($scope, $jsonKey, $defaultScope); + } elseif (AppIdentityCredentials::onAppEngine() && !GCECredentials::onAppEngineFlexible()) { + $creds = new AppIdentityCredentials($anyScope); + } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) { + $creds = new GCECredentials(null, $anyScope, null, $quotaProject, null, $universeDomain); + $creds->setIsOnGce(\true); + // save the credentials a trip to the metadata server + } + if (is_null($creds)) { + throw new DomainException(self::notFound()); + } + if (!is_null($cache)) { + $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache); + } + return $creds; + } + /** + * Obtains an AuthTokenMiddleware which will fetch an ID token to use in the + * Authorization header. The middleware is configured with the default + * FetchAuthTokenInterface implementation to use in this environment. + * + * If supplied, $targetAudience is used to set the "aud" on the resulting + * ID token. + * + * @param string $targetAudience The audience for the ID token. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return AuthTokenMiddleware + * @throws DomainException if no implementation can be obtained. + */ + public static function getIdTokenMiddleware($targetAudience, callable $httpHandler = null, array $cacheConfig = null, CacheItemPoolInterface $cache = null) + { + $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); + return new AuthTokenMiddleware($creds, $httpHandler); + } + /** + * Obtains an ProxyAuthTokenMiddleware which will fetch an ID token to use in the + * Authorization header. The middleware is configured with the default + * FetchAuthTokenInterface implementation to use in this environment. + * + * If supplied, $targetAudience is used to set the "aud" on the resulting + * ID token. + * + * @param string $targetAudience The audience for the ID token. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return ProxyAuthTokenMiddleware + * @throws DomainException if no implementation can be obtained. + */ + public static function getProxyIdTokenMiddleware($targetAudience, callable $httpHandler = null, array $cacheConfig = null, CacheItemPoolInterface $cache = null) + { + $creds = self::getIdTokenCredentials($targetAudience, $httpHandler, $cacheConfig, $cache); + return new ProxyAuthTokenMiddleware($creds, $httpHandler); + } + /** + * Obtains the default FetchAuthTokenInterface implementation to use + * in this environment, configured with a $targetAudience for fetching an ID + * token. + * + * @param string $targetAudience The audience for the ID token. + * @param callable $httpHandler callback which delivers psr7 request + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache A cache implementation, may be + * provided if you have one already available for use. + * @return FetchAuthTokenInterface + * @throws DomainException if no implementation can be obtained. + * @throws InvalidArgumentException if JSON "type" key is invalid + */ + public static function getIdTokenCredentials($targetAudience, callable $httpHandler = null, array $cacheConfig = null, CacheItemPoolInterface $cache = null) + { + $creds = null; + $jsonKey = CredentialsLoader::fromEnv() ?: CredentialsLoader::fromWellKnownFile(); + if (!$httpHandler) { + if (!($client = HttpClientCache::getHttpClient())) { + $client = new Client(); + HttpClientCache::setHttpClient($client); + } + $httpHandler = HttpHandlerFactory::build($client); + } + if (!is_null($jsonKey)) { + if (!array_key_exists('type', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the type field'); + } + if ($jsonKey['type'] == 'authorized_user') { + throw new InvalidArgumentException('ID tokens are not supported for end user credentials'); + } + if ($jsonKey['type'] != 'service_account') { + throw new InvalidArgumentException('invalid value in the type field'); + } + $creds = new ServiceAccountCredentials(null, $jsonKey, null, $targetAudience); + } elseif (self::onGce($httpHandler, $cacheConfig, $cache)) { + $creds = new GCECredentials(null, null, $targetAudience); + $creds->setIsOnGce(\true); + // save the credentials a trip to the metadata server + } + if (is_null($creds)) { + throw new DomainException(self::notFound()); + } + if (!is_null($cache)) { + $creds = new FetchAuthTokenCache($creds, $cacheConfig, $cache); + } + return $creds; + } + /** + * @return string + */ + private static function notFound() + { + $msg = 'Your default credentials were not found. To set up '; + $msg .= 'Application Default Credentials, see '; + $msg .= 'https://cloud.google.com/docs/authentication/external/set-up-adc'; + return $msg; + } + /** + * @param callable $httpHandler + * @param array $cacheConfig + * @param CacheItemPoolInterface $cache + * @return bool + */ + private static function onGce(callable $httpHandler = null, array $cacheConfig = null, CacheItemPoolInterface $cache = null) + { + $gceCacheConfig = []; + foreach (['lifetime', 'prefix'] as $key) { + if (isset($cacheConfig['gce_' . $key])) { + $gceCacheConfig[$key] = $cacheConfig['gce_' . $key]; + } + } + return (new GCECache($gceCacheConfig, $cache))->onGce($httpHandler); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/InvalidArgumentException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/InvalidArgumentException.php new file mode 100644 index 0000000..1414ac7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/InvalidArgumentException.php @@ -0,0 +1,23 @@ +key = $key; + } + /** + * {@inheritdoc} + */ + public function getKey() + { + return $this->key; + } + /** + * {@inheritdoc} + */ + public function get() + { + return $this->isHit() ? $this->value : null; + } + /** + * {@inheritdoc} + */ + public function isHit() + { + if (!$this->isHit) { + return \false; + } + if ($this->expiration === null) { + return \true; + } + return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp(); + } + /** + * {@inheritdoc} + */ + public function set($value) + { + $this->isHit = \true; + $this->value = $value; + return $this; + } + /** + * {@inheritdoc} + */ + public function expiresAt($expiration) + { + if ($this->isValidExpiration($expiration)) { + $this->expiration = $expiration; + return $this; + } + $error = sprintf('Argument 1 passed to %s::expiresAt() must implement interface DateTimeInterface, %s given', get_class($this), gettype($expiration)); + throw new TypeError($error); + } + /** + * {@inheritdoc} + */ + public function expiresAfter($time) + { + if (is_int($time)) { + $this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S")); + } elseif ($time instanceof \DateInterval) { + $this->expiration = $this->currentTime()->add($time); + } elseif ($time === null) { + $this->expiration = $time; + } else { + $message = 'Argument 1 passed to %s::expiresAfter() must be an ' . 'instance of DateInterval or of the type integer, %s given'; + $error = sprintf($message, get_class($this), gettype($time)); + throw new TypeError($error); + } + return $this; + } + /** + * Determines if an expiration is valid based on the rules defined by PSR6. + * + * @param mixed $expiration + * @return bool + */ + private function isValidExpiration($expiration) + { + if ($expiration === null) { + return \true; + } + if ($expiration instanceof DateTimeInterface) { + return \true; + } + return \false; + } + /** + * @return DateTime + */ + protected function currentTime() + { + return new DateTime('now', new DateTimeZone('UTC')); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/MemoryCacheItemPool.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/MemoryCacheItemPool.php new file mode 100644 index 0000000..7ce3614 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/MemoryCacheItemPool.php @@ -0,0 +1,161 @@ +getItems([$key])); + // @phpstan-ignore-line + } + /** + * {@inheritdoc} + * + * @return iterable + * A traversable collection of Cache Items keyed by the cache keys of + * each item. A Cache item will be returned for each key, even if that + * key is not found. However, if no keys are specified then an empty + * traversable MUST be returned instead. + */ + public function getItems(array $keys = []) : iterable + { + $items = []; + $itemClass = \PHP_VERSION_ID >= 80000 ? TypedItem::class : Item::class; + foreach ($keys as $key) { + $items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new $itemClass($key); + } + return $items; + } + /** + * {@inheritdoc} + * + * @return bool + * True if item exists in the cache, false otherwise. + */ + public function hasItem($key) : bool + { + $this->isValidKey($key); + return isset($this->items[$key]) && $this->items[$key]->isHit(); + } + /** + * {@inheritdoc} + * + * @return bool + * True if the pool was successfully cleared. False if there was an error. + */ + public function clear() : bool + { + $this->items = []; + $this->deferredItems = []; + return \true; + } + /** + * {@inheritdoc} + * + * @return bool + * True if the item was successfully removed. False if there was an error. + */ + public function deleteItem($key) : bool + { + return $this->deleteItems([$key]); + } + /** + * {@inheritdoc} + * + * @return bool + * True if the items were successfully removed. False if there was an error. + */ + public function deleteItems(array $keys) : bool + { + array_walk($keys, [$this, 'isValidKey']); + foreach ($keys as $key) { + unset($this->items[$key]); + } + return \true; + } + /** + * {@inheritdoc} + * + * @return bool + * True if the item was successfully persisted. False if there was an error. + */ + public function save(CacheItemInterface $item) : bool + { + $this->items[$item->getKey()] = $item; + return \true; + } + /** + * {@inheritdoc} + * + * @return bool + * False if the item could not be queued or if a commit was attempted and failed. True otherwise. + */ + public function saveDeferred(CacheItemInterface $item) : bool + { + $this->deferredItems[$item->getKey()] = $item; + return \true; + } + /** + * {@inheritdoc} + * + * @return bool + * True if all not-yet-saved items were successfully saved or there were none. False otherwise. + */ + public function commit() : bool + { + foreach ($this->deferredItems as $item) { + $this->save($item); + } + $this->deferredItems = []; + return \true; + } + /** + * Determines if the provided key is valid. + * + * @param string $key + * @return bool + * @throws InvalidArgumentException + */ + private function isValidKey($key) + { + $invalidCharacters = '{}()/\\\\@:'; + if (!is_string($key) || preg_match("#[{$invalidCharacters}]#", $key)) { + throw new InvalidArgumentException('The provided key is not valid: ' . var_export($key, \true)); + } + return \true; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/SysVCacheItemPool.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/SysVCacheItemPool.php new file mode 100644 index 0000000..9d81bd8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/SysVCacheItemPool.php @@ -0,0 +1,207 @@ + + */ + private $options; + /** + * @var bool + */ + private $hasLoadedItems = \false; + /** + * Create a SystemV shared memory based CacheItemPool. + * + * @param array $options { + * [optional] Configuration options. + * + * @type int $variableKey The variable key for getting the data from the shared memory. **Defaults to** 1. + * @type string $proj The project identifier for ftok. This needs to be a one character string. + * **Defaults to** 'A'. + * @type int $memsize The memory size in bytes for shm_attach. **Defaults to** 10000. + * @type int $perm The permission for shm_attach. **Defaults to** 0600. + * } + */ + public function __construct($options = []) + { + if (!extension_loaded('sysvshm')) { + throw new \RuntimeException('sysvshm extension is required to use this ItemPool'); + } + $this->options = $options + ['variableKey' => self::VAR_KEY, 'proj' => self::DEFAULT_PROJ, 'memsize' => self::DEFAULT_MEMSIZE, 'perm' => self::DEFAULT_PERM]; + $this->items = []; + $this->deferredItems = []; + $this->sysvKey = ftok(__FILE__, $this->options['proj']); + } + /** + * @param mixed $key + * @return CacheItemInterface + */ + public function getItem($key) : CacheItemInterface + { + $this->loadItems(); + return current($this->getItems([$key])); + // @phpstan-ignore-line + } + /** + * @param array $keys + * @return iterable + */ + public function getItems(array $keys = []) : iterable + { + $this->loadItems(); + $items = []; + $itemClass = \PHP_VERSION_ID >= 80000 ? TypedItem::class : Item::class; + foreach ($keys as $key) { + $items[$key] = $this->hasItem($key) ? clone $this->items[$key] : new $itemClass($key); + } + return $items; + } + /** + * {@inheritdoc} + */ + public function hasItem($key) : bool + { + $this->loadItems(); + return isset($this->items[$key]) && $this->items[$key]->isHit(); + } + /** + * {@inheritdoc} + */ + public function clear() : bool + { + $this->items = []; + $this->deferredItems = []; + return $this->saveCurrentItems(); + } + /** + * {@inheritdoc} + */ + public function deleteItem($key) : bool + { + return $this->deleteItems([$key]); + } + /** + * {@inheritdoc} + */ + public function deleteItems(array $keys) : bool + { + if (!$this->hasLoadedItems) { + $this->loadItems(); + } + foreach ($keys as $key) { + unset($this->items[$key]); + } + return $this->saveCurrentItems(); + } + /** + * {@inheritdoc} + */ + public function save(CacheItemInterface $item) : bool + { + if (!$this->hasLoadedItems) { + $this->loadItems(); + } + $this->items[$item->getKey()] = $item; + return $this->saveCurrentItems(); + } + /** + * {@inheritdoc} + */ + public function saveDeferred(CacheItemInterface $item) : bool + { + $this->deferredItems[$item->getKey()] = $item; + return \true; + } + /** + * {@inheritdoc} + */ + public function commit() : bool + { + foreach ($this->deferredItems as $item) { + if ($this->save($item) === \false) { + return \false; + } + } + $this->deferredItems = []; + return \true; + } + /** + * Save the current items. + * + * @return bool true when success, false upon failure + */ + private function saveCurrentItems() + { + $shmid = shm_attach($this->sysvKey, $this->options['memsize'], $this->options['perm']); + if ($shmid !== \false) { + $ret = shm_put_var($shmid, $this->options['variableKey'], $this->items); + shm_detach($shmid); + return $ret; + } + return \false; + } + /** + * Load the items from the shared memory. + * + * @return bool true when success, false upon failure + */ + private function loadItems() + { + $shmid = shm_attach($this->sysvKey, $this->options['memsize'], $this->options['perm']); + if ($shmid !== \false) { + $data = @shm_get_var($shmid, $this->options['variableKey']); + if (!empty($data)) { + $this->items = $data; + } else { + $this->items = []; + } + shm_detach($shmid); + $this->hasLoadedItems = \true; + return \true; + } + return \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/TypedItem.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/TypedItem.php new file mode 100644 index 0000000..1bab6ab --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Cache/TypedItem.php @@ -0,0 +1,152 @@ +key = $key; + $this->key = $key; + $this->expiration = null; + } + /** + * {@inheritdoc} + */ + public function getKey() : string + { + return $this->key; + } + /** + * {@inheritdoc} + * @return mixed + */ + public function get() + { + return $this->isHit() ? $this->value : null; + } + /** + * {@inheritdoc} + */ + public function isHit() : bool + { + if (!$this->isHit) { + return \false; + } + if ($this->expiration === null) { + return \true; + } + return $this->currentTime()->getTimestamp() < $this->expiration->getTimestamp(); + } + /** + * {@inheritdoc} + * @param mixed $value + * @return static + */ + public function set($value) + { + $this->isHit = \true; + $this->value = $value; + return $this; + } + /** + * {@inheritdoc} + * @return static + */ + public function expiresAt($expiration) + { + if ($this->isValidExpiration($expiration)) { + $this->expiration = $expiration; + return $this; + } + $error = sprintf('Argument 1 passed to %s::expiresAt() must implement interface DateTimeInterface, %s given', get_class($this), gettype($expiration)); + throw new \TypeError($error); + } + /** + * {@inheritdoc} + * @return static + */ + public function expiresAfter($time) + { + if (is_int($time)) { + $this->expiration = $this->currentTime()->add(new \DateInterval("PT{$time}S")); + } elseif ($time instanceof \DateInterval) { + $this->expiration = $this->currentTime()->add($time); + } elseif ($time === null) { + $this->expiration = $time; + } else { + $message = 'Argument 1 passed to %s::expiresAfter() must be an ' . 'instance of DateInterval or of the type integer, %s given'; + $error = sprintf($message, get_class($this), gettype($time)); + throw new \TypeError($error); + } + return $this; + } + /** + * Determines if an expiration is valid based on the rules defined by PSR6. + * + * @param mixed $expiration + * @return bool + */ + private function isValidExpiration($expiration) + { + if ($expiration === null) { + return \true; + } + // We test for two types here due to the fact the DateTimeInterface + // was not introduced until PHP 5.5. Checking for the DateTime type as + // well allows us to support 5.4. + if ($expiration instanceof \DateTimeInterface) { + return \true; + } + return \false; + } + /** + * @return \DateTime + */ + protected function currentTime() + { + return new \DateTime('now', new \DateTimeZone('UTC')); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CacheTrait.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CacheTrait.php new file mode 100644 index 0000000..a8f55f2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CacheTrait.php @@ -0,0 +1,96 @@ + + */ + private $cacheConfig; + /** + * @var ?CacheItemPoolInterface + */ + private $cache; + /** + * Gets the cached value if it is present in the cache when that is + * available. + * + * @param mixed $k + * + * @return mixed + */ + private function getCachedValue($k) + { + if (is_null($this->cache)) { + return null; + } + $key = $this->getFullCacheKey($k); + if (is_null($key)) { + return null; + } + $cacheItem = $this->cache->getItem($key); + if ($cacheItem->isHit()) { + return $cacheItem->get(); + } + } + /** + * Saves the value in the cache when that is available. + * + * @param mixed $k + * @param mixed $v + * @return mixed + */ + private function setCachedValue($k, $v) + { + if (is_null($this->cache)) { + return null; + } + $key = $this->getFullCacheKey($k); + if (is_null($key)) { + return null; + } + $cacheItem = $this->cache->getItem($key); + $cacheItem->set($v); + $cacheItem->expiresAfter($this->cacheConfig['lifetime']); + return $this->cache->save($cacheItem); + } + /** + * @param null|string $key + * @return null|string + */ + private function getFullCacheKey($key) + { + if (is_null($key)) { + return null; + } + $key = $this->cacheConfig['prefix'] . $key; + // ensure we do not have illegal characters + $key = preg_replace('|[^a-zA-Z0-9_\\.!]|', '', $key); + // Hash keys if they exceed $maxKeyLength (defaults to 64) + if ($this->maxKeyLength && strlen($key) > $this->maxKeyLength) { + $key = substr(hash('sha256', $key), 0, $this->maxKeyLength); + } + return $key; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/AwsNativeSource.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/AwsNativeSource.php new file mode 100644 index 0000000..17f3a22 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/AwsNativeSource.php @@ -0,0 +1,287 @@ +audience = $audience; + $this->regionalCredVerificationUrl = $regionalCredVerificationUrl; + $this->regionUrl = $regionUrl; + $this->securityCredentialsUrl = $securityCredentialsUrl; + $this->imdsv2SessionTokenUrl = $imdsv2SessionTokenUrl; + } + public function fetchSubjectToken(callable $httpHandler = null) : string + { + if (is_null($httpHandler)) { + $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + $headers = []; + if ($this->imdsv2SessionTokenUrl) { + $headers = ['X-aws-ec2-metadata-token' => self::getImdsV2SessionToken($this->imdsv2SessionTokenUrl, $httpHandler)]; + } + if (!($signingVars = self::getSigningVarsFromEnv())) { + if (!$this->securityCredentialsUrl) { + throw new \LogicException('Unable to get credentials from ENV, and no security credentials URL provided'); + } + $signingVars = self::getSigningVarsFromUrl($httpHandler, $this->securityCredentialsUrl, self::getRoleName($httpHandler, $this->securityCredentialsUrl, $headers), $headers); + } + if (!($region = self::getRegionFromEnv())) { + if (!$this->regionUrl) { + throw new \LogicException('Unable to get region from ENV, and no region URL provided'); + } + $region = self::getRegionFromUrl($httpHandler, $this->regionUrl, $headers); + } + $url = str_replace('{region}', $region, $this->regionalCredVerificationUrl); + $host = parse_url($url)['host'] ?? ''; + // From here we use the signing vars to create the signed request to receive a token + [$accessKeyId, $secretAccessKey, $securityToken] = $signingVars; + $headers = self::getSignedRequestHeaders($region, $host, $accessKeyId, $secretAccessKey, $securityToken); + // Inject x-goog-cloud-target-resource into header + $headers['x-goog-cloud-target-resource'] = $this->audience; + // Format headers as they're expected in the subject token + $formattedHeaders = array_map(function ($k, $v) { + return ['key' => $k, 'value' => $v]; + }, array_keys($headers), $headers); + $request = ['headers' => $formattedHeaders, 'method' => 'POST', 'url' => $url]; + return urlencode(json_encode($request) ?: ''); + } + /** + * @internal + */ + public static function getImdsV2SessionToken(string $imdsV2Url, callable $httpHandler) : string + { + $headers = ['X-aws-ec2-metadata-token-ttl-seconds' => '21600']; + $request = new Request('PUT', $imdsV2Url, $headers); + $response = $httpHandler($request); + return (string) $response->getBody(); + } + /** + * @see http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html + * + * @internal + * + * @return array + */ + public static function getSignedRequestHeaders(string $region, string $host, string $accessKeyId, string $secretAccessKey, ?string $securityToken) : array + { + $service = 'sts'; + # Create a date for headers and the credential string in ISO-8601 format + $amzdate = date('Ymd\\THis\\Z'); + $datestamp = date('Ymd'); + # Date w/o time, used in credential scope + # Create the canonical headers and signed headers. Header names + # must be trimmed and lowercase, and sorted in code point order from + # low to high. Note that there is a trailing \n. + $canonicalHeaders = sprintf("host:%s\nx-amz-date:%s\n", $host, $amzdate); + if ($securityToken) { + $canonicalHeaders .= sprintf("x-amz-security-token:%s\n", $securityToken); + } + # Step 5: Create the list of signed headers. This lists the headers + # in the canonicalHeaders list, delimited with ";" and in alpha order. + # Note: The request can include any headers; $canonicalHeaders and + # $signedHeaders lists those that you want to be included in the + # hash of the request. "Host" and "x-amz-date" are always required. + $signedHeaders = 'host;x-amz-date'; + if ($securityToken) { + $signedHeaders .= ';x-amz-security-token'; + } + # Step 6: Create payload hash (hash of the request body content). For GET + # requests, the payload is an empty string (""). + $payloadHash = hash('sha256', ''); + # Step 7: Combine elements to create canonical request + $canonicalRequest = implode("\n", [ + 'POST', + // method + '/', + // canonical URL + self::CRED_VERIFICATION_QUERY, + // query string + $canonicalHeaders, + $signedHeaders, + $payloadHash, + ]); + # ************* TASK 2: CREATE THE STRING TO SIGN************* + # Match the algorithm to the hashing algorithm you use, either SHA-1 or + # SHA-256 (recommended) + $algorithm = 'AWS4-HMAC-SHA256'; + $scope = implode('/', [$datestamp, $region, $service, 'aws4_request']); + $stringToSign = implode("\n", [$algorithm, $amzdate, $scope, hash('sha256', $canonicalRequest)]); + # ************* TASK 3: CALCULATE THE SIGNATURE ************* + # Create the signing key using the function defined above. + // (done above) + $signingKey = self::getSignatureKey($secretAccessKey, $datestamp, $region, $service); + # Sign the string_to_sign using the signing_key + $signature = bin2hex(self::hmacSign($signingKey, $stringToSign)); + # ************* TASK 4: ADD SIGNING INFORMATION TO THE REQUEST ************* + # The signing information can be either in a query string value or in + # a header named Authorization. This code shows how to use a header. + # Create authorization header and add to request headers + $authorizationHeader = sprintf('%s Credential=%s/%s, SignedHeaders=%s, Signature=%s', $algorithm, $accessKeyId, $scope, $signedHeaders, $signature); + # The request can include any headers, but MUST include "host", "x-amz-date", + # and (for this scenario) "Authorization". "host" and "x-amz-date" must + # be included in the canonical_headers and signed_headers, as noted + # earlier. Order here is not significant. + $headers = ['host' => $host, 'x-amz-date' => $amzdate, 'Authorization' => $authorizationHeader]; + if ($securityToken) { + $headers['x-amz-security-token'] = $securityToken; + } + return $headers; + } + /** + * @internal + */ + public static function getRegionFromEnv() : ?string + { + $region = getenv('AWS_REGION'); + if (empty($region)) { + $region = getenv('AWS_DEFAULT_REGION'); + } + return $region ?: null; + } + /** + * @internal + * + * @param callable $httpHandler + * @param string $regionUrl + * @param array $headers Request headers to send in with the request. + */ + public static function getRegionFromUrl(callable $httpHandler, string $regionUrl, array $headers) : string + { + // get the region/zone from the region URL + $regionRequest = new Request('GET', $regionUrl, $headers); + $regionResponse = $httpHandler($regionRequest); + // Remove last character. For example, if us-east-2b is returned, + // the region would be us-east-2. + return substr((string) $regionResponse->getBody(), 0, -1); + } + /** + * @internal + * + * @param callable $httpHandler + * @param string $securityCredentialsUrl + * @param array $headers Request headers to send in with the request. + */ + public static function getRoleName(callable $httpHandler, string $securityCredentialsUrl, array $headers) : string + { + // Get the AWS role name + $roleRequest = new Request('GET', $securityCredentialsUrl, $headers); + $roleResponse = $httpHandler($roleRequest); + $roleName = (string) $roleResponse->getBody(); + return $roleName; + } + /** + * @internal + * + * @param callable $httpHandler + * @param string $securityCredentialsUrl + * @param array $headers Request headers to send in with the request. + * @return array{string, string, ?string} + */ + public static function getSigningVarsFromUrl(callable $httpHandler, string $securityCredentialsUrl, string $roleName, array $headers) : array + { + // Get the AWS credentials + $credsRequest = new Request('GET', $securityCredentialsUrl . '/' . $roleName, $headers); + $credsResponse = $httpHandler($credsRequest); + $awsCreds = json_decode((string) $credsResponse->getBody(), \true); + return [ + $awsCreds['AccessKeyId'], + // accessKeyId + $awsCreds['SecretAccessKey'], + // secretAccessKey + $awsCreds['Token'], + ]; + } + /** + * @internal + * + * @return array{string, string, ?string} + */ + public static function getSigningVarsFromEnv() : ?array + { + $accessKeyId = getenv('AWS_ACCESS_KEY_ID'); + $secretAccessKey = getenv('AWS_SECRET_ACCESS_KEY'); + if ($accessKeyId && $secretAccessKey) { + return [$accessKeyId, $secretAccessKey, getenv('AWS_SESSION_TOKEN') ?: null]; + } + return null; + } + /** + * Return HMAC hash in binary string + */ + private static function hmacSign(string $key, string $msg) : string + { + return hash_hmac('sha256', self::utf8Encode($msg), $key, \true); + } + /** + * @TODO add a fallback when mbstring is not available + */ + private static function utf8Encode(string $string) : string + { + return mb_convert_encoding($string, 'UTF-8', 'ISO-8859-1'); + } + private static function getSignatureKey(string $key, string $dateStamp, string $regionName, string $serviceName) : string + { + $kDate = self::hmacSign(self::utf8Encode('AWS4' . $key), $dateStamp); + $kRegion = self::hmacSign($kDate, $regionName); + $kService = self::hmacSign($kRegion, $serviceName); + $kSigning = self::hmacSign($kService, 'aws4_request'); + return $kSigning; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/FileSource.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/FileSource.php new file mode 100644 index 0000000..1020376 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/FileSource.php @@ -0,0 +1,69 @@ +file = $file; + if ($format === 'json' && is_null($subjectTokenFieldName)) { + throw new InvalidArgumentException('subject_token_field_name must be set when format is JSON'); + } + $this->format = $format; + $this->subjectTokenFieldName = $subjectTokenFieldName; + } + public function fetchSubjectToken(callable $httpHandler = null) : string + { + $contents = file_get_contents($this->file); + if ($this->format === 'json') { + if (!($json = json_decode((string) $contents, \true))) { + throw new UnexpectedValueException('Unable to decode JSON file'); + } + if (!isset($json[$this->subjectTokenFieldName])) { + throw new UnexpectedValueException('subject_token_field_name not found in JSON file'); + } + $contents = $json[$this->subjectTokenFieldName]; + } + return $contents; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/UrlSource.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/UrlSource.php new file mode 100644 index 0000000..09d216d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialSource/UrlSource.php @@ -0,0 +1,83 @@ + + */ + private $headers; + /** + * @param string $url The URL to fetch the subject token from. + * @param string $format The format of the token in the response. Can be null or "json". + * @param string $subjectTokenFieldName The name of the field containing the token in the response. This is required + * when format is "json". + * @param array $headers Request headers to send in with the request to the URL. + */ + public function __construct(string $url, string $format = null, string $subjectTokenFieldName = null, array $headers = null) + { + $this->url = $url; + if ($format === 'json' && is_null($subjectTokenFieldName)) { + throw new InvalidArgumentException('subject_token_field_name must be set when format is JSON'); + } + $this->format = $format; + $this->subjectTokenFieldName = $subjectTokenFieldName; + $this->headers = $headers; + } + public function fetchSubjectToken(callable $httpHandler = null) : string + { + if (is_null($httpHandler)) { + $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + $request = new Request('GET', $this->url, $this->headers ?: []); + $response = $httpHandler($request); + $body = (string) $response->getBody(); + if ($this->format === 'json') { + if (!($json = json_decode((string) $body, \true))) { + throw new UnexpectedValueException('Unable to decode JSON response'); + } + if (!isset($json[$this->subjectTokenFieldName])) { + throw new UnexpectedValueException('subject_token_field_name not found in JSON file'); + } + $body = $json[$this->subjectTokenFieldName]; + } + return $body; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/AppIdentityCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/AppIdentityCredentials.php new file mode 100644 index 0000000..977395d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/AppIdentityCredentials.php @@ -0,0 +1,209 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/books/v1', + * 'auth' => 'google_auth' + * ]); + * + * $res = $client->get('volumes?q=Henry+David+Thoreau&country=US'); + * ``` + */ +class AppIdentityCredentials extends CredentialsLoader implements SignBlobInterface, ProjectIdProviderInterface +{ + /** + * Result of fetchAuthToken. + * + * @var array + */ + protected $lastReceivedToken; + /** + * Array of OAuth2 scopes to be requested. + * + * @var string[] + */ + private $scope; + /** + * @var string + */ + private $clientName; + /** + * @param string|string[] $scope One or more scopes. + */ + public function __construct($scope = []) + { + $this->scope = is_array($scope) ? $scope : explode(' ', (string) $scope); + } + /** + * Determines if this an App Engine instance, by accessing the + * SERVER_SOFTWARE environment variable (prod) or the APPENGINE_RUNTIME + * environment variable (dev). + * + * @return bool true if this an App Engine Instance, false otherwise + */ + public static function onAppEngine() + { + $appEngineProduction = isset($_SERVER['SERVER_SOFTWARE']) && 0 === strpos($_SERVER['SERVER_SOFTWARE'], 'Google App Engine'); + if ($appEngineProduction) { + return \true; + } + $appEngineDevAppServer = isset($_SERVER['APPENGINE_RUNTIME']) && $_SERVER['APPENGINE_RUNTIME'] == 'php'; + if ($appEngineDevAppServer) { + return \true; + } + return \false; + } + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * Fetches the auth tokens using the AppIdentityService if available. + * As the AppIdentityService uses protobufs to fetch the access token, + * the GuzzleHttp\ClientInterface instance passed in will not be used. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return array { + * A set of auth related metadata, containing the following + * + * @type string $access_token + * @type string $expiration_time + * } + */ + public function fetchAuthToken(callable $httpHandler = null) + { + try { + $this->checkAppEngineContext(); + } catch (\Exception $e) { + return []; + } + /** @phpstan-ignore-next-line */ + $token = AppIdentityService::getAccessToken($this->scope); + $this->lastReceivedToken = $token; + return $token; + } + /** + * Sign a string using AppIdentityService. + * + * @param string $stringToSign The string to sign. + * @param bool $forceOpenSsl [optional] Does not apply to this credentials + * type. + * @return string The signature, base64-encoded. + * @throws \Exception If AppEngine SDK or mock is not available. + */ + public function signBlob($stringToSign, $forceOpenSsl = \false) + { + $this->checkAppEngineContext(); + /** @phpstan-ignore-next-line */ + return base64_encode(AppIdentityService::signForApp($stringToSign)['signature']); + } + /** + * Get the project ID from AppIdentityService. + * + * Returns null if AppIdentityService is unavailable. + * + * @param callable $httpHandler Not used by this type. + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + try { + $this->checkAppEngineContext(); + } catch (\Exception $e) { + return null; + } + /** @phpstan-ignore-next-line */ + return AppIdentityService::getApplicationId(); + } + /** + * Get the client name from AppIdentityService. + * + * Subsequent calls to this method will return a cached value. + * + * @param callable $httpHandler Not used in this implementation. + * @return string + * @throws \Exception If AppEngine SDK or mock is not available. + */ + public function getClientName(callable $httpHandler = null) + { + $this->checkAppEngineContext(); + if (!$this->clientName) { + /** @phpstan-ignore-next-line */ + $this->clientName = AppIdentityService::getServiceAccountName(); + } + return $this->clientName; + } + /** + * @return array{access_token:string,expires_at:int}|null + */ + public function getLastReceivedToken() + { + if ($this->lastReceivedToken) { + return ['access_token' => $this->lastReceivedToken['access_token'], 'expires_at' => $this->lastReceivedToken['expiration_time']]; + } + return null; + } + /** + * Caching is handled by the underlying AppIdentityService, return empty string + * to prevent caching. + * + * @return string + */ + public function getCacheKey() + { + return ''; + } + /** + * @return void + */ + private function checkAppEngineContext() + { + if (!self::onAppEngine() || !class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\google\\appengine\\api\\app_identity\\AppIdentityService')) { + throw new \Exception('This class must be run in App Engine, or you must include the AppIdentityService ' . 'mock class defined in tests/mocks/AppIdentityService.php'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ExternalAccountCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ExternalAccountCredentials.php new file mode 100644 index 0000000..565a1d7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ExternalAccountCredentials.php @@ -0,0 +1,177 @@ + $jsonKey JSON credentials as an associative array. + */ + public function __construct($scope, array $jsonKey) + { + if (!array_key_exists('type', $jsonKey)) { + throw new InvalidArgumentException('json key is missing the type field'); + } + if ($jsonKey['type'] !== self::EXTERNAL_ACCOUNT_TYPE) { + throw new InvalidArgumentException(sprintf('expected "%s" type but received "%s"', self::EXTERNAL_ACCOUNT_TYPE, $jsonKey['type'])); + } + if (!array_key_exists('token_url', $jsonKey)) { + throw new InvalidArgumentException('json key is missing the token_url field'); + } + if (!array_key_exists('audience', $jsonKey)) { + throw new InvalidArgumentException('json key is missing the audience field'); + } + if (!array_key_exists('subject_token_type', $jsonKey)) { + throw new InvalidArgumentException('json key is missing the subject_token_type field'); + } + if (!array_key_exists('credential_source', $jsonKey)) { + throw new InvalidArgumentException('json key is missing the credential_source field'); + } + if (array_key_exists('service_account_impersonation_url', $jsonKey)) { + $this->serviceAccountImpersonationUrl = $jsonKey['service_account_impersonation_url']; + } + $this->quotaProject = $jsonKey['quota_project_id'] ?? null; + $this->auth = new OAuth2(['tokenCredentialUri' => $jsonKey['token_url'], 'audience' => $jsonKey['audience'], 'scope' => $scope, 'subjectTokenType' => $jsonKey['subject_token_type'], 'subjectTokenFetcher' => self::buildCredentialSource($jsonKey)]); + } + /** + * @param array $jsonKey + */ + private static function buildCredentialSource(array $jsonKey) : ExternalAccountCredentialSourceInterface + { + $credentialSource = $jsonKey['credential_source']; + if (isset($credentialSource['file'])) { + return new FileSource($credentialSource['file'], $credentialSource['format']['type'] ?? null, $credentialSource['format']['subject_token_field_name'] ?? null); + } + if (isset($credentialSource['environment_id']) && 1 === preg_match('/^aws(\\d+)$/', $credentialSource['environment_id'], $matches)) { + if ($matches[1] !== '1') { + throw new InvalidArgumentException("aws version \"{$matches[1]}\" is not supported in the current build."); + } + if (!array_key_exists('regional_cred_verification_url', $credentialSource)) { + throw new InvalidArgumentException('The regional_cred_verification_url field is required for aws1 credential source.'); + } + if (!array_key_exists('audience', $jsonKey)) { + throw new InvalidArgumentException('aws1 credential source requires an audience to be set in the JSON file.'); + } + return new AwsNativeSource( + $jsonKey['audience'], + $credentialSource['regional_cred_verification_url'], + // $regionalCredVerificationUrl + $credentialSource['region_url'] ?? null, + // $regionUrl + $credentialSource['url'] ?? null, + // $securityCredentialsUrl + $credentialSource['imdsv2_session_token_url'] ?? null + ); + } + if (isset($credentialSource['url'])) { + return new UrlSource($credentialSource['url'], $credentialSource['format']['type'] ?? null, $credentialSource['format']['subject_token_field_name'] ?? null, $credentialSource['headers'] ?? null); + } + throw new InvalidArgumentException('Unable to determine credential source from json key.'); + } + /** + * @param string $stsToken + * @param callable $httpHandler + * + * @return array { + * A set of auth related metadata, containing the following + * + * @type string $access_token + * @type int $expires_at + * } + */ + private function getImpersonatedAccessToken(string $stsToken, callable $httpHandler = null) : array + { + if (!isset($this->serviceAccountImpersonationUrl)) { + throw new InvalidArgumentException('service_account_impersonation_url must be set in JSON credentials.'); + } + $request = new Request('POST', $this->serviceAccountImpersonationUrl, ['Content-Type' => 'application/json', 'Authorization' => 'Bearer ' . $stsToken], (string) json_encode(['lifetime' => sprintf('%ss', OAuth2::DEFAULT_EXPIRY_SECONDS), 'scope' => $this->auth->getScope()])); + if (is_null($httpHandler)) { + $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + $response = $httpHandler($request); + $body = json_decode((string) $response->getBody(), \true); + return ['access_token' => $body['accessToken'], 'expires_at' => strtotime($body['expireTime'])]; + } + /** + * @param callable $httpHandler + * + * @return array { + * A set of auth related metadata, containing the following + * + * @type string $access_token + * @type int $expires_at (impersonated service accounts only) + * @type int $expires_in (identity pool only) + * @type string $issued_token_type (identity pool only) + * @type string $token_type (identity pool only) + * } + */ + public function fetchAuthToken(callable $httpHandler = null) + { + $stsToken = $this->auth->fetchAuthToken($httpHandler); + if (isset($this->serviceAccountImpersonationUrl)) { + return $this->getImpersonatedAccessToken($stsToken['access_token'], $httpHandler); + } + return $stsToken; + } + public function getCacheKey() + { + return $this->auth->getCacheKey(); + } + public function getLastReceivedToken() + { + return $this->auth->getLastReceivedToken(); + } + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/GCECredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/GCECredentials.php new file mode 100644 index 0000000..cd344fd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/GCECredentials.php @@ -0,0 +1,493 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + */ +class GCECredentials extends CredentialsLoader implements SignBlobInterface, ProjectIdProviderInterface, GetQuotaProjectInterface +{ + use IamSignerTrait; + // phpcs:disable + const cacheKey = 'GOOGLE_AUTH_PHP_GCE'; + // phpcs:enable + /** + * The metadata IP address on appengine instances. + * + * The IP is used instead of the domain 'metadata' to avoid slow responses + * when not on Compute Engine. + */ + const METADATA_IP = '169.254.169.254'; + /** + * The metadata path of the default token. + */ + const TOKEN_URI_PATH = 'v1/instance/service-accounts/default/token'; + /** + * The metadata path of the default id token. + */ + const ID_TOKEN_URI_PATH = 'v1/instance/service-accounts/default/identity'; + /** + * The metadata path of the client ID. + */ + const CLIENT_ID_URI_PATH = 'v1/instance/service-accounts/default/email'; + /** + * The metadata path of the project ID. + */ + const PROJECT_ID_URI_PATH = 'v1/project/project-id'; + /** + * The metadata path of the project ID. + */ + const UNIVERSE_DOMAIN_URI_PATH = 'v1/universe/universe_domain'; + /** + * The header whose presence indicates GCE presence. + */ + const FLAVOR_HEADER = 'Metadata-Flavor'; + /** + * The Linux file which contains the product name. + */ + private const GKE_PRODUCT_NAME_FILE = '/sys/class/dmi/id/product_name'; + /** + * Note: the explicit `timeout` and `tries` below is a workaround. The underlying + * issue is that resolving an unknown host on some networks will take + * 20-30 seconds; making this timeout short fixes the issue, but + * could lead to false negatives in the event that we are on GCE, but + * the metadata resolution was particularly slow. The latter case is + * "unlikely" since the expected 4-nines time is about 0.5 seconds. + * This allows us to limit the total ping maximum timeout to 1.5 seconds + * for developer desktop scenarios. + */ + const MAX_COMPUTE_PING_TRIES = 3; + const COMPUTE_PING_CONNECTION_TIMEOUT_S = 0.5; + /** + * Flag used to ensure that the onGCE test is only done once;. + * + * @var bool + */ + private $hasCheckedOnGce = \false; + /** + * Flag that stores the value of the onGCE check. + * + * @var bool + */ + private $isOnGce = \false; + /** + * Result of fetchAuthToken. + * + * @var array + */ + protected $lastReceivedToken; + /** + * @var string|null + */ + private $clientName; + /** + * @var string|null + */ + private $projectId; + /** + * @var string + */ + private $tokenUri; + /** + * @var string + */ + private $targetAudience; + /** + * @var string|null + */ + private $quotaProject; + /** + * @var string|null + */ + private $serviceAccountIdentity; + /** + * @var string + */ + private $universeDomain; + /** + * @param Iam $iam [optional] An IAM instance. + * @param string|string[] $scope [optional] the scope of the access request, + * expressed either as an array or as a space-delimited string. + * @param string $targetAudience [optional] The audience for the ID token. + * @param string $quotaProject [optional] Specifies a project to bill for access + * charges associated with the request. + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @param string $universeDomain [optional] Specify a universe domain to use + * instead of fetching one from the metadata server. + */ + public function __construct(Iam $iam = null, $scope = null, $targetAudience = null, $quotaProject = null, $serviceAccountIdentity = null, string $universeDomain = null) + { + $this->iam = $iam; + if ($scope && $targetAudience) { + throw new InvalidArgumentException('Scope and targetAudience cannot both be supplied'); + } + $tokenUri = self::getTokenUri($serviceAccountIdentity); + if ($scope) { + if (is_string($scope)) { + $scope = explode(' ', $scope); + } + $scope = implode(',', $scope); + $tokenUri = $tokenUri . '?scopes=' . $scope; + } elseif ($targetAudience) { + $tokenUri = self::getIdTokenUri($serviceAccountIdentity); + $tokenUri = $tokenUri . '?audience=' . $targetAudience; + $this->targetAudience = $targetAudience; + } + $this->tokenUri = $tokenUri; + $this->quotaProject = $quotaProject; + $this->serviceAccountIdentity = $serviceAccountIdentity; + $this->universeDomain = $universeDomain; + } + /** + * The full uri for accessing the default token. + * + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @return string + */ + public static function getTokenUri($serviceAccountIdentity = null) + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + $base .= self::TOKEN_URI_PATH; + if ($serviceAccountIdentity) { + return str_replace('/default/', '/' . $serviceAccountIdentity . '/', $base); + } + return $base; + } + /** + * The full uri for accessing the default service account. + * + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @return string + */ + public static function getClientNameUri($serviceAccountIdentity = null) + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + $base .= self::CLIENT_ID_URI_PATH; + if ($serviceAccountIdentity) { + return str_replace('/default/', '/' . $serviceAccountIdentity . '/', $base); + } + return $base; + } + /** + * The full uri for accesesing the default identity token. + * + * @param string $serviceAccountIdentity [optional] Specify a service + * account identity name to use instead of "default". + * @return string + */ + private static function getIdTokenUri($serviceAccountIdentity = null) + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + $base .= self::ID_TOKEN_URI_PATH; + if ($serviceAccountIdentity) { + return str_replace('/default/', '/' . $serviceAccountIdentity . '/', $base); + } + return $base; + } + /** + * The full uri for accessing the default project ID. + * + * @return string + */ + private static function getProjectIdUri() + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + return $base . self::PROJECT_ID_URI_PATH; + } + /** + * The full uri for accessing the default universe domain. + * + * @return string + */ + private static function getUniverseDomainUri() + { + $base = 'http://' . self::METADATA_IP . '/computeMetadata/'; + return $base . self::UNIVERSE_DOMAIN_URI_PATH; + } + /** + * Determines if this an App Engine Flexible instance, by accessing the + * GAE_INSTANCE environment variable. + * + * @return bool true if this an App Engine Flexible Instance, false otherwise + */ + public static function onAppEngineFlexible() + { + return substr((string) getenv('GAE_INSTANCE'), 0, 4) === 'aef-'; + } + /** + * Determines if this a GCE instance, by accessing the expected metadata + * host. + * If $httpHandler is not specified a the default HttpHandler is used. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return bool True if this a GCEInstance, false otherwise + */ + public static function onGce(callable $httpHandler = null) + { + $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + $checkUri = 'http://' . self::METADATA_IP; + for ($i = 1; $i <= self::MAX_COMPUTE_PING_TRIES; $i++) { + try { + // Comment from: oauth2client/client.py + // + // Note: the explicit `timeout` below is a workaround. The underlying + // issue is that resolving an unknown host on some networks will take + // 20-30 seconds; making this timeout short fixes the issue, but + // could lead to false negatives in the event that we are on GCE, but + // the metadata resolution was particularly slow. The latter case is + // "unlikely". + $resp = $httpHandler(new Request('GET', $checkUri, [self::FLAVOR_HEADER => 'Google']), ['timeout' => self::COMPUTE_PING_CONNECTION_TIMEOUT_S]); + return $resp->getHeaderLine(self::FLAVOR_HEADER) == 'Google'; + } catch (ClientException $e) { + } catch (ServerException $e) { + } catch (RequestException $e) { + } catch (ConnectException $e) { + } + } + if (\PHP_OS === 'Windows') { + // @TODO: implement GCE residency detection on Windows + return \false; + } + // Detect GCE residency on Linux + return self::detectResidencyLinux(self::GKE_PRODUCT_NAME_FILE); + } + private static function detectResidencyLinux(string $productNameFile) : bool + { + if (file_exists($productNameFile)) { + $productName = trim((string) file_get_contents($productNameFile)); + return 0 === strpos($productName, 'Google'); + } + return \false; + } + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * Fetches the auth tokens from the GCE metadata host if it is available. + * If $httpHandler is not specified a the default HttpHandler is used. + * + * @param callable $httpHandler callback which delivers psr7 request + * + * @return array { + * A set of auth related metadata, based on the token type. + * + * @type string $access_token for access tokens + * @type int $expires_in for access tokens + * @type string $token_type for access tokens + * @type string $id_token for ID tokens + * } + * @throws \Exception + */ + public function fetchAuthToken(callable $httpHandler = null) + { + $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = \true; + } + if (!$this->isOnGce) { + return []; + // return an empty array with no access token + } + $response = $this->getFromMetadata($httpHandler, $this->tokenUri); + if ($this->targetAudience) { + return $this->lastReceivedToken = ['id_token' => $response]; + } + if (null === ($json = json_decode($response, \true))) { + throw new \Exception('Invalid JSON response'); + } + $json['expires_at'] = time() + $json['expires_in']; + // store this so we can retrieve it later + $this->lastReceivedToken = $json; + return $json; + } + /** + * @return string + */ + public function getCacheKey() + { + return self::cacheKey; + } + /** + * @return array|null + */ + public function getLastReceivedToken() + { + if ($this->lastReceivedToken) { + if (array_key_exists('id_token', $this->lastReceivedToken)) { + return $this->lastReceivedToken; + } + return ['access_token' => $this->lastReceivedToken['access_token'], 'expires_at' => $this->lastReceivedToken['expires_at']]; + } + return null; + } + /** + * Get the client name from GCE metadata. + * + * Subsequent calls will return a cached value. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + if ($this->clientName) { + return $this->clientName; + } + $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = \true; + } + if (!$this->isOnGce) { + return ''; + } + $this->clientName = $this->getFromMetadata($httpHandler, self::getClientNameUri($this->serviceAccountIdentity)); + return $this->clientName; + } + /** + * Fetch the default Project ID from compute engine. + * + * Returns null if called outside GCE. + * + * @param callable $httpHandler Callback which delivers psr7 request + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + if ($this->projectId) { + return $this->projectId; + } + $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = \true; + } + if (!$this->isOnGce) { + return null; + } + $this->projectId = $this->getFromMetadata($httpHandler, self::getProjectIdUri()); + return $this->projectId; + } + /** + * Fetch the default universe domain from the metadata server. + * + * @param callable $httpHandler Callback which delivers psr7 request + * @return string + */ + public function getUniverseDomain(callable $httpHandler = null) : string + { + if (null !== $this->universeDomain) { + return $this->universeDomain; + } + $httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + if (!$this->hasCheckedOnGce) { + $this->isOnGce = self::onGce($httpHandler); + $this->hasCheckedOnGce = \true; + } + try { + $this->universeDomain = $this->getFromMetadata($httpHandler, self::getUniverseDomainUri()); + } catch (ClientException $e) { + // If the metadata server exists, but returns a 404 for the universe domain, the auth + // libraries should safely assume this is an older metadata server running in GCU, and + // should return the default universe domain. + if (!$e->hasResponse() || 404 != $e->getResponse()->getStatusCode()) { + throw $e; + } + $this->universeDomain = self::DEFAULT_UNIVERSE_DOMAIN; + } + // We expect in some cases the metadata server will return an empty string for the universe + // domain. In this case, the auth library MUST return the default universe domain. + if ('' === $this->universeDomain) { + $this->universeDomain = self::DEFAULT_UNIVERSE_DOMAIN; + } + return $this->universeDomain; + } + /** + * Fetch the value of a GCE metadata server URI. + * + * @param callable $httpHandler An HTTP Handler to deliver PSR7 requests. + * @param string $uri The metadata URI. + * @return string + */ + private function getFromMetadata(callable $httpHandler, $uri) + { + $resp = $httpHandler(new Request('GET', $uri, [self::FLAVOR_HEADER => 'Google'])); + return (string) $resp->getBody(); + } + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } + /** + * Set whether or not we've already checked the GCE environment. + * + * @param bool $isOnGce + * + * @return void + */ + public function setIsOnGce($isOnGce) + { + // Implicitly set hasCheckedGce to true + $this->hasCheckedOnGce = \true; + // Set isOnGce + $this->isOnGce = $isOnGce; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/IAMCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/IAMCredentials.php new file mode 100644 index 0000000..2becc55 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/IAMCredentials.php @@ -0,0 +1,77 @@ +selector = $selector; + $this->token = $token; + } + /** + * export a callback function which updates runtime metadata. + * + * @return callable updateMetadata function + */ + public function getUpdateMetadataFunc() + { + return [$this, 'updateMetadata']; + } + /** + * Updates metadata with the appropriate header metadata. + * + * @param array $metadata metadata hashmap + * @param string $unusedAuthUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * Note: this param is unused here, only included here for + * consistency with other credentials class + * + * @return array updated metadata hashmap + */ + public function updateMetadata($metadata, $unusedAuthUri = null, callable $httpHandler = null) + { + $metadata_copy = $metadata; + $metadata_copy[self::SELECTOR_KEY] = $this->selector; + $metadata_copy[self::TOKEN_KEY] = $this->token; + return $metadata_copy; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php new file mode 100644 index 0000000..8d38694 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php @@ -0,0 +1,120 @@ + $jsonKey JSON credential file path or JSON credentials + * as an associative array. + */ + public function __construct($scope, $jsonKey) + { + if (is_string($jsonKey)) { + if (!file_exists($jsonKey)) { + throw new \InvalidArgumentException('file does not exist'); + } + $json = file_get_contents($jsonKey); + if (!($jsonKey = json_decode((string) $json, \true))) { + throw new \LogicException('invalid json for auth config'); + } + } + if (!array_key_exists('service_account_impersonation_url', $jsonKey)) { + throw new \LogicException('json key is missing the service_account_impersonation_url field'); + } + if (!array_key_exists('source_credentials', $jsonKey)) { + throw new \LogicException('json key is missing the source_credentials field'); + } + $this->impersonatedServiceAccountName = $this->getImpersonatedServiceAccountNameFromUrl($jsonKey['service_account_impersonation_url']); + $this->sourceCredentials = new UserRefreshCredentials($scope, $jsonKey['source_credentials']); + } + /** + * Helper function for extracting the Server Account Name from the URL saved in the account + * credentials file. + * + * @param $serviceAccountImpersonationUrl string URL from "service_account_impersonation_url" + * @return string Service account email or ID. + */ + private function getImpersonatedServiceAccountNameFromUrl(string $serviceAccountImpersonationUrl) : string + { + $fields = explode('/', $serviceAccountImpersonationUrl); + $lastField = end($fields); + $splitter = explode(':', $lastField); + return $splitter[0]; + } + /** + * Get the client name from the keyfile + * + * In this implementation, it will return the issuers email from the oauth token. + * + * @param callable|null $unusedHttpHandler not used by this credentials type. + * @return string Token issuer email + */ + public function getClientName(callable $unusedHttpHandler = null) + { + return $this->impersonatedServiceAccountName; + } + /** + * @param callable $httpHandler + * + * @return array { + * A set of auth related metadata, containing the following + * + * @type string $access_token + * @type int $expires_in + * @type string $scope + * @type string $token_type + * @type string $id_token + * } + */ + public function fetchAuthToken(callable $httpHandler = null) + { + return $this->sourceCredentials->fetchAuthToken($httpHandler); + } + /** + * @return string + */ + public function getCacheKey() + { + return $this->sourceCredentials->getCacheKey(); + } + /** + * @return array + */ + public function getLastReceivedToken() + { + return $this->sourceCredentials->getLastReceivedToken(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/InsecureCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/InsecureCredentials.php new file mode 100644 index 0000000..0048d71 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/InsecureCredentials.php @@ -0,0 +1,62 @@ + '']; + /** + * Fetches the auth token. In this case it returns an empty string. + * + * @param callable $httpHandler + * @return array{access_token:string} A set of auth related metadata + */ + public function fetchAuthToken(callable $httpHandler = null) + { + return $this->token; + } + /** + * Returns the cache key. In this case it returns a null value, disabling + * caching. + * + * @return string|null + */ + public function getCacheKey() + { + return null; + } + /** + * Fetches the last received token. In this case, it returns the same empty string + * auth token. + * + * @return array{access_token:string} + */ + public function getLastReceivedToken() + { + return $this->token; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ServiceAccountCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ServiceAccountCredentials.php new file mode 100644 index 0000000..07deac5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ServiceAccountCredentials.php @@ -0,0 +1,312 @@ +push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + */ +class ServiceAccountCredentials extends CredentialsLoader implements GetQuotaProjectInterface, SignBlobInterface, ProjectIdProviderInterface +{ + use ServiceAccountSignerTrait; + /** + * The OAuth2 instance used to conduct authorization. + * + * @var OAuth2 + */ + protected $auth; + /** + * The quota project associated with the JSON credentials + * + * @var string + */ + protected $quotaProject; + /** + * @var string|null + */ + protected $projectId; + /** + * @var array|null + */ + private $lastReceivedJwtAccessToken; + /** + * @var bool + */ + private $useJwtAccessWithScope = \false; + /** + * @var ServiceAccountJwtAccessCredentials|null + */ + private $jwtAccessCredentials; + /** + * @var string + */ + private $universeDomain; + /** + * Create a new ServiceAccountCredentials. + * + * @param string|string[]|null $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param string|array $jsonKey JSON credential file path or JSON credentials + * as an associative array + * @param string $sub an email address account to impersonate, in situations when + * the service account has been delegated domain wide access. + * @param string $targetAudience The audience for the ID token. + */ + public function __construct($scope, $jsonKey, $sub = null, $targetAudience = null) + { + if (is_string($jsonKey)) { + if (!file_exists($jsonKey)) { + throw new \InvalidArgumentException('file does not exist'); + } + $jsonKeyStream = file_get_contents($jsonKey); + if (!($jsonKey = json_decode((string) $jsonKeyStream, \true))) { + throw new \LogicException('invalid json for auth config'); + } + } + if (!array_key_exists('client_email', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the client_email field'); + } + if (!array_key_exists('private_key', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the private_key field'); + } + if (array_key_exists('quota_project_id', $jsonKey)) { + $this->quotaProject = (string) $jsonKey['quota_project_id']; + } + if ($scope && $targetAudience) { + throw new InvalidArgumentException('Scope and targetAudience cannot both be supplied'); + } + $additionalClaims = []; + if ($targetAudience) { + $additionalClaims = ['target_audience' => $targetAudience]; + } + $this->auth = new OAuth2(['audience' => self::TOKEN_CREDENTIAL_URI, 'issuer' => $jsonKey['client_email'], 'scope' => $scope, 'signingAlgorithm' => 'RS256', 'signingKey' => $jsonKey['private_key'], 'sub' => $sub, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI, 'additionalClaims' => $additionalClaims]); + $this->projectId = $jsonKey['project_id'] ?? null; + $this->universeDomain = $jsonKey['universe_domain'] ?? self::DEFAULT_UNIVERSE_DOMAIN; + } + /** + * When called, the ServiceAccountCredentials will use an instance of + * ServiceAccountJwtAccessCredentials to fetch (self-sign) an access token + * even when only scopes are supplied. Otherwise, + * ServiceAccountJwtAccessCredentials is only called when no scopes and an + * authUrl (audience) is suppled. + * + * @return void + */ + public function useJwtAccessWithScope() + { + $this->useJwtAccessWithScope = \true; + } + /** + * @param callable $httpHandler + * + * @return array { + * A set of auth related metadata, containing the following + * + * @type string $access_token + * @type int $expires_in + * @type string $token_type + * } + */ + public function fetchAuthToken(callable $httpHandler = null) + { + if ($this->useSelfSignedJwt()) { + $jwtCreds = $this->createJwtAccessCredentials(); + $accessToken = $jwtCreds->fetchAuthToken($httpHandler); + if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) { + // Keep self-signed JWTs in memory as the last received token + $this->lastReceivedJwtAccessToken = $lastReceivedToken; + } + return $accessToken; + } + return $this->auth->fetchAuthToken($httpHandler); + } + /** + * @return string + */ + public function getCacheKey() + { + $key = $this->auth->getIssuer() . ':' . $this->auth->getCacheKey(); + if ($sub = $this->auth->getSub()) { + $key .= ':' . $sub; + } + return $key; + } + /** + * @return array + */ + public function getLastReceivedToken() + { + // If self-signed JWTs are being used, fetch the last received token + // from memory. Else, fetch it from OAuth2 + return $this->useSelfSignedJwt() ? $this->lastReceivedJwtAccessToken : $this->auth->getLastReceivedToken(); + } + /** + * Get the project ID from the service account keyfile. + * + * Returns null if the project ID does not exist in the keyfile. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + return $this->projectId; + } + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null) + { + // scope exists. use oauth implementation + if (!$this->useSelfSignedJwt()) { + return parent::updateMetadata($metadata, $authUri, $httpHandler); + } + $jwtCreds = $this->createJwtAccessCredentials(); + if ($this->auth->getScope()) { + // Prefer user-provided "scope" to "audience" + $updatedMetadata = $jwtCreds->updateMetadata($metadata, null, $httpHandler); + } else { + $updatedMetadata = $jwtCreds->updateMetadata($metadata, $authUri, $httpHandler); + } + if ($lastReceivedToken = $jwtCreds->getLastReceivedToken()) { + // Keep self-signed JWTs in memory as the last received token + $this->lastReceivedJwtAccessToken = $lastReceivedToken; + } + return $updatedMetadata; + } + /** + * @return ServiceAccountJwtAccessCredentials + */ + private function createJwtAccessCredentials() + { + if (!$this->jwtAccessCredentials) { + // Create credentials for self-signing a JWT (JwtAccess) + $credJson = ['private_key' => $this->auth->getSigningKey(), 'client_email' => $this->auth->getIssuer()]; + $this->jwtAccessCredentials = new ServiceAccountJwtAccessCredentials($credJson, $this->auth->getScope()); + } + return $this->jwtAccessCredentials; + } + /** + * @param string $sub an email address account to impersonate, in situations when + * the service account has been delegated domain wide access. + * @return void + */ + public function setSub($sub) + { + $this->auth->setSub($sub); + } + /** + * Get the client name from the keyfile. + * + * In this case, it returns the keyfile's client_email key. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + return $this->auth->getIssuer(); + } + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } + /** + * Get the universe domain configured in the JSON credential. + * + * @return string + */ + public function getUniverseDomain() : string + { + return $this->universeDomain; + } + /** + * @return bool + */ + private function useSelfSignedJwt() + { + // When a sub is supplied, the user is using domain-wide delegation, which not available + // with self-signed JWTs + if (null !== $this->auth->getSub()) { + // If we are outside the GDU, we can't use domain-wide delegation + if ($this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) { + throw new \LogicException(sprintf('Service Account subject is configured for the credential. Domain-wide ' . 'delegation is not supported in universes other than %s.', self::DEFAULT_UNIVERSE_DOMAIN)); + } + return \false; + } + // If claims are set, this call is for "id_tokens" + if ($this->auth->getAdditionalClaims()) { + return \false; + } + // When true, ServiceAccountCredentials will always use JwtAccess for access tokens + if ($this->useJwtAccessWithScope) { + return \true; + } + // If the universe domain is outside the GDU, use JwtAccess for access tokens + if ($this->getUniverseDomain() !== self::DEFAULT_UNIVERSE_DOMAIN) { + return \true; + } + return is_null($this->auth->getScope()); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php new file mode 100644 index 0000000..81fa9fd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php @@ -0,0 +1,171 @@ + $jsonKey JSON credential file path or JSON credentials + * as an associative array + * @param string|string[] $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + */ + public function __construct($jsonKey, $scope = null) + { + if (is_string($jsonKey)) { + if (!file_exists($jsonKey)) { + throw new \InvalidArgumentException('file does not exist'); + } + $jsonKeyStream = file_get_contents($jsonKey); + if (!($jsonKey = json_decode((string) $jsonKeyStream, \true))) { + throw new \LogicException('invalid json for auth config'); + } + } + if (!array_key_exists('client_email', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the client_email field'); + } + if (!array_key_exists('private_key', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the private_key field'); + } + if (array_key_exists('quota_project_id', $jsonKey)) { + $this->quotaProject = (string) $jsonKey['quota_project_id']; + } + $this->auth = new OAuth2(['issuer' => $jsonKey['client_email'], 'sub' => $jsonKey['client_email'], 'signingAlgorithm' => 'RS256', 'signingKey' => $jsonKey['private_key'], 'scope' => $scope]); + $this->projectId = $jsonKey['project_id'] ?? null; + } + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null) + { + $scope = $this->auth->getScope(); + if (empty($authUri) && empty($scope)) { + return $metadata; + } + $this->auth->setAudience($authUri); + return parent::updateMetadata($metadata, $authUri, $httpHandler); + } + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * @param callable $httpHandler + * + * @return null|array{access_token:string} A set of auth related metadata + */ + public function fetchAuthToken(callable $httpHandler = null) + { + $audience = $this->auth->getAudience(); + $scope = $this->auth->getScope(); + if (empty($audience) && empty($scope)) { + return null; + } + if (!empty($audience) && !empty($scope)) { + throw new \UnexpectedValueException('Cannot sign both audience and scope in JwtAccess'); + } + $access_token = $this->auth->toJwt(); + // Set the self-signed access token in OAuth2 for getLastReceivedToken + $this->auth->setAccessToken($access_token); + return ['access_token' => $access_token]; + } + /** + * @return string + */ + public function getCacheKey() + { + return $this->auth->getCacheKey(); + } + /** + * @return array + */ + public function getLastReceivedToken() + { + return $this->auth->getLastReceivedToken(); + } + /** + * Get the project ID from the service account keyfile. + * + * Returns null if the project ID does not exist in the keyfile. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string|null + */ + public function getProjectId(callable $httpHandler = null) + { + return $this->projectId; + } + /** + * Get the client name from the keyfile. + * + * In this case, it returns the keyfile's client_email key. + * + * @param callable $httpHandler Not used by this credentials type. + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + return $this->auth->getIssuer(); + } + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/UserRefreshCredentials.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/UserRefreshCredentials.php new file mode 100644 index 0000000..dd215e4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Credentials/UserRefreshCredentials.php @@ -0,0 +1,130 @@ + $jsonKey JSON credential file path or JSON credentials + * as an associative array + */ + public function __construct($scope, $jsonKey) + { + if (is_string($jsonKey)) { + if (!file_exists($jsonKey)) { + throw new \InvalidArgumentException('file does not exist'); + } + $json = file_get_contents($jsonKey); + if (!($jsonKey = json_decode((string) $json, \true))) { + throw new \LogicException('invalid json for auth config'); + } + } + if (!array_key_exists('client_id', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the client_id field'); + } + if (!array_key_exists('client_secret', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the client_secret field'); + } + if (!array_key_exists('refresh_token', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the refresh_token field'); + } + $this->auth = new OAuth2(['clientId' => $jsonKey['client_id'], 'clientSecret' => $jsonKey['client_secret'], 'refresh_token' => $jsonKey['refresh_token'], 'scope' => $scope, 'tokenCredentialUri' => self::TOKEN_CREDENTIAL_URI]); + if (array_key_exists('quota_project_id', $jsonKey)) { + $this->quotaProject = (string) $jsonKey['quota_project_id']; + } + } + /** + * @param callable $httpHandler + * + * @return array { + * A set of auth related metadata, containing the following + * + * @type string $access_token + * @type int $expires_in + * @type string $scope + * @type string $token_type + * @type string $id_token + * } + */ + public function fetchAuthToken(callable $httpHandler = null) + { + return $this->auth->fetchAuthToken($httpHandler); + } + /** + * @return string + */ + public function getCacheKey() + { + return $this->auth->getClientId() . ':' . $this->auth->getCacheKey(); + } + /** + * @return array + */ + public function getLastReceivedToken() + { + return $this->auth->getLastReceivedToken(); + } + /** + * Get the quota project used for this API request + * + * @return string|null + */ + public function getQuotaProject() + { + return $this->quotaProject; + } + /** + * Get the granted scopes (if they exist) for the last fetched token. + * + * @return string|null + */ + public function getGrantedScope() + { + return $this->auth->getGrantedScope(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialsLoader.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialsLoader.php new file mode 100644 index 0000000..1b586d6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/CredentialsLoader.php @@ -0,0 +1,242 @@ +|null JSON key | null + */ + public static function fromEnv() + { + $path = getenv(self::ENV_VAR); + if (empty($path)) { + return null; + } + if (!file_exists($path)) { + $cause = 'file ' . $path . ' does not exist'; + throw new \DomainException(self::unableToReadEnv($cause)); + } + $jsonKey = file_get_contents($path); + return json_decode((string) $jsonKey, \true); + } + /** + * Load a JSON key from a well known path. + * + * The well known path is OS dependent: + * + * * windows: %APPDATA%/gcloud/application_default_credentials.json + * * others: $HOME/.config/gcloud/application_default_credentials.json + * + * If the file does not exist, this returns null. + * + * @return array|null JSON key | null + */ + public static function fromWellKnownFile() + { + $rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME'; + $path = [getenv($rootEnv)]; + if (!self::isOnWindows()) { + $path[] = self::NON_WINDOWS_WELL_KNOWN_PATH_BASE; + } + $path[] = self::WELL_KNOWN_PATH; + $path = implode(\DIRECTORY_SEPARATOR, $path); + if (!file_exists($path)) { + return null; + } + $jsonKey = file_get_contents($path); + return json_decode((string) $jsonKey, \true); + } + /** + * Create a new Credentials instance. + * + * @param string|string[] $scope the scope of the access request, expressed + * either as an Array or as a space-delimited String. + * @param array $jsonKey the JSON credentials. + * @param string|string[] $defaultScope The default scope to use if no + * user-defined scopes exist, expressed either as an Array or as a + * space-delimited string. + * + * @return ServiceAccountCredentials|UserRefreshCredentials|ImpersonatedServiceAccountCredentials|ExternalAccountCredentials + */ + public static function makeCredentials($scope, array $jsonKey, $defaultScope = null) + { + if (!array_key_exists('type', $jsonKey)) { + throw new \InvalidArgumentException('json key is missing the type field'); + } + if ($jsonKey['type'] == 'service_account') { + // Do not pass $defaultScope to ServiceAccountCredentials + return new ServiceAccountCredentials($scope, $jsonKey); + } + if ($jsonKey['type'] == 'authorized_user') { + $anyScope = $scope ?: $defaultScope; + return new UserRefreshCredentials($anyScope, $jsonKey); + } + if ($jsonKey['type'] == 'impersonated_service_account') { + $anyScope = $scope ?: $defaultScope; + return new ImpersonatedServiceAccountCredentials($anyScope, $jsonKey); + } + if ($jsonKey['type'] == 'external_account') { + $anyScope = $scope ?: $defaultScope; + return new ExternalAccountCredentials($anyScope, $jsonKey); + } + throw new \InvalidArgumentException('invalid value in the type field'); + } + /** + * Create an authorized HTTP Client from an instance of FetchAuthTokenInterface. + * + * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token + * @param array $httpClientOptions (optional) Array of request options to apply. + * @param callable $httpHandler (optional) http client to fetch the token. + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + * @return \GuzzleHttp\Client + */ + public static function makeHttpClient(FetchAuthTokenInterface $fetcher, array $httpClientOptions = [], callable $httpHandler = null, callable $tokenCallback = null) + { + $middleware = new Middleware\AuthTokenMiddleware($fetcher, $httpHandler, $tokenCallback); + $stack = \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\HandlerStack::create(); + $stack->push($middleware); + return new \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Client(['handler' => $stack, 'auth' => 'google_auth'] + $httpClientOptions); + } + /** + * Create a new instance of InsecureCredentials. + * + * @return InsecureCredentials + */ + public static function makeInsecureCredentials() + { + return new InsecureCredentials(); + } + /** + * Fetch a quota project from the environment variable + * GOOGLE_CLOUD_QUOTA_PROJECT. Return null if + * GOOGLE_CLOUD_QUOTA_PROJECT is not specified. + * + * @return string|null + */ + public static function quotaProjectFromEnv() + { + return getenv(self::QUOTA_PROJECT_ENV_VAR) ?: null; + } + /** + * Gets a callable which returns the default device certification. + * + * @throws UnexpectedValueException + * @return callable|null + */ + public static function getDefaultClientCertSource() + { + if (!($clientCertSourceJson = self::loadDefaultClientCertSourceFile())) { + return null; + } + $clientCertSourceCmd = $clientCertSourceJson['cert_provider_command']; + return function () use($clientCertSourceCmd) { + $cmd = array_map('escapeshellarg', $clientCertSourceCmd); + exec(implode(' ', $cmd), $output, $returnVar); + if (0 === $returnVar) { + return implode(\PHP_EOL, $output); + } + throw new RuntimeException('"cert_provider_command" failed with a nonzero exit code'); + }; + } + /** + * Determines whether or not the default device certificate should be loaded. + * + * @return bool + */ + public static function shouldLoadClientCertSource() + { + return filter_var(getenv(self::MTLS_CERT_ENV_VAR), \FILTER_VALIDATE_BOOLEAN); + } + /** + * @return array{cert_provider_command:string[]}|null + */ + private static function loadDefaultClientCertSourceFile() + { + $rootEnv = self::isOnWindows() ? 'APPDATA' : 'HOME'; + $path = sprintf('%s/%s', getenv($rootEnv), self::MTLS_WELL_KNOWN_PATH); + if (!file_exists($path)) { + return null; + } + $jsonKey = file_get_contents($path); + $clientCertSourceJson = json_decode((string) $jsonKey, \true); + if (!$clientCertSourceJson) { + throw new UnexpectedValueException('Invalid client cert source JSON'); + } + if (!isset($clientCertSourceJson['cert_provider_command'])) { + throw new UnexpectedValueException('cert source requires "cert_provider_command"'); + } + if (!is_array($clientCertSourceJson['cert_provider_command'])) { + throw new UnexpectedValueException('cert source expects "cert_provider_command" to be an array'); + } + return $clientCertSourceJson; + } + /** + * Get the universe domain from the credential. Defaults to "googleapis.com" + * for all credential types which do not support universe domain. + * + * @return string + */ + public function getUniverseDomain() : string + { + return self::DEFAULT_UNIVERSE_DOMAIN; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ExternalAccountCredentialSourceInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ExternalAccountCredentialSourceInterface.php new file mode 100644 index 0000000..463bec1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ExternalAccountCredentialSourceInterface.php @@ -0,0 +1,23 @@ + $cacheConfig Configuration for the cache + * @param CacheItemPoolInterface $cache + */ + public function __construct(FetchAuthTokenInterface $fetcher, array $cacheConfig = null, CacheItemPoolInterface $cache) + { + $this->fetcher = $fetcher; + $this->cache = $cache; + $this->cacheConfig = array_merge(['lifetime' => 1500, 'prefix' => ''], (array) $cacheConfig); + } + /** + * @return FetchAuthTokenInterface + */ + public function getFetcher() + { + return $this->fetcher; + } + /** + * Implements FetchAuthTokenInterface#fetchAuthToken. + * + * Checks the cache for a valid auth token and fetches the auth tokens + * from the supplied fetcher. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return array the response + * @throws \Exception + */ + public function fetchAuthToken(callable $httpHandler = null) + { + if ($cached = $this->fetchAuthTokenFromCache()) { + return $cached; + } + $auth_token = $this->fetcher->fetchAuthToken($httpHandler); + $this->saveAuthTokenInCache($auth_token); + return $auth_token; + } + /** + * @return string + */ + public function getCacheKey() + { + return $this->getFullCacheKey($this->fetcher->getCacheKey()); + } + /** + * @return array|null + */ + public function getLastReceivedToken() + { + return $this->fetcher->getLastReceivedToken(); + } + /** + * Get the client name from the fetcher. + * + * @param callable $httpHandler An HTTP handler to deliver PSR7 requests. + * @return string + */ + public function getClientName(callable $httpHandler = null) + { + if (!$this->fetcher instanceof SignBlobInterface) { + throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\SignBlobInterface'); + } + return $this->fetcher->getClientName($httpHandler); + } + /** + * Sign a blob using the fetcher. + * + * @param string $stringToSign The string to sign. + * @param bool $forceOpenSsl Require use of OpenSSL for local signing. Does + * not apply to signing done using external services. **Defaults to** + * `false`. + * @return string The resulting signature. + * @throws \RuntimeException If the fetcher does not implement + * `Google\Auth\SignBlobInterface`. + */ + public function signBlob($stringToSign, $forceOpenSsl = \false) + { + if (!$this->fetcher instanceof SignBlobInterface) { + throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\SignBlobInterface'); + } + // Pass the access token from cache to GCECredentials for signing a blob. + // This saves a call to the metadata server when a cached token exists. + if ($this->fetcher instanceof Credentials\GCECredentials) { + $cached = $this->fetchAuthTokenFromCache(); + $accessToken = $cached['access_token'] ?? null; + return $this->fetcher->signBlob($stringToSign, $forceOpenSsl, $accessToken); + } + return $this->fetcher->signBlob($stringToSign, $forceOpenSsl); + } + /** + * Get the quota project used for this API request from the credentials + * fetcher. + * + * @return string|null + */ + public function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + return null; + } + /* + * Get the Project ID from the fetcher. + * + * @param callable $httpHandler Callback which delivers psr7 request + * @return string|null + * @throws \RuntimeException If the fetcher does not implement + * `Google\Auth\ProvidesProjectIdInterface`. + */ + public function getProjectId(callable $httpHandler = null) + { + if (!$this->fetcher instanceof ProjectIdProviderInterface) { + throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\ProvidesProjectIdInterface'); + } + return $this->fetcher->getProjectId($httpHandler); + } + /* + * Get the Universe Domain from the fetcher. + * + * @return string + */ + public function getUniverseDomain() : string + { + if ($this->fetcher instanceof GetUniverseDomainInterface) { + return $this->fetcher->getUniverseDomain(); + } + return GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN; + } + /** + * Updates metadata with the authorization token. + * + * @param array $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + * @throws \RuntimeException If the fetcher does not implement + * `Google\Auth\UpdateMetadataInterface`. + */ + public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null) + { + if (!$this->fetcher instanceof UpdateMetadataInterface) { + throw new \RuntimeException('Credentials fetcher does not implement ' . 'Google\\Auth\\UpdateMetadataInterface'); + } + $cached = $this->fetchAuthTokenFromCache($authUri); + if ($cached) { + // Set the access token in the `Authorization` metadata header so + // the downstream call to updateMetadata know they don't need to + // fetch another token. + if (isset($cached['access_token'])) { + $metadata[self::AUTH_METADATA_KEY] = ['Bearer ' . $cached['access_token']]; + } elseif (isset($cached['id_token'])) { + $metadata[self::AUTH_METADATA_KEY] = ['Bearer ' . $cached['id_token']]; + } + } + $newMetadata = $this->fetcher->updateMetadata($metadata, $authUri, $httpHandler); + if (!$cached && ($token = $this->fetcher->getLastReceivedToken())) { + $this->saveAuthTokenInCache($token, $authUri); + } + return $newMetadata; + } + /** + * @param string|null $authUri + * @return array|null + */ + private function fetchAuthTokenFromCache($authUri = null) + { + // Use the cached value if its available. + // + // TODO: correct caching; update the call to setCachedValue to set the expiry + // to the value returned with the auth token. + // + // TODO: correct caching; enable the cache to be cleared. + // if $authUri is set, use it as the cache key + $cacheKey = $authUri ? $this->getFullCacheKey($authUri) : $this->fetcher->getCacheKey(); + $cached = $this->getCachedValue($cacheKey); + if (is_array($cached)) { + if (empty($cached['expires_at'])) { + // If there is no expiration data, assume token is not expired. + // (for JwtAccess and ID tokens) + return $cached; + } + if (time() + $this->eagerRefreshThresholdSeconds < $cached['expires_at']) { + // access token is not expired + return $cached; + } + } + return null; + } + /** + * @param array $authToken + * @param string|null $authUri + * @return void + */ + private function saveAuthTokenInCache($authToken, $authUri = null) + { + if (isset($authToken['access_token']) || isset($authToken['id_token'])) { + // if $authUri is set, use it as the cache key + $cacheKey = $authUri ? $this->getFullCacheKey($authUri) : $this->fetcher->getCacheKey(); + $this->setCachedValue($cacheKey, $authToken); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/FetchAuthTokenInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/FetchAuthTokenInterface.php new file mode 100644 index 0000000..368af0a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/FetchAuthTokenInterface.php @@ -0,0 +1,52 @@ + a hash of auth tokens + */ + public function fetchAuthToken(callable $httpHandler = null); + /** + * Obtains a key that can used to cache the results of #fetchAuthToken. + * + * If the value is empty, the auth token is not cached. + * + * @return string a key that may be used to cache the auth token. + */ + public function getCacheKey(); + /** + * Returns an associative array with the token and + * expiration time. + * + * @return null|array { + * The last received access token. + * + * @type string $access_token The access token string. + * @type int $expires_at The time the token expires as a UNIX timestamp. + * } + */ + public function getLastReceivedToken(); +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/GCECache.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/GCECache.php new file mode 100644 index 0000000..661bc63 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/GCECache.php @@ -0,0 +1,70 @@ + $cacheConfig Configuration for the cache + * @param CacheItemPoolInterface $cache + */ + public function __construct(array $cacheConfig = null, CacheItemPoolInterface $cache = null) + { + $this->cache = $cache; + $this->cacheConfig = array_merge(['lifetime' => 1500, 'prefix' => ''], (array) $cacheConfig); + } + /** + * Caches the result of onGce so the metadata server is not called multiple + * times. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return bool True if this a GCEInstance, false otherwise + */ + public function onGce(callable $httpHandler = null) + { + if (is_null($this->cache)) { + return GCECredentials::onGce($httpHandler); + } + $cacheKey = self::GCE_CACHE_KEY; + $onGce = $this->getCachedValue($cacheKey); + if (is_null($onGce)) { + $onGce = GCECredentials::onGce($httpHandler); + $this->setCachedValue($cacheKey, $onGce); + } + return $onGce; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/GetQuotaProjectInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/GetQuotaProjectInterface.php new file mode 100644 index 0000000..6ea732e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/GetQuotaProjectInterface.php @@ -0,0 +1,32 @@ +client = $client; + } + /** + * Accepts a PSR-7 request and an array of options and returns a PSR-7 response. + * + * @param RequestInterface $request + * @param array $options + * @return ResponseInterface + */ + public function __invoke(RequestInterface $request, array $options = []) + { + return $this->client->send($request, $options); + } + /** + * Accepts a PSR-7 request and an array of options and returns a PromiseInterface + * + * @param RequestInterface $request + * @param array $options + * + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function async(RequestInterface $request, array $options = []) + { + return $this->client->sendAsync($request, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/HttpHandler/Guzzle7HttpHandler.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/HttpHandler/Guzzle7HttpHandler.php new file mode 100644 index 0000000..7b2cce1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/HttpHandler/Guzzle7HttpHandler.php @@ -0,0 +1,22 @@ +remove('http_errors'); + $stack->unshift(Middleware::httpErrors($bodySummarizer), 'http_errors'); + } + $client = new Client(['handler' => $stack]); + } + $version = null; + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientInterface::MAJOR_VERSION')) { + $version = ClientInterface::MAJOR_VERSION; + } elseif (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientInterface::VERSION')) { + $version = (int) substr(ClientInterface::VERSION, 0, 1); + } + switch ($version) { + case 6: + return new Guzzle6HttpHandler($client); + case 7: + return new Guzzle7HttpHandler($client); + default: + throw new \Exception('Version not supported'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Iam.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Iam.php new file mode 100644 index 0000000..96f3acb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Iam.php @@ -0,0 +1,79 @@ +httpHandler = $httpHandler ?: HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + /** + * Sign a string using the IAM signBlob API. + * + * Note that signing using IAM requires your service account to have the + * `iam.serviceAccounts.signBlob` permission, part of the "Service Account + * Token Creator" IAM role. + * + * @param string $email The service account email. + * @param string $accessToken An access token from the service account. + * @param string $stringToSign The string to be signed. + * @param array $delegates [optional] A list of service account emails to + * add to the delegate chain. If omitted, the value of `$email` will + * be used. + * @return string The signed string, base64-encoded. + */ + public function signBlob($email, $accessToken, $stringToSign, array $delegates = []) + { + $httpHandler = $this->httpHandler; + $name = sprintf(self::SERVICE_ACCOUNT_NAME, $email); + $uri = self::IAM_API_ROOT . '/' . sprintf(self::SIGN_BLOB_PATH, $name); + if ($delegates) { + foreach ($delegates as &$delegate) { + $delegate = sprintf(self::SERVICE_ACCOUNT_NAME, $delegate); + } + } else { + $delegates = [$name]; + } + $body = ['delegates' => $delegates, 'payload' => base64_encode($stringToSign)]; + $headers = ['Authorization' => 'Bearer ' . $accessToken]; + $request = new Psr7\Request('POST', $uri, $headers, Utils::streamFor(json_encode($body))); + $res = $httpHandler($request); + $body = json_decode((string) $res->getBody(), \true); + return $body['signedBlob']; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/IamSignerTrait.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/IamSignerTrait.php new file mode 100644 index 0000000..4c898b6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/IamSignerTrait.php @@ -0,0 +1,58 @@ +iam ?: new Iam($httpHandler); + $email = $this->getClientName($httpHandler); + if (is_null($accessToken)) { + $previousToken = $this->getLastReceivedToken(); + $accessToken = $previousToken ? $previousToken['access_token'] : $this->fetchAuthToken($httpHandler)['access_token']; + } + return $signer->signBlob($email, $accessToken, $stringToSign); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/AuthTokenMiddleware.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/AuthTokenMiddleware.php new file mode 100644 index 0000000..7a7308d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/AuthTokenMiddleware.php @@ -0,0 +1,138 @@ +' + */ +class AuthTokenMiddleware +{ + /** + * @var callable + */ + private $httpHandler; + /** + * It must be an implementation of FetchAuthTokenInterface. + * It may also implement UpdateMetadataInterface allowing direct + * retrieval of auth related headers + * @var FetchAuthTokenInterface + */ + private $fetcher; + /** + * @var ?callable + */ + private $tokenCallback; + /** + * Creates a new AuthTokenMiddleware. + * + * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token + * @param callable $httpHandler (optional) callback which delivers psr7 request + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + */ + public function __construct(FetchAuthTokenInterface $fetcher, callable $httpHandler = null, callable $tokenCallback = null) + { + $this->fetcher = $fetcher; + $this->httpHandler = $httpHandler; + $this->tokenCallback = $tokenCallback; + } + /** + * Updates the request with an Authorization header when auth is 'google_auth'. + * + * use Google\Auth\Middleware\AuthTokenMiddleware; + * use Google\Auth\OAuth2; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $config = [...]; + * $oauth2 = new OAuth2($config) + * $middleware = new AuthTokenMiddleware($oauth2); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use($handler) { + // Requests using "auth"="google_auth" will be authorized. + if (!isset($options['auth']) || $options['auth'] !== 'google_auth') { + return $handler($request, $options); + } + $request = $this->addAuthHeaders($request); + if ($quotaProject = $this->getQuotaProject()) { + $request = $request->withHeader(GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, $quotaProject); + } + return $handler($request, $options); + }; + } + /** + * Adds auth related headers to the request. + * + * @param RequestInterface $request + * @return RequestInterface + */ + private function addAuthHeaders(RequestInterface $request) + { + if (!$this->fetcher instanceof UpdateMetadataInterface || $this->fetcher instanceof FetchAuthTokenCache && !$this->fetcher->getFetcher() instanceof UpdateMetadataInterface) { + $token = $this->fetcher->fetchAuthToken(); + $request = $request->withHeader('authorization', 'Bearer ' . ($token['access_token'] ?? $token['id_token'] ?? '')); + } else { + $headers = $this->fetcher->updateMetadata($request->getHeaders(), null, $this->httpHandler); + $request = Utils::modifyRequest($request, ['set_headers' => $headers]); + } + if ($this->tokenCallback && ($token = $this->fetcher->getLastReceivedToken())) { + if (array_key_exists('access_token', $token)) { + call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $token['access_token']); + } + } + return $request; + } + /** + * @return string|null + */ + private function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + return null; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php new file mode 100644 index 0000000..1e83dec --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php @@ -0,0 +1,130 @@ +' + */ +class ProxyAuthTokenMiddleware +{ + /** + * @var callable + */ + private $httpHandler; + /** + * @var FetchAuthTokenInterface + */ + private $fetcher; + /** + * @var ?callable + */ + private $tokenCallback; + /** + * Creates a new ProxyAuthTokenMiddleware. + * + * @param FetchAuthTokenInterface $fetcher is used to fetch the auth token + * @param callable $httpHandler (optional) callback which delivers psr7 request + * @param callable $tokenCallback (optional) function to be called when a new token is fetched. + */ + public function __construct(FetchAuthTokenInterface $fetcher, callable $httpHandler = null, callable $tokenCallback = null) + { + $this->fetcher = $fetcher; + $this->httpHandler = $httpHandler; + $this->tokenCallback = $tokenCallback; + } + /** + * Updates the request with an Authorization header when auth is 'google_auth'. + * + * use Google\Auth\Middleware\ProxyAuthTokenMiddleware; + * use Google\Auth\OAuth2; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $config = [...]; + * $oauth2 = new OAuth2($config) + * $middleware = new ProxyAuthTokenMiddleware($oauth2); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'proxy_auth' => 'google_auth' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use($handler) { + // Requests using "proxy_auth"="google_auth" will be authorized. + if (!isset($options['proxy_auth']) || $options['proxy_auth'] !== 'google_auth') { + return $handler($request, $options); + } + $request = $request->withHeader('proxy-authorization', 'Bearer ' . $this->fetchToken()); + if ($quotaProject = $this->getQuotaProject()) { + $request = $request->withHeader(GetQuotaProjectInterface::X_GOOG_USER_PROJECT_HEADER, $quotaProject); + } + return $handler($request, $options); + }; + } + /** + * Call fetcher to fetch the token. + * + * @return string|null + */ + private function fetchToken() + { + $auth_tokens = $this->fetcher->fetchAuthToken($this->httpHandler); + if (array_key_exists('access_token', $auth_tokens)) { + // notify the callback if applicable + if ($this->tokenCallback) { + call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $auth_tokens['access_token']); + } + return $auth_tokens['access_token']; + } + if (array_key_exists('id_token', $auth_tokens)) { + return $auth_tokens['id_token']; + } + return null; + } + /** + * @return string|null; + */ + private function getQuotaProject() + { + if ($this->fetcher instanceof GetQuotaProjectInterface) { + return $this->fetcher->getQuotaProject(); + } + return null; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php new file mode 100644 index 0000000..61a3ff5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php @@ -0,0 +1,140 @@ +' + */ +class ScopedAccessTokenMiddleware +{ + use CacheTrait; + const DEFAULT_CACHE_LIFETIME = 1500; + /** + * @var callable + */ + private $tokenFunc; + /** + * @var array|string + */ + private $scopes; + /** + * Creates a new ScopedAccessTokenMiddleware. + * + * @param callable $tokenFunc a token generator function + * @param array|string $scopes the token authentication scopes + * @param array $cacheConfig configuration for the cache when it's present + * @param CacheItemPoolInterface $cache an implementation of CacheItemPoolInterface + */ + public function __construct(callable $tokenFunc, $scopes, array $cacheConfig = null, CacheItemPoolInterface $cache = null) + { + $this->tokenFunc = $tokenFunc; + if (!(is_string($scopes) || is_array($scopes))) { + throw new \InvalidArgumentException('wants scope should be string or array'); + } + $this->scopes = $scopes; + if (!is_null($cache)) { + $this->cache = $cache; + $this->cacheConfig = array_merge(['lifetime' => self::DEFAULT_CACHE_LIFETIME, 'prefix' => ''], $cacheConfig); + } + } + /** + * Updates the request with an Authorization header when auth is 'scoped'. + * + * E.g this could be used to authenticate using the AppEngine + * AppIdentityService. + * + * use google\appengine\api\app_identity\AppIdentityService; + * use Google\Auth\Middleware\ScopedAccessTokenMiddleware; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $scope = 'https://www.googleapis.com/auth/taskqueue' + * $middleware = new ScopedAccessTokenMiddleware( + * 'AppIdentityService::getAccessToken', + * $scope, + * [ 'prefix' => 'Google\Auth\ScopedAccessToken::' ], + * $cache = new Memcache() + * ); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_url' => 'https://www.googleapis.com/taskqueue/v1beta2/projects/', + * 'auth' => 'scoped' // authorize all requests + * ]); + * + * $res = $client->get('myproject/taskqueues/myqueue'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use($handler) { + // Requests using "auth"="scoped" will be authorized. + if (!isset($options['auth']) || $options['auth'] !== 'scoped') { + return $handler($request, $options); + } + $request = $request->withHeader('authorization', 'Bearer ' . $this->fetchToken()); + return $handler($request, $options); + }; + } + /** + * @return string + */ + private function getCacheKey() + { + $key = null; + if (is_string($this->scopes)) { + $key .= $this->scopes; + } elseif (is_array($this->scopes)) { + $key .= implode(':', $this->scopes); + } + return $key; + } + /** + * Determine if token is available in the cache, if not call tokenFunc to + * fetch it. + * + * @return string + */ + private function fetchToken() + { + $cacheKey = $this->getCacheKey(); + $cached = $this->getCachedValue($cacheKey); + if (!empty($cached)) { + return $cached; + } + $token = call_user_func($this->tokenFunc, $this->scopes); + $this->setCachedValue($cacheKey, $token); + return $token; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/SimpleMiddleware.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/SimpleMiddleware.php new file mode 100644 index 0000000..4201173 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/Middleware/SimpleMiddleware.php @@ -0,0 +1,86 @@ + + */ + private $config; + /** + * Create a new Simple plugin. + * + * The configuration array expects one option + * - key: required, otherwise InvalidArgumentException is thrown + * + * @param array $config Configuration array + */ + public function __construct(array $config) + { + if (!isset($config['key'])) { + throw new \InvalidArgumentException('requires a key to have been set'); + } + $this->config = array_merge(['key' => null], $config); + } + /** + * Updates the request query with the developer key if auth is set to simple. + * + * use Google\Auth\Middleware\SimpleMiddleware; + * use GuzzleHttp\Client; + * use GuzzleHttp\HandlerStack; + * + * $my_key = 'is not the same as yours'; + * $middleware = new SimpleMiddleware(['key' => $my_key]); + * $stack = HandlerStack::create(); + * $stack->push($middleware); + * + * $client = new Client([ + * 'handler' => $stack, + * 'base_uri' => 'https://www.googleapis.com/discovery/v1/', + * 'auth' => 'simple' + * ]); + * + * $res = $client->get('drive/v2/rest'); + * + * @param callable $handler + * @return \Closure + */ + public function __invoke(callable $handler) + { + return function (RequestInterface $request, array $options) use($handler) { + // Requests using "auth"="scoped" will be authorized. + if (!isset($options['auth']) || $options['auth'] !== 'simple') { + return $handler($request, $options); + } + $query = Query::parse($request->getUri()->getQuery()); + $params = array_merge($query, $this->config); + $uri = $request->getUri()->withQuery(Query::build($params)); + $request = $request->withUri($uri); + return $handler($request, $options); + }; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/OAuth2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/OAuth2.php new file mode 100644 index 0000000..bc5ce46 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/OAuth2.php @@ -0,0 +1,1515 @@ + + */ + public static $knownSigningAlgorithms = ['HS256', 'HS512', 'HS384', 'RS256']; + /** + * The well known grant types. + * + * @var array + */ + public static $knownGrantTypes = ['authorization_code', 'refresh_token', 'password', 'client_credentials']; + /** + * - authorizationUri + * The authorization server's HTTP endpoint capable of + * authenticating the end-user and obtaining authorization. + * + * @var ?UriInterface + */ + private $authorizationUri; + /** + * - tokenCredentialUri + * The authorization server's HTTP endpoint capable of issuing + * tokens and refreshing expired tokens. + * + * @var UriInterface + */ + private $tokenCredentialUri; + /** + * The redirection URI used in the initial request. + * + * @var ?string + */ + private $redirectUri; + /** + * A unique identifier issued to the client to identify itself to the + * authorization server. + * + * @var string + */ + private $clientId; + /** + * A shared symmetric secret issued by the authorization server, which is + * used to authenticate the client. + * + * @var string + */ + private $clientSecret; + /** + * The resource owner's username. + * + * @var ?string + */ + private $username; + /** + * The resource owner's password. + * + * @var ?string + */ + private $password; + /** + * The scope of the access request, expressed either as an Array or as a + * space-delimited string. + * + * @var ?array + */ + private $scope; + /** + * An arbitrary string designed to allow the client to maintain state. + * + * @var string + */ + private $state; + /** + * The authorization code issued to this client. + * + * Only used by the authorization code access grant type. + * + * @var ?string + */ + private $code; + /** + * The issuer ID when using assertion profile. + * + * @var ?string + */ + private $issuer; + /** + * The target audience for assertions. + * + * @var string + */ + private $audience; + /** + * The target sub when issuing assertions. + * + * @var string + */ + private $sub; + /** + * The number of seconds assertions are valid for. + * + * @var int + */ + private $expiry; + /** + * The signing key when using assertion profile. + * + * @var ?string + */ + private $signingKey; + /** + * The signing key id when using assertion profile. Param kid in jwt header + * + * @var string + */ + private $signingKeyId; + /** + * The signing algorithm when using an assertion profile. + * + * @var ?string + */ + private $signingAlgorithm; + /** + * The refresh token associated with the access token to be refreshed. + * + * @var ?string + */ + private $refreshToken; + /** + * The current access token. + * + * @var string + */ + private $accessToken; + /** + * The current ID token. + * + * @var string + */ + private $idToken; + /** + * The scopes granted to the current access token + * + * @var string + */ + private $grantedScope; + /** + * The lifetime in seconds of the current access token. + * + * @var ?int + */ + private $expiresIn; + /** + * The expiration time of the access token as a number of seconds since the + * unix epoch. + * + * @var ?int + */ + private $expiresAt; + /** + * The issue time of the access token as a number of seconds since the unix + * epoch. + * + * @var ?int + */ + private $issuedAt; + /** + * The current grant type. + * + * @var ?string + */ + private $grantType; + /** + * When using an extension grant type, this is the set of parameters used by + * that extension. + * + * @var array + */ + private $extensionParams; + /** + * When using the toJwt function, these claims will be added to the JWT + * payload. + * + * @var array + */ + private $additionalClaims; + /** + * The code verifier for PKCE for OAuth 2.0. When set, the authorization + * URI will contain the Code Challenge and Code Challenge Method querystring + * parameters, and the token URI will contain the Code Verifier parameter. + * + * @see https://datatracker.ietf.org/doc/html/rfc7636 + * @var ?string + */ + private $codeVerifier; + /** + * For STS requests. + * A URI that indicates the target service or resource where the client + * intends to use the requested security token. + * @var string|null + */ + private $resource; + /** + * For STS requests. + * A fetcher for the "subject_token", which is a security token that + * represents the identity of the party on behalf of whom the request is + * being made. + * @var \Matomo\Dependencies\SearchEngineKeywordsPerformance\Google\Auth\ExternalAccountCredentialSourceInterface|null + */ + private $subjectTokenFetcher; + /** + * For STS requests. + * An identifier, that indicates the type of the security token in the + * subjectToken parameter. + * @var string|null + */ + private $subjectTokenType; + /** + * For STS requests. + * A security token that represents the identity of the acting party. + * @var string|null + */ + private $actorToken; + /** + * For STS requests. + * An identifier that indicates the type of the security token in the + * actorToken parameter. + * @var string|null + */ + private $actorTokenType; + /** + * From STS response. + * An identifier for the representation of the issued security token. + * @var string|null + */ + private $issuedTokenType; + /** + * Create a new OAuthCredentials. + * + * The configuration array accepts various options + * + * - authorizationUri + * The authorization server's HTTP endpoint capable of + * authenticating the end-user and obtaining authorization. + * + * - tokenCredentialUri + * The authorization server's HTTP endpoint capable of issuing + * tokens and refreshing expired tokens. + * + * - clientId + * A unique identifier issued to the client to identify itself to the + * authorization server. + * + * - clientSecret + * A shared symmetric secret issued by the authorization server, + * which is used to authenticate the client. + * + * - scope + * The scope of the access request, expressed either as an Array + * or as a space-delimited String. + * + * - state + * An arbitrary string designed to allow the client to maintain state. + * + * - redirectUri + * The redirection URI used in the initial request. + * + * - username + * The resource owner's username. + * + * - password + * The resource owner's password. + * + * - issuer + * Issuer ID when using assertion profile + * + * - audience + * Target audience for assertions + * + * - expiry + * Number of seconds assertions are valid for + * + * - signingKey + * Signing key when using assertion profile + * + * - signingKeyId + * Signing key id when using assertion profile + * + * - refreshToken + * The refresh token associated with the access token + * to be refreshed. + * + * - accessToken + * The current access token for this client. + * + * - idToken + * The current ID token for this client. + * + * - extensionParams + * When using an extension grant type, this is the set of parameters used + * by that extension. + * + * - codeVerifier + * The code verifier for PKCE for OAuth 2.0. + * + * - resource + * The target service or resource where the client ntends to use the + * requested security token. + * + * - subjectTokenFetcher + * A fetcher for the "subject_token", which is a security token that + * represents the identity of the party on behalf of whom the request is + * being made. + * + * - subjectTokenType + * An identifier that indicates the type of the security token in the + * subjectToken parameter. + * + * - actorToken + * A security token that represents the identity of the acting party. + * + * - actorTokenType + * An identifier for the representation of the issued security token. + * + * @param array $config Configuration array + */ + public function __construct(array $config) + { + $opts = array_merge(['expiry' => self::DEFAULT_EXPIRY_SECONDS, 'extensionParams' => [], 'authorizationUri' => null, 'redirectUri' => null, 'tokenCredentialUri' => null, 'state' => null, 'username' => null, 'password' => null, 'clientId' => null, 'clientSecret' => null, 'issuer' => null, 'sub' => null, 'audience' => null, 'signingKey' => null, 'signingKeyId' => null, 'signingAlgorithm' => null, 'scope' => null, 'additionalClaims' => [], 'codeVerifier' => null, 'resource' => null, 'subjectTokenFetcher' => null, 'subjectTokenType' => null, 'actorToken' => null, 'actorTokenType' => null], $config); + $this->setAuthorizationUri($opts['authorizationUri']); + $this->setRedirectUri($opts['redirectUri']); + $this->setTokenCredentialUri($opts['tokenCredentialUri']); + $this->setState($opts['state']); + $this->setUsername($opts['username']); + $this->setPassword($opts['password']); + $this->setClientId($opts['clientId']); + $this->setClientSecret($opts['clientSecret']); + $this->setIssuer($opts['issuer']); + $this->setSub($opts['sub']); + $this->setExpiry($opts['expiry']); + $this->setAudience($opts['audience']); + $this->setSigningKey($opts['signingKey']); + $this->setSigningKeyId($opts['signingKeyId']); + $this->setSigningAlgorithm($opts['signingAlgorithm']); + $this->setScope($opts['scope']); + $this->setExtensionParams($opts['extensionParams']); + $this->setAdditionalClaims($opts['additionalClaims']); + $this->setCodeVerifier($opts['codeVerifier']); + // for STS + $this->resource = $opts['resource']; + $this->subjectTokenFetcher = $opts['subjectTokenFetcher']; + $this->subjectTokenType = $opts['subjectTokenType']; + $this->actorToken = $opts['actorToken']; + $this->actorTokenType = $opts['actorTokenType']; + $this->updateToken($opts); + } + /** + * Verifies the idToken if present. + * + * - if none is present, return null + * - if present, but invalid, raises DomainException. + * - otherwise returns the payload in the idtoken as a PHP object. + * + * The behavior of this method varies depending on the version of + * `firebase/php-jwt` you are using. In versions 6.0 and above, you cannot + * provide multiple $allowed_algs, and instead must provide an array of Key + * objects as the $publicKey. + * + * @param string|Key|Key[] $publicKey The public key to use to authenticate the token + * @param string|array $allowed_algs algorithm or array of supported verification algorithms. + * Providing more than one algorithm will throw an exception. + * @throws \DomainException if the token is missing an audience. + * @throws \DomainException if the audience does not match the one set in + * the OAuth2 class instance. + * @throws \UnexpectedValueException If the token is invalid + * @throws \InvalidArgumentException If more than one value for allowed_algs is supplied + * @throws \Firebase\JWT\SignatureInvalidException If the signature is invalid. + * @throws \Firebase\JWT\BeforeValidException If the token is not yet valid. + * @throws \Firebase\JWT\ExpiredException If the token has expired. + * @return null|object + */ + public function verifyIdToken($publicKey = null, $allowed_algs = []) + { + $idToken = $this->getIdToken(); + if (is_null($idToken)) { + return null; + } + $resp = $this->jwtDecode($idToken, $publicKey, $allowed_algs); + if (!property_exists($resp, 'aud')) { + throw new \DomainException('No audience found the id token'); + } + if ($resp->aud != $this->getAudience()) { + throw new \DomainException('Wrong audience present in the id token'); + } + return $resp; + } + /** + * Obtains the encoded jwt from the instance data. + * + * @param array $config array optional configuration parameters + * @return string + */ + public function toJwt(array $config = []) + { + if (is_null($this->getSigningKey())) { + throw new \DomainException('No signing key available'); + } + if (is_null($this->getSigningAlgorithm())) { + throw new \DomainException('No signing algorithm specified'); + } + $now = time(); + $opts = array_merge(['skew' => self::DEFAULT_SKEW_SECONDS], $config); + $assertion = ['iss' => $this->getIssuer(), 'exp' => $now + $this->getExpiry(), 'iat' => $now - $opts['skew']]; + foreach ($assertion as $k => $v) { + if (is_null($v)) { + throw new \DomainException($k . ' should not be null'); + } + } + if (!is_null($this->getAudience())) { + $assertion['aud'] = $this->getAudience(); + } + if (!is_null($this->getScope())) { + $assertion['scope'] = $this->getScope(); + } + if (empty($assertion['scope']) && empty($assertion['aud'])) { + throw new \DomainException('one of scope or aud should not be null'); + } + if (!is_null($this->getSub())) { + $assertion['sub'] = $this->getSub(); + } + $assertion += $this->getAdditionalClaims(); + return JWT::encode($assertion, $this->getSigningKey(), $this->getSigningAlgorithm(), $this->getSigningKeyId()); + } + /** + * Generates a request for token credentials. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return RequestInterface the authorization Url. + */ + public function generateCredentialsRequest(callable $httpHandler = null) + { + $uri = $this->getTokenCredentialUri(); + if (is_null($uri)) { + throw new \DomainException('No token credential URI was set.'); + } + $grantType = $this->getGrantType(); + $params = ['grant_type' => $grantType]; + switch ($grantType) { + case 'authorization_code': + $params['code'] = $this->getCode(); + $params['redirect_uri'] = $this->getRedirectUri(); + if ($this->codeVerifier) { + $params['code_verifier'] = $this->codeVerifier; + } + $this->addClientCredentials($params); + break; + case 'password': + $params['username'] = $this->getUsername(); + $params['password'] = $this->getPassword(); + $this->addClientCredentials($params); + break; + case 'refresh_token': + $params['refresh_token'] = $this->getRefreshToken(); + $this->addClientCredentials($params); + break; + case self::JWT_URN: + $params['assertion'] = $this->toJwt(); + break; + case self::STS_URN: + $token = $this->subjectTokenFetcher->fetchSubjectToken($httpHandler); + $params['subject_token'] = $token; + $params['subject_token_type'] = $this->subjectTokenType; + $params += array_filter(['resource' => $this->resource, 'audience' => $this->audience, 'scope' => $this->getScope(), 'requested_token_type' => self::STS_REQUESTED_TOKEN_TYPE, 'actor_token' => $this->actorToken, 'actor_token_type' => $this->actorTokenType]); + break; + default: + if (!is_null($this->getRedirectUri())) { + # Grant type was supposed to be 'authorization_code', as there + # is a redirect URI. + throw new \DomainException('Missing authorization code'); + } + unset($params['grant_type']); + if (!is_null($grantType)) { + $params['grant_type'] = $grantType; + } + $params = array_merge($params, $this->getExtensionParams()); + } + $headers = ['Cache-Control' => 'no-store', 'Content-Type' => 'application/x-www-form-urlencoded']; + return new Request('POST', $uri, $headers, Query::build($params)); + } + /** + * Fetches the auth tokens based on the current state. + * + * @param callable $httpHandler callback which delivers psr7 request + * @return array the response + */ + public function fetchAuthToken(callable $httpHandler = null) + { + if (is_null($httpHandler)) { + $httpHandler = HttpHandlerFactory::build(HttpClientCache::getHttpClient()); + } + $response = $httpHandler($this->generateCredentialsRequest($httpHandler)); + $credentials = $this->parseTokenResponse($response); + $this->updateToken($credentials); + if (isset($credentials['scope'])) { + $this->setGrantedScope($credentials['scope']); + } + return $credentials; + } + /** + * Obtains a key that can used to cache the results of #fetchAuthToken. + * + * The key is derived from the scopes. + * + * @return ?string a key that may be used to cache the auth token. + */ + public function getCacheKey() + { + if (is_array($this->scope)) { + return implode(':', $this->scope); + } + if ($this->audience) { + return $this->audience; + } + // If scope has not set, return null to indicate no caching. + return null; + } + /** + * Parses the fetched tokens. + * + * @param ResponseInterface $resp the response. + * @return array the tokens parsed from the response body. + * @throws \Exception + */ + public function parseTokenResponse(ResponseInterface $resp) + { + $body = (string) $resp->getBody(); + if ($resp->hasHeader('Content-Type') && $resp->getHeaderLine('Content-Type') == 'application/x-www-form-urlencoded') { + $res = []; + parse_str($body, $res); + return $res; + } + // Assume it's JSON; if it's not throw an exception + if (null === ($res = json_decode($body, \true))) { + throw new \Exception('Invalid JSON response'); + } + return $res; + } + /** + * Updates an OAuth 2.0 client. + * + * Example: + * ``` + * $oauth->updateToken([ + * 'refresh_token' => 'n4E9O119d', + * 'access_token' => 'FJQbwq9', + * 'expires_in' => 3600 + * ]); + * ``` + * + * @param array $config + * The configuration parameters related to the token. + * + * - refresh_token + * The refresh token associated with the access token + * to be refreshed. + * + * - access_token + * The current access token for this client. + * + * - id_token + * The current ID token for this client. + * + * - expires_in + * The time in seconds until access token expiration. + * + * - expires_at + * The time as an integer number of seconds since the Epoch + * + * - issued_at + * The timestamp that the token was issued at. + * @return void + */ + public function updateToken(array $config) + { + $opts = array_merge(['extensionParams' => [], 'access_token' => null, 'id_token' => null, 'expires_in' => null, 'expires_at' => null, 'issued_at' => null, 'scope' => null], $config); + $this->setExpiresAt($opts['expires_at']); + $this->setExpiresIn($opts['expires_in']); + // By default, the token is issued at `Time.now` when `expiresIn` is set, + // but this can be used to supply a more precise time. + if (!is_null($opts['issued_at'])) { + $this->setIssuedAt($opts['issued_at']); + } + $this->setAccessToken($opts['access_token']); + $this->setIdToken($opts['id_token']); + // The refresh token should only be updated if a value is explicitly + // passed in, as some access token responses do not include a refresh + // token. + if (array_key_exists('refresh_token', $opts)) { + $this->setRefreshToken($opts['refresh_token']); + } + // Required for STS response. An identifier for the representation of + // the issued security token. + if (array_key_exists('issued_token_type', $opts)) { + $this->issuedTokenType = $opts['issued_token_type']; + } + } + /** + * Builds the authorization Uri that the user should be redirected to. + * + * @param array $config configuration options that customize the return url. + * @return UriInterface the authorization Url. + * @throws InvalidArgumentException + */ + public function buildFullAuthorizationUri(array $config = []) + { + if (is_null($this->getAuthorizationUri())) { + throw new InvalidArgumentException('requires an authorizationUri to have been set'); + } + $params = array_merge(['response_type' => 'code', 'access_type' => 'offline', 'client_id' => $this->clientId, 'redirect_uri' => $this->redirectUri, 'state' => $this->state, 'scope' => $this->getScope()], $config); + // Validate the auth_params + if (is_null($params['client_id'])) { + throw new InvalidArgumentException('missing the required client identifier'); + } + if (is_null($params['redirect_uri'])) { + throw new InvalidArgumentException('missing the required redirect URI'); + } + if (!empty($params['prompt']) && !empty($params['approval_prompt'])) { + throw new InvalidArgumentException('prompt and approval_prompt are mutually exclusive'); + } + if ($this->codeVerifier) { + $params['code_challenge'] = $this->getCodeChallenge($this->codeVerifier); + $params['code_challenge_method'] = $this->getCodeChallengeMethod(); + } + // Construct the uri object; return it if it is valid. + $result = clone $this->authorizationUri; + $existingParams = Query::parse($result->getQuery()); + $result = $result->withQuery(Query::build(array_merge($existingParams, $params))); + if ($result->getScheme() != 'https') { + throw new InvalidArgumentException('Authorization endpoint must be protected by TLS'); + } + return $result; + } + /** + * @return string|null + */ + public function getCodeVerifier() : ?string + { + return $this->codeVerifier; + } + /** + * A cryptographically random string that is used to correlate the + * authorization request to the token request. + * + * The code verifier for PKCE for OAuth 2.0. When set, the authorization + * URI will contain the Code Challenge and Code Challenge Method querystring + * parameters, and the token URI will contain the Code Verifier parameter. + * + * @see https://datatracker.ietf.org/doc/html/rfc7636 + * + * @param string|null $codeVerifier + */ + public function setCodeVerifier(?string $codeVerifier) : void + { + $this->codeVerifier = $codeVerifier; + } + /** + * Generates a random 128-character string for the "code_verifier" parameter + * in PKCE for OAuth 2.0. This is a cryptographically random string that is + * determined using random_int, hashed using "hash" and sha256, and base64 + * encoded. + * + * When this method is called, the code verifier is set on the object. + * + * @return string + */ + public function generateCodeVerifier() : string + { + return $this->codeVerifier = $this->generateRandomString(128); + } + private function getCodeChallenge(string $randomString) : string + { + return rtrim(strtr(base64_encode(hash('sha256', $randomString, \true)), '+/', '-_'), '='); + } + private function getCodeChallengeMethod() : string + { + return 'S256'; + } + private function generateRandomString(int $length) : string + { + $validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~'; + $validCharsLen = strlen($validChars); + $str = ''; + $i = 0; + while ($i++ < $length) { + $str .= $validChars[random_int(0, $validCharsLen - 1)]; + } + return $str; + } + /** + * Sets the authorization server's HTTP endpoint capable of authenticating + * the end-user and obtaining authorization. + * + * @param string $uri + * @return void + */ + public function setAuthorizationUri($uri) + { + $this->authorizationUri = $this->coerceUri($uri); + } + /** + * Gets the authorization server's HTTP endpoint capable of authenticating + * the end-user and obtaining authorization. + * + * @return ?UriInterface + */ + public function getAuthorizationUri() + { + return $this->authorizationUri; + } + /** + * Gets the authorization server's HTTP endpoint capable of issuing tokens + * and refreshing expired tokens. + * + * @return ?UriInterface + */ + public function getTokenCredentialUri() + { + return $this->tokenCredentialUri; + } + /** + * Sets the authorization server's HTTP endpoint capable of issuing tokens + * and refreshing expired tokens. + * + * @param string $uri + * @return void + */ + public function setTokenCredentialUri($uri) + { + $this->tokenCredentialUri = $this->coerceUri($uri); + } + /** + * Gets the redirection URI used in the initial request. + * + * @return ?string + */ + public function getRedirectUri() + { + return $this->redirectUri; + } + /** + * Sets the redirection URI used in the initial request. + * + * @param ?string $uri + * @return void + */ + public function setRedirectUri($uri) + { + if (is_null($uri)) { + $this->redirectUri = null; + return; + } + // redirect URI must be absolute + if (!$this->isAbsoluteUri($uri)) { + // "postmessage" is a reserved URI string in Google-land + // @see https://developers.google.com/identity/sign-in/web/server-side-flow + if ('postmessage' !== (string) $uri) { + throw new InvalidArgumentException('Redirect URI must be absolute'); + } + } + $this->redirectUri = (string) $uri; + } + /** + * Gets the scope of the access requests as a space-delimited String. + * + * @return ?string + */ + public function getScope() + { + if (is_null($this->scope)) { + return $this->scope; + } + return implode(' ', $this->scope); + } + /** + * Sets the scope of the access request, expressed either as an Array or as + * a space-delimited String. + * + * @param string|array|null $scope + * @return void + * @throws InvalidArgumentException + */ + public function setScope($scope) + { + if (is_null($scope)) { + $this->scope = null; + } elseif (is_string($scope)) { + $this->scope = explode(' ', $scope); + } elseif (is_array($scope)) { + foreach ($scope as $s) { + $pos = strpos($s, ' '); + if ($pos !== \false) { + throw new InvalidArgumentException('array scope values should not contain spaces'); + } + } + $this->scope = $scope; + } else { + throw new InvalidArgumentException('scopes should be a string or array of strings'); + } + } + /** + * Gets the current grant type. + * + * @return ?string + */ + public function getGrantType() + { + if (!is_null($this->grantType)) { + return $this->grantType; + } + // Returns the inferred grant type, based on the current object instance + // state. + if (!is_null($this->code)) { + return 'authorization_code'; + } + if (!is_null($this->refreshToken)) { + return 'refresh_token'; + } + if (!is_null($this->username) && !is_null($this->password)) { + return 'password'; + } + if (!is_null($this->issuer) && !is_null($this->signingKey)) { + return self::JWT_URN; + } + if (!is_null($this->subjectTokenFetcher) && !is_null($this->subjectTokenType)) { + return self::STS_URN; + } + return null; + } + /** + * Sets the current grant type. + * + * @param string $grantType + * @return void + * @throws InvalidArgumentException + */ + public function setGrantType($grantType) + { + if (in_array($grantType, self::$knownGrantTypes)) { + $this->grantType = $grantType; + } else { + // validate URI + if (!$this->isAbsoluteUri($grantType)) { + throw new InvalidArgumentException('invalid grant type'); + } + $this->grantType = (string) $grantType; + } + } + /** + * Gets an arbitrary string designed to allow the client to maintain state. + * + * @return string + */ + public function getState() + { + return $this->state; + } + /** + * Sets an arbitrary string designed to allow the client to maintain state. + * + * @param string $state + * @return void + */ + public function setState($state) + { + $this->state = $state; + } + /** + * Gets the authorization code issued to this client. + * + * @return string + */ + public function getCode() + { + return $this->code; + } + /** + * Sets the authorization code issued to this client. + * + * @param string $code + * @return void + */ + public function setCode($code) + { + $this->code = $code; + } + /** + * Gets the resource owner's username. + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + /** + * Sets the resource owner's username. + * + * @param string $username + * @return void + */ + public function setUsername($username) + { + $this->username = $username; + } + /** + * Gets the resource owner's password. + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + /** + * Sets the resource owner's password. + * + * @param string $password + * @return void + */ + public function setPassword($password) + { + $this->password = $password; + } + /** + * Sets a unique identifier issued to the client to identify itself to the + * authorization server. + * + * @return string + */ + public function getClientId() + { + return $this->clientId; + } + /** + * Sets a unique identifier issued to the client to identify itself to the + * authorization server. + * + * @param string $clientId + * @return void + */ + public function setClientId($clientId) + { + $this->clientId = $clientId; + } + /** + * Gets a shared symmetric secret issued by the authorization server, which + * is used to authenticate the client. + * + * @return string + */ + public function getClientSecret() + { + return $this->clientSecret; + } + /** + * Sets a shared symmetric secret issued by the authorization server, which + * is used to authenticate the client. + * + * @param string $clientSecret + * @return void + */ + public function setClientSecret($clientSecret) + { + $this->clientSecret = $clientSecret; + } + /** + * Gets the Issuer ID when using assertion profile. + * + * @return ?string + */ + public function getIssuer() + { + return $this->issuer; + } + /** + * Sets the Issuer ID when using assertion profile. + * + * @param string $issuer + * @return void + */ + public function setIssuer($issuer) + { + $this->issuer = $issuer; + } + /** + * Gets the target sub when issuing assertions. + * + * @return ?string + */ + public function getSub() + { + return $this->sub; + } + /** + * Sets the target sub when issuing assertions. + * + * @param string $sub + * @return void + */ + public function setSub($sub) + { + $this->sub = $sub; + } + /** + * Gets the target audience when issuing assertions. + * + * @return ?string + */ + public function getAudience() + { + return $this->audience; + } + /** + * Sets the target audience when issuing assertions. + * + * @param string $audience + * @return void + */ + public function setAudience($audience) + { + $this->audience = $audience; + } + /** + * Gets the signing key when using an assertion profile. + * + * @return ?string + */ + public function getSigningKey() + { + return $this->signingKey; + } + /** + * Sets the signing key when using an assertion profile. + * + * @param string $signingKey + * @return void + */ + public function setSigningKey($signingKey) + { + $this->signingKey = $signingKey; + } + /** + * Gets the signing key id when using an assertion profile. + * + * @return ?string + */ + public function getSigningKeyId() + { + return $this->signingKeyId; + } + /** + * Sets the signing key id when using an assertion profile. + * + * @param string $signingKeyId + * @return void + */ + public function setSigningKeyId($signingKeyId) + { + $this->signingKeyId = $signingKeyId; + } + /** + * Gets the signing algorithm when using an assertion profile. + * + * @return ?string + */ + public function getSigningAlgorithm() + { + return $this->signingAlgorithm; + } + /** + * Sets the signing algorithm when using an assertion profile. + * + * @param ?string $signingAlgorithm + * @return void + */ + public function setSigningAlgorithm($signingAlgorithm) + { + if (is_null($signingAlgorithm)) { + $this->signingAlgorithm = null; + } elseif (!in_array($signingAlgorithm, self::$knownSigningAlgorithms)) { + throw new InvalidArgumentException('unknown signing algorithm'); + } else { + $this->signingAlgorithm = $signingAlgorithm; + } + } + /** + * Gets the set of parameters used by extension when using an extension + * grant type. + * + * @return array + */ + public function getExtensionParams() + { + return $this->extensionParams; + } + /** + * Sets the set of parameters used by extension when using an extension + * grant type. + * + * @param array $extensionParams + * @return void + */ + public function setExtensionParams($extensionParams) + { + $this->extensionParams = $extensionParams; + } + /** + * Gets the number of seconds assertions are valid for. + * + * @return int + */ + public function getExpiry() + { + return $this->expiry; + } + /** + * Sets the number of seconds assertions are valid for. + * + * @param int $expiry + * @return void + */ + public function setExpiry($expiry) + { + $this->expiry = $expiry; + } + /** + * Gets the lifetime of the access token in seconds. + * + * @return int + */ + public function getExpiresIn() + { + return $this->expiresIn; + } + /** + * Sets the lifetime of the access token in seconds. + * + * @param ?int $expiresIn + * @return void + */ + public function setExpiresIn($expiresIn) + { + if (is_null($expiresIn)) { + $this->expiresIn = null; + $this->issuedAt = null; + } else { + $this->issuedAt = time(); + $this->expiresIn = (int) $expiresIn; + } + } + /** + * Gets the time the current access token expires at. + * + * @return ?int + */ + public function getExpiresAt() + { + if (!is_null($this->expiresAt)) { + return $this->expiresAt; + } + if (!is_null($this->issuedAt) && !is_null($this->expiresIn)) { + return $this->issuedAt + $this->expiresIn; + } + return null; + } + /** + * Returns true if the acccess token has expired. + * + * @return bool + */ + public function isExpired() + { + $expiration = $this->getExpiresAt(); + $now = time(); + return !is_null($expiration) && $now >= $expiration; + } + /** + * Sets the time the current access token expires at. + * + * @param int $expiresAt + * @return void + */ + public function setExpiresAt($expiresAt) + { + $this->expiresAt = $expiresAt; + } + /** + * Gets the time the current access token was issued at. + * + * @return ?int + */ + public function getIssuedAt() + { + return $this->issuedAt; + } + /** + * Sets the time the current access token was issued at. + * + * @param int $issuedAt + * @return void + */ + public function setIssuedAt($issuedAt) + { + $this->issuedAt = $issuedAt; + } + /** + * Gets the current access token. + * + * @return ?string + */ + public function getAccessToken() + { + return $this->accessToken; + } + /** + * Sets the current access token. + * + * @param string $accessToken + * @return void + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + } + /** + * Gets the current ID token. + * + * @return ?string + */ + public function getIdToken() + { + return $this->idToken; + } + /** + * Sets the current ID token. + * + * @param string $idToken + * @return void + */ + public function setIdToken($idToken) + { + $this->idToken = $idToken; + } + /** + * Get the granted space-separated scopes (if they exist) for the last + * fetched token. + * + * @return string|null + */ + public function getGrantedScope() + { + return $this->grantedScope; + } + /** + * Sets the current ID token. + * + * @param string $grantedScope + * @return void + */ + public function setGrantedScope($grantedScope) + { + $this->grantedScope = $grantedScope; + } + /** + * Gets the refresh token associated with the current access token. + * + * @return ?string + */ + public function getRefreshToken() + { + return $this->refreshToken; + } + /** + * Sets the refresh token associated with the current access token. + * + * @param string $refreshToken + * @return void + */ + public function setRefreshToken($refreshToken) + { + $this->refreshToken = $refreshToken; + } + /** + * Sets additional claims to be included in the JWT token + * + * @param array $additionalClaims + * @return void + */ + public function setAdditionalClaims(array $additionalClaims) + { + $this->additionalClaims = $additionalClaims; + } + /** + * Gets the additional claims to be included in the JWT token. + * + * @return array + */ + public function getAdditionalClaims() + { + return $this->additionalClaims; + } + /** + * Gets the additional claims to be included in the JWT token. + * + * @return ?string + */ + public function getIssuedTokenType() + { + return $this->issuedTokenType; + } + /** + * The expiration of the last received token. + * + * @return array|null + */ + public function getLastReceivedToken() + { + if ($token = $this->getAccessToken()) { + // the bare necessity of an auth token + $authToken = ['access_token' => $token, 'expires_at' => $this->getExpiresAt()]; + } elseif ($idToken = $this->getIdToken()) { + $authToken = ['id_token' => $idToken, 'expires_at' => $this->getExpiresAt()]; + } else { + return null; + } + if ($expiresIn = $this->getExpiresIn()) { + $authToken['expires_in'] = $expiresIn; + } + if ($issuedAt = $this->getIssuedAt()) { + $authToken['issued_at'] = $issuedAt; + } + if ($refreshToken = $this->getRefreshToken()) { + $authToken['refresh_token'] = $refreshToken; + } + return $authToken; + } + /** + * Get the client ID. + * + * Alias of {@see Google\Auth\OAuth2::getClientId()}. + * + * @param callable $httpHandler + * @return string + * @access private + */ + public function getClientName(callable $httpHandler = null) + { + return $this->getClientId(); + } + /** + * @todo handle uri as array + * + * @param ?string $uri + * @return null|UriInterface + */ + private function coerceUri($uri) + { + if (is_null($uri)) { + return null; + } + return Utils::uriFor($uri); + } + /** + * @param string $idToken + * @param Key|Key[]|string|string[] $publicKey + * @param string|string[] $allowedAlgs + * @return object + */ + private function jwtDecode($idToken, $publicKey, $allowedAlgs) + { + $keys = $this->getFirebaseJwtKeys($publicKey, $allowedAlgs); + // Default exception if none are caught. We are using the same exception + // class and message from firebase/php-jwt to preserve backwards + // compatibility. + $e = new \InvalidArgumentException('Key may not be empty'); + foreach ($keys as $key) { + try { + return JWT::decode($idToken, $key); + } catch (\Exception $e) { + // try next alg + } + } + throw $e; + } + /** + * @param Key|Key[]|string|string[] $publicKey + * @param string|string[] $allowedAlgs + * @return Key[] + */ + private function getFirebaseJwtKeys($publicKey, $allowedAlgs) + { + // If $publicKey is instance of Key, return it + if ($publicKey instanceof Key) { + return [$publicKey]; + } + // If $allowedAlgs is empty, $publicKey must be Key or Key[]. + if (empty($allowedAlgs)) { + $keys = []; + foreach ((array) $publicKey as $kid => $pubKey) { + if (!$pubKey instanceof Key) { + throw new \InvalidArgumentException(sprintf('When allowed algorithms is empty, the public key must' . 'be an instance of %s or an array of %s objects', Key::class, Key::class)); + } + $keys[$kid] = $pubKey; + } + return $keys; + } + $allowedAlg = null; + if (is_string($allowedAlgs)) { + $allowedAlg = $allowedAlgs; + } elseif (is_array($allowedAlgs)) { + if (count($allowedAlgs) > 1) { + throw new \InvalidArgumentException('To have multiple allowed algorithms, You must provide an' . ' array of Firebase\\JWT\\Key objects.' . ' See https://github.com/firebase/php-jwt for more information.'); + } + $allowedAlg = array_pop($allowedAlgs); + } else { + throw new \InvalidArgumentException('allowed algorithms must be a string or array.'); + } + if (is_array($publicKey)) { + // When publicKey is greater than 1, create keys with the single alg. + $keys = []; + foreach ($publicKey as $kid => $pubKey) { + if ($pubKey instanceof Key) { + $keys[$kid] = $pubKey; + } else { + $keys[$kid] = new Key($pubKey, $allowedAlg); + } + } + return $keys; + } + return [new Key($publicKey, $allowedAlg)]; + } + /** + * Determines if the URI is absolute based on its scheme and host or path + * (RFC 3986). + * + * @param string $uri + * @return bool + */ + private function isAbsoluteUri($uri) + { + $uri = $this->coerceUri($uri); + return $uri->getScheme() && ($uri->getHost() || $uri->getPath()); + } + /** + * @param array $params + * @return array + */ + private function addClientCredentials(&$params) + { + $clientId = $this->getClientId(); + $clientSecret = $this->getClientSecret(); + if ($clientId && $clientSecret) { + $params['client_id'] = $clientId; + $params['client_secret'] = $clientSecret; + } + return $params; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ProjectIdProviderInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ProjectIdProviderInterface.php new file mode 100644 index 0000000..a430786 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/ProjectIdProviderInterface.php @@ -0,0 +1,32 @@ +auth->getSigningKey(); + $signedString = ''; + if (class_exists('\\phpseclib\\Crypt\\RSA') && !$forceOpenssl) { + $rsa = new RSA(); + $rsa->loadKey($privateKey); + $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1); + $rsa->setHash('sha256'); + $signedString = $rsa->sign($stringToSign); + } elseif (extension_loaded('openssl')) { + openssl_sign($stringToSign, $signedString, $privateKey, 'sha256WithRSAEncryption'); + } else { + // @codeCoverageIgnoreStart + throw new \RuntimeException('OpenSSL is not installed.'); + } + // @codeCoverageIgnoreEnd + return base64_encode($signedString); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/SignBlobInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/SignBlobInterface.php new file mode 100644 index 0000000..9209f1c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/SignBlobInterface.php @@ -0,0 +1,43 @@ + $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null); +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/UpdateMetadataTrait.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/UpdateMetadataTrait.php new file mode 100644 index 0000000..a63a51f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/google/auth/src/UpdateMetadataTrait.php @@ -0,0 +1,62 @@ + $metadata metadata hashmap + * @param string $authUri optional auth uri + * @param callable $httpHandler callback which delivers psr7 request + * @return array updated metadata hashmap + */ + public function updateMetadata($metadata, $authUri = null, callable $httpHandler = null) + { + if (isset($metadata[self::AUTH_METADATA_KEY])) { + // Auth metadata has already been set + return $metadata; + } + $result = $this->fetchAuthToken($httpHandler); + $metadata_copy = $metadata; + if (isset($result['access_token'])) { + $metadata_copy[self::AUTH_METADATA_KEY] = ['Bearer ' . $result['access_token']]; + } elseif (isset($result['id_token'])) { + $metadata_copy[self::AUTH_METADATA_KEY] = ['Bearer ' . $result['id_token']]; + } + return $metadata_copy; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/LICENSE new file mode 100644 index 0000000..fd2375d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/LICENSE @@ -0,0 +1,27 @@ +The MIT License (MIT) + +Copyright (c) 2011 Michael Dowling +Copyright (c) 2012 Jeremy Lindblom +Copyright (c) 2014 Graham Campbell +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Tobias Schultze +Copyright (c) 2016 Tobias Nyholm +Copyright (c) 2016 George Mponos + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/BodySummarizer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/BodySummarizer.php new file mode 100644 index 0000000..6792b70 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/BodySummarizer.php @@ -0,0 +1,23 @@ +truncateAt = $truncateAt; + } + /** + * Returns a summarized message body. + */ + public function summarize(MessageInterface $message) : ?string + { + return $this->truncateAt === null ? \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Psr7\Message::bodySummary($message) : \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Psr7\Message::bodySummary($message, $this->truncateAt); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/BodySummarizerInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/BodySummarizerInterface.php new file mode 100644 index 0000000..7f4ff59 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/BodySummarizerInterface.php @@ -0,0 +1,12 @@ + 'http://www.foo.com/1.0/', + * 'timeout' => 0, + * 'allow_redirects' => false, + * 'proxy' => '192.168.16.1:10' + * ]); + * + * Client configuration settings include the following options: + * + * - handler: (callable) Function that transfers HTTP requests over the + * wire. The function is called with a Psr7\Http\Message\RequestInterface + * and array of transfer options, and must return a + * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a + * Psr7\Http\Message\ResponseInterface on success. + * If no handler is provided, a default handler will be created + * that enables all of the request options below by attaching all of the + * default middleware to the handler. + * - base_uri: (string|UriInterface) Base URI of the client that is merged + * into relative URIs. Can be a string or instance of UriInterface. + * - **: any request option + * + * @param array $config Client configuration settings. + * + * @see \GuzzleHttp\RequestOptions for a list of available request options. + */ + public function __construct(array $config = []) + { + if (!isset($config['handler'])) { + $config['handler'] = HandlerStack::create(); + } elseif (!\is_callable($config['handler'])) { + throw new InvalidArgumentException('handler must be a callable'); + } + // Convert the base_uri to a UriInterface + if (isset($config['base_uri'])) { + $config['base_uri'] = Psr7\Utils::uriFor($config['base_uri']); + } + $this->configureDefaults($config); + } + /** + * @param string $method + * @param array $args + * + * @return PromiseInterface|ResponseInterface + * + * @deprecated Client::__call will be removed in guzzlehttp/guzzle:8.0. + */ + public function __call($method, $args) + { + if (\count($args) < 1) { + throw new InvalidArgumentException('Magic request methods require a URI and optional options array'); + } + $uri = $args[0]; + $opts = $args[1] ?? []; + return \substr($method, -5) === 'Async' ? $this->requestAsync(\substr($method, 0, -5), $uri, $opts) : $this->request($method, $uri, $opts); + } + /** + * Asynchronously send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + */ + public function sendAsync(RequestInterface $request, array $options = []) : PromiseInterface + { + // Merge the base URI into the request URI if needed. + $options = $this->prepareDefaults($options); + return $this->transfer($request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), $options); + } + /** + * Send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function send(RequestInterface $request, array $options = []) : ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = \true; + return $this->sendAsync($request, $options)->wait(); + } + /** + * The HttpClient PSR (PSR-18) specify this method. + * + * {@inheritDoc} + */ + public function sendRequest(RequestInterface $request) : ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = \true; + $options[RequestOptions::ALLOW_REDIRECTS] = \false; + $options[RequestOptions::HTTP_ERRORS] = \false; + return $this->sendAsync($request, $options)->wait(); + } + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + */ + public function requestAsync(string $method, $uri = '', array $options = []) : PromiseInterface + { + $options = $this->prepareDefaults($options); + // Remove request modifying parameter because it can be done up-front. + $headers = $options['headers'] ?? []; + $body = $options['body'] ?? null; + $version = $options['version'] ?? '1.1'; + // Merge the URI into the base URI. + $uri = $this->buildUri(Psr7\Utils::uriFor($uri), $options); + if (\is_array($body)) { + throw $this->invalidBody(); + } + $request = new Psr7\Request($method, $uri, $headers, $body, $version); + // Remove the option so that they are not doubly-applied. + unset($options['headers'], $options['body'], $options['version']); + return $this->transfer($request, $options); + } + /** + * Create and send an HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string $method HTTP method. + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + * + * @throws GuzzleException + */ + public function request(string $method, $uri = '', array $options = []) : ResponseInterface + { + $options[RequestOptions::SYNCHRONOUS] = \true; + return $this->requestAsync($method, $uri, $options)->wait(); + } + /** + * Get a client configuration option. + * + * These options include default request options of the client, a "handler" + * (if utilized by the concrete client), and a "base_uri" if utilized by + * the concrete client. + * + * @param string|null $option The config option to retrieve. + * + * @return mixed + * + * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0. + */ + public function getConfig(string $option = null) + { + return $option === null ? $this->config : $this->config[$option] ?? null; + } + private function buildUri(UriInterface $uri, array $config) : UriInterface + { + if (isset($config['base_uri'])) { + $uri = Psr7\UriResolver::resolve(Psr7\Utils::uriFor($config['base_uri']), $uri); + } + if (isset($config['idn_conversion']) && $config['idn_conversion'] !== \false) { + $idnOptions = $config['idn_conversion'] === \true ? \IDNA_DEFAULT : $config['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; + } + /** + * Configures the default options for a client. + */ + private function configureDefaults(array $config) : void + { + $defaults = ['allow_redirects' => RedirectMiddleware::$defaultSettings, 'http_errors' => \true, 'decode_content' => \true, 'verify' => \true, 'cookies' => \false, 'idn_conversion' => \false]; + // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. + // We can only trust the HTTP_PROXY environment variable in a CLI + // process due to the fact that PHP has no reliable mechanism to + // get environment variables that start with "HTTP_". + if (\PHP_SAPI === 'cli' && ($proxy = Utils::getenv('HTTP_PROXY'))) { + $defaults['proxy']['http'] = $proxy; + } + if ($proxy = Utils::getenv('HTTPS_PROXY')) { + $defaults['proxy']['https'] = $proxy; + } + if ($noProxy = Utils::getenv('NO_PROXY')) { + $cleanedNoProxy = \str_replace(' ', '', $noProxy); + $defaults['proxy']['no'] = \explode(',', $cleanedNoProxy); + } + $this->config = $config + $defaults; + if (!empty($config['cookies']) && $config['cookies'] === \true) { + $this->config['cookies'] = new CookieJar(); + } + // Add the default user-agent header. + if (!isset($this->config['headers'])) { + $this->config['headers'] = ['User-Agent' => Utils::defaultUserAgent()]; + } else { + // Add the User-Agent header if one was not already set. + foreach (\array_keys($this->config['headers']) as $name) { + if (\strtolower($name) === 'user-agent') { + return; + } + } + $this->config['headers']['User-Agent'] = Utils::defaultUserAgent(); + } + } + /** + * Merges default options into the array. + * + * @param array $options Options to modify by reference + */ + private function prepareDefaults(array $options) : array + { + $defaults = $this->config; + if (!empty($defaults['headers'])) { + // Default headers are only added if they are not present. + $defaults['_conditional'] = $defaults['headers']; + unset($defaults['headers']); + } + // Special handling for headers is required as they are added as + // conditional headers and as headers passed to a request ctor. + if (\array_key_exists('headers', $options)) { + // Allows default headers to be unset. + if ($options['headers'] === null) { + $defaults['_conditional'] = []; + unset($options['headers']); + } elseif (!\is_array($options['headers'])) { + throw new InvalidArgumentException('headers must be an array'); + } + } + // Shallow merge defaults underneath options. + $result = $options + $defaults; + // Remove null values. + foreach ($result as $k => $v) { + if ($v === null) { + unset($result[$k]); + } + } + return $result; + } + /** + * Transfers the given request and applies request options. + * + * The URI of the request is not modified and the request options are used + * as-is without merging in default options. + * + * @param array $options See \GuzzleHttp\RequestOptions. + */ + private function transfer(RequestInterface $request, array $options) : PromiseInterface + { + $request = $this->applyOptions($request, $options); + /** @var HandlerStack $handler */ + $handler = $options['handler']; + try { + return P\Create::promiseFor($handler($request, $options)); + } catch (\Exception $e) { + return P\Create::rejectionFor($e); + } + } + /** + * Applies the array of request options to a request. + */ + private function applyOptions(RequestInterface $request, array &$options) : RequestInterface + { + $modify = ['set_headers' => []]; + if (isset($options['headers'])) { + if (array_keys($options['headers']) === range(0, count($options['headers']) - 1)) { + throw new InvalidArgumentException('The headers array must have header name as keys.'); + } + $modify['set_headers'] = $options['headers']; + unset($options['headers']); + } + if (isset($options['form_params'])) { + if (isset($options['multipart'])) { + throw new InvalidArgumentException('You cannot use ' . 'form_params and multipart at the same time. Use the ' . 'form_params option if you want to send application/' . 'x-www-form-urlencoded requests, and the multipart ' . 'option to send multipart/form-data requests.'); + } + $options['body'] = \http_build_query($options['form_params'], '', '&'); + unset($options['form_params']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + if (isset($options['multipart'])) { + $options['body'] = new Psr7\MultipartStream($options['multipart']); + unset($options['multipart']); + } + if (isset($options['json'])) { + $options['body'] = Utils::jsonEncode($options['json']); + unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/json'; + } + if (!empty($options['decode_content']) && $options['decode_content'] !== \true) { + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Accept-Encoding'], $options['_conditional']); + $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; + } + if (isset($options['body'])) { + if (\is_array($options['body'])) { + throw $this->invalidBody(); + } + $modify['body'] = Psr7\Utils::streamFor($options['body']); + unset($options['body']); + } + if (!empty($options['auth']) && \is_array($options['auth'])) { + $value = $options['auth']; + $type = isset($value[2]) ? \strtolower($value[2]) : 'basic'; + switch ($type) { + case 'basic': + // Ensure that we don't have the header in different case and set the new value. + $modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']); + $modify['set_headers']['Authorization'] = 'Basic ' . \base64_encode("{$value[0]}:{$value[1]}"); + break; + case 'digest': + // @todo: Do not rely on curl + $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST; + $options['curl'][\CURLOPT_USERPWD] = "{$value[0]}:{$value[1]}"; + break; + case 'ntlm': + $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_NTLM; + $options['curl'][\CURLOPT_USERPWD] = "{$value[0]}:{$value[1]}"; + break; + } + } + if (isset($options['query'])) { + $value = $options['query']; + if (\is_array($value)) { + $value = \http_build_query($value, '', '&', \PHP_QUERY_RFC3986); + } + if (!\is_string($value)) { + throw new InvalidArgumentException('query must be a string or array'); + } + $modify['query'] = $value; + unset($options['query']); + } + // Ensure that sink is not an invalid value. + if (isset($options['sink'])) { + // TODO: Add more sink validation? + if (\is_bool($options['sink'])) { + throw new InvalidArgumentException('sink must not be a boolean'); + } + } + if (isset($options['version'])) { + $modify['version'] = $options['version']; + } + $request = Psr7\Utils::modifyRequest($request, $modify); + if ($request->getBody() instanceof Psr7\MultipartStream) { + // Use a multipart/form-data POST if a Content-Type is not set. + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' . $request->getBody()->getBoundary(); + } + // Merge in conditional headers if they are not present. + if (isset($options['_conditional'])) { + // Build up the changes so it's in a single clone of the message. + $modify = []; + foreach ($options['_conditional'] as $k => $v) { + if (!$request->hasHeader($k)) { + $modify['set_headers'][$k] = $v; + } + } + $request = Psr7\Utils::modifyRequest($request, $modify); + // Don't pass this internal value along to middleware/handlers. + unset($options['_conditional']); + } + return $request; + } + /** + * Return an InvalidArgumentException with pre-set message. + */ + private function invalidBody() : InvalidArgumentException + { + return new InvalidArgumentException('Passing in the "body" request ' . 'option as an array to send a request is not supported. ' . 'Please use the "form_params" request option to send a ' . 'application/x-www-form-urlencoded request, or the "multipart" ' . 'request option to send a multipart/form-data request.'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/ClientInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/ClientInterface.php new file mode 100644 index 0000000..217672e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/ClientInterface.php @@ -0,0 +1,78 @@ +request('GET', $uri, $options); + } + /** + * Create and send an HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function head($uri, array $options = []) : ResponseInterface + { + return $this->request('HEAD', $uri, $options); + } + /** + * Create and send an HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function put($uri, array $options = []) : ResponseInterface + { + return $this->request('PUT', $uri, $options); + } + /** + * Create and send an HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function post($uri, array $options = []) : ResponseInterface + { + return $this->request('POST', $uri, $options); + } + /** + * Create and send an HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function patch($uri, array $options = []) : ResponseInterface + { + return $this->request('PATCH', $uri, $options); + } + /** + * Create and send an HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + * + * @throws GuzzleException + */ + public function delete($uri, array $options = []) : ResponseInterface + { + return $this->request('DELETE', $uri, $options); + } + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public abstract function requestAsync(string $method, $uri, array $options = []) : PromiseInterface; + /** + * Create and send an asynchronous HTTP GET request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function getAsync($uri, array $options = []) : PromiseInterface + { + return $this->requestAsync('GET', $uri, $options); + } + /** + * Create and send an asynchronous HTTP HEAD request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function headAsync($uri, array $options = []) : PromiseInterface + { + return $this->requestAsync('HEAD', $uri, $options); + } + /** + * Create and send an asynchronous HTTP PUT request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function putAsync($uri, array $options = []) : PromiseInterface + { + return $this->requestAsync('PUT', $uri, $options); + } + /** + * Create and send an asynchronous HTTP POST request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function postAsync($uri, array $options = []) : PromiseInterface + { + return $this->requestAsync('POST', $uri, $options); + } + /** + * Create and send an asynchronous HTTP PATCH request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function patchAsync($uri, array $options = []) : PromiseInterface + { + return $this->requestAsync('PATCH', $uri, $options); + } + /** + * Create and send an asynchronous HTTP DELETE request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. + */ + public function deleteAsync($uri, array $options = []) : PromiseInterface + { + return $this->requestAsync('DELETE', $uri, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php new file mode 100644 index 0000000..e212e48 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -0,0 +1,240 @@ +strictMode = $strictMode; + foreach ($cookieArray as $cookie) { + if (!$cookie instanceof SetCookie) { + $cookie = new SetCookie($cookie); + } + $this->setCookie($cookie); + } + } + /** + * Create a new Cookie jar from an associative array and domain. + * + * @param array $cookies Cookies to create the jar from + * @param string $domain Domain to set the cookies to + */ + public static function fromArray(array $cookies, string $domain) : self + { + $cookieJar = new self(); + foreach ($cookies as $name => $value) { + $cookieJar->setCookie(new SetCookie(['Domain' => $domain, 'Name' => $name, 'Value' => $value, 'Discard' => \true])); + } + return $cookieJar; + } + /** + * Evaluate if this cookie should be persisted to storage + * that survives between requests. + * + * @param SetCookie $cookie Being evaluated. + * @param bool $allowSessionCookies If we should persist session cookies + */ + public static function shouldPersist(SetCookie $cookie, bool $allowSessionCookies = \false) : bool + { + if ($cookie->getExpires() || $allowSessionCookies) { + if (!$cookie->getDiscard()) { + return \true; + } + } + return \false; + } + /** + * Finds and returns the cookie based on the name + * + * @param string $name cookie name to search for + * + * @return SetCookie|null cookie that was found or null if not found + */ + public function getCookieByName(string $name) : ?SetCookie + { + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && \strcasecmp($cookie->getName(), $name) === 0) { + return $cookie; + } + } + return null; + } + public function toArray() : array + { + return \array_map(static function (SetCookie $cookie) : array { + return $cookie->toArray(); + }, $this->getIterator()->getArrayCopy()); + } + public function clear(string $domain = null, string $path = null, string $name = null) : void + { + if (!$domain) { + $this->cookies = []; + return; + } elseif (!$path) { + $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) use($domain) : bool { + return !$cookie->matchesDomain($domain); + }); + } elseif (!$name) { + $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) use($path, $domain) : bool { + return !($cookie->matchesPath($path) && $cookie->matchesDomain($domain)); + }); + } else { + $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) use($path, $domain, $name) { + return !($cookie->getName() == $name && $cookie->matchesPath($path) && $cookie->matchesDomain($domain)); + }); + } + } + public function clearSessionCookies() : void + { + $this->cookies = \array_filter($this->cookies, static function (SetCookie $cookie) : bool { + return !$cookie->getDiscard() && $cookie->getExpires(); + }); + } + public function setCookie(SetCookie $cookie) : bool + { + // If the name string is empty (but not 0), ignore the set-cookie + // string entirely. + $name = $cookie->getName(); + if (!$name && $name !== '0') { + return \false; + } + // Only allow cookies with set and valid domain, name, value + $result = $cookie->validate(); + if ($result !== \true) { + if ($this->strictMode) { + throw new \RuntimeException('Invalid cookie: ' . $result); + } + $this->removeCookieIfEmpty($cookie); + return \false; + } + // Resolve conflicts with previously set cookies + foreach ($this->cookies as $i => $c) { + // Two cookies are identical, when their path, and domain are + // identical. + if ($c->getPath() != $cookie->getPath() || $c->getDomain() != $cookie->getDomain() || $c->getName() != $cookie->getName()) { + continue; + } + // The previously set cookie is a discard cookie and this one is + // not so allow the new cookie to be set + if (!$cookie->getDiscard() && $c->getDiscard()) { + unset($this->cookies[$i]); + continue; + } + // If the new cookie's expiration is further into the future, then + // replace the old cookie + if ($cookie->getExpires() > $c->getExpires()) { + unset($this->cookies[$i]); + continue; + } + // If the value has changed, we better change it + if ($cookie->getValue() !== $c->getValue()) { + unset($this->cookies[$i]); + continue; + } + // The cookie exists, so no need to continue + return \false; + } + $this->cookies[] = $cookie; + return \true; + } + public function count() : int + { + return \count($this->cookies); + } + /** + * @return \ArrayIterator + */ + public function getIterator() : \ArrayIterator + { + return new \ArrayIterator(\array_values($this->cookies)); + } + public function extractCookies(RequestInterface $request, ResponseInterface $response) : void + { + if ($cookieHeader = $response->getHeader('Set-Cookie')) { + foreach ($cookieHeader as $cookie) { + $sc = SetCookie::fromString($cookie); + if (!$sc->getDomain()) { + $sc->setDomain($request->getUri()->getHost()); + } + if (0 !== \strpos($sc->getPath(), '/')) { + $sc->setPath($this->getCookiePathFromRequest($request)); + } + if (!$sc->matchesDomain($request->getUri()->getHost())) { + continue; + } + // Note: At this point `$sc->getDomain()` being a public suffix should + // be rejected, but we don't want to pull in the full PSL dependency. + $this->setCookie($sc); + } + } + } + /** + * Computes cookie path following RFC 6265 section 5.1.4 + * + * @see https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4 + */ + private function getCookiePathFromRequest(RequestInterface $request) : string + { + $uriPath = $request->getUri()->getPath(); + if ('' === $uriPath) { + return '/'; + } + if (0 !== \strpos($uriPath, '/')) { + return '/'; + } + if ('/' === $uriPath) { + return '/'; + } + $lastSlashPos = \strrpos($uriPath, '/'); + if (0 === $lastSlashPos || \false === $lastSlashPos) { + return '/'; + } + return \substr($uriPath, 0, $lastSlashPos); + } + public function withCookieHeader(RequestInterface $request) : RequestInterface + { + $values = []; + $uri = $request->getUri(); + $scheme = $uri->getScheme(); + $host = $uri->getHost(); + $path = $uri->getPath() ?: '/'; + foreach ($this->cookies as $cookie) { + if ($cookie->matchesPath($path) && $cookie->matchesDomain($host) && !$cookie->isExpired() && (!$cookie->getSecure() || $scheme === 'https')) { + $values[] = $cookie->getName() . '=' . $cookie->getValue(); + } + } + return $values ? $request->withHeader('Cookie', \implode('; ', $values)) : $request; + } + /** + * If a cookie already exists and the server asks to set it again with a + * null value, the cookie must be deleted. + */ + private function removeCookieIfEmpty(SetCookie $cookie) : void + { + $cookieValue = $cookie->getValue(); + if ($cookieValue === null || $cookieValue === '') { + $this->clear($cookie->getDomain(), $cookie->getPath(), $cookie->getName()); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php new file mode 100644 index 0000000..977b7cb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -0,0 +1,74 @@ + + */ +interface CookieJarInterface extends \Countable, \IteratorAggregate +{ + /** + * Create a request with added cookie headers. + * + * If no matching cookies are found in the cookie jar, then no Cookie + * header is added to the request and the same request is returned. + * + * @param RequestInterface $request Request object to modify. + * + * @return RequestInterface returns the modified request. + */ + public function withCookieHeader(RequestInterface $request) : RequestInterface; + /** + * Extract cookies from an HTTP response and store them in the CookieJar. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface $response Response that was received + */ + public function extractCookies(RequestInterface $request, ResponseInterface $response) : void; + /** + * Sets a cookie in the cookie jar. + * + * @param SetCookie $cookie Cookie to set. + * + * @return bool Returns true on success or false on failure + */ + public function setCookie(SetCookie $cookie) : bool; + /** + * Remove cookies currently held in the cookie jar. + * + * Invoking this method without arguments will empty the whole cookie jar. + * If given a $domain argument only cookies belonging to that domain will + * be removed. If given a $domain and $path argument, cookies belonging to + * the specified path within that domain are removed. If given all three + * arguments, then the cookie with the specified name, path and domain is + * removed. + * + * @param string|null $domain Clears cookies matching a domain + * @param string|null $path Clears cookies matching a domain and path + * @param string|null $name Clears cookies matching a domain, path, and name + */ + public function clear(string $domain = null, string $path = null, string $name = null) : void; + /** + * Discard all sessions cookies. + * + * Removes cookies that don't have an expire field or a have a discard + * field set to true. To be called when the user agent shuts down according + * to RFC 2965. + */ + public function clearSessionCookies() : void; + /** + * Converts the cookie jar to an array. + */ + public function toArray() : array; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php new file mode 100644 index 0000000..fea38c2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php @@ -0,0 +1,92 @@ +filename = $cookieFile; + $this->storeSessionCookies = $storeSessionCookies; + if (\file_exists($cookieFile)) { + $this->load($cookieFile); + } + } + /** + * Saves the file when shutting down + */ + public function __destruct() + { + $this->save($this->filename); + } + /** + * Saves the cookies to a file. + * + * @param string $filename File to save + * + * @throws \RuntimeException if the file cannot be found or created + */ + public function save(string $filename) : void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + $jsonStr = Utils::jsonEncode($json); + if (\false === \file_put_contents($filename, $jsonStr, \LOCK_EX)) { + throw new \RuntimeException("Unable to save file {$filename}"); + } + } + /** + * Load cookies from a JSON formatted file. + * + * Old cookies are kept unless overwritten by newly loaded ones. + * + * @param string $filename Cookie file to load. + * + * @throws \RuntimeException if the file cannot be loaded. + */ + public function load(string $filename) : void + { + $json = \file_get_contents($filename); + if (\false === $json) { + throw new \RuntimeException("Unable to load file {$filename}"); + } + if ($json === '') { + return; + } + $data = Utils::jsonDecode($json, \true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\is_scalar($data) && !empty($data)) { + throw new \RuntimeException("Invalid cookie file: {$filename}"); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php new file mode 100644 index 0000000..fd0510e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -0,0 +1,71 @@ +sessionKey = $sessionKey; + $this->storeSessionCookies = $storeSessionCookies; + $this->load(); + } + /** + * Saves cookies to session when shutting down + */ + public function __destruct() + { + $this->save(); + } + /** + * Save cookies to the client session + */ + public function save() : void + { + $json = []; + /** @var SetCookie $cookie */ + foreach ($this as $cookie) { + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { + $json[] = $cookie->toArray(); + } + } + $_SESSION[$this->sessionKey] = \json_encode($json); + } + /** + * Load the contents of the client session into the data array + */ + protected function load() : void + { + if (!isset($_SESSION[$this->sessionKey])) { + return; + } + $data = \json_decode($_SESSION[$this->sessionKey], \true); + if (\is_array($data)) { + foreach ($data as $cookie) { + $this->setCookie(new SetCookie($cookie)); + } + } elseif (\strlen($data)) { + throw new \RuntimeException('Invalid cookie data'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/SetCookie.php new file mode 100644 index 0000000..be0cc0c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -0,0 +1,407 @@ + null, 'Value' => null, 'Domain' => null, 'Path' => '/', 'Max-Age' => null, 'Expires' => null, 'Secure' => \false, 'Discard' => \false, 'HttpOnly' => \false]; + /** + * @var array Cookie data + */ + private $data; + /** + * Create a new SetCookie object from a string. + * + * @param string $cookie Set-Cookie header string + */ + public static function fromString(string $cookie) : self + { + // Create the default return array + $data = self::$defaults; + // Explode the cookie string using a series of semicolons + $pieces = \array_filter(\array_map('trim', \explode(';', $cookie))); + // The name of the cookie (first kvp) must exist and include an equal sign. + if (!isset($pieces[0]) || \strpos($pieces[0], '=') === \false) { + return new self($data); + } + // Add the cookie pieces into the parsed data array + foreach ($pieces as $part) { + $cookieParts = \explode('=', $part, 2); + $key = \trim($cookieParts[0]); + $value = isset($cookieParts[1]) ? \trim($cookieParts[1], " \n\r\t\x00\v") : \true; + // Only check for non-cookies when cookies have been found + if (!isset($data['Name'])) { + $data['Name'] = $key; + $data['Value'] = $value; + } else { + foreach (\array_keys(self::$defaults) as $search) { + if (!\strcasecmp($search, $key)) { + if ($search === 'Max-Age') { + if (is_numeric($value)) { + $data[$search] = (int) $value; + } + } else { + $data[$search] = $value; + } + continue 2; + } + } + $data[$key] = $value; + } + } + return new self($data); + } + /** + * @param array $data Array of cookie data provided by a Cookie parser + */ + public function __construct(array $data = []) + { + $this->data = self::$defaults; + if (isset($data['Name'])) { + $this->setName($data['Name']); + } + if (isset($data['Value'])) { + $this->setValue($data['Value']); + } + if (isset($data['Domain'])) { + $this->setDomain($data['Domain']); + } + if (isset($data['Path'])) { + $this->setPath($data['Path']); + } + if (isset($data['Max-Age'])) { + $this->setMaxAge($data['Max-Age']); + } + if (isset($data['Expires'])) { + $this->setExpires($data['Expires']); + } + if (isset($data['Secure'])) { + $this->setSecure($data['Secure']); + } + if (isset($data['Discard'])) { + $this->setDiscard($data['Discard']); + } + if (isset($data['HttpOnly'])) { + $this->setHttpOnly($data['HttpOnly']); + } + // Set the remaining values that don't have extra validation logic + foreach (array_diff(array_keys($data), array_keys(self::$defaults)) as $key) { + $this->data[$key] = $data[$key]; + } + // Extract the Expires value and turn it into a UNIX timestamp if needed + if (!$this->getExpires() && $this->getMaxAge()) { + // Calculate the Expires date + $this->setExpires(\time() + $this->getMaxAge()); + } elseif (null !== ($expires = $this->getExpires()) && !\is_numeric($expires)) { + $this->setExpires($expires); + } + } + public function __toString() + { + $str = $this->data['Name'] . '=' . ($this->data['Value'] ?? '') . '; '; + foreach ($this->data as $k => $v) { + if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== \false) { + if ($k === 'Expires') { + $str .= 'Expires=' . \gmdate('D, d M Y H:i:s \\G\\M\\T', $v) . '; '; + } else { + $str .= ($v === \true ? $k : "{$k}={$v}") . '; '; + } + } + } + return \rtrim($str, '; '); + } + public function toArray() : array + { + return $this->data; + } + /** + * Get the cookie name. + * + * @return string + */ + public function getName() + { + return $this->data['Name']; + } + /** + * Set the cookie name. + * + * @param string $name Cookie name + */ + public function setName($name) : void + { + if (!is_string($name)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Name'] = (string) $name; + } + /** + * Get the cookie value. + * + * @return string|null + */ + public function getValue() + { + return $this->data['Value']; + } + /** + * Set the cookie value. + * + * @param string $value Cookie value + */ + public function setValue($value) : void + { + if (!is_string($value)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Value'] = (string) $value; + } + /** + * Get the domain. + * + * @return string|null + */ + public function getDomain() + { + return $this->data['Domain']; + } + /** + * Set the domain of the cookie. + * + * @param string|null $domain + */ + public function setDomain($domain) : void + { + if (!is_string($domain) && null !== $domain) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Domain'] = null === $domain ? null : (string) $domain; + } + /** + * Get the path. + * + * @return string + */ + public function getPath() + { + return $this->data['Path']; + } + /** + * Set the path of the cookie. + * + * @param string $path Path of the cookie + */ + public function setPath($path) : void + { + if (!is_string($path)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Path'] = (string) $path; + } + /** + * Maximum lifetime of the cookie in seconds. + * + * @return int|null + */ + public function getMaxAge() + { + return null === $this->data['Max-Age'] ? null : (int) $this->data['Max-Age']; + } + /** + * Set the max-age of the cookie. + * + * @param int|null $maxAge Max age of the cookie in seconds + */ + public function setMaxAge($maxAge) : void + { + if (!is_int($maxAge) && null !== $maxAge) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Max-Age'] = $maxAge === null ? null : (int) $maxAge; + } + /** + * The UNIX timestamp when the cookie Expires. + * + * @return string|int|null + */ + public function getExpires() + { + return $this->data['Expires']; + } + /** + * Set the unix timestamp for which the cookie will expire. + * + * @param int|string|null $timestamp Unix timestamp or any English textual datetime description. + */ + public function setExpires($timestamp) : void + { + if (!is_int($timestamp) && !is_string($timestamp) && null !== $timestamp) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an int, string or null to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Expires'] = null === $timestamp ? null : (\is_numeric($timestamp) ? (int) $timestamp : \strtotime((string) $timestamp)); + } + /** + * Get whether or not this is a secure cookie. + * + * @return bool + */ + public function getSecure() + { + return $this->data['Secure']; + } + /** + * Set whether or not the cookie is secure. + * + * @param bool $secure Set to true or false if secure + */ + public function setSecure($secure) : void + { + if (!is_bool($secure)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Secure'] = (bool) $secure; + } + /** + * Get whether or not this is a session cookie. + * + * @return bool|null + */ + public function getDiscard() + { + return $this->data['Discard']; + } + /** + * Set whether or not this is a session cookie. + * + * @param bool $discard Set to true or false if this is a session cookie + */ + public function setDiscard($discard) : void + { + if (!is_bool($discard)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['Discard'] = (bool) $discard; + } + /** + * Get whether or not this is an HTTP only cookie. + * + * @return bool + */ + public function getHttpOnly() + { + return $this->data['HttpOnly']; + } + /** + * Set whether or not this is an HTTP only cookie. + * + * @param bool $httpOnly Set to true or false if this is HTTP only + */ + public function setHttpOnly($httpOnly) : void + { + if (!is_bool($httpOnly)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a bool to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->data['HttpOnly'] = (bool) $httpOnly; + } + /** + * Check if the cookie matches a path value. + * + * A request-path path-matches a given cookie-path if at least one of + * the following conditions holds: + * + * - The cookie-path and the request-path are identical. + * - The cookie-path is a prefix of the request-path, and the last + * character of the cookie-path is %x2F ("/"). + * - The cookie-path is a prefix of the request-path, and the first + * character of the request-path that is not included in the cookie- + * path is a %x2F ("/") character. + * + * @param string $requestPath Path to check against + */ + public function matchesPath(string $requestPath) : bool + { + $cookiePath = $this->getPath(); + // Match on exact matches or when path is the default empty "/" + if ($cookiePath === '/' || $cookiePath == $requestPath) { + return \true; + } + // Ensure that the cookie-path is a prefix of the request path. + if (0 !== \strpos($requestPath, $cookiePath)) { + return \false; + } + // Match if the last character of the cookie-path is "/" + if (\substr($cookiePath, -1, 1) === '/') { + return \true; + } + // Match if the first character not included in cookie path is "/" + return \substr($requestPath, \strlen($cookiePath), 1) === '/'; + } + /** + * Check if the cookie matches a domain value. + * + * @param string $domain Domain to check against + */ + public function matchesDomain(string $domain) : bool + { + $cookieDomain = $this->getDomain(); + if (null === $cookieDomain) { + return \true; + } + // Remove the leading '.' as per spec in RFC 6265. + // https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.3 + $cookieDomain = \ltrim(\strtolower($cookieDomain), '.'); + $domain = \strtolower($domain); + // Domain not set or exact match. + if ('' === $cookieDomain || $domain === $cookieDomain) { + return \true; + } + // Matching the subdomain according to RFC 6265. + // https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3 + if (\filter_var($domain, \FILTER_VALIDATE_IP)) { + return \false; + } + return (bool) \preg_match('/\\.' . \preg_quote($cookieDomain, '/') . '$/', $domain); + } + /** + * Check if the cookie is expired. + */ + public function isExpired() : bool + { + return $this->getExpires() !== null && \time() > $this->getExpires(); + } + /** + * Check if the cookie is valid according to RFC 6265. + * + * @return bool|string Returns true if valid or an error message if invalid + */ + public function validate() + { + $name = $this->getName(); + if ($name === '') { + return 'The cookie name must not be empty'; + } + // Check if any of the invalid characters are present in the cookie name + if (\preg_match('/[\\x00-\\x20\\x22\\x28-\\x29\\x2c\\x2f\\x3a-\\x40\\x5c\\x7b\\x7d\\x7f]/', $name)) { + return 'Cookie name must not contain invalid characters: ASCII ' . 'Control characters (0-31;127), space, tab and the ' . 'following characters: ()<>@,;:\\"/?={}'; + } + // Value must not be null. 0 and empty string are valid. Empty strings + // are technically against RFC 6265, but known to happen in the wild. + $value = $this->getValue(); + if ($value === null) { + return 'The cookie value must not be empty'; + } + // Domains must not be empty, but can be 0. "0" is not a valid internet + // domain, but may be used as server name in a private network. + $domain = $this->getDomain(); + if ($domain === null || $domain === '') { + return 'The cookie domain must not be empty'; + } + return \true; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php new file mode 100644 index 0000000..c808c79 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -0,0 +1,31 @@ +request = $request; + $this->handlerContext = $handlerContext; + } + /** + * Get the request that caused the exception + */ + public function getRequest() : RequestInterface + { + return $this->request; + } + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + */ + public function getHandlerContext() : array + { + return $this->handlerContext; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/GuzzleException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/GuzzleException.php new file mode 100644 index 0000000..ca4ccab --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/GuzzleException.php @@ -0,0 +1,8 @@ +getStatusCode() : 0; + parent::__construct($message, $code, $previous); + $this->request = $request; + $this->response = $response; + $this->handlerContext = $handlerContext; + } + /** + * Wrap non-RequestExceptions with a RequestException + */ + public static function wrapException(RequestInterface $request, \Throwable $e) : RequestException + { + return $e instanceof RequestException ? $e : new RequestException($e->getMessage(), $request, null, $e); + } + /** + * Factory method to create a new exception with a normalized error message + * + * @param RequestInterface $request Request sent + * @param ResponseInterface $response Response received + * @param \Throwable|null $previous Previous exception + * @param array $handlerContext Optional handler context + * @param BodySummarizerInterface|null $bodySummarizer Optional body summarizer + */ + public static function create(RequestInterface $request, ResponseInterface $response = null, \Throwable $previous = null, array $handlerContext = [], BodySummarizerInterface $bodySummarizer = null) : self + { + if (!$response) { + return new self('Error completing request', $request, null, $previous, $handlerContext); + } + $level = (int) \floor($response->getStatusCode() / 100); + if ($level === 4) { + $label = 'Client error'; + $className = ClientException::class; + } elseif ($level === 5) { + $label = 'Server error'; + $className = ServerException::class; + } else { + $label = 'Unsuccessful request'; + $className = __CLASS__; + } + $uri = $request->getUri(); + $uri = static::obfuscateUri($uri); + // Client Error: `GET /` resulted in a `404 Not Found` response: + // ... (truncated) + $message = \sprintf('%s: `%s %s` resulted in a `%s %s` response', $label, $request->getMethod(), $uri->__toString(), $response->getStatusCode(), $response->getReasonPhrase()); + $summary = ($bodySummarizer ?? new BodySummarizer())->summarize($response); + if ($summary !== null) { + $message .= ":\n{$summary}\n"; + } + return new $className($message, $request, $response, $previous, $handlerContext); + } + /** + * Obfuscates URI if there is a username and a password present + */ + private static function obfuscateUri(UriInterface $uri) : UriInterface + { + $userInfo = $uri->getUserInfo(); + if (\false !== ($pos = \strpos($userInfo, ':'))) { + return $uri->withUserInfo(\substr($userInfo, 0, $pos), '***'); + } + return $uri; + } + /** + * Get the request that caused the exception + */ + public function getRequest() : RequestInterface + { + return $this->request; + } + /** + * Get the associated response + */ + public function getResponse() : ?ResponseInterface + { + return $this->response; + } + /** + * Check if a response was received + */ + public function hasResponse() : bool + { + return $this->response !== null; + } + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + */ + public function getHandlerContext() : array + { + return $this->handlerContext; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/ServerException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/ServerException.php new file mode 100644 index 0000000..9bcbdea --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -0,0 +1,10 @@ +maxHandles = $maxHandles; + } + public function create(RequestInterface $request, array $options) : EasyHandle + { + if (isset($options['curl']['body_as_string'])) { + $options['_body_as_string'] = $options['curl']['body_as_string']; + unset($options['curl']['body_as_string']); + } + $easy = new EasyHandle(); + $easy->request = $request; + $easy->options = $options; + $conf = $this->getDefaultConf($easy); + $this->applyMethod($easy, $conf); + $this->applyHandlerOptions($easy, $conf); + $this->applyHeaders($easy, $conf); + unset($conf['_headers']); + // Add handler options from the request configuration options + if (isset($options['curl'])) { + $conf = \array_replace($conf, $options['curl']); + } + $conf[\CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + $easy->handle = $this->handles ? \array_pop($this->handles) : \curl_init(); + curl_setopt_array($easy->handle, $conf); + return $easy; + } + public function release(EasyHandle $easy) : void + { + $resource = $easy->handle; + unset($easy->handle); + if (\count($this->handles) >= $this->maxHandles) { + \curl_close($resource); + } else { + // Remove all callback functions as they can hold onto references + // and are not cleaned up by curl_reset. Using curl_setopt_array + // does not work for some reason, so removing each one + // individually. + \curl_setopt($resource, \CURLOPT_HEADERFUNCTION, null); + \curl_setopt($resource, \CURLOPT_READFUNCTION, null); + \curl_setopt($resource, \CURLOPT_WRITEFUNCTION, null); + \curl_setopt($resource, \CURLOPT_PROGRESSFUNCTION, null); + \curl_reset($resource); + $this->handles[] = $resource; + } + } + /** + * Completes a cURL transaction, either returning a response promise or a + * rejected promise. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + * @param CurlFactoryInterface $factory Dictates how the handle is released + */ + public static function finish(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) : PromiseInterface + { + if (isset($easy->options['on_stats'])) { + self::invokeStats($easy); + } + if (!$easy->response || $easy->errno) { + return self::finishError($handler, $easy, $factory); + } + // Return the response if it is present and there is no error. + $factory->release($easy); + // Rewind the body of the response if possible. + $body = $easy->response->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + return new FulfilledPromise($easy->response); + } + private static function invokeStats(EasyHandle $easy) : void + { + $curlStats = \curl_getinfo($easy->handle); + $curlStats['appconnect_time'] = \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME); + $stats = new TransferStats($easy->request, $easy->response, $curlStats['total_time'], $easy->errno, $curlStats); + $easy->options['on_stats']($stats); + } + /** + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function finishError(callable $handler, EasyHandle $easy, CurlFactoryInterface $factory) : PromiseInterface + { + // Get error information and release the handle to the factory. + $ctx = ['errno' => $easy->errno, 'error' => \curl_error($easy->handle), 'appconnect_time' => \curl_getinfo($easy->handle, \CURLINFO_APPCONNECT_TIME)] + \curl_getinfo($easy->handle); + $ctx[self::CURL_VERSION_STR] = \curl_version()['version']; + $factory->release($easy); + // Retry when nothing is present or when curl failed to rewind. + if (empty($easy->options['_err_message']) && (!$easy->errno || $easy->errno == 65)) { + return self::retryFailedRewind($handler, $easy, $ctx); + } + return self::createRejection($easy, $ctx); + } + private static function createRejection(EasyHandle $easy, array $ctx) : PromiseInterface + { + static $connectionErrors = [\CURLE_OPERATION_TIMEOUTED => \true, \CURLE_COULDNT_RESOLVE_HOST => \true, \CURLE_COULDNT_CONNECT => \true, \CURLE_SSL_CONNECT_ERROR => \true, \CURLE_GOT_NOTHING => \true]; + if ($easy->createResponseException) { + return P\Create::rejectionFor(new RequestException('An error was encountered while creating the response', $easy->request, $easy->response, $easy->createResponseException, $ctx)); + } + // If an exception was encountered during the onHeaders event, then + // return a rejected promise that wraps that exception. + if ($easy->onHeadersException) { + return P\Create::rejectionFor(new RequestException('An error was encountered during the on_headers event', $easy->request, $easy->response, $easy->onHeadersException, $ctx)); + } + $message = \sprintf('cURL error %s: %s (%s)', $ctx['errno'], $ctx['error'], 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html'); + $uriString = (string) $easy->request->getUri(); + if ($uriString !== '' && \false === \strpos($ctx['error'], $uriString)) { + $message .= \sprintf(' for %s', $uriString); + } + // Create a connection exception if it was a specific error code. + $error = isset($connectionErrors[$easy->errno]) ? new ConnectException($message, $easy->request, null, $ctx) : new RequestException($message, $easy->request, $easy->response, null, $ctx); + return P\Create::rejectionFor($error); + } + /** + * @return array + */ + private function getDefaultConf(EasyHandle $easy) : array + { + $conf = ['_headers' => $easy->request->getHeaders(), \CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), \CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), \CURLOPT_RETURNTRANSFER => \false, \CURLOPT_HEADER => \false, \CURLOPT_CONNECTTIMEOUT => 300]; + if (\defined('CURLOPT_PROTOCOLS')) { + $conf[\CURLOPT_PROTOCOLS] = \CURLPROTO_HTTP | \CURLPROTO_HTTPS; + } + $version = $easy->request->getProtocolVersion(); + if ($version == 1.1) { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_1; + } elseif ($version == 2.0) { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_2_0; + } else { + $conf[\CURLOPT_HTTP_VERSION] = \CURL_HTTP_VERSION_1_0; + } + return $conf; + } + private function applyMethod(EasyHandle $easy, array &$conf) : void + { + $body = $easy->request->getBody(); + $size = $body->getSize(); + if ($size === null || $size > 0) { + $this->applyBody($easy->request, $easy->options, $conf); + return; + } + $method = $easy->request->getMethod(); + if ($method === 'PUT' || $method === 'POST') { + // See https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2 + if (!$easy->request->hasHeader('Content-Length')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + } elseif ($method === 'HEAD') { + $conf[\CURLOPT_NOBODY] = \true; + unset($conf[\CURLOPT_WRITEFUNCTION], $conf[\CURLOPT_READFUNCTION], $conf[\CURLOPT_FILE], $conf[\CURLOPT_INFILE]); + } + } + private function applyBody(RequestInterface $request, array $options, array &$conf) : void + { + $size = $request->hasHeader('Content-Length') ? (int) $request->getHeaderLine('Content-Length') : null; + // Send the body as a string if the size is less than 1MB OR if the + // [curl][body_as_string] request value is set. + if ($size !== null && $size < 1000000 || !empty($options['_body_as_string'])) { + $conf[\CURLOPT_POSTFIELDS] = (string) $request->getBody(); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $conf); + $this->removeHeader('Transfer-Encoding', $conf); + } else { + $conf[\CURLOPT_UPLOAD] = \true; + if ($size !== null) { + $conf[\CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $conf); + } + $body = $request->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + $conf[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use($body) { + return $body->read($length); + }; + } + // If the Expect header is not present, prevent curl from adding it + if (!$request->hasHeader('Expect')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Expect:'; + } + // cURL sometimes adds a content-type by default. Prevent this. + if (!$request->hasHeader('Content-Type')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + private function applyHeaders(EasyHandle $easy, array &$conf) : void + { + foreach ($conf['_headers'] as $name => $values) { + foreach ($values as $value) { + $value = (string) $value; + if ($value === '') { + // cURL requires a special format for empty headers. + // See https://github.com/guzzle/guzzle/issues/1882 for more details. + $conf[\CURLOPT_HTTPHEADER][] = "{$name};"; + } else { + $conf[\CURLOPT_HTTPHEADER][] = "{$name}: {$value}"; + } + } + } + // Remove the Accept header if one was not set + if (!$easy->request->hasHeader('Accept')) { + $conf[\CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader(string $name, array &$options) : void + { + foreach (\array_keys($options['_headers']) as $key) { + if (!\strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + private function applyHandlerOptions(EasyHandle $easy, array &$conf) : void + { + $options = $easy->options; + if (isset($options['verify'])) { + if ($options['verify'] === \false) { + unset($conf[\CURLOPT_CAINFO]); + $conf[\CURLOPT_SSL_VERIFYHOST] = 0; + $conf[\CURLOPT_SSL_VERIFYPEER] = \false; + } else { + $conf[\CURLOPT_SSL_VERIFYHOST] = 2; + $conf[\CURLOPT_SSL_VERIFYPEER] = \true; + if (\is_string($options['verify'])) { + // Throw an error if the file/folder/link path is not valid or doesn't exist. + if (!\file_exists($options['verify'])) { + throw new \InvalidArgumentException("SSL CA bundle not found: {$options['verify']}"); + } + // If it's a directory or a link to a directory use CURLOPT_CAPATH. + // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. + if (\is_dir($options['verify']) || \is_link($options['verify']) === \true && ($verifyLink = \readlink($options['verify'])) !== \false && \is_dir($verifyLink)) { + $conf[\CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[\CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + if (!isset($options['curl'][\CURLOPT_ENCODING]) && !empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[\CURLOPT_ENCODING] = $accept; + } else { + // The empty string enables all available decoders and implicitly + // sets a matching 'Accept-Encoding' header. + $conf[\CURLOPT_ENCODING] = ''; + // But as the user did not specify any acceptable encodings we need + // to overwrite this implicit header with an empty one. + $conf[\CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + if (!isset($options['sink'])) { + // Use a default temp stream if no sink was set. + $options['sink'] = \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Psr7\Utils::tryFopen('php://temp', 'w+'); + } + $sink = $options['sink']; + if (!\is_string($sink)) { + $sink = \Matomo\Dependencies\SearchEngineKeywordsPerformance\GuzzleHttp\Psr7\Utils::streamFor($sink); + } elseif (!\is_dir(\dirname($sink))) { + // Ensure that the directory exists before failing in curl. + throw new \RuntimeException(\sprintf('Directory %s does not exist for sink value of %s', \dirname($sink), $sink)); + } else { + $sink = new LazyOpenStream($sink, 'w+'); + } + $easy->sink = $sink; + $conf[\CURLOPT_WRITEFUNCTION] = static function ($ch, $write) use($sink) : int { + return $sink->write($write); + }; + $timeoutRequiresNoSignal = \false; + if (isset($options['timeout'])) { + $timeoutRequiresNoSignal |= $options['timeout'] < 1; + $conf[\CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + } + // CURL default value is CURL_IPRESOLVE_WHATEVER + if (isset($options['force_ip_resolve'])) { + if ('v4' === $options['force_ip_resolve']) { + $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V4; + } elseif ('v6' === $options['force_ip_resolve']) { + $conf[\CURLOPT_IPRESOLVE] = \CURL_IPRESOLVE_V6; + } + } + if (isset($options['connect_timeout'])) { + $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; + $conf[\CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + } + if ($timeoutRequiresNoSignal && \strtoupper(\substr(\PHP_OS, 0, 3)) !== 'WIN') { + $conf[\CURLOPT_NOSIGNAL] = \true; + } + if (isset($options['proxy'])) { + if (!\is_array($options['proxy'])) { + $conf[\CURLOPT_PROXY] = $options['proxy']; + } else { + $scheme = $easy->request->getUri()->getScheme(); + if (isset($options['proxy'][$scheme])) { + $host = $easy->request->getUri()->getHost(); + if (isset($options['proxy']['no']) && Utils::isHostInNoProxy($host, $options['proxy']['no'])) { + unset($conf[\CURLOPT_PROXY]); + } else { + $conf[\CURLOPT_PROXY] = $options['proxy'][$scheme]; + } + } + } + } + if (isset($options['crypto_method'])) { + if (\STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_0')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.0 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_0; + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_1')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.1 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_1; + } elseif (\STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_2')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.2 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_2; + } elseif (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT === $options['crypto_method']) { + if (!defined('CURL_SSLVERSION_TLSv1_3')) { + throw new \InvalidArgumentException('Invalid crypto_method request option: TLS 1.3 not supported by your version of cURL'); + } + $conf[\CURLOPT_SSLVERSION] = \CURL_SSLVERSION_TLSv1_3; + } else { + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + } + if (isset($options['cert'])) { + $cert = $options['cert']; + if (\is_array($cert)) { + $conf[\CURLOPT_SSLCERTPASSWD] = $cert[1]; + $cert = $cert[0]; + } + if (!\file_exists($cert)) { + throw new \InvalidArgumentException("SSL certificate not found: {$cert}"); + } + // OpenSSL (versions 0.9.3 and later) also support "P12" for PKCS#12-encoded files. + // see https://curl.se/libcurl/c/CURLOPT_SSLCERTTYPE.html + $ext = pathinfo($cert, \PATHINFO_EXTENSION); + if (preg_match('#^(der|p12)$#i', $ext)) { + $conf[\CURLOPT_SSLCERTTYPE] = strtoupper($ext); + } + $conf[\CURLOPT_SSLCERT] = $cert; + } + if (isset($options['ssl_key'])) { + if (\is_array($options['ssl_key'])) { + if (\count($options['ssl_key']) === 2) { + [$sslKey, $conf[\CURLOPT_SSLKEYPASSWD]] = $options['ssl_key']; + } else { + [$sslKey] = $options['ssl_key']; + } + } + $sslKey = $sslKey ?? $options['ssl_key']; + if (!\file_exists($sslKey)) { + throw new \InvalidArgumentException("SSL private key not found: {$sslKey}"); + } + $conf[\CURLOPT_SSLKEY] = $sslKey; + } + if (isset($options['progress'])) { + $progress = $options['progress']; + if (!\is_callable($progress)) { + throw new \InvalidArgumentException('progress client option must be callable'); + } + $conf[\CURLOPT_NOPROGRESS] = \false; + $conf[\CURLOPT_PROGRESSFUNCTION] = static function ($resource, int $downloadSize, int $downloaded, int $uploadSize, int $uploaded) use($progress) { + $progress($downloadSize, $downloaded, $uploadSize, $uploaded); + }; + } + if (!empty($options['debug'])) { + $conf[\CURLOPT_STDERR] = Utils::debugResource($options['debug']); + $conf[\CURLOPT_VERBOSE] = \true; + } + } + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + * + * @param callable(RequestInterface, array): PromiseInterface $handler + */ + private static function retryFailedRewind(callable $handler, EasyHandle $easy, array $ctx) : PromiseInterface + { + try { + // Only rewind if the body has been read from. + $body = $easy->request->getBody(); + if ($body->tell() > 0) { + $body->rewind(); + } + } catch (\RuntimeException $e) { + $ctx['error'] = 'The connection unexpectedly failed without ' . 'providing an error. The request would have been retried, ' . 'but attempting to rewind the request body failed. ' . 'Exception: ' . $e; + return self::createRejection($easy, $ctx); + } + // Retry no more than 3 times before giving up. + if (!isset($easy->options['_curl_retries'])) { + $easy->options['_curl_retries'] = 1; + } elseif ($easy->options['_curl_retries'] == 2) { + $ctx['error'] = 'The cURL request was retried 3 times ' . 'and did not succeed. The most likely reason for the failure ' . 'is that cURL was unable to rewind the body of the request ' . 'and subsequent retries resulted in the same error. Turn on ' . 'the debug option to see what went wrong. See ' . 'https://bugs.php.net/bug.php?id=47204 for more information.'; + return self::createRejection($easy, $ctx); + } else { + ++$easy->options['_curl_retries']; + } + return $handler($easy->request, $easy->options); + } + private function createHeaderFn(EasyHandle $easy) : callable + { + if (isset($easy->options['on_headers'])) { + $onHeaders = $easy->options['on_headers']; + if (!\is_callable($onHeaders)) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + } else { + $onHeaders = null; + } + return static function ($ch, $h) use($onHeaders, $easy, &$startingResponse) { + $value = \trim($h); + if ($value === '') { + $startingResponse = \true; + try { + $easy->createResponse(); + } catch (\Exception $e) { + $easy->createResponseException = $e; + return -1; + } + if ($onHeaders !== null) { + try { + $onHeaders($easy->response); + } catch (\Exception $e) { + // Associate the exception with the handle and trigger + // a curl header write error by returning 0. + $easy->onHeadersException = $e; + return -1; + } + } + } elseif ($startingResponse) { + $startingResponse = \false; + $easy->headers = [$value]; + } else { + $easy->headers[] = $value; + } + return \strlen($h); + }; + } + public function __destruct() + { + foreach ($this->handles as $id => $handle) { + \curl_close($handle); + unset($this->handles[$id]); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php new file mode 100644 index 0000000..4f96219 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -0,0 +1,23 @@ +factory = $options['handle_factory'] ?? new CurlFactory(3); + } + public function __invoke(RequestInterface $request, array $options) : PromiseInterface + { + if (isset($options['delay'])) { + \usleep($options['delay'] * 1000); + } + $easy = $this->factory->create($request, $options); + \curl_exec($easy->handle); + $easy->errno = \curl_errno($easy->handle); + return CurlFactory::finish($this, $easy, $this->factory); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php new file mode 100644 index 0000000..c3dff44 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -0,0 +1,220 @@ + An array of delay times, indexed by handle id in `addRequest`. + * + * @see CurlMultiHandler::addRequest + */ + private $delays = []; + /** + * @var array An associative array of CURLMOPT_* options and corresponding values for curl_multi_setopt() + */ + private $options = []; + /** @var resource|\CurlMultiHandle */ + private $_mh; + /** + * This handler accepts the following options: + * + * - handle_factory: An optional factory used to create curl handles + * - select_timeout: Optional timeout (in seconds) to block before timing + * out while selecting curl handles. Defaults to 1 second. + * - options: An associative array of CURLMOPT_* options and + * corresponding values for curl_multi_setopt() + */ + public function __construct(array $options = []) + { + $this->factory = $options['handle_factory'] ?? new CurlFactory(50); + if (isset($options['select_timeout'])) { + $this->selectTimeout = $options['select_timeout']; + } elseif ($selectTimeout = Utils::getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { + @trigger_error('Since guzzlehttp/guzzle 7.2.0: Using environment variable GUZZLE_CURL_SELECT_TIMEOUT is deprecated. Use option "select_timeout" instead.', \E_USER_DEPRECATED); + $this->selectTimeout = (int) $selectTimeout; + } else { + $this->selectTimeout = 1; + } + $this->options = $options['options'] ?? []; + // unsetting the property forces the first access to go through + // __get(). + unset($this->_mh); + } + /** + * @param string $name + * + * @return resource|\CurlMultiHandle + * + * @throws \BadMethodCallException when another field as `_mh` will be gotten + * @throws \RuntimeException when curl can not initialize a multi handle + */ + public function __get($name) + { + if ($name !== '_mh') { + throw new \BadMethodCallException("Can not get other property as '_mh'."); + } + $multiHandle = \curl_multi_init(); + if (\false === $multiHandle) { + throw new \RuntimeException('Can not initialize curl multi handle.'); + } + $this->_mh = $multiHandle; + foreach ($this->options as $option => $value) { + // A warning is raised in case of a wrong option. + curl_multi_setopt($this->_mh, $option, $value); + } + return $this->_mh; + } + public function __destruct() + { + if (isset($this->_mh)) { + \curl_multi_close($this->_mh); + unset($this->_mh); + } + } + public function __invoke(RequestInterface $request, array $options) : PromiseInterface + { + $easy = $this->factory->create($request, $options); + $id = (int) $easy->handle; + $promise = new Promise([$this, 'execute'], function () use($id) { + return $this->cancel($id); + }); + $this->addRequest(['easy' => $easy, 'deferred' => $promise]); + return $promise; + } + /** + * Ticks the curl event loop. + */ + public function tick() : void + { + // Add any delayed handles if needed. + if ($this->delays) { + $currentTime = Utils::currentTime(); + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + \curl_multi_add_handle($this->_mh, $this->handles[$id]['easy']->handle); + } + } + } + // Step through the task queue which may add additional requests. + P\Utils::queue()->run(); + if ($this->active && \curl_multi_select($this->_mh, $this->selectTimeout) === -1) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + \usleep(250); + } + while (\curl_multi_exec($this->_mh, $this->active) === \CURLM_CALL_MULTI_PERFORM) { + } + $this->processMessages(); + } + /** + * Runs until all outstanding connections have completed. + */ + public function execute() : void + { + $queue = P\Utils::queue(); + while ($this->handles || !$queue->isEmpty()) { + // If there are no transfers, then sleep for the next delay + if (!$this->active && $this->delays) { + \usleep($this->timeToNext()); + } + $this->tick(); + } + } + private function addRequest(array $entry) : void + { + $easy = $entry['easy']; + $id = (int) $easy->handle; + $this->handles[$id] = $entry; + if (empty($easy->options['delay'])) { + \curl_multi_add_handle($this->_mh, $easy->handle); + } else { + $this->delays[$id] = Utils::currentTime() + $easy->options['delay'] / 1000; + } + } + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id) : bool + { + if (!is_int($id)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing an integer to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return \false; + } + $handle = $this->handles[$id]['easy']->handle; + unset($this->delays[$id], $this->handles[$id]); + \curl_multi_remove_handle($this->_mh, $handle); + \curl_close($handle); + return \true; + } + private function processMessages() : void + { + while ($done = \curl_multi_info_read($this->_mh)) { + if ($done['msg'] !== \CURLMSG_DONE) { + // if it's not done, then it would be premature to remove the handle. ref https://github.com/guzzle/guzzle/pull/2892#issuecomment-945150216 + continue; + } + $id = (int) $done['handle']; + \curl_multi_remove_handle($this->_mh, $done['handle']); + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + $entry = $this->handles[$id]; + unset($this->handles[$id], $this->delays[$id]); + $entry['easy']->errno = $done['result']; + $entry['deferred']->resolve(CurlFactory::finish($this, $entry['easy'], $this->factory)); + } + } + private function timeToNext() : int + { + $currentTime = Utils::currentTime(); + $nextTime = \PHP_INT_MAX; + foreach ($this->delays as $time) { + if ($time < $nextTime) { + $nextTime = $time; + } + } + return (int) \max(0, $nextTime - $currentTime) * 1000000; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/EasyHandle.php new file mode 100644 index 0000000..7a6ca9c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -0,0 +1,91 @@ +headers); + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + if (!empty($this->options['decode_content']) && isset($normalizedKeys['content-encoding'])) { + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; + unset($headers[$normalizedKeys['content-encoding']]); + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']]; + $bodyLength = (int) $this->sink->getSize(); + if ($bodyLength) { + $headers[$normalizedKeys['content-length']] = $bodyLength; + } else { + unset($headers[$normalizedKeys['content-length']]); + } + } + } + // Attach a response to the easy handle with the parsed headers. + $this->response = new Response($status, $headers, $this->sink, $ver, $reason); + } + /** + * @param string $name + * + * @return void + * + * @throws \BadMethodCallException + */ + public function __get($name) + { + $msg = $name === 'handle' ? 'The EasyHandle has been released' : 'Invalid property: ' . $name; + throw new \BadMethodCallException($msg); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php new file mode 100644 index 0000000..7864c14 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php @@ -0,0 +1,36 @@ +|null $queue The parameters to be passed to the append function, as an indexed array. + * @param callable|null $onFulfilled Callback to invoke when the return value is fulfilled. + * @param callable|null $onRejected Callback to invoke when the return value is rejected. + */ + public function __construct(array $queue = null, callable $onFulfilled = null, callable $onRejected = null) + { + $this->onFulfilled = $onFulfilled; + $this->onRejected = $onRejected; + if ($queue) { + // array_values included for BC + $this->append(...array_values($queue)); + } + } + public function __invoke(RequestInterface $request, array $options) : PromiseInterface + { + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + if (isset($options['delay']) && \is_numeric($options['delay'])) { + \usleep((int) $options['delay'] * 1000); + } + $this->lastRequest = $request; + $this->lastOptions = $options; + $response = \array_shift($this->queue); + if (isset($options['on_headers'])) { + if (!\is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $response = new RequestException($msg, $request, $response, $e); + } + } + if (\is_callable($response)) { + $response = $response($request, $options); + } + $response = $response instanceof \Throwable ? P\Create::rejectionFor($response) : P\Create::promiseFor($response); + return $response->then(function (?ResponseInterface $value) use($request, $options) { + $this->invokeStats($request, $options, $value); + if ($this->onFulfilled) { + ($this->onFulfilled)($value); + } + if ($value !== null && isset($options['sink'])) { + $contents = (string) $value->getBody(); + $sink = $options['sink']; + if (\is_resource($sink)) { + \fwrite($sink, $contents); + } elseif (\is_string($sink)) { + \file_put_contents($sink, $contents); + } elseif ($sink instanceof StreamInterface) { + $sink->write($contents); + } + } + return $value; + }, function ($reason) use($request, $options) { + $this->invokeStats($request, $options, null, $reason); + if ($this->onRejected) { + ($this->onRejected)($reason); + } + return P\Create::rejectionFor($reason); + }); + } + /** + * Adds one or more variadic requests, exceptions, callables, or promises + * to the queue. + * + * @param mixed ...$values + */ + public function append(...$values) : void + { + foreach ($values as $value) { + if ($value instanceof ResponseInterface || $value instanceof \Throwable || $value instanceof PromiseInterface || \is_callable($value)) { + $this->queue[] = $value; + } else { + throw new \TypeError('Expected a Response, Promise, Throwable or callable. Found ' . Utils::describeType($value)); + } + } + } + /** + * Get the last received request. + */ + public function getLastRequest() : ?RequestInterface + { + return $this->lastRequest; + } + /** + * Get the last received request options. + */ + public function getLastOptions() : array + { + return $this->lastOptions; + } + /** + * Returns the number of remaining items in the queue. + */ + public function count() : int + { + return \count($this->queue); + } + public function reset() : void + { + $this->queue = []; + } + /** + * @param mixed $reason Promise or reason. + */ + private function invokeStats(RequestInterface $request, array $options, ResponseInterface $response = null, $reason = null) : void + { + if (isset($options['on_stats'])) { + $transferTime = $options['transfer_time'] ?? 0; + $stats = new TransferStats($request, $response, $transferTime, $reason); + $options['on_stats']($stats); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/Proxy.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/Proxy.php new file mode 100644 index 0000000..aa4ca6b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -0,0 +1,49 @@ +withoutHeader('Expect'); + // Append a content-length header if body size is zero to match + // cURL's behavior. + if (0 === $request->getBody()->getSize()) { + $request = $request->withHeader('Content-Length', '0'); + } + return $this->createResponse($request, $options, $this->createStream($request, $options), $startTime); + } catch (\InvalidArgumentException $e) { + throw $e; + } catch (\Exception $e) { + // Determine if the error was a networking error. + $message = $e->getMessage(); + // This list can probably get more comprehensive. + if (\false !== \strpos($message, 'getaddrinfo') || \false !== \strpos($message, 'Connection refused') || \false !== \strpos($message, "couldn't connect to host") || \false !== \strpos($message, 'connection attempt failed')) { + $e = new ConnectException($e->getMessage(), $request, $e); + } else { + $e = RequestException::wrapException($request, $e); + } + $this->invokeStats($options, $request, $startTime, null, $e); + return P\Create::rejectionFor($e); + } + } + private function invokeStats(array $options, RequestInterface $request, ?float $startTime, ResponseInterface $response = null, \Throwable $error = null) : void + { + if (isset($options['on_stats'])) { + $stats = new TransferStats($request, $response, Utils::currentTime() - $startTime, $error, []); + $options['on_stats']($stats); + } + } + /** + * @param resource $stream + */ + private function createResponse(RequestInterface $request, array $options, $stream, ?float $startTime) : PromiseInterface + { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + try { + [$ver, $status, $reason, $headers] = HeaderProcessor::parseHeaders($hdrs); + } catch (\Exception $e) { + return P\Create::rejectionFor(new RequestException('An error was encountered while creating the response', $request, null, $e)); + } + [$stream, $headers] = $this->checkDecode($options, $headers, $stream); + $stream = Psr7\Utils::streamFor($stream); + $sink = $stream; + if (\strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + try { + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + } catch (\Exception $e) { + return P\Create::rejectionFor(new RequestException('An error was encountered while creating the response', $request, null, $e)); + } + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + return P\Create::rejectionFor(new RequestException('An error was encountered during the on_headers event', $request, $response, $e)); + } + } + // Do not drain when the request is a HEAD request because they have + // no body. + if ($sink !== $stream) { + $this->drain($stream, $sink, $response->getHeaderLine('Content-Length')); + } + $this->invokeStats($options, $request, $startTime, $response, null); + return new FulfilledPromise($response); + } + private function createSink(StreamInterface $stream, array $options) : StreamInterface + { + if (!empty($options['stream'])) { + return $stream; + } + $sink = $options['sink'] ?? Psr7\Utils::tryFopen('php://temp', 'r+'); + return \is_string($sink) ? new Psr7\LazyOpenStream($sink, 'w+') : Psr7\Utils::streamFor($sink); + } + /** + * @param resource $stream + */ + private function checkDecode(array $options, array $headers, $stream) : array + { + // Automatically decode responses when instructed. + if (!empty($options['decode_content'])) { + $normalizedKeys = Utils::normalizeHeaderKeys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + $stream = new Psr7\InflateStream(Psr7\Utils::streamFor($stream)); + $headers['x-encoded-content-encoding'] = $headers[$normalizedKeys['content-encoding']]; + // Remove content-encoding header + unset($headers[$normalizedKeys['content-encoding']]); + // Fix content-length header + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] = $headers[$normalizedKeys['content-length']]; + $length = (int) $stream->getSize(); + if ($length === 0) { + unset($headers[$normalizedKeys['content-length']]); + } else { + $headers[$normalizedKeys['content-length']] = [$length]; + } + } + } + } + } + return [$stream, $headers]; + } + /** + * Drains the source stream into the "sink" client option. + * + * @param string $contentLength Header specifying the amount of + * data to read. + * + * @throws \RuntimeException when the sink option is invalid. + */ + private function drain(StreamInterface $source, StreamInterface $sink, string $contentLength) : StreamInterface + { + // If a content-length header is provided, then stop reading once + // that number of bytes has been read. This can prevent infinitely + // reading from a stream when dealing with servers that do not honor + // Connection: Close headers. + Psr7\Utils::copyToStream($source, $sink, \strlen($contentLength) > 0 && (int) $contentLength > 0 ? (int) $contentLength : -1); + $sink->seek(0); + $source->close(); + return $sink; + } + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = []; + \set_error_handler(static function ($_, $msg, $file, $line) use(&$errors) : bool { + $errors[] = ['message' => $msg, 'file' => $file, 'line' => $line]; + return \true; + }); + try { + $resource = $callback(); + } finally { + \restore_error_handler(); + } + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[{$key}] {$value}" . \PHP_EOL; + } + } + throw new \RuntimeException(\trim($message)); + } + return $resource; + } + /** + * @return resource + */ + private function createStream(RequestInterface $request, array $options) + { + static $methods; + if (!$methods) { + $methods = \array_flip(\get_class_methods(__CLASS__)); + } + if (!\in_array($request->getUri()->getScheme(), ['http', 'https'])) { + throw new RequestException(\sprintf("The scheme '%s' is not supported.", $request->getUri()->getScheme()), $request); + } + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ($request->getProtocolVersion() == '1.1' && !$request->hasHeader('Connection')) { + $request = $request->withHeader('Connection', 'close'); + } + // Ensure SSL is verified by default + if (!isset($options['verify'])) { + $options['verify'] = \true; + } + $params = []; + $context = $this->getDefaultContext($request); + if (isset($options['on_headers']) && !\is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + if (!empty($options)) { + foreach ($options as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $context, $value, $params); + } + } + } + if (isset($options['stream_context'])) { + if (!\is_array($options['stream_context'])) { + throw new \InvalidArgumentException('stream_context must be an array'); + } + $context = \array_replace_recursive($context, $options['stream_context']); + } + // Microsoft NTLM authentication only supported with curl handler + if (isset($options['auth'][2]) && 'ntlm' === $options['auth'][2]) { + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + $uri = $this->resolveHost($request, $options); + $contextResource = $this->createResource(static function () use($context, $params) { + return \stream_context_create($context, $params); + }); + return $this->createResource(function () use($uri, &$http_response_header, $contextResource, $context, $options, $request) { + $resource = @\fopen((string) $uri, 'r', \false, $contextResource); + $this->lastHeaders = $http_response_header ?? []; + if (\false === $resource) { + throw new ConnectException(sprintf('Connection refused for URI %s', $uri), $request, null, $context); + } + if (isset($options['read_timeout'])) { + $readTimeout = $options['read_timeout']; + $sec = (int) $readTimeout; + $usec = ($readTimeout - $sec) * 100000; + \stream_set_timeout($resource, $sec, $usec); + } + return $resource; + }); + } + private function resolveHost(RequestInterface $request, array $options) : UriInterface + { + $uri = $request->getUri(); + if (isset($options['force_ip_resolve']) && !\filter_var($uri->getHost(), \FILTER_VALIDATE_IP)) { + if ('v4' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_A); + if (\false === $records || !isset($records[0]['ip'])) { + throw new ConnectException(\sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request); + } + return $uri->withHost($records[0]['ip']); + } + if ('v6' === $options['force_ip_resolve']) { + $records = \dns_get_record($uri->getHost(), \DNS_AAAA); + if (\false === $records || !isset($records[0]['ipv6'])) { + throw new ConnectException(\sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request); + } + return $uri->withHost('[' . $records[0]['ipv6'] . ']'); + } + } + return $uri; + } + private function getDefaultContext(RequestInterface $request) : array + { + $headers = ''; + foreach ($request->getHeaders() as $name => $value) { + foreach ($value as $val) { + $headers .= "{$name}: {$val}\r\n"; + } + } + $context = ['http' => ['method' => $request->getMethod(), 'header' => $headers, 'protocol_version' => $request->getProtocolVersion(), 'ignore_errors' => \true, 'follow_location' => 0], 'ssl' => ['peer_name' => $request->getUri()->getHost()]]; + $body = (string) $request->getBody(); + if ('' !== $body) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!$request->hasHeader('Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + $context['http']['header'] = \rtrim($context['http']['header']); + return $context; + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_proxy(RequestInterface $request, array &$options, $value, array &$params) : void + { + $uri = null; + if (!\is_array($value)) { + $uri = $value; + } else { + $scheme = $request->getUri()->getScheme(); + if (isset($value[$scheme])) { + if (!isset($value['no']) || !Utils::isHostInNoProxy($request->getUri()->getHost(), $value['no'])) { + $uri = $value[$scheme]; + } + } + } + if (!$uri) { + return; + } + $parsed = $this->parse_proxy($uri); + $options['http']['proxy'] = $parsed['proxy']; + if ($parsed['auth']) { + if (!isset($options['http']['header'])) { + $options['http']['header'] = []; + } + $options['http']['header'] .= "\r\nProxy-Authorization: {$parsed['auth']}"; + } + } + /** + * Parses the given proxy URL to make it compatible with the format PHP's stream context expects. + */ + private function parse_proxy(string $url) : array + { + $parsed = \parse_url($url); + if ($parsed !== \false && isset($parsed['scheme']) && $parsed['scheme'] === 'http') { + if (isset($parsed['host']) && isset($parsed['port'])) { + $auth = null; + if (isset($parsed['user']) && isset($parsed['pass'])) { + $auth = \base64_encode("{$parsed['user']}:{$parsed['pass']}"); + } + return ['proxy' => "tcp://{$parsed['host']}:{$parsed['port']}", 'auth' => $auth ? "Basic {$auth}" : null]; + } + } + // Return proxy as-is. + return ['proxy' => $url, 'auth' => null]; + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_timeout(RequestInterface $request, array &$options, $value, array &$params) : void + { + if ($value > 0) { + $options['http']['timeout'] = $value; + } + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_crypto_method(RequestInterface $request, array &$options, $value, array &$params) : void + { + if ($value === \STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT || $value === \STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT || $value === \STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT || defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT') && $value === \STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT) { + $options['http']['crypto_method'] = $value; + return; + } + throw new \InvalidArgumentException('Invalid crypto_method request option: unknown version provided'); + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_verify(RequestInterface $request, array &$options, $value, array &$params) : void + { + if ($value === \false) { + $options['ssl']['verify_peer'] = \false; + $options['ssl']['verify_peer_name'] = \false; + return; + } + if (\is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!\file_exists($value)) { + throw new \RuntimeException("SSL CA bundle not found: {$value}"); + } + } elseif ($value !== \true) { + throw new \InvalidArgumentException('Invalid verify request option'); + } + $options['ssl']['verify_peer'] = \true; + $options['ssl']['verify_peer_name'] = \true; + $options['ssl']['allow_self_signed'] = \false; + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_cert(RequestInterface $request, array &$options, $value, array &$params) : void + { + if (\is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + if (!\file_exists($value)) { + throw new \RuntimeException("SSL certificate not found: {$value}"); + } + $options['ssl']['local_cert'] = $value; + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_progress(RequestInterface $request, array &$options, $value, array &$params) : void + { + self::addNotification($params, static function ($code, $a, $b, $c, $transferred, $total) use($value) { + if ($code == \STREAM_NOTIFY_PROGRESS) { + // The upload progress cannot be determined. Use 0 for cURL compatibility: + // https://curl.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html + $value($total, $transferred, 0, 0); + } + }); + } + /** + * @param mixed $value as passed via Request transfer options. + */ + private function add_debug(RequestInterface $request, array &$options, $value, array &$params) : void + { + if ($value === \false) { + return; + } + static $map = [\STREAM_NOTIFY_CONNECT => 'CONNECT', \STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', \STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', \STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', \STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', \STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', \STREAM_NOTIFY_PROGRESS => 'PROGRESS', \STREAM_NOTIFY_FAILURE => 'FAILURE', \STREAM_NOTIFY_COMPLETED => 'COMPLETED', \STREAM_NOTIFY_RESOLVE => 'RESOLVE']; + static $args = ['severity', 'message', 'message_code', 'bytes_transferred', 'bytes_max']; + $value = Utils::debugResource($value); + $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); + self::addNotification($params, static function (int $code, ...$passed) use($ident, $value, $map, $args) : void { + \fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (\array_filter($passed) as $i => $v) { + \fwrite($value, $args[$i] . ': "' . $v . '" '); + } + \fwrite($value, "\n"); + }); + } + private static function addNotification(array &$params, callable $notify) : void + { + // Wrap the existing function if needed. + if (!isset($params['notification'])) { + $params['notification'] = $notify; + } else { + $params['notification'] = self::callArray([$params['notification'], $notify]); + } + } + private static function callArray(array $functions) : callable + { + return static function (...$args) use($functions) { + foreach ($functions as $fn) { + $fn(...$args); + } + }; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/HandlerStack.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/HandlerStack.php new file mode 100644 index 0000000..0e5d429 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/HandlerStack.php @@ -0,0 +1,238 @@ +push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::redirect(), 'allow_redirects'); + $stack->push(Middleware::cookies(), 'cookies'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); + return $stack; + } + /** + * @param (callable(RequestInterface, array): PromiseInterface)|null $handler Underlying HTTP handler. + */ + public function __construct(callable $handler = null) + { + $this->handler = $handler; + } + /** + * Invokes the handler stack as a composed handler + * + * @return ResponseInterface|PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $handler = $this->resolve(); + return $handler($request, $options); + } + /** + * Dumps a string representation of the stack. + * + * @return string + */ + public function __toString() + { + $depth = 0; + $stack = []; + if ($this->handler !== null) { + $stack[] = '0) Handler: ' . $this->debugCallable($this->handler); + } + $result = ''; + foreach (\array_reverse($this->stack) as $tuple) { + ++$depth; + $str = "{$depth}) Name: '{$tuple[1]}', "; + $str .= 'Function: ' . $this->debugCallable($tuple[0]); + $result = "> {$str}\n{$result}"; + $stack[] = $str; + } + foreach (\array_keys($stack) as $k) { + $result .= "< {$stack[$k]}\n"; + } + return $result; + } + /** + * Set the HTTP handler that actually returns a promise. + * + * @param callable(RequestInterface, array): PromiseInterface $handler Accepts a request and array of options and + * returns a Promise. + */ + public function setHandler(callable $handler) : void + { + $this->handler = $handler; + $this->cached = null; + } + /** + * Returns true if the builder has a handler. + */ + public function hasHandler() : bool + { + return $this->handler !== null; + } + /** + * Unshift a middleware to the bottom of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function unshift(callable $middleware, string $name = null) : void + { + \array_unshift($this->stack, [$middleware, $name]); + $this->cached = null; + } + /** + * Push a middleware to the top of the stack. + * + * @param callable(callable): callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function push(callable $middleware, string $name = '') : void + { + $this->stack[] = [$middleware, $name]; + $this->cached = null; + } + /** + * Add a middleware before another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function before(string $findName, callable $middleware, string $withName = '') : void + { + $this->splice($findName, $withName, $middleware, \true); + } + /** + * Add a middleware after another middleware by name. + * + * @param string $findName Middleware to find + * @param callable(callable): callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function after(string $findName, callable $middleware, string $withName = '') : void + { + $this->splice($findName, $withName, $middleware, \false); + } + /** + * Remove a middleware by instance or name from the stack. + * + * @param callable|string $remove Middleware to remove by instance or name. + */ + public function remove($remove) : void + { + if (!is_string($remove) && !is_callable($remove)) { + trigger_deprecation('guzzlehttp/guzzle', '7.4', 'Not passing a callable or string to %s::%s() is deprecated and will cause an error in 8.0.', __CLASS__, __FUNCTION__); + } + $this->cached = null; + $idx = \is_callable($remove) ? 0 : 1; + $this->stack = \array_values(\array_filter($this->stack, static function ($tuple) use($idx, $remove) { + return $tuple[$idx] !== $remove; + })); + } + /** + * Compose the middleware and handler into a single callable function. + * + * @return callable(RequestInterface, array): PromiseInterface + */ + public function resolve() : callable + { + if ($this->cached === null) { + if (($prev = $this->handler) === null) { + throw new \LogicException('No handler has been specified'); + } + foreach (\array_reverse($this->stack) as $fn) { + /** @var callable(RequestInterface, array): PromiseInterface $prev */ + $prev = $fn[0]($prev); + } + $this->cached = $prev; + } + return $this->cached; + } + private function findByName(string $name) : int + { + foreach ($this->stack as $k => $v) { + if ($v[1] === $name) { + return $k; + } + } + throw new \InvalidArgumentException("Middleware not found: {$name}"); + } + /** + * Splices a function into the middleware list at a specific position. + */ + private function splice(string $findName, string $withName, callable $middleware, bool $before) : void + { + $this->cached = null; + $idx = $this->findByName($findName); + $tuple = [$middleware, $withName]; + if ($before) { + if ($idx === 0) { + \array_unshift($this->stack, $tuple); + } else { + $replacement = [$tuple, $this->stack[$idx]]; + \array_splice($this->stack, $idx, 1, $replacement); + } + } elseif ($idx === \count($this->stack) - 1) { + $this->stack[] = $tuple; + } else { + $replacement = [$this->stack[$idx], $tuple]; + \array_splice($this->stack, $idx, 1, $replacement); + } + } + /** + * Provides a debug string for a given callable. + * + * @param callable|string $fn Function to write as a string. + */ + private function debugCallable($fn) : string + { + if (\is_string($fn)) { + return "callable({$fn})"; + } + if (\is_array($fn)) { + return \is_string($fn[0]) ? "callable({$fn[0]}::{$fn[1]})" : "callable(['" . \get_class($fn[0]) . "', '{$fn[1]}'])"; + } + /** @var object $fn */ + return 'callable(' . \spl_object_hash($fn) . ')'; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/MessageFormatter.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/MessageFormatter.php new file mode 100644 index 0000000..cad16fb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/MessageFormatter.php @@ -0,0 +1,168 @@ +>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; + public const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; + /** + * @var string Template used to format log messages + */ + private $template; + /** + * @param string $template Log message template + */ + public function __construct(?string $template = self::CLF) + { + $this->template = $template ?: self::CLF; + } + /** + * Returns a formatted message string. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface|null $response Response that was received + * @param \Throwable|null $error Exception that was received + */ + public function format(RequestInterface $request, ResponseInterface $response = null, \Throwable $error = null) : string + { + $cache = []; + /** @var string */ + return \preg_replace_callback('/{\\s*([A-Za-z_\\-\\.0-9]+)\\s*}/', function (array $matches) use($request, $response, $error, &$cache) { + if (isset($cache[$matches[1]])) { + return $cache[$matches[1]]; + } + $result = ''; + switch ($matches[1]) { + case 'request': + $result = Psr7\Message::toString($request); + break; + case 'response': + $result = $response ? Psr7\Message::toString($response) : ''; + break; + case 'req_headers': + $result = \trim($request->getMethod() . ' ' . $request->getRequestTarget()) . ' HTTP/' . $request->getProtocolVersion() . "\r\n" . $this->headers($request); + break; + case 'res_headers': + $result = $response ? \sprintf('HTTP/%s %d %s', $response->getProtocolVersion(), $response->getStatusCode(), $response->getReasonPhrase()) . "\r\n" . $this->headers($response) : 'NULL'; + break; + case 'req_body': + $result = $request->getBody()->__toString(); + break; + case 'res_body': + if (!$response instanceof ResponseInterface) { + $result = 'NULL'; + break; + } + $body = $response->getBody(); + if (!$body->isSeekable()) { + $result = 'RESPONSE_NOT_LOGGEABLE'; + break; + } + $result = $response->getBody()->__toString(); + break; + case 'ts': + case 'date_iso_8601': + $result = \gmdate('c'); + break; + case 'date_common_log': + $result = \date('d/M/Y:H:i:s O'); + break; + case 'method': + $result = $request->getMethod(); + break; + case 'version': + $result = $request->getProtocolVersion(); + break; + case 'uri': + case 'url': + $result = $request->getUri()->__toString(); + break; + case 'target': + $result = $request->getRequestTarget(); + break; + case 'req_version': + $result = $request->getProtocolVersion(); + break; + case 'res_version': + $result = $response ? $response->getProtocolVersion() : 'NULL'; + break; + case 'host': + $result = $request->getHeaderLine('Host'); + break; + case 'hostname': + $result = \gethostname(); + break; + case 'code': + $result = $response ? $response->getStatusCode() : 'NULL'; + break; + case 'phrase': + $result = $response ? $response->getReasonPhrase() : 'NULL'; + break; + case 'error': + $result = $error ? $error->getMessage() : 'NULL'; + break; + default: + // handle prefixed dynamic headers + if (\strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(\substr($matches[1], 11)); + } elseif (\strpos($matches[1], 'res_header_') === 0) { + $result = $response ? $response->getHeaderLine(\substr($matches[1], 11)) : 'NULL'; + } + } + $cache[$matches[1]] = $result; + return $result; + }, $this->template); + } + /** + * Get headers from message as string + */ + private function headers(MessageInterface $message) : string + { + $result = ''; + foreach ($message->getHeaders() as $name => $values) { + $result .= $name . ': ' . \implode(', ', $values) . "\r\n"; + } + return \trim($result); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php new file mode 100644 index 0000000..2c3bfa8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/MessageFormatterInterface.php @@ -0,0 +1,17 @@ +withCookieHeader($request); + return $handler($request, $options)->then(static function (ResponseInterface $response) use($cookieJar, $request) : ResponseInterface { + $cookieJar->extractCookies($request, $response); + return $response; + }); + }; + }; + } + /** + * Middleware that throws exceptions for 4xx or 5xx responses when the + * "http_errors" request option is set to true. + * + * @param BodySummarizerInterface|null $bodySummarizer The body summarizer to use in exception messages. + * + * @return callable(callable): callable Returns a function that accepts the next handler. + */ + public static function httpErrors(BodySummarizerInterface $bodySummarizer = null) : callable + { + return static function (callable $handler) use($bodySummarizer) : callable { + return static function ($request, array $options) use($handler, $bodySummarizer) { + if (empty($options['http_errors'])) { + return $handler($request, $options); + } + return $handler($request, $options)->then(static function (ResponseInterface $response) use($request, $bodySummarizer) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + throw RequestException::create($request, $response, null, [], $bodySummarizer); + }); + }; + }; + } + /** + * Middleware that pushes history data to an ArrayAccess container. + * + * @param array|\ArrayAccess $container Container to hold the history (by reference). + * + * @return callable(callable): callable Returns a function that accepts the next handler. + * + * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + */ + public static function history(&$container) : callable + { + if (!\is_array($container) && !$container instanceof \ArrayAccess) { + throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + } + return static function (callable $handler) use(&$container) : callable { + return static function (RequestInterface $request, array $options) use($handler, &$container) { + return $handler($request, $options)->then(static function ($value) use($request, &$container, $options) { + $container[] = ['request' => $request, 'response' => $value, 'error' => null, 'options' => $options]; + return $value; + }, static function ($reason) use($request, &$container, $options) { + $container[] = ['request' => $request, 'response' => null, 'error' => $reason, 'options' => $options]; + return P\Create::rejectionFor($reason); + }); + }; + }; + } + /** + * Middleware that invokes a callback before and after sending a request. + * + * The provided listener cannot modify or alter the response. It simply + * "taps" into the chain to be notified before returning the promise. The + * before listener accepts a request and options array, and the after + * listener accepts a request, options array, and response promise. + * + * @param callable $before Function to invoke before forwarding the request. + * @param callable $after Function invoked after forwarding. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function tap(callable $before = null, callable $after = null) : callable + { + return static function (callable $handler) use($before, $after) : callable { + return static function (RequestInterface $request, array $options) use($handler, $before, $after) { + if ($before) { + $before($request, $options); + } + $response = $handler($request, $options); + if ($after) { + $after($request, $options, $response); + } + return $response; + }; + }; + } + /** + * Middleware that handles request redirects. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function redirect() : callable + { + return static function (callable $handler) : RedirectMiddleware { + return new RedirectMiddleware($handler); + }; + } + /** + * Middleware that retries requests based on the boolean result of + * invoking the provided "decider" function. + * + * If no delay function is provided, a simple implementation of exponential + * backoff will be utilized. + * + * @param callable $decider Function that accepts the number of retries, + * a request, [response], and [exception] and + * returns true if the request is to be retried. + * @param callable $delay Function that accepts the number of retries and + * returns the number of milliseconds to delay. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function retry(callable $decider, callable $delay = null) : callable + { + return static function (callable $handler) use($decider, $delay) : RetryMiddleware { + return new RetryMiddleware($decider, $handler, $delay); + }; + } + /** + * Middleware that logs requests, responses, and errors using a message + * formatter. + * + * @phpstan-param \Psr\Log\LogLevel::* $logLevel Level at which to log requests. + * + * @param LoggerInterface $logger Logs messages. + * @param MessageFormatterInterface|MessageFormatter $formatter Formatter used to create message strings. + * @param string $logLevel Level at which to log requests. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function log(LoggerInterface $logger, $formatter, string $logLevel = 'info') : callable + { + // To be compatible with Guzzle 7.1.x we need to allow users to pass a MessageFormatter + if (!$formatter instanceof MessageFormatter && !$formatter instanceof MessageFormatterInterface) { + throw new \LogicException(sprintf('Argument 2 to %s::log() must be of type %s', self::class, MessageFormatterInterface::class)); + } + return static function (callable $handler) use($logger, $formatter, $logLevel) : callable { + return static function (RequestInterface $request, array $options = []) use($handler, $logger, $formatter, $logLevel) { + return $handler($request, $options)->then(static function ($response) use($logger, $request, $formatter, $logLevel) : ResponseInterface { + $message = $formatter->format($request, $response); + $logger->log($logLevel, $message); + return $response; + }, static function ($reason) use($logger, $request, $formatter) : PromiseInterface { + $response = $reason instanceof RequestException ? $reason->getResponse() : null; + $message = $formatter->format($request, $response, P\Create::exceptionFor($reason)); + $logger->error($message); + return P\Create::rejectionFor($reason); + }); + }; + }; + } + /** + * This middleware adds a default content-type if possible, a default + * content-length or transfer-encoding header, and the expect header. + */ + public static function prepareBody() : callable + { + return static function (callable $handler) : PrepareBodyMiddleware { + return new PrepareBodyMiddleware($handler); + }; + } + /** + * Middleware that applies a map function to the request before passing to + * the next handler. + * + * @param callable $fn Function that accepts a RequestInterface and returns + * a RequestInterface. + */ + public static function mapRequest(callable $fn) : callable + { + return static function (callable $handler) use($fn) : callable { + return static function (RequestInterface $request, array $options) use($handler, $fn) { + return $handler($fn($request), $options); + }; + }; + } + /** + * Middleware that applies a map function to the resolved promise's + * response. + * + * @param callable $fn Function that accepts a ResponseInterface and + * returns a ResponseInterface. + */ + public static function mapResponse(callable $fn) : callable + { + return static function (callable $handler) use($fn) : callable { + return static function (RequestInterface $request, array $options) use($handler, $fn) { + return $handler($request, $options)->then($fn); + }; + }; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Pool.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Pool.php new file mode 100644 index 0000000..7899284 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Pool.php @@ -0,0 +1,116 @@ + $rfn) { + if ($rfn instanceof RequestInterface) { + (yield $key => $client->sendAsync($rfn, $opts)); + } elseif (\is_callable($rfn)) { + (yield $key => $rfn($opts)); + } else { + throw new \InvalidArgumentException('Each value yielded by the iterator must be a Psr7\\Http\\Message\\RequestInterface or a callable that returns a promise that fulfills with a Psr7\\Message\\Http\\ResponseInterface object.'); + } + } + }; + $this->each = new EachPromise($requests(), $config); + } + /** + * Get promise + */ + public function promise() : PromiseInterface + { + return $this->each->promise(); + } + /** + * Sends multiple requests concurrently and returns an array of responses + * and exceptions that uses the same ordering as the provided requests. + * + * IMPORTANT: This method keeps every request and response in memory, and + * as such, is NOT recommended when sending a large number or an + * indeterminate number of requests concurrently. + * + * @param ClientInterface $client Client used to send the requests + * @param array|\Iterator $requests Requests to send concurrently. + * @param array $options Passes through the options available in + * {@see \GuzzleHttp\Pool::__construct} + * + * @return array Returns an array containing the response or an exception + * in the same order that the requests were sent. + * + * @throws \InvalidArgumentException if the event format is incorrect. + */ + public static function batch(ClientInterface $client, $requests, array $options = []) : array + { + $res = []; + self::cmpCallback($options, 'fulfilled', $res); + self::cmpCallback($options, 'rejected', $res); + $pool = new static($client, $requests, $options); + $pool->promise()->wait(); + \ksort($res); + return $res; + } + /** + * Execute callback(s) + */ + private static function cmpCallback(array &$options, string $name, array &$results) : void + { + if (!isset($options[$name])) { + $options[$name] = static function ($v, $k) use(&$results) { + $results[$k] = $v; + }; + } else { + $currentFn = $options[$name]; + $options[$name] = static function ($v, $k) use(&$results, $currentFn) { + $currentFn($v, $k); + $results[$k] = $v; + }; + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php new file mode 100644 index 0000000..e73fd20 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -0,0 +1,86 @@ +nextHandler = $nextHandler; + } + public function __invoke(RequestInterface $request, array $options) : PromiseInterface + { + $fn = $this->nextHandler; + // Don't do anything if the request has no body. + if ($request->getBody()->getSize() === 0) { + return $fn($request, $options); + } + $modify = []; + // Add a default content-type if possible. + if (!$request->hasHeader('Content-Type')) { + if ($uri = $request->getBody()->getMetadata('uri')) { + if (is_string($uri) && ($type = Psr7\MimeType::fromFilename($uri))) { + $modify['set_headers']['Content-Type'] = $type; + } + } + } + // Add a default content-length or transfer-encoding header. + if (!$request->hasHeader('Content-Length') && !$request->hasHeader('Transfer-Encoding')) { + $size = $request->getBody()->getSize(); + if ($size !== null) { + $modify['set_headers']['Content-Length'] = $size; + } else { + $modify['set_headers']['Transfer-Encoding'] = 'chunked'; + } + } + // Add the expect header if needed. + $this->addExpectHeader($request, $options, $modify); + return $fn(Psr7\Utils::modifyRequest($request, $modify), $options); + } + /** + * Add expect header + */ + private function addExpectHeader(RequestInterface $request, array $options, array &$modify) : void + { + // Determine if the Expect header should be used + if ($request->hasHeader('Expect')) { + return; + } + $expect = $options['expect'] ?? null; + // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 + if ($expect === \false || $request->getProtocolVersion() < 1.1) { + return; + } + // The expect header is unconditionally enabled + if ($expect === \true) { + $modify['set_headers']['Expect'] = '100-Continue'; + return; + } + // By default, send the expect header when the payload is > 1mb + if ($expect === null) { + $expect = 1048576; + } + // Always add if the body cannot be rewound, the size cannot be + // determined, or the size is greater than the cutoff threshold + $body = $request->getBody(); + $size = $body->getSize(); + if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { + $modify['set_headers']['Expect'] = '100-Continue'; + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/RedirectMiddleware.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/RedirectMiddleware.php new file mode 100644 index 0000000..ae4feea --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -0,0 +1,162 @@ + 5, 'protocols' => ['http', 'https'], 'strict' => \false, 'referer' => \false, 'track_redirects' => \false]; + /** + * @var callable(RequestInterface, array): PromiseInterface + */ + private $nextHandler; + /** + * @param callable(RequestInterface, array): PromiseInterface $nextHandler Next handler to invoke. + */ + public function __construct(callable $nextHandler) + { + $this->nextHandler = $nextHandler; + } + public function __invoke(RequestInterface $request, array $options) : PromiseInterface + { + $fn = $this->nextHandler; + if (empty($options['allow_redirects'])) { + return $fn($request, $options); + } + if ($options['allow_redirects'] === \true) { + $options['allow_redirects'] = self::$defaultSettings; + } elseif (!\is_array($options['allow_redirects'])) { + throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); + } else { + // Merge the default settings with the provided settings + $options['allow_redirects'] += self::$defaultSettings; + } + if (empty($options['allow_redirects']['max'])) { + return $fn($request, $options); + } + return $fn($request, $options)->then(function (ResponseInterface $response) use($request, $options) { + return $this->checkRedirect($request, $options, $response); + }); + } + /** + * @return ResponseInterface|PromiseInterface + */ + public function checkRedirect(RequestInterface $request, array $options, ResponseInterface $response) + { + if (\strpos((string) $response->getStatusCode(), '3') !== 0 || !$response->hasHeader('Location')) { + return $response; + } + $this->guardMax($request, $response, $options); + $nextRequest = $this->modifyRequest($request, $options, $response); + // If authorization is handled by curl, unset it if URI is cross-origin. + if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $nextRequest->getUri()) && defined('\\CURLOPT_HTTPAUTH')) { + unset($options['curl'][\CURLOPT_HTTPAUTH], $options['curl'][\CURLOPT_USERPWD]); + } + if (isset($options['allow_redirects']['on_redirect'])) { + $options['allow_redirects']['on_redirect']($request, $response, $nextRequest->getUri()); + } + $promise = $this($nextRequest, $options); + // Add headers to be able to track history of redirects. + if (!empty($options['allow_redirects']['track_redirects'])) { + return $this->withTracking($promise, (string) $nextRequest->getUri(), $response->getStatusCode()); + } + return $promise; + } + /** + * Enable tracking on promise. + */ + private function withTracking(PromiseInterface $promise, string $uri, int $statusCode) : PromiseInterface + { + return $promise->then(static function (ResponseInterface $response) use($uri, $statusCode) { + // Note that we are pushing to the front of the list as this + // would be an earlier response than what is currently present + // in the history header. + $historyHeader = $response->getHeader(self::HISTORY_HEADER); + $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); + \array_unshift($historyHeader, $uri); + \array_unshift($statusHeader, (string) $statusCode); + return $response->withHeader(self::HISTORY_HEADER, $historyHeader)->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); + }); + } + /** + * Check for too many redirects. + * + * @throws TooManyRedirectsException Too many redirects. + */ + private function guardMax(RequestInterface $request, ResponseInterface $response, array &$options) : void + { + $current = $options['__redirect_count'] ?? 0; + $options['__redirect_count'] = $current + 1; + $max = $options['allow_redirects']['max']; + if ($options['__redirect_count'] > $max) { + throw new TooManyRedirectsException("Will not follow more than {$max} redirects", $request, $response); + } + } + public function modifyRequest(RequestInterface $request, array $options, ResponseInterface $response) : RequestInterface + { + // Request modifications to apply. + $modify = []; + $protocols = $options['allow_redirects']['protocols']; + // Use a GET request if this is an entity enclosing request and we are + // not forcing RFC compliance, but rather emulating what all browsers + // would do. + $statusCode = $response->getStatusCode(); + if ($statusCode == 303 || $statusCode <= 302 && !$options['allow_redirects']['strict']) { + $safeMethods = ['GET', 'HEAD', 'OPTIONS']; + $requestMethod = $request->getMethod(); + $modify['method'] = in_array($requestMethod, $safeMethods) ? $requestMethod : 'GET'; + $modify['body'] = ''; + } + $uri = self::redirectUri($request, $response, $protocols); + if (isset($options['idn_conversion']) && $options['idn_conversion'] !== \false) { + $idnOptions = $options['idn_conversion'] === \true ? \IDNA_DEFAULT : $options['idn_conversion']; + $uri = Utils::idnUriConvert($uri, $idnOptions); + } + $modify['uri'] = $uri; + Psr7\Message::rewindBody($request); + // Add the Referer header if it is told to do so and only + // add the header if we are not redirecting from https to http. + if ($options['allow_redirects']['referer'] && $modify['uri']->getScheme() === $request->getUri()->getScheme()) { + $uri = $request->getUri()->withUserInfo(''); + $modify['set_headers']['Referer'] = (string) $uri; + } else { + $modify['remove_headers'][] = 'Referer'; + } + // Remove Authorization and Cookie headers if URI is cross-origin. + if (Psr7\UriComparator::isCrossOrigin($request->getUri(), $modify['uri'])) { + $modify['remove_headers'][] = 'Authorization'; + $modify['remove_headers'][] = 'Cookie'; + } + return Psr7\Utils::modifyRequest($request, $modify); + } + /** + * Set the appropriate URL on the request based on the location header. + */ + private static function redirectUri(RequestInterface $request, ResponseInterface $response, array $protocols) : UriInterface + { + $location = Psr7\UriResolver::resolve($request->getUri(), new Psr7\Uri($response->getHeaderLine('Location'))); + // Ensure that the redirect URI is allowed based on the protocols. + if (!\in_array($location->getScheme(), $protocols)) { + throw new BadResponseException(\sprintf('Redirect URI, %s, does not use one of the allowed redirect protocols: %s', $location, \implode(', ', $protocols)), $request, $response); + } + return $location; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/RequestOptions.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/RequestOptions.php new file mode 100644 index 0000000..1e7a146 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/RequestOptions.php @@ -0,0 +1,244 @@ +decider = $decider; + $this->nextHandler = $nextHandler; + $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; + } + /** + * Default exponential backoff delay function. + * + * @return int milliseconds. + */ + public static function exponentialDelay(int $retries) : int + { + return (int) 2 ** ($retries - 1) * 1000; + } + public function __invoke(RequestInterface $request, array $options) : PromiseInterface + { + if (!isset($options['retries'])) { + $options['retries'] = 0; + } + $fn = $this->nextHandler; + return $fn($request, $options)->then($this->onFulfilled($request, $options), $this->onRejected($request, $options)); + } + /** + * Execute fulfilled closure + */ + private function onFulfilled(RequestInterface $request, array $options) : callable + { + return function ($value) use($request, $options) { + if (!($this->decider)($options['retries'], $request, $value, null)) { + return $value; + } + return $this->doRetry($request, $options, $value); + }; + } + /** + * Execute rejected closure + */ + private function onRejected(RequestInterface $req, array $options) : callable + { + return function ($reason) use($req, $options) { + if (!($this->decider)($options['retries'], $req, null, $reason)) { + return P\Create::rejectionFor($reason); + } + return $this->doRetry($req, $options); + }; + } + private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null) : PromiseInterface + { + $options['delay'] = ($this->delay)(++$options['retries'], $response, $request); + return $this($request, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/TransferStats.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/TransferStats.php new file mode 100644 index 0000000..98c93e3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/TransferStats.php @@ -0,0 +1,114 @@ +request = $request; + $this->response = $response; + $this->transferTime = $transferTime; + $this->handlerErrorData = $handlerErrorData; + $this->handlerStats = $handlerStats; + } + public function getRequest() : RequestInterface + { + return $this->request; + } + /** + * Returns the response that was received (if any). + */ + public function getResponse() : ?ResponseInterface + { + return $this->response; + } + /** + * Returns true if a response was received. + */ + public function hasResponse() : bool + { + return $this->response !== null; + } + /** + * Gets handler specific error data. + * + * This might be an exception, a integer representing an error code, or + * anything else. Relying on this value assumes that you know what handler + * you are using. + * + * @return mixed + */ + public function getHandlerErrorData() + { + return $this->handlerErrorData; + } + /** + * Get the effective URI the request was sent to. + */ + public function getEffectiveUri() : UriInterface + { + return $this->request->getUri(); + } + /** + * Get the estimated time the request was being transferred by the handler. + * + * @return float|null Time in seconds. + */ + public function getTransferTime() : ?float + { + return $this->transferTime; + } + /** + * Gets an array of all of the handler specific transfer data. + */ + public function getHandlerStats() : array + { + return $this->handlerStats; + } + /** + * Get a specific handler statistic from the handler by name. + * + * @param string $stat Handler specific transfer stat to retrieve. + * + * @return mixed|null + */ + public function getHandlerStat(string $stat) + { + return $this->handlerStats[$stat] ?? null; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Utils.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Utils.php new file mode 100644 index 0000000..af3e1d1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/Utils.php @@ -0,0 +1,339 @@ +getHost()) { + $asciiHost = self::idnToAsci($uri->getHost(), $options, $info); + if ($asciiHost === \false) { + $errorBitSet = $info['errors'] ?? 0; + $errorConstants = array_filter(array_keys(get_defined_constants()), static function (string $name) : bool { + return substr($name, 0, 11) === 'IDNA_ERROR_'; + }); + $errors = []; + foreach ($errorConstants as $errorConstant) { + if ($errorBitSet & constant($errorConstant)) { + $errors[] = $errorConstant; + } + } + $errorMessage = 'IDN conversion failed'; + if ($errors) { + $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; + } + throw new InvalidArgumentException($errorMessage); + } + if ($uri->getHost() !== $asciiHost) { + // Replace URI only if the ASCII version is different + $uri = $uri->withHost($asciiHost); + } + } + return $uri; + } + /** + * @internal + */ + public static function getenv(string $name) : ?string + { + if (isset($_SERVER[$name])) { + return (string) $_SERVER[$name]; + } + if (\PHP_SAPI === 'cli' && ($value = \getenv($name)) !== \false && $value !== null) { + return (string) $value; + } + return null; + } + /** + * @return string|false + */ + private static function idnToAsci(string $domain, int $options, ?array &$info = []) + { + if (\function_exists('idn_to_ascii') && \defined('INTL_IDNA_VARIANT_UTS46')) { + return \idn_to_ascii($domain, $options, \INTL_IDNA_VARIANT_UTS46, $info); + } + throw new \Error('ext-idn or symfony/polyfill-intl-idn not loaded or too old'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/functions.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/functions.php new file mode 100644 index 0000000..bb1edf3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/guzzle/src/functions.php @@ -0,0 +1,158 @@ + +Copyright (c) 2015 Graham Campbell +Copyright (c) 2017 Tobias Schultze +Copyright (c) 2020 Tobias Nyholm + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/AggregateException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/AggregateException.php new file mode 100644 index 0000000..3fb0645 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/AggregateException.php @@ -0,0 +1,14 @@ +then(function ($v) { echo $v; }); + * + * @param callable $generatorFn Generator function to wrap into a promise. + * + * @return Promise + * + * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration + */ +final class Coroutine implements PromiseInterface +{ + /** + * @var PromiseInterface|null + */ + private $currentPromise; + /** + * @var Generator + */ + private $generator; + /** + * @var Promise + */ + private $result; + public function __construct(callable $generatorFn) + { + $this->generator = $generatorFn(); + $this->result = new Promise(function () { + while (isset($this->currentPromise)) { + $this->currentPromise->wait(); + } + }); + try { + $this->nextCoroutine($this->generator->current()); + } catch (\Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + /** + * Create a new coroutine. + * + * @return self + */ + public static function of(callable $generatorFn) + { + return new self($generatorFn); + } + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + return $this->result->then($onFulfilled, $onRejected); + } + public function otherwise(callable $onRejected) + { + return $this->result->otherwise($onRejected); + } + public function wait($unwrap = \true) + { + return $this->result->wait($unwrap); + } + public function getState() + { + return $this->result->getState(); + } + public function resolve($value) + { + $this->result->resolve($value); + } + public function reject($reason) + { + $this->result->reject($reason); + } + public function cancel() + { + $this->currentPromise->cancel(); + $this->result->cancel(); + } + private function nextCoroutine($yielded) + { + $this->currentPromise = Create::promiseFor($yielded)->then([$this, '_handleSuccess'], [$this, '_handleFailure']); + } + /** + * @internal + */ + public function _handleSuccess($value) + { + unset($this->currentPromise); + try { + $next = $this->generator->send($value); + if ($this->generator->valid()) { + $this->nextCoroutine($next); + } else { + $this->result->resolve($value); + } + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + /** + * @internal + */ + public function _handleFailure($reason) + { + unset($this->currentPromise); + try { + $nextYield = $this->generator->throw(Create::exceptionFor($reason)); + // The throw was caught, so keep iterating on the coroutine + $this->nextCoroutine($nextYield); + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Create.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Create.php new file mode 100644 index 0000000..6886ad1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Create.php @@ -0,0 +1,75 @@ +then([$promise, 'resolve'], [$promise, 'reject']); + return $promise; + } + return new FulfilledPromise($value); + } + /** + * Creates a rejected promise for a reason if the reason is not a promise. + * If the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + * + * @return PromiseInterface + */ + public static function rejectionFor($reason) + { + if ($reason instanceof PromiseInterface) { + return $reason; + } + return new RejectedPromise($reason); + } + /** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + */ + public static function exceptionFor($reason) + { + if ($reason instanceof \Exception || $reason instanceof \Throwable) { + return $reason; + } + return new RejectionException($reason); + } + /** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + */ + public static function iterFor($value) + { + if ($value instanceof \Iterator) { + return $value; + } + if (is_array($value)) { + return new \ArrayIterator($value); + } + return new \ArrayIterator([$value]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Each.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Each.php new file mode 100644 index 0000000..a8b1cd4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Each.php @@ -0,0 +1,66 @@ + $onFulfilled, 'rejected' => $onRejected]))->promise(); + } + /** + * Like of, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow + * for dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + */ + public static function ofLimit($iterable, $concurrency, callable $onFulfilled = null, callable $onRejected = null) + { + return (new EachPromise($iterable, ['fulfilled' => $onFulfilled, 'rejected' => $onRejected, 'concurrency' => $concurrency]))->promise(); + } + /** + * Like limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * + * @return PromiseInterface + */ + public static function ofLimitAll($iterable, $concurrency, callable $onFulfilled = null) + { + return self::ofLimit($iterable, $concurrency, $onFulfilled, function ($reason, $idx, PromiseInterface $aggregate) { + $aggregate->reject($reason); + }); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/EachPromise.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/EachPromise.php new file mode 100644 index 0000000..f11752f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/EachPromise.php @@ -0,0 +1,200 @@ +iterable = Create::iterFor($iterable); + if (isset($config['concurrency'])) { + $this->concurrency = $config['concurrency']; + } + if (isset($config['fulfilled'])) { + $this->onFulfilled = $config['fulfilled']; + } + if (isset($config['rejected'])) { + $this->onRejected = $config['rejected']; + } + } + /** @psalm-suppress InvalidNullableReturnType */ + public function promise() + { + if ($this->aggregate) { + return $this->aggregate; + } + try { + $this->createPromise(); + /** @psalm-assert Promise $this->aggregate */ + $this->iterable->rewind(); + $this->refillPending(); + } catch (\Throwable $e) { + $this->aggregate->reject($e); + } catch (\Exception $e) { + $this->aggregate->reject($e); + } + /** + * @psalm-suppress NullableReturnStatement + * @phpstan-ignore-next-line + */ + return $this->aggregate; + } + private function createPromise() + { + $this->mutex = \false; + $this->aggregate = new Promise(function () { + if ($this->checkIfFinished()) { + return; + } + reset($this->pending); + // Consume a potentially fluctuating list of promises while + // ensuring that indexes are maintained (precluding array_shift). + while ($promise = current($this->pending)) { + next($this->pending); + $promise->wait(); + if (Is::settled($this->aggregate)) { + return; + } + } + }); + // Clear the references when the promise is resolved. + $clearFn = function () { + $this->iterable = $this->concurrency = $this->pending = null; + $this->onFulfilled = $this->onRejected = null; + $this->nextPendingIndex = 0; + }; + $this->aggregate->then($clearFn, $clearFn); + } + private function refillPending() + { + if (!$this->concurrency) { + // Add all pending promises. + while ($this->addPending() && $this->advanceIterator()) { + } + return; + } + // Add only up to N pending promises. + $concurrency = is_callable($this->concurrency) ? call_user_func($this->concurrency, count($this->pending)) : $this->concurrency; + $concurrency = max($concurrency - count($this->pending), 0); + // Concurrency may be set to 0 to disallow new promises. + if (!$concurrency) { + return; + } + // Add the first pending promise. + $this->addPending(); + // Note this is special handling for concurrency=1 so that we do + // not advance the iterator after adding the first promise. This + // helps work around issues with generators that might not have the + // next value to yield until promise callbacks are called. + while (--$concurrency && $this->advanceIterator() && $this->addPending()) { + } + } + private function addPending() + { + if (!$this->iterable || !$this->iterable->valid()) { + return \false; + } + $promise = Create::promiseFor($this->iterable->current()); + $key = $this->iterable->key(); + // Iterable keys may not be unique, so we use a counter to + // guarantee uniqueness + $idx = $this->nextPendingIndex++; + $this->pending[$idx] = $promise->then(function ($value) use($idx, $key) { + if ($this->onFulfilled) { + call_user_func($this->onFulfilled, $value, $key, $this->aggregate); + } + $this->step($idx); + }, function ($reason) use($idx, $key) { + if ($this->onRejected) { + call_user_func($this->onRejected, $reason, $key, $this->aggregate); + } + $this->step($idx); + }); + return \true; + } + private function advanceIterator() + { + // Place a lock on the iterator so that we ensure to not recurse, + // preventing fatal generator errors. + if ($this->mutex) { + return \false; + } + $this->mutex = \true; + try { + $this->iterable->next(); + $this->mutex = \false; + return \true; + } catch (\Throwable $e) { + $this->aggregate->reject($e); + $this->mutex = \false; + return \false; + } catch (\Exception $e) { + $this->aggregate->reject($e); + $this->mutex = \false; + return \false; + } + } + private function step($idx) + { + // If the promise was already resolved, then ignore this step. + if (Is::settled($this->aggregate)) { + return; + } + unset($this->pending[$idx]); + // Only refill pending promises if we are not locked, preventing the + // EachPromise to recursively invoke the provided iterator, which + // cause a fatal error: "Cannot resume an already running generator" + if ($this->advanceIterator() && !$this->checkIfFinished()) { + // Add more pending promises if possible. + $this->refillPending(); + } + } + private function checkIfFinished() + { + if (!$this->pending && !$this->iterable->valid()) { + // Resolve the promise if there's nothing left to do. + $this->aggregate->resolve(null); + return \true; + } + return \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/FulfilledPromise.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/FulfilledPromise.php new file mode 100644 index 0000000..c54b568 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/FulfilledPromise.php @@ -0,0 +1,69 @@ +value = $value; + } + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + // Return itself if there is no onFulfilled function. + if (!$onFulfilled) { + return $this; + } + $queue = Utils::queue(); + $p = new Promise([$queue, 'run']); + $value = $this->value; + $queue->add(static function () use($p, $value, $onFulfilled) { + if (Is::pending($p)) { + try { + $p->resolve($onFulfilled($value)); + } catch (\Throwable $e) { + $p->reject($e); + } catch (\Exception $e) { + $p->reject($e); + } + } + }); + return $p; + } + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + public function wait($unwrap = \true, $defaultDelivery = null) + { + return $unwrap ? $this->value : null; + } + public function getState() + { + return self::FULFILLED; + } + public function resolve($value) + { + if ($value !== $this->value) { + throw new \LogicException("Cannot resolve a fulfilled promise"); + } + } + public function reject($reason) + { + throw new \LogicException("Cannot reject a fulfilled promise"); + } + public function cancel() + { + // pass + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Is.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Is.php new file mode 100644 index 0000000..64b7554 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Is.php @@ -0,0 +1,43 @@ +getState() === PromiseInterface::PENDING; + } + /** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + */ + public static function settled(PromiseInterface $promise) + { + return $promise->getState() !== PromiseInterface::PENDING; + } + /** + * Returns true if a promise is fulfilled. + * + * @return bool + */ + public static function fulfilled(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::FULFILLED; + } + /** + * Returns true if a promise is rejected. + * + * @return bool + */ + public static function rejected(PromiseInterface $promise) + { + return $promise->getState() === PromiseInterface::REJECTED; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Promise.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Promise.php new file mode 100644 index 0000000..5b7a591 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/Promise.php @@ -0,0 +1,237 @@ +waitFn = $waitFn; + $this->cancelFn = $cancelFn; + } + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + if ($this->state === self::PENDING) { + $p = new Promise(null, [$this, 'cancel']); + $this->handlers[] = [$p, $onFulfilled, $onRejected]; + $p->waitList = $this->waitList; + $p->waitList[] = $this; + return $p; + } + // Return a fulfilled promise and immediately invoke any callbacks. + if ($this->state === self::FULFILLED) { + $promise = Create::promiseFor($this->result); + return $onFulfilled ? $promise->then($onFulfilled) : $promise; + } + // It's either cancelled or rejected, so return a rejected promise + // and immediately invoke any callbacks. + $rejection = Create::rejectionFor($this->result); + return $onRejected ? $rejection->then(null, $onRejected) : $rejection; + } + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + public function wait($unwrap = \true) + { + $this->waitIfPending(); + if ($this->result instanceof PromiseInterface) { + return $this->result->wait($unwrap); + } + if ($unwrap) { + if ($this->state === self::FULFILLED) { + return $this->result; + } + // It's rejected so "unwrap" and throw an exception. + throw Create::exceptionFor($this->result); + } + } + public function getState() + { + return $this->state; + } + public function cancel() + { + if ($this->state !== self::PENDING) { + return; + } + $this->waitFn = $this->waitList = null; + if ($this->cancelFn) { + $fn = $this->cancelFn; + $this->cancelFn = null; + try { + $fn(); + } catch (\Throwable $e) { + $this->reject($e); + } catch (\Exception $e) { + $this->reject($e); + } + } + // Reject the promise only if it wasn't rejected in a then callback. + /** @psalm-suppress RedundantCondition */ + if ($this->state === self::PENDING) { + $this->reject(new CancellationException('Promise has been cancelled')); + } + } + public function resolve($value) + { + $this->settle(self::FULFILLED, $value); + } + public function reject($reason) + { + $this->settle(self::REJECTED, $reason); + } + private function settle($state, $value) + { + if ($this->state !== self::PENDING) { + // Ignore calls with the same resolution. + if ($state === $this->state && $value === $this->result) { + return; + } + throw $this->state === $state ? new \LogicException("The promise is already {$state}.") : new \LogicException("Cannot change a {$this->state} promise to {$state}"); + } + if ($value === $this) { + throw new \LogicException('Cannot fulfill or reject a promise with itself'); + } + // Clear out the state of the promise but stash the handlers. + $this->state = $state; + $this->result = $value; + $handlers = $this->handlers; + $this->handlers = null; + $this->waitList = $this->waitFn = null; + $this->cancelFn = null; + if (!$handlers) { + return; + } + // If the value was not a settled promise or a thenable, then resolve + // it in the task queue using the correct ID. + if (!is_object($value) || !method_exists($value, 'then')) { + $id = $state === self::FULFILLED ? 1 : 2; + // It's a success, so resolve the handlers in the queue. + Utils::queue()->add(static function () use($id, $value, $handlers) { + foreach ($handlers as $handler) { + self::callHandler($id, $value, $handler); + } + }); + } elseif ($value instanceof Promise && Is::pending($value)) { + // We can just merge our handlers onto the next promise. + $value->handlers = array_merge($value->handlers, $handlers); + } else { + // Resolve the handlers when the forwarded promise is resolved. + $value->then(static function ($value) use($handlers) { + foreach ($handlers as $handler) { + self::callHandler(1, $value, $handler); + } + }, static function ($reason) use($handlers) { + foreach ($handlers as $handler) { + self::callHandler(2, $reason, $handler); + } + }); + } + } + /** + * Call a stack of handlers using a specific callback index and value. + * + * @param int $index 1 (resolve) or 2 (reject). + * @param mixed $value Value to pass to the callback. + * @param array $handler Array of handler data (promise and callbacks). + */ + private static function callHandler($index, $value, array $handler) + { + /** @var PromiseInterface $promise */ + $promise = $handler[0]; + // The promise may have been cancelled or resolved before placing + // this thunk in the queue. + if (Is::settled($promise)) { + return; + } + try { + if (isset($handler[$index])) { + /* + * If $f throws an exception, then $handler will be in the exception + * stack trace. Since $handler contains a reference to the callable + * itself we get a circular reference. We clear the $handler + * here to avoid that memory leak. + */ + $f = $handler[$index]; + unset($handler); + $promise->resolve($f($value)); + } elseif ($index === 1) { + // Forward resolution values as-is. + $promise->resolve($value); + } else { + // Forward rejections down the chain. + $promise->reject($value); + } + } catch (\Throwable $reason) { + $promise->reject($reason); + } catch (\Exception $reason) { + $promise->reject($reason); + } + } + private function waitIfPending() + { + if ($this->state !== self::PENDING) { + return; + } elseif ($this->waitFn) { + $this->invokeWaitFn(); + } elseif ($this->waitList) { + $this->invokeWaitList(); + } else { + // If there's no wait function, then reject the promise. + $this->reject('Cannot wait on a promise that has ' . 'no internal wait function. You must provide a wait ' . 'function when constructing the promise to be able to ' . 'wait on a promise.'); + } + Utils::queue()->run(); + /** @psalm-suppress RedundantCondition */ + if ($this->state === self::PENDING) { + $this->reject('Invoking the wait callback did not resolve the promise'); + } + } + private function invokeWaitFn() + { + try { + $wfn = $this->waitFn; + $this->waitFn = null; + $wfn(\true); + } catch (\Exception $reason) { + if ($this->state === self::PENDING) { + // The promise has not been resolved yet, so reject the promise + // with the exception. + $this->reject($reason); + } else { + // The promise was already resolved, so there's a problem in + // the application. + throw $reason; + } + } + } + private function invokeWaitList() + { + $waitList = $this->waitList; + $this->waitList = null; + foreach ($waitList as $result) { + do { + $result->waitIfPending(); + $result = $result->result; + } while ($result instanceof Promise); + if ($result instanceof PromiseInterface) { + $result->wait(\false); + } + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/PromiseInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/PromiseInterface.php new file mode 100644 index 0000000..e295178 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/PromiseInterface.php @@ -0,0 +1,87 @@ +reason = $reason; + } + public function then(callable $onFulfilled = null, callable $onRejected = null) + { + // If there's no onRejected callback then just return self. + if (!$onRejected) { + return $this; + } + $queue = Utils::queue(); + $reason = $this->reason; + $p = new Promise([$queue, 'run']); + $queue->add(static function () use($p, $reason, $onRejected) { + if (Is::pending($p)) { + try { + // Return a resolved promise if onRejected does not throw. + $p->resolve($onRejected($reason)); + } catch (\Throwable $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } catch (\Exception $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } + } + }); + return $p; + } + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + public function wait($unwrap = \true, $defaultDelivery = null) + { + if ($unwrap) { + throw Create::exceptionFor($this->reason); + } + return null; + } + public function getState() + { + return self::REJECTED; + } + public function resolve($value) + { + throw new \LogicException("Cannot resolve a rejected promise"); + } + public function reject($reason) + { + if ($reason !== $this->reason) { + throw new \LogicException("Cannot reject a rejected promise"); + } + } + public function cancel() + { + // pass + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/RejectionException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/RejectionException.php new file mode 100644 index 0000000..484345b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/RejectionException.php @@ -0,0 +1,40 @@ +reason = $reason; + $message = 'The promise was rejected'; + if ($description) { + $message .= ' with reason: ' . $description; + } elseif (is_string($reason) || is_object($reason) && method_exists($reason, '__toString')) { + $message .= ' with reason: ' . $this->reason; + } elseif ($reason instanceof \JsonSerializable) { + $message .= ' with reason: ' . json_encode($this->reason, \JSON_PRETTY_PRINT); + } + parent::__construct($message); + } + /** + * Returns the rejection reason. + * + * @return mixed + */ + public function getReason() + { + return $this->reason; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/TaskQueue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/TaskQueue.php new file mode 100644 index 0000000..60034de --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/TaskQueue.php @@ -0,0 +1,62 @@ +run(); + */ +class TaskQueue implements TaskQueueInterface +{ + private $enableShutdown = \true; + private $queue = []; + public function __construct($withShutdown = \true) + { + if ($withShutdown) { + register_shutdown_function(function () { + if ($this->enableShutdown) { + // Only run the tasks if an E_ERROR didn't occur. + $err = error_get_last(); + if (!$err || $err['type'] ^ \E_ERROR) { + $this->run(); + } + } + }); + } + } + public function isEmpty() + { + return !$this->queue; + } + public function add(callable $task) + { + $this->queue[] = $task; + } + public function run() + { + while ($task = array_shift($this->queue)) { + /** @var callable $task */ + $task(); + } + } + /** + * The task queue will be run and exhausted by default when the process + * exits IFF the exit is not the result of a PHP E_ERROR error. + * + * You can disable running the automatic shutdown of the queue by calling + * this function. If you disable the task queue shutdown process, then you + * MUST either run the task queue (as a result of running your event loop + * or manually using the run() method) or wait on each outstanding promise. + * + * Note: This shutdown will occur before any destructors are triggered. + */ + public function disableShutdown() + { + $this->enableShutdown = \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/TaskQueueInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/TaskQueueInterface.php new file mode 100644 index 0000000..a5fb1f7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/TaskQueueInterface.php @@ -0,0 +1,22 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\Utils::queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + */ + public static function queue(TaskQueueInterface $assign = null) + { + static $queue; + if ($assign) { + $queue = $assign; + } elseif (!$queue) { + $queue = new TaskQueue(); + } + return $queue; + } + /** + * Adds a function to run in the task queue when it is next `run()` and + * returns a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + * + * @return PromiseInterface + */ + public static function task(callable $task) + { + $queue = self::queue(); + $promise = new Promise([$queue, 'run']); + $queue->add(function () use($task, $promise) { + try { + if (Is::pending($promise)) { + $promise->resolve($task()); + } + } catch (\Throwable $e) { + $promise->reject($e); + } catch (\Exception $e) { + $promise->reject($e); + } + }); + return $promise; + } + /** + * Synchronously waits on a promise to resolve and returns an inspection + * state array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the + * array will contain a "value" key mapping to the fulfilled value of the + * promise. If the promise is rejected, the array will contain a "reason" + * key mapping to the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + * + * @return array + */ + public static function inspect(PromiseInterface $promise) + { + try { + return ['state' => PromiseInterface::FULFILLED, 'value' => $promise->wait()]; + } catch (RejectionException $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; + } catch (\Throwable $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } catch (\Exception $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } + } + /** + * Waits on all of the provided promises, but does not unwrap rejected + * promises as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + */ + public static function inspectAll($promises) + { + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = self::inspect($promise); + } + return $results; + } + /** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same + * order the promises were provided). An exception is thrown if any of the + * promises are rejected. + * + * @param iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + */ + public static function unwrap($promises) + { + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = $promise->wait(); + } + return $results; + } + /** + * Given an array of promises, return a promise that is fulfilled when all + * the items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + * + * @return PromiseInterface + */ + public static function all($promises, $recursive = \false) + { + $results = []; + $promise = Each::of($promises, function ($value, $idx) use(&$results) { + $results[$idx] = $value; + }, function ($reason, $idx, Promise $aggregate) { + $aggregate->reject($reason); + })->then(function () use(&$results) { + ksort($results); + return $results; + }); + if (\true === $recursive) { + $promise = $promise->then(function ($results) use($recursive, &$promises) { + foreach ($promises as $promise) { + if (Is::pending($promise)) { + return self::all($promises, $recursive); + } + } + return $results; + }); + } + return $promise; + } + /** + * Initiate a competitive race between multiple promises or values (values + * will become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise + * is fulfilled with an array that contains the fulfillment values of the + * winners in order of resolution. + * + * This promise is rejected with a {@see AggregateException} if the number + * of fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function some($count, $promises) + { + $results = []; + $rejections = []; + return Each::of($promises, function ($value, $idx, PromiseInterface $p) use(&$results, $count) { + if (Is::settled($p)) { + return; + } + $results[$idx] = $value; + if (count($results) >= $count) { + $p->resolve(null); + } + }, function ($reason) use(&$rejections) { + $rejections[] = $reason; + })->then(function () use(&$results, &$rejections, $count) { + if (count($results) !== $count) { + throw new AggregateException('Not enough promises to fulfill count', $rejections); + } + ksort($results); + return array_values($results); + }); + } + /** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function any($promises) + { + return self::some(1, $promises)->then(function ($values) { + return $values[0]; + }); + } + /** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ + public static function settle($promises) + { + $results = []; + return Each::of($promises, function ($value, $idx) use(&$results) { + $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; + }, function ($reason, $idx) use(&$results) { + $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; + })->then(function () use(&$results) { + ksort($results); + return $results; + }); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/functions.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/functions.php new file mode 100644 index 0000000..755a324 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/functions.php @@ -0,0 +1,334 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + * + * @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead. + */ +function queue(TaskQueueInterface $assign = null) +{ + return Utils::queue($assign); +} +/** + * Adds a function to run in the task queue when it is next `run()` and returns + * a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + * + * @return PromiseInterface + * + * @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead. + */ +function task(callable $task) +{ + return Utils::task($task); +} +/** + * Creates a promise for a value if the value is not a promise. + * + * @param mixed $value Promise or value. + * + * @return PromiseInterface + * + * @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead. + */ +function promise_for($value) +{ + return Create::promiseFor($value); +} +/** + * Creates a rejected promise for a reason if the reason is not a promise. If + * the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + * + * @return PromiseInterface + * + * @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead. + */ +function rejection_for($reason) +{ + return Create::rejectionFor($reason); +} +/** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + * + * @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead. + */ +function exception_for($reason) +{ + return Create::exceptionFor($reason); +} +/** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + * + * @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead. + */ +function iter_for($value) +{ + return Create::iterFor($value); +} +/** + * Synchronously waits on a promise to resolve and returns an inspection state + * array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the array + * will contain a "value" key mapping to the fulfilled value of the promise. If + * the promise is rejected, the array will contain a "reason" key mapping to + * the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + * + * @return array + * + * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead. + */ +function inspect(PromiseInterface $promise) +{ + return Utils::inspect($promise); +} +/** + * Waits on all of the provided promises, but does not unwrap rejected promises + * as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + * + * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead. + */ +function inspect_all($promises) +{ + return Utils::inspectAll($promises); +} +/** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same order + * the promises were provided). An exception is thrown if any of the promises + * are rejected. + * + * @param iterable $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + * + * @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead. + */ +function unwrap($promises) +{ + return Utils::unwrap($promises); +} +/** + * Given an array of promises, return a promise that is fulfilled when all the + * items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * @param bool $recursive If true, resolves new promises that might have been added to the stack during its own resolution. + * + * @return PromiseInterface + * + * @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead. + */ +function all($promises, $recursive = \false) +{ + return Utils::all($promises, $recursive); +} +/** + * Initiate a competitive race between multiple promises or values (values will + * become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise is + * fulfilled with an array that contains the fulfillment values of the winners + * in order of resolution. + * + * This promise is rejected with a {@see AggregateException} if the number of + * fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead. + */ +function some($count, $promises) +{ + return Utils::some($count, $promises); +} +/** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead. + */ +function any($promises) +{ + return Utils::any($promises); +} +/** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @see inspect for the inspection state array format. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * + * @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead. + */ +function settle($promises) +{ + return Utils::settle($promises); +} +/** + * Given an iterator that yields promises or values, returns a promise that is + * fulfilled with a null value when the iterator has been consumed or the + * aggregate promise has been fulfilled or rejected. + * + * $onFulfilled is a function that accepts the fulfilled value, iterator index, + * and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate if needed. + * + * $onRejected is a function that accepts the rejection reason, iterator index, + * and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate if needed. + * + * @param mixed $iterable Iterator or array to iterate over. + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + * + * @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead. + */ +function each($iterable, callable $onFulfilled = null, callable $onRejected = null) +{ + return Each::of($iterable, $onFulfilled, $onRejected); +} +/** + * Like each, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow for + * dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + * + * @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead. + */ +function each_limit($iterable, $concurrency, callable $onFulfilled = null, callable $onRejected = null) +{ + return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected); +} +/** + * Like each_limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * + * @return PromiseInterface + * + * @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead. + */ +function each_limit_all($iterable, $concurrency, callable $onFulfilled = null) +{ + return Each::ofLimitAll($iterable, $concurrency, $onFulfilled); +} +/** + * Returns true if a promise is fulfilled. + * + * @return bool + * + * @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead. + */ +function is_fulfilled(PromiseInterface $promise) +{ + return Is::fulfilled($promise); +} +/** + * Returns true if a promise is rejected. + * + * @return bool + * + * @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead. + */ +function is_rejected(PromiseInterface $promise) +{ + return Is::rejected($promise); +} +/** + * Returns true if a promise is fulfilled or rejected. + * + * @return bool + * + * @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead. + */ +function is_settled(PromiseInterface $promise) +{ + return Is::settled($promise); +} +/** + * Create a new coroutine. + * + * @see Coroutine + * + * @return PromiseInterface + * + * @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead. + */ +function coroutine(callable $generatorFn) +{ + return Coroutine::of($generatorFn); +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/functions_include.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/functions_include.php new file mode 100644 index 0000000..1a467ec --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/promises/src/functions_include.php @@ -0,0 +1,8 @@ + +Copyright (c) 2015 Márk Sági-Kazár +Copyright (c) 2015 Graham Campbell +Copyright (c) 2016 Tobias Schultze +Copyright (c) 2016 George Mponos +Copyright (c) 2018 Tobias Nyholm + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/AppendStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 0000000..f77f82c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,205 @@ +addStream($stream); + } + } + public function __toString() : string + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR); + return ''; + } + } + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) : void + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = \false; + } + $this->streams[] = $stream; + } + public function getContents() : string + { + return Utils::copyToString($this); + } + /** + * Closes each attached stream. + */ + public function close() : void + { + $this->pos = $this->current = 0; + $this->seekable = \true; + foreach ($this->streams as $stream) { + $stream->close(); + } + $this->streams = []; + } + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = \true; + foreach ($this->streams as $stream) { + $stream->detach(); + } + $this->streams = []; + return null; + } + public function tell() : int + { + return $this->pos; + } + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + */ + public function getSize() : ?int + { + $size = 0; + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + return $size; + } + public function eof() : bool + { + return !$this->streams || $this->current >= count($this->streams) - 1 && $this->streams[$this->current]->eof(); + } + public function rewind() : void + { + $this->seek(0); + } + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + */ + public function seek($offset, $whence = \SEEK_SET) : void + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== \SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + $this->pos = $this->current = 0; + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' . $i . ' of the AppendStream', 0, $e); + } + } + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + /** + * Reads from all of the appended streams until the length is met or EOF. + */ + public function read($length) : string + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = \false; + while ($remaining > 0) { + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = \false; + if ($this->current === $total) { + break; + } + ++$this->current; + } + $result = $this->streams[$this->current]->read($remaining); + if ($result === '') { + $progressToNext = \true; + continue; + } + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + $this->pos += strlen($buffer); + return $buffer; + } + public function isReadable() : bool + { + return \true; + } + public function isWritable() : bool + { + return \false; + } + public function isSeekable() : bool + { + return $this->seekable; + } + public function write($string) : int + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/BufferStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 0000000..c7a664a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,123 @@ +hwm = $hwm; + } + public function __toString() : string + { + return $this->getContents(); + } + public function getContents() : string + { + $buffer = $this->buffer; + $this->buffer = ''; + return $buffer; + } + public function close() : void + { + $this->buffer = ''; + } + public function detach() + { + $this->close(); + return null; + } + public function getSize() : ?int + { + return strlen($this->buffer); + } + public function isReadable() : bool + { + return \true; + } + public function isWritable() : bool + { + return \true; + } + public function isSeekable() : bool + { + return \false; + } + public function rewind() : void + { + $this->seek(0); + } + public function seek($offset, $whence = \SEEK_SET) : void + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + public function eof() : bool + { + return strlen($this->buffer) === 0; + } + public function tell() : int + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + /** + * Reads data from the buffer. + */ + public function read($length) : string + { + $currentLength = strlen($this->buffer); + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + return $result; + } + /** + * Writes data to the buffer. + */ + public function write($string) : int + { + $this->buffer .= $string; + if (strlen($this->buffer) >= $this->hwm) { + return 0; + } + return strlen($string); + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if ($key === 'hwm') { + return $this->hwm; + } + return $key ? null : []; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/CachingStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 0000000..56dbfe6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,125 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(Utils::tryFopen('php://temp', 'r+')); + } + public function getSize() : ?int + { + $remoteSize = $this->remoteStream->getSize(); + if (null === $remoteSize) { + return null; + } + return max($this->stream->getSize(), $remoteSize); + } + public function rewind() : void + { + $this->seek(0); + } + public function seek($offset, $whence = \SEEK_SET) : void + { + if ($whence === \SEEK_SET) { + $byte = $offset; + } elseif ($whence === \SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence === \SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + $diff = $byte - $this->stream->getSize(); + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + public function read($length) : string + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read($remaining + $this->skipReadBytes); + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + $data .= $remoteData; + $this->stream->write($remoteData); + } + return $data; + } + public function write($string) : int + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = strlen($string) + $this->tell() - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + return $this->stream->write($string); + } + public function eof() : bool + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + /** + * Close both the remote stream and buffer stream + */ + public function close() : void + { + $this->remoteStream->close(); + $this->stream->close(); + } + private function cacheEntireStream() : int + { + $target = new FnStream(['write' => 'strlen']); + Utils::copyToStream($this, $target); + return $this->tell(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/DroppingStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000..54774ae --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,40 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + public function write($string) : int + { + $diff = $this->maxLength - $this->stream->getSize(); + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Exception/MalformedUriException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Exception/MalformedUriException.php new file mode 100644 index 0000000..1f6654a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Exception/MalformedUriException.php @@ -0,0 +1,12 @@ + */ + private $methods; + /** + * @param array $methods Hash of method name to a callable. + */ + public function __construct(array $methods) + { + $this->methods = $methods; + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + /** + * Lazily determine which methods are not implemented. + * + * @throws \BadMethodCallException + */ + public function __get(string $name) : void + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) . '() is not implemented in the FnStream'); + } + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * + * @throws \LogicException + */ + public function __wakeup() : void + { + throw new \LogicException('FnStream should never be unserialized'); + } + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::SLOTS, array_keys($methods)) as $diff) { + /** @var callable $callable */ + $callable = [$stream, $diff]; + $methods[$diff] = $callable; + } + return new self($methods); + } + public function __toString() : string + { + try { + return call_user_func($this->_fn___toString); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR); + return ''; + } + } + public function close() : void + { + call_user_func($this->_fn_close); + } + public function detach() + { + return call_user_func($this->_fn_detach); + } + public function getSize() : ?int + { + return call_user_func($this->_fn_getSize); + } + public function tell() : int + { + return call_user_func($this->_fn_tell); + } + public function eof() : bool + { + return call_user_func($this->_fn_eof); + } + public function isSeekable() : bool + { + return call_user_func($this->_fn_isSeekable); + } + public function rewind() : void + { + call_user_func($this->_fn_rewind); + } + public function seek($offset, $whence = \SEEK_SET) : void + { + call_user_func($this->_fn_seek, $offset, $whence); + } + public function isWritable() : bool + { + return call_user_func($this->_fn_isWritable); + } + public function write($string) : int + { + return call_user_func($this->_fn_write, $string); + } + public function isReadable() : bool + { + return call_user_func($this->_fn_isReadable); + } + public function read($length) : string + { + return call_user_func($this->_fn_read, $length); + } + public function getContents() : string + { + return call_user_func($this->_fn_getContents); + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Header.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Header.php new file mode 100644 index 0000000..688b1ee --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Header.php @@ -0,0 +1,117 @@ +]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + } + return $params; + } + /** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @deprecated Use self::splitList() instead. + */ + public static function normalize($header) : array + { + $result = []; + foreach ((array) $header as $value) { + foreach (self::splitList($value) as $parsed) { + $result[] = $parsed; + } + } + return $result; + } + /** + * Splits a HTTP header defined to contain a comma-separated list into + * each individual value. Empty values will be removed. + * + * Example headers include 'accept', 'cache-control' and 'if-none-match'. + * + * This method must not be used to parse headers that are not defined as + * a list, such as 'user-agent' or 'set-cookie'. + * + * @param string|string[] $values Header value as returned by MessageInterface::getHeader() + * + * @return string[] + */ + public static function splitList($values) : array + { + if (!\is_array($values)) { + $values = [$values]; + } + $result = []; + foreach ($values as $value) { + if (!\is_string($value)) { + throw new \TypeError('$header must either be a string or an array containing strings.'); + } + $v = ''; + $isQuoted = \false; + $isEscaped = \false; + for ($i = 0, $max = \strlen($value); $i < $max; ++$i) { + if ($isEscaped) { + $v .= $value[$i]; + $isEscaped = \false; + continue; + } + if (!$isQuoted && $value[$i] === ',') { + $v = \trim($v); + if ($v !== '') { + $result[] = $v; + } + $v = ''; + continue; + } + if ($isQuoted && $value[$i] === '\\') { + $isEscaped = \true; + $v .= $value[$i]; + continue; + } + if ($value[$i] === '"') { + $isQuoted = !$isQuoted; + $v .= $value[$i]; + continue; + } + $v .= $value[$i]; + } + $v = \trim($v); + if ($v !== '') { + $result[] = $v; + } + } + return $result; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/HttpFactory.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/HttpFactory.php new file mode 100644 index 0000000..6c51b07 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/HttpFactory.php @@ -0,0 +1,76 @@ +getSize(); + } + return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); + } + public function createStream(string $content = '') : StreamInterface + { + return Utils::streamFor($content); + } + public function createStreamFromFile(string $file, string $mode = 'r') : StreamInterface + { + try { + $resource = Utils::tryFopen($file, $mode); + } catch (\RuntimeException $e) { + if ('' === $mode || \false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], \true)) { + throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e); + } + throw $e; + } + return Utils::streamFor($resource); + } + public function createStreamFromResource($resource) : StreamInterface + { + return Utils::streamFor($resource); + } + public function createServerRequest(string $method, $uri, array $serverParams = []) : ServerRequestInterface + { + if (empty($method)) { + if (!empty($serverParams['REQUEST_METHOD'])) { + $method = $serverParams['REQUEST_METHOD']; + } else { + throw new \InvalidArgumentException('Cannot determine HTTP method'); + } + } + return new ServerRequest($method, $uri, [], null, '1.1', $serverParams); + } + public function createResponse(int $code = 200, string $reasonPhrase = '') : ResponseInterface + { + return new Response($code, [], null, '1.1', $reasonPhrase); + } + public function createRequest(string $method, $uri) : RequestInterface + { + return new Request($method, $uri); + } + public function createUri(string $uri = '') : UriInterface + { + return new Uri($uri); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/InflateStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 0000000..2a9253c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,33 @@ + 15 + 32]); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/LazyOpenStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 0000000..e8ef4ac --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,41 @@ +filename = $filename; + $this->mode = $mode; + // unsetting the property forces the first access to go through + // __get(). + unset($this->stream); + } + /** + * Creates the underlying stream lazily when required. + */ + protected function createStream() : StreamInterface + { + return Utils::streamFor(Utils::tryFopen($this->filename, $this->mode)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/LimitStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 0000000..6a0172f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,128 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + public function eof() : bool + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return \true; + } + // No limit and the underlying stream is not at EOF + if ($this->limit === -1) { + return \false; + } + return $this->stream->tell() >= $this->offset + $this->limit; + } + /** + * Returns the size of the limited subset of data + */ + public function getSize() : ?int + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit === -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + /** + * Allow for a bounded seek on the read limited stream + */ + public function seek($offset, $whence = \SEEK_SET) : void + { + if ($whence !== \SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf('Cannot seek to offset %s with whence %s', $offset, $whence)); + } + $offset += $this->offset; + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + $this->stream->seek($offset); + } + /** + * Give a relative tell() + */ + public function tell() : int + { + return $this->stream->tell() - $this->offset; + } + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset(int $offset) : void + { + $current = $this->stream->tell(); + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset {$offset}"); + } else { + $this->stream->read($offset - $current); + } + } + $this->offset = $offset; + } + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit(int $limit) : void + { + $this->limit = $limit; + } + public function read($length) : string + { + if ($this->limit === -1) { + return $this->stream->read($length); + } + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = $this->offset + $this->limit - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + return ''; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Message.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Message.php new file mode 100644 index 0000000..d7265b9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Message.php @@ -0,0 +1,189 @@ +getMethod() . ' ' . $message->getRequestTarget()) . ' HTTP/' . $message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: " . $message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' . $message->getStatusCode() . ' ' . $message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + foreach ($message->getHeaders() as $name => $values) { + if (strtolower($name) === 'set-cookie') { + foreach ($values as $value) { + $msg .= "\r\n{$name}: " . $value; + } + } else { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + } + return "{$msg}\r\n\r\n" . $message->getBody(); + } + /** + * Get a short summary of the message body. + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + */ + public static function bodySummary(MessageInterface $message, int $truncateAt = 120) : ?string + { + $body = $message->getBody(); + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + $size = $body->getSize(); + if ($size === 0) { + return null; + } + $body->rewind(); + $summary = $body->read($truncateAt); + $body->rewind(); + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\\pL\\pM\\pN\\pP\\pS\\pZ\\n\\r\\t]/u', $summary) !== 0) { + return null; + } + return $summary; + } + /** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` + * returns a value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ + public static function rewindBody(MessageInterface $message) : void + { + $body = $message->getBody(); + if ($body->tell()) { + $body->rewind(); + } + } + /** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + */ + public static function parseMessage(string $message) : array + { + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + $message = ltrim($message, "\r\n"); + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + if ($messageParts === \false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + [$rawHeaders, $body] = $messageParts; + $rawHeaders .= "\r\n"; + // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + if ($headerParts === \false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + [$startLine, $rawHeaders] = $headerParts; + if (preg_match("/(?:^HTTP\\/|^[A-Z]+ \\S+ HTTP\\/)(\\d+(?:\\.\\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, \PREG_SET_ORDER); + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + throw new \InvalidArgumentException('Invalid header syntax'); + } + $headers = []; + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + return ['start-line' => $startLine, 'headers' => $headers, 'body' => $body]; + } + /** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + */ + public static function parseRequestUri(string $path, array $headers) : string + { + $hostKey = array_filter(array_keys($headers), function ($k) { + // Numeric array keys are converted to int by PHP. + $k = (string) $k; + return strtolower($k) === 'host'; + }); + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + return $scheme . '://' . $host . '/' . ltrim($path, '/'); + } + /** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + */ + public static function parseRequest(string $message) : RequestInterface + { + $data = self::parseMessage($message); + $matches = []; + if (!preg_match('/^[\\S]+\\s+([a-zA-Z]+:\\/\\/|\\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + $request = new Request($parts[0], $matches[1] === '/' ? self::parseRequestUri($parts[1], $data['headers']) : $parts[1], $data['headers'], $data['body'], $version); + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); + } + /** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + */ + public static function parseResponse(string $message) : ResponseInterface + { + $data = self::parseMessage($message); + // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space + // between status-code and reason-phrase is required. But browsers accept + // responses without space and reason as well. + if (!preg_match('/^HTTP\\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + return new Response((int) $parts[1], $data['headers'], $data['body'], explode('/', $parts[0])[1], $parts[2] ?? null); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MessageTrait.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 0000000..92fa427 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,212 @@ + Map of all registered headers, as original name => array of values */ + private $headers = []; + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + /** @var string */ + private $protocol = '1.1'; + /** @var StreamInterface|null */ + private $stream; + public function getProtocolVersion() : string + { + return $this->protocol; + } + public function withProtocolVersion($version) : MessageInterface + { + if ($this->protocol === $version) { + return $this; + } + $new = clone $this; + $new->protocol = $version; + return $new; + } + public function getHeaders() : array + { + return $this->headers; + } + public function hasHeader($header) : bool + { + return isset($this->headerNames[strtolower($header)]); + } + public function getHeader($header) : array + { + $header = strtolower($header); + if (!isset($this->headerNames[$header])) { + return []; + } + $header = $this->headerNames[$header]; + return $this->headers[$header]; + } + public function getHeaderLine($header) : string + { + return implode(', ', $this->getHeader($header)); + } + public function withHeader($header, $value) : MessageInterface + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + return $new; + } + public function withAddedHeader($header, $value) : MessageInterface + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + return $new; + } + public function withoutHeader($header) : MessageInterface + { + $normalized = strtolower($header); + if (!isset($this->headerNames[$normalized])) { + return $this; + } + $header = $this->headerNames[$normalized]; + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + return $new; + } + public function getBody() : StreamInterface + { + if (!$this->stream) { + $this->stream = Utils::streamFor(''); + } + return $this->stream; + } + public function withBody(StreamInterface $body) : MessageInterface + { + if ($body === $this->stream) { + return $this; + } + $new = clone $this; + $new->stream = $body; + return $new; + } + /** + * @param array $headers + */ + private function setHeaders(array $headers) : void + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + // Numeric array keys are converted to int by PHP. + $header = (string) $header; + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + /** + * @param mixed $value + * + * @return string[] + */ + private function normalizeHeaderValue($value) : array + { + if (!is_array($value)) { + return $this->trimAndValidateHeaderValues([$value]); + } + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + return $this->trimAndValidateHeaderValues($value); + } + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param mixed[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimAndValidateHeaderValues(array $values) : array + { + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf('Header value must be scalar or null but %s provided.', is_object($value) ? get_class($value) : gettype($value))); + } + $trimmed = trim((string) $value, " \t"); + $this->assertValue($trimmed); + return $trimmed; + }, array_values($values)); + } + /** + * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * + * @param mixed $header + */ + private function assertHeader($header) : void + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf('Header name must be a string but %s provided.', is_object($header) ? get_class($header) : gettype($header))); + } + if (!preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/D', $header)) { + throw new \InvalidArgumentException(sprintf('"%s" is not valid header name.', $header)); + } + } + /** + * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * + * field-value = *( field-content / obs-fold ) + * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] + * field-vchar = VCHAR / obs-text + * VCHAR = %x21-7E + * obs-text = %x80-FF + * obs-fold = CRLF 1*( SP / HTAB ) + */ + private function assertValue(string $value) : void + { + // The regular expression intentionally does not support the obs-fold production, because as + // per RFC 7230#3.2.4: + // + // A sender MUST NOT generate a message that includes + // line folding (i.e., that has any field-value that contains a match to + // the obs-fold rule) unless the message is intended for packaging + // within the message/http media type. + // + // Clients must not send a request with line folding and a server sending folded headers is + // likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting + // folding is not likely to break any legitimate use case. + if (!preg_match('/^[\\x20\\x09\\x21-\\x7E\\x80-\\xFF]*$/D', $value)) { + throw new \InvalidArgumentException(sprintf('"%s" is not valid header value.', $value)); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MimeType.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MimeType.php new file mode 100644 index 0000000..2837625 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MimeType.php @@ -0,0 +1,27 @@ + 'application/vnd.1000minds.decision-model+xml', '3dml' => 'text/vnd.in3d.3dml', '3ds' => 'image/x-3ds', '3g2' => 'video/3gpp2', '3gp' => 'video/3gp', '3gpp' => 'video/3gpp', '3mf' => 'model/3mf', '7z' => 'application/x-7z-compressed', '7zip' => 'application/x-7z-compressed', '123' => 'application/vnd.lotus-1-2-3', 'aab' => 'application/x-authorware-bin', 'aac' => 'audio/aac', 'aam' => 'application/x-authorware-map', 'aas' => 'application/x-authorware-seg', 'abw' => 'application/x-abiword', 'ac' => 'application/vnd.nokia.n-gage.ac+xml', 'ac3' => 'audio/ac3', 'acc' => 'application/vnd.americandynamics.acc', 'ace' => 'application/x-ace-compressed', 'acu' => 'application/vnd.acucobol', 'acutc' => 'application/vnd.acucorp', 'adp' => 'audio/adpcm', 'aep' => 'application/vnd.audiograph', 'afm' => 'application/x-font-type1', 'afp' => 'application/vnd.ibm.modcap', 'age' => 'application/vnd.age', 'ahead' => 'application/vnd.ahead.space', 'ai' => 'application/pdf', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'air' => 'application/vnd.adobe.air-application-installer-package+zip', 'ait' => 'application/vnd.dvb.ait', 'ami' => 'application/vnd.amiga.ami', 'amr' => 'audio/amr', 'apk' => 'application/vnd.android.package-archive', 'apng' => 'image/apng', 'appcache' => 'text/cache-manifest', 'application' => 'application/x-ms-application', 'apr' => 'application/vnd.lotus-approach', 'arc' => 'application/x-freearc', 'arj' => 'application/x-arj', 'asc' => 'application/pgp-signature', 'asf' => 'video/x-ms-asf', 'asm' => 'text/x-asm', 'aso' => 'application/vnd.accpac.simply.aso', 'asx' => 'video/x-ms-asf', 'atc' => 'application/vnd.acucorp', 'atom' => 'application/atom+xml', 'atomcat' => 'application/atomcat+xml', 'atomdeleted' => 'application/atomdeleted+xml', 'atomsvc' => 'application/atomsvc+xml', 'atx' => 'application/vnd.antix.game-component', 'au' => 'audio/x-au', 'avci' => 'image/avci', 'avcs' => 'image/avcs', 'avi' => 'video/x-msvideo', 'avif' => 'image/avif', 'aw' => 'application/applixware', 'azf' => 'application/vnd.airzip.filesecure.azf', 'azs' => 'application/vnd.airzip.filesecure.azs', 'azv' => 'image/vnd.airzip.accelerator.azv', 'azw' => 'application/vnd.amazon.ebook', 'b16' => 'image/vnd.pco.b16', 'bat' => 'application/x-msdownload', 'bcpio' => 'application/x-bcpio', 'bdf' => 'application/x-font-bdf', 'bdm' => 'application/vnd.syncml.dm+wbxml', 'bdoc' => 'application/x-bdoc', 'bed' => 'application/vnd.realvnc.bed', 'bh2' => 'application/vnd.fujitsu.oasysprs', 'bin' => 'application/octet-stream', 'blb' => 'application/x-blorb', 'blorb' => 'application/x-blorb', 'bmi' => 'application/vnd.bmi', 'bmml' => 'application/vnd.balsamiq.bmml+xml', 'bmp' => 'image/bmp', 'book' => 'application/vnd.framemaker', 'box' => 'application/vnd.previewsystems.box', 'boz' => 'application/x-bzip2', 'bpk' => 'application/octet-stream', 'bpmn' => 'application/octet-stream', 'bsp' => 'model/vnd.valve.source.compiled-map', 'btif' => 'image/prs.btif', 'buffer' => 'application/octet-stream', 'bz' => 'application/x-bzip', 'bz2' => 'application/x-bzip2', 'c' => 'text/x-c', 'c4d' => 'application/vnd.clonk.c4group', 'c4f' => 'application/vnd.clonk.c4group', 'c4g' => 'application/vnd.clonk.c4group', 'c4p' => 'application/vnd.clonk.c4group', 'c4u' => 'application/vnd.clonk.c4group', 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', 'cab' => 'application/vnd.ms-cab-compressed', 'caf' => 'audio/x-caf', 'cap' => 'application/vnd.tcpdump.pcap', 'car' => 'application/vnd.curl.car', 'cat' => 'application/vnd.ms-pki.seccat', 'cb7' => 'application/x-cbr', 'cba' => 'application/x-cbr', 'cbr' => 'application/x-cbr', 'cbt' => 'application/x-cbr', 'cbz' => 'application/x-cbr', 'cc' => 'text/x-c', 'cco' => 'application/x-cocoa', 'cct' => 'application/x-director', 'ccxml' => 'application/ccxml+xml', 'cdbcmsg' => 'application/vnd.contact.cmsg', 'cdf' => 'application/x-netcdf', 'cdfx' => 'application/cdfx+xml', 'cdkey' => 'application/vnd.mediastation.cdkey', 'cdmia' => 'application/cdmi-capability', 'cdmic' => 'application/cdmi-container', 'cdmid' => 'application/cdmi-domain', 'cdmio' => 'application/cdmi-object', 'cdmiq' => 'application/cdmi-queue', 'cdr' => 'application/cdr', 'cdx' => 'chemical/x-cdx', 'cdxml' => 'application/vnd.chemdraw+xml', 'cdy' => 'application/vnd.cinderella', 'cer' => 'application/pkix-cert', 'cfs' => 'application/x-cfs-compressed', 'cgm' => 'image/cgm', 'chat' => 'application/x-chat', 'chm' => 'application/vnd.ms-htmlhelp', 'chrt' => 'application/vnd.kde.kchart', 'cif' => 'chemical/x-cif', 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', 'cil' => 'application/vnd.ms-artgalry', 'cjs' => 'application/node', 'cla' => 'application/vnd.claymore', 'class' => 'application/octet-stream', 'clkk' => 'application/vnd.crick.clicker.keyboard', 'clkp' => 'application/vnd.crick.clicker.palette', 'clkt' => 'application/vnd.crick.clicker.template', 'clkw' => 'application/vnd.crick.clicker.wordbank', 'clkx' => 'application/vnd.crick.clicker', 'clp' => 'application/x-msclip', 'cmc' => 'application/vnd.cosmocaller', 'cmdf' => 'chemical/x-cmdf', 'cml' => 'chemical/x-cml', 'cmp' => 'application/vnd.yellowriver-custom-menu', 'cmx' => 'image/x-cmx', 'cod' => 'application/vnd.rim.cod', 'coffee' => 'text/coffeescript', 'com' => 'application/x-msdownload', 'conf' => 'text/plain', 'cpio' => 'application/x-cpio', 'cpl' => 'application/cpl+xml', 'cpp' => 'text/x-c', 'cpt' => 'application/mac-compactpro', 'crd' => 'application/x-mscardfile', 'crl' => 'application/pkix-crl', 'crt' => 'application/x-x509-ca-cert', 'crx' => 'application/x-chrome-extension', 'cryptonote' => 'application/vnd.rig.cryptonote', 'csh' => 'application/x-csh', 'csl' => 'application/vnd.citationstyles.style+xml', 'csml' => 'chemical/x-csml', 'csp' => 'application/vnd.commonspace', 'csr' => 'application/octet-stream', 'css' => 'text/css', 'cst' => 'application/x-director', 'csv' => 'text/csv', 'cu' => 'application/cu-seeme', 'curl' => 'text/vnd.curl', 'cww' => 'application/prs.cww', 'cxt' => 'application/x-director', 'cxx' => 'text/x-c', 'dae' => 'model/vnd.collada+xml', 'daf' => 'application/vnd.mobius.daf', 'dart' => 'application/vnd.dart', 'dataless' => 'application/vnd.fdsn.seed', 'davmount' => 'application/davmount+xml', 'dbf' => 'application/vnd.dbf', 'dbk' => 'application/docbook+xml', 'dcr' => 'application/x-director', 'dcurl' => 'text/vnd.curl.dcurl', 'dd2' => 'application/vnd.oma.dd2+xml', 'ddd' => 'application/vnd.fujixerox.ddd', 'ddf' => 'application/vnd.syncml.dmddf+xml', 'dds' => 'image/vnd.ms-dds', 'deb' => 'application/x-debian-package', 'def' => 'text/plain', 'deploy' => 'application/octet-stream', 'der' => 'application/x-x509-ca-cert', 'dfac' => 'application/vnd.dreamfactory', 'dgc' => 'application/x-dgc-compressed', 'dic' => 'text/x-c', 'dir' => 'application/x-director', 'dis' => 'application/vnd.mobius.dis', 'disposition-notification' => 'message/disposition-notification', 'dist' => 'application/octet-stream', 'distz' => 'application/octet-stream', 'djv' => 'image/vnd.djvu', 'djvu' => 'image/vnd.djvu', 'dll' => 'application/octet-stream', 'dmg' => 'application/x-apple-diskimage', 'dmn' => 'application/octet-stream', 'dmp' => 'application/vnd.tcpdump.pcap', 'dms' => 'application/octet-stream', 'dna' => 'application/vnd.dna', 'doc' => 'application/msword', 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'dot' => 'application/msword', 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', 'dp' => 'application/vnd.osgi.dp', 'dpg' => 'application/vnd.dpgraph', 'dra' => 'audio/vnd.dra', 'drle' => 'image/dicom-rle', 'dsc' => 'text/prs.lines.tag', 'dssc' => 'application/dssc+der', 'dtb' => 'application/x-dtbook+xml', 'dtd' => 'application/xml-dtd', 'dts' => 'audio/vnd.dts', 'dtshd' => 'audio/vnd.dts.hd', 'dump' => 'application/octet-stream', 'dvb' => 'video/vnd.dvb.file', 'dvi' => 'application/x-dvi', 'dwd' => 'application/atsc-dwd+xml', 'dwf' => 'model/vnd.dwf', 'dwg' => 'image/vnd.dwg', 'dxf' => 'image/vnd.dxf', 'dxp' => 'application/vnd.spotfire.dxp', 'dxr' => 'application/x-director', 'ear' => 'application/java-archive', 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', 'ecma' => 'application/ecmascript', 'edm' => 'application/vnd.novadigm.edm', 'edx' => 'application/vnd.novadigm.edx', 'efif' => 'application/vnd.picsel', 'ei6' => 'application/vnd.pg.osasli', 'elc' => 'application/octet-stream', 'emf' => 'image/emf', 'eml' => 'message/rfc822', 'emma' => 'application/emma+xml', 'emotionml' => 'application/emotionml+xml', 'emz' => 'application/x-msmetafile', 'eol' => 'audio/vnd.digital-winds', 'eot' => 'application/vnd.ms-fontobject', 'eps' => 'application/postscript', 'epub' => 'application/epub+zip', 'es' => 'application/ecmascript', 'es3' => 'application/vnd.eszigno3+xml', 'esa' => 'application/vnd.osgi.subsystem', 'esf' => 'application/vnd.epson.esf', 'et3' => 'application/vnd.eszigno3+xml', 'etx' => 'text/x-setext', 'eva' => 'application/x-eva', 'evy' => 'application/x-envoy', 'exe' => 'application/octet-stream', 'exi' => 'application/exi', 'exp' => 'application/express', 'exr' => 'image/aces', 'ext' => 'application/vnd.novadigm.ext', 'ez' => 'application/andrew-inset', 'ez2' => 'application/vnd.ezpix-album', 'ez3' => 'application/vnd.ezpix-package', 'f' => 'text/x-fortran', 'f4v' => 'video/mp4', 'f77' => 'text/x-fortran', 'f90' => 'text/x-fortran', 'fbs' => 'image/vnd.fastbidsheet', 'fcdt' => 'application/vnd.adobe.formscentral.fcdt', 'fcs' => 'application/vnd.isac.fcs', 'fdf' => 'application/vnd.fdf', 'fdt' => 'application/fdt+xml', 'fe_launch' => 'application/vnd.denovo.fcselayout-link', 'fg5' => 'application/vnd.fujitsu.oasysgp', 'fgd' => 'application/x-director', 'fh' => 'image/x-freehand', 'fh4' => 'image/x-freehand', 'fh5' => 'image/x-freehand', 'fh7' => 'image/x-freehand', 'fhc' => 'image/x-freehand', 'fig' => 'application/x-xfig', 'fits' => 'image/fits', 'flac' => 'audio/x-flac', 'fli' => 'video/x-fli', 'flo' => 'application/vnd.micrografx.flo', 'flv' => 'video/x-flv', 'flw' => 'application/vnd.kde.kivio', 'flx' => 'text/vnd.fmi.flexstor', 'fly' => 'text/vnd.fly', 'fm' => 'application/vnd.framemaker', 'fnc' => 'application/vnd.frogans.fnc', 'fo' => 'application/vnd.software602.filler.form+xml', 'for' => 'text/x-fortran', 'fpx' => 'image/vnd.fpx', 'frame' => 'application/vnd.framemaker', 'fsc' => 'application/vnd.fsc.weblaunch', 'fst' => 'image/vnd.fst', 'ftc' => 'application/vnd.fluxtime.clip', 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', 'fvt' => 'video/vnd.fvt', 'fxp' => 'application/vnd.adobe.fxp', 'fxpl' => 'application/vnd.adobe.fxp', 'fzs' => 'application/vnd.fuzzysheet', 'g2w' => 'application/vnd.geoplan', 'g3' => 'image/g3fax', 'g3w' => 'application/vnd.geospace', 'gac' => 'application/vnd.groove-account', 'gam' => 'application/x-tads', 'gbr' => 'application/rpki-ghostbusters', 'gca' => 'application/x-gca-compressed', 'gdl' => 'model/vnd.gdl', 'gdoc' => 'application/vnd.google-apps.document', 'ged' => 'text/vnd.familysearch.gedcom', 'geo' => 'application/vnd.dynageo', 'geojson' => 'application/geo+json', 'gex' => 'application/vnd.geometry-explorer', 'ggb' => 'application/vnd.geogebra.file', 'ggt' => 'application/vnd.geogebra.tool', 'ghf' => 'application/vnd.groove-help', 'gif' => 'image/gif', 'gim' => 'application/vnd.groove-identity-message', 'glb' => 'model/gltf-binary', 'gltf' => 'model/gltf+json', 'gml' => 'application/gml+xml', 'gmx' => 'application/vnd.gmx', 'gnumeric' => 'application/x-gnumeric', 'gpg' => 'application/gpg-keys', 'gph' => 'application/vnd.flographit', 'gpx' => 'application/gpx+xml', 'gqf' => 'application/vnd.grafeq', 'gqs' => 'application/vnd.grafeq', 'gram' => 'application/srgs', 'gramps' => 'application/x-gramps-xml', 'gre' => 'application/vnd.geometry-explorer', 'grv' => 'application/vnd.groove-injector', 'grxml' => 'application/srgs+xml', 'gsf' => 'application/x-font-ghostscript', 'gsheet' => 'application/vnd.google-apps.spreadsheet', 'gslides' => 'application/vnd.google-apps.presentation', 'gtar' => 'application/x-gtar', 'gtm' => 'application/vnd.groove-tool-message', 'gtw' => 'model/vnd.gtw', 'gv' => 'text/vnd.graphviz', 'gxf' => 'application/gxf', 'gxt' => 'application/vnd.geonext', 'gz' => 'application/gzip', 'gzip' => 'application/gzip', 'h' => 'text/x-c', 'h261' => 'video/h261', 'h263' => 'video/h263', 'h264' => 'video/h264', 'hal' => 'application/vnd.hal+xml', 'hbci' => 'application/vnd.hbci', 'hbs' => 'text/x-handlebars-template', 'hdd' => 'application/x-virtualbox-hdd', 'hdf' => 'application/x-hdf', 'heic' => 'image/heic', 'heics' => 'image/heic-sequence', 'heif' => 'image/heif', 'heifs' => 'image/heif-sequence', 'hej2' => 'image/hej2k', 'held' => 'application/atsc-held+xml', 'hh' => 'text/x-c', 'hjson' => 'application/hjson', 'hlp' => 'application/winhlp', 'hpgl' => 'application/vnd.hp-hpgl', 'hpid' => 'application/vnd.hp-hpid', 'hps' => 'application/vnd.hp-hps', 'hqx' => 'application/mac-binhex40', 'hsj2' => 'image/hsj2', 'htc' => 'text/x-component', 'htke' => 'application/vnd.kenameaapp', 'htm' => 'text/html', 'html' => 'text/html', 'hvd' => 'application/vnd.yamaha.hv-dic', 'hvp' => 'application/vnd.yamaha.hv-voice', 'hvs' => 'application/vnd.yamaha.hv-script', 'i2g' => 'application/vnd.intergeo', 'icc' => 'application/vnd.iccprofile', 'ice' => 'x-conference/x-cooltalk', 'icm' => 'application/vnd.iccprofile', 'ico' => 'image/x-icon', 'ics' => 'text/calendar', 'ief' => 'image/ief', 'ifb' => 'text/calendar', 'ifm' => 'application/vnd.shana.informed.formdata', 'iges' => 'model/iges', 'igl' => 'application/vnd.igloader', 'igm' => 'application/vnd.insors.igm', 'igs' => 'model/iges', 'igx' => 'application/vnd.micrografx.igx', 'iif' => 'application/vnd.shana.informed.interchange', 'img' => 'application/octet-stream', 'imp' => 'application/vnd.accpac.simply.imp', 'ims' => 'application/vnd.ms-ims', 'in' => 'text/plain', 'ini' => 'text/plain', 'ink' => 'application/inkml+xml', 'inkml' => 'application/inkml+xml', 'install' => 'application/x-install-instructions', 'iota' => 'application/vnd.astraea-software.iota', 'ipfix' => 'application/ipfix', 'ipk' => 'application/vnd.shana.informed.package', 'irm' => 'application/vnd.ibm.rights-management', 'irp' => 'application/vnd.irepository.package+xml', 'iso' => 'application/x-iso9660-image', 'itp' => 'application/vnd.shana.informed.formtemplate', 'its' => 'application/its+xml', 'ivp' => 'application/vnd.immervision-ivp', 'ivu' => 'application/vnd.immervision-ivu', 'jad' => 'text/vnd.sun.j2me.app-descriptor', 'jade' => 'text/jade', 'jam' => 'application/vnd.jam', 'jar' => 'application/java-archive', 'jardiff' => 'application/x-java-archive-diff', 'java' => 'text/x-java-source', 'jhc' => 'image/jphc', 'jisp' => 'application/vnd.jisp', 'jls' => 'image/jls', 'jlt' => 'application/vnd.hp-jlyt', 'jng' => 'image/x-jng', 'jnlp' => 'application/x-java-jnlp-file', 'joda' => 'application/vnd.joost.joda-archive', 'jp2' => 'image/jp2', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpf' => 'image/jpx', 'jpg' => 'image/jpeg', 'jpg2' => 'image/jp2', 'jpgm' => 'video/jpm', 'jpgv' => 'video/jpeg', 'jph' => 'image/jph', 'jpm' => 'video/jpm', 'jpx' => 'image/jpx', 'js' => 'application/javascript', 'json' => 'application/json', 'json5' => 'application/json5', 'jsonld' => 'application/ld+json', 'jsonml' => 'application/jsonml+json', 'jsx' => 'text/jsx', 'jxr' => 'image/jxr', 'jxra' => 'image/jxra', 'jxrs' => 'image/jxrs', 'jxs' => 'image/jxs', 'jxsc' => 'image/jxsc', 'jxsi' => 'image/jxsi', 'jxss' => 'image/jxss', 'kar' => 'audio/midi', 'karbon' => 'application/vnd.kde.karbon', 'kdb' => 'application/octet-stream', 'kdbx' => 'application/x-keepass2', 'key' => 'application/x-iwork-keynote-sffkey', 'kfo' => 'application/vnd.kde.kformula', 'kia' => 'application/vnd.kidspiration', 'kml' => 'application/vnd.google-earth.kml+xml', 'kmz' => 'application/vnd.google-earth.kmz', 'kne' => 'application/vnd.kinar', 'knp' => 'application/vnd.kinar', 'kon' => 'application/vnd.kde.kontour', 'kpr' => 'application/vnd.kde.kpresenter', 'kpt' => 'application/vnd.kde.kpresenter', 'kpxx' => 'application/vnd.ds-keypoint', 'ksp' => 'application/vnd.kde.kspread', 'ktr' => 'application/vnd.kahootz', 'ktx' => 'image/ktx', 'ktx2' => 'image/ktx2', 'ktz' => 'application/vnd.kahootz', 'kwd' => 'application/vnd.kde.kword', 'kwt' => 'application/vnd.kde.kword', 'lasxml' => 'application/vnd.las.las+xml', 'latex' => 'application/x-latex', 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', 'les' => 'application/vnd.hhe.lesson-player', 'less' => 'text/less', 'lgr' => 'application/lgr+xml', 'lha' => 'application/octet-stream', 'link66' => 'application/vnd.route66.link66+xml', 'list' => 'text/plain', 'list3820' => 'application/vnd.ibm.modcap', 'listafp' => 'application/vnd.ibm.modcap', 'litcoffee' => 'text/coffeescript', 'lnk' => 'application/x-ms-shortcut', 'log' => 'text/plain', 'lostxml' => 'application/lost+xml', 'lrf' => 'application/octet-stream', 'lrm' => 'application/vnd.ms-lrm', 'ltf' => 'application/vnd.frogans.ltf', 'lua' => 'text/x-lua', 'luac' => 'application/x-lua-bytecode', 'lvp' => 'audio/vnd.lucent.voice', 'lwp' => 'application/vnd.lotus-wordpro', 'lzh' => 'application/octet-stream', 'm1v' => 'video/mpeg', 'm2a' => 'audio/mpeg', 'm2v' => 'video/mpeg', 'm3a' => 'audio/mpeg', 'm3u' => 'text/plain', 'm3u8' => 'application/vnd.apple.mpegurl', 'm4a' => 'audio/x-m4a', 'm4p' => 'application/mp4', 'm4s' => 'video/iso.segment', 'm4u' => 'application/vnd.mpegurl', 'm4v' => 'video/x-m4v', 'm13' => 'application/x-msmediaview', 'm14' => 'application/x-msmediaview', 'm21' => 'application/mp21', 'ma' => 'application/mathematica', 'mads' => 'application/mads+xml', 'maei' => 'application/mmt-aei+xml', 'mag' => 'application/vnd.ecowin.chart', 'maker' => 'application/vnd.framemaker', 'man' => 'text/troff', 'manifest' => 'text/cache-manifest', 'map' => 'application/json', 'mar' => 'application/octet-stream', 'markdown' => 'text/markdown', 'mathml' => 'application/mathml+xml', 'mb' => 'application/mathematica', 'mbk' => 'application/vnd.mobius.mbk', 'mbox' => 'application/mbox', 'mc1' => 'application/vnd.medcalcdata', 'mcd' => 'application/vnd.mcd', 'mcurl' => 'text/vnd.curl.mcurl', 'md' => 'text/markdown', 'mdb' => 'application/x-msaccess', 'mdi' => 'image/vnd.ms-modi', 'mdx' => 'text/mdx', 'me' => 'text/troff', 'mesh' => 'model/mesh', 'meta4' => 'application/metalink4+xml', 'metalink' => 'application/metalink+xml', 'mets' => 'application/mets+xml', 'mfm' => 'application/vnd.mfmp', 'mft' => 'application/rpki-manifest', 'mgp' => 'application/vnd.osgeo.mapguide.package', 'mgz' => 'application/vnd.proteus.magazine', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mie' => 'application/x-mie', 'mif' => 'application/vnd.mif', 'mime' => 'message/rfc822', 'mj2' => 'video/mj2', 'mjp2' => 'video/mj2', 'mjs' => 'application/javascript', 'mk3d' => 'video/x-matroska', 'mka' => 'audio/x-matroska', 'mkd' => 'text/x-markdown', 'mks' => 'video/x-matroska', 'mkv' => 'video/x-matroska', 'mlp' => 'application/vnd.dolby.mlp', 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', 'mmf' => 'application/vnd.smaf', 'mml' => 'text/mathml', 'mmr' => 'image/vnd.fujixerox.edmics-mmr', 'mng' => 'video/x-mng', 'mny' => 'application/x-msmoney', 'mobi' => 'application/x-mobipocket-ebook', 'mods' => 'application/mods+xml', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/mpeg', 'mp2a' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mp4' => 'video/mp4', 'mp4a' => 'audio/mp4', 'mp4s' => 'application/mp4', 'mp4v' => 'video/mp4', 'mp21' => 'application/mp21', 'mpc' => 'application/vnd.mophun.certificate', 'mpd' => 'application/dash+xml', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpf' => 'application/media-policy-dataset+xml', 'mpg' => 'video/mpeg', 'mpg4' => 'video/mp4', 'mpga' => 'audio/mpeg', 'mpkg' => 'application/vnd.apple.installer+xml', 'mpm' => 'application/vnd.blueice.multipass', 'mpn' => 'application/vnd.mophun.application', 'mpp' => 'application/vnd.ms-project', 'mpt' => 'application/vnd.ms-project', 'mpy' => 'application/vnd.ibm.minipay', 'mqy' => 'application/vnd.mobius.mqy', 'mrc' => 'application/marc', 'mrcx' => 'application/marcxml+xml', 'ms' => 'text/troff', 'mscml' => 'application/mediaservercontrol+xml', 'mseed' => 'application/vnd.fdsn.mseed', 'mseq' => 'application/vnd.mseq', 'msf' => 'application/vnd.epson.msf', 'msg' => 'application/vnd.ms-outlook', 'msh' => 'model/mesh', 'msi' => 'application/x-msdownload', 'msl' => 'application/vnd.mobius.msl', 'msm' => 'application/octet-stream', 'msp' => 'application/octet-stream', 'msty' => 'application/vnd.muvee.style', 'mtl' => 'model/mtl', 'mts' => 'model/vnd.mts', 'mus' => 'application/vnd.musician', 'musd' => 'application/mmt-usd+xml', 'musicxml' => 'application/vnd.recordare.musicxml+xml', 'mvb' => 'application/x-msmediaview', 'mvt' => 'application/vnd.mapbox-vector-tile', 'mwf' => 'application/vnd.mfer', 'mxf' => 'application/mxf', 'mxl' => 'application/vnd.recordare.musicxml', 'mxmf' => 'audio/mobile-xmf', 'mxml' => 'application/xv+xml', 'mxs' => 'application/vnd.triscape.mxs', 'mxu' => 'video/vnd.mpegurl', 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', 'n3' => 'text/n3', 'nb' => 'application/mathematica', 'nbp' => 'application/vnd.wolfram.player', 'nc' => 'application/x-netcdf', 'ncx' => 'application/x-dtbncx+xml', 'nfo' => 'text/x-nfo', 'ngdat' => 'application/vnd.nokia.n-gage.data', 'nitf' => 'application/vnd.nitf', 'nlu' => 'application/vnd.neurolanguage.nlu', 'nml' => 'application/vnd.enliven', 'nnd' => 'application/vnd.noblenet-directory', 'nns' => 'application/vnd.noblenet-sealer', 'nnw' => 'application/vnd.noblenet-web', 'npx' => 'image/vnd.net-fpx', 'nq' => 'application/n-quads', 'nsc' => 'application/x-conference', 'nsf' => 'application/vnd.lotus-notes', 'nt' => 'application/n-triples', 'ntf' => 'application/vnd.nitf', 'numbers' => 'application/x-iwork-numbers-sffnumbers', 'nzb' => 'application/x-nzb', 'oa2' => 'application/vnd.fujitsu.oasys2', 'oa3' => 'application/vnd.fujitsu.oasys3', 'oas' => 'application/vnd.fujitsu.oasys', 'obd' => 'application/x-msbinder', 'obgx' => 'application/vnd.openblox.game+xml', 'obj' => 'model/obj', 'oda' => 'application/oda', 'odb' => 'application/vnd.oasis.opendocument.database', 'odc' => 'application/vnd.oasis.opendocument.chart', 'odf' => 'application/vnd.oasis.opendocument.formula', 'odft' => 'application/vnd.oasis.opendocument.formula-template', 'odg' => 'application/vnd.oasis.opendocument.graphics', 'odi' => 'application/vnd.oasis.opendocument.image', 'odm' => 'application/vnd.oasis.opendocument.text-master', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odt' => 'application/vnd.oasis.opendocument.text', 'oga' => 'audio/ogg', 'ogex' => 'model/vnd.opengex', 'ogg' => 'audio/ogg', 'ogv' => 'video/ogg', 'ogx' => 'application/ogg', 'omdoc' => 'application/omdoc+xml', 'onepkg' => 'application/onenote', 'onetmp' => 'application/onenote', 'onetoc' => 'application/onenote', 'onetoc2' => 'application/onenote', 'opf' => 'application/oebps-package+xml', 'opml' => 'text/x-opml', 'oprc' => 'application/vnd.palm', 'opus' => 'audio/ogg', 'org' => 'text/x-org', 'osf' => 'application/vnd.yamaha.openscoreformat', 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', 'osm' => 'application/vnd.openstreetmap.data+xml', 'otc' => 'application/vnd.oasis.opendocument.chart-template', 'otf' => 'font/otf', 'otg' => 'application/vnd.oasis.opendocument.graphics-template', 'oth' => 'application/vnd.oasis.opendocument.text-web', 'oti' => 'application/vnd.oasis.opendocument.image-template', 'otp' => 'application/vnd.oasis.opendocument.presentation-template', 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', 'ott' => 'application/vnd.oasis.opendocument.text-template', 'ova' => 'application/x-virtualbox-ova', 'ovf' => 'application/x-virtualbox-ovf', 'owl' => 'application/rdf+xml', 'oxps' => 'application/oxps', 'oxt' => 'application/vnd.openofficeorg.extension', 'p' => 'text/x-pascal', 'p7a' => 'application/x-pkcs7-signature', 'p7b' => 'application/x-pkcs7-certificates', 'p7c' => 'application/pkcs7-mime', 'p7m' => 'application/pkcs7-mime', 'p7r' => 'application/x-pkcs7-certreqresp', 'p7s' => 'application/pkcs7-signature', 'p8' => 'application/pkcs8', 'p10' => 'application/x-pkcs10', 'p12' => 'application/x-pkcs12', 'pac' => 'application/x-ns-proxy-autoconfig', 'pages' => 'application/x-iwork-pages-sffpages', 'pas' => 'text/x-pascal', 'paw' => 'application/vnd.pawaafile', 'pbd' => 'application/vnd.powerbuilder6', 'pbm' => 'image/x-portable-bitmap', 'pcap' => 'application/vnd.tcpdump.pcap', 'pcf' => 'application/x-font-pcf', 'pcl' => 'application/vnd.hp-pcl', 'pclxl' => 'application/vnd.hp-pclxl', 'pct' => 'image/x-pict', 'pcurl' => 'application/vnd.curl.pcurl', 'pcx' => 'image/x-pcx', 'pdb' => 'application/x-pilot', 'pde' => 'text/x-processing', 'pdf' => 'application/pdf', 'pem' => 'application/x-x509-user-cert', 'pfa' => 'application/x-font-type1', 'pfb' => 'application/x-font-type1', 'pfm' => 'application/x-font-type1', 'pfr' => 'application/font-tdpfr', 'pfx' => 'application/x-pkcs12', 'pgm' => 'image/x-portable-graymap', 'pgn' => 'application/x-chess-pgn', 'pgp' => 'application/pgp', 'phar' => 'application/octet-stream', 'php' => 'application/x-httpd-php', 'php3' => 'application/x-httpd-php', 'php4' => 'application/x-httpd-php', 'phps' => 'application/x-httpd-php-source', 'phtml' => 'application/x-httpd-php', 'pic' => 'image/x-pict', 'pkg' => 'application/octet-stream', 'pki' => 'application/pkixcmp', 'pkipath' => 'application/pkix-pkipath', 'pkpass' => 'application/vnd.apple.pkpass', 'pl' => 'application/x-perl', 'plb' => 'application/vnd.3gpp.pic-bw-large', 'plc' => 'application/vnd.mobius.plc', 'plf' => 'application/vnd.pocketlearn', 'pls' => 'application/pls+xml', 'pm' => 'application/x-perl', 'pml' => 'application/vnd.ctc-posml', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'portpkg' => 'application/vnd.macports.portpkg', 'pot' => 'application/vnd.ms-powerpoint', 'potm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', 'ppa' => 'application/vnd.ms-powerpoint', 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', 'ppd' => 'application/vnd.cups-ppd', 'ppm' => 'image/x-portable-pixmap', 'pps' => 'application/vnd.ms-powerpoint', 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', 'ppt' => 'application/powerpoint', 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', 'pqa' => 'application/vnd.palm', 'prc' => 'model/prc', 'pre' => 'application/vnd.lotus-freelance', 'prf' => 'application/pics-rules', 'provx' => 'application/provenance+xml', 'ps' => 'application/postscript', 'psb' => 'application/vnd.3gpp.pic-bw-small', 'psd' => 'application/x-photoshop', 'psf' => 'application/x-font-linux-psf', 'pskcxml' => 'application/pskc+xml', 'pti' => 'image/prs.pti', 'ptid' => 'application/vnd.pvi.ptid1', 'pub' => 'application/x-mspublisher', 'pvb' => 'application/vnd.3gpp.pic-bw-var', 'pwn' => 'application/vnd.3m.post-it-notes', 'pya' => 'audio/vnd.ms-playready.media.pya', 'pyv' => 'video/vnd.ms-playready.media.pyv', 'qam' => 'application/vnd.epson.quickanime', 'qbo' => 'application/vnd.intu.qbo', 'qfx' => 'application/vnd.intu.qfx', 'qps' => 'application/vnd.publishare-delta-tree', 'qt' => 'video/quicktime', 'qwd' => 'application/vnd.quark.quarkxpress', 'qwt' => 'application/vnd.quark.quarkxpress', 'qxb' => 'application/vnd.quark.quarkxpress', 'qxd' => 'application/vnd.quark.quarkxpress', 'qxl' => 'application/vnd.quark.quarkxpress', 'qxt' => 'application/vnd.quark.quarkxpress', 'ra' => 'audio/x-realaudio', 'ram' => 'audio/x-pn-realaudio', 'raml' => 'application/raml+yaml', 'rapd' => 'application/route-apd+xml', 'rar' => 'application/x-rar', 'ras' => 'image/x-cmu-raster', 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', 'rdf' => 'application/rdf+xml', 'rdz' => 'application/vnd.data-vision.rdz', 'relo' => 'application/p2p-overlay+xml', 'rep' => 'application/vnd.businessobjects', 'res' => 'application/x-dtbresource+xml', 'rgb' => 'image/x-rgb', 'rif' => 'application/reginfo+xml', 'rip' => 'audio/vnd.rip', 'ris' => 'application/x-research-info-systems', 'rl' => 'application/resource-lists+xml', 'rlc' => 'image/vnd.fujixerox.edmics-rlc', 'rld' => 'application/resource-lists-diff+xml', 'rm' => 'audio/x-pn-realaudio', 'rmi' => 'audio/midi', 'rmp' => 'audio/x-pn-realaudio-plugin', 'rms' => 'application/vnd.jcp.javame.midlet-rms', 'rmvb' => 'application/vnd.rn-realmedia-vbr', 'rnc' => 'application/relax-ng-compact-syntax', 'rng' => 'application/xml', 'roa' => 'application/rpki-roa', 'roff' => 'text/troff', 'rp9' => 'application/vnd.cloanto.rp9', 'rpm' => 'audio/x-pn-realaudio-plugin', 'rpss' => 'application/vnd.nokia.radio-presets', 'rpst' => 'application/vnd.nokia.radio-preset', 'rq' => 'application/sparql-query', 'rs' => 'application/rls-services+xml', 'rsa' => 'application/x-pkcs7', 'rsat' => 'application/atsc-rsat+xml', 'rsd' => 'application/rsd+xml', 'rsheet' => 'application/urc-ressheet+xml', 'rss' => 'application/rss+xml', 'rtf' => 'text/rtf', 'rtx' => 'text/richtext', 'run' => 'application/x-makeself', 'rusd' => 'application/route-usd+xml', 'rv' => 'video/vnd.rn-realvideo', 's' => 'text/x-asm', 's3m' => 'audio/s3m', 'saf' => 'application/vnd.yamaha.smaf-audio', 'sass' => 'text/x-sass', 'sbml' => 'application/sbml+xml', 'sc' => 'application/vnd.ibm.secure-container', 'scd' => 'application/x-msschedule', 'scm' => 'application/vnd.lotus-screencam', 'scq' => 'application/scvp-cv-request', 'scs' => 'application/scvp-cv-response', 'scss' => 'text/x-scss', 'scurl' => 'text/vnd.curl.scurl', 'sda' => 'application/vnd.stardivision.draw', 'sdc' => 'application/vnd.stardivision.calc', 'sdd' => 'application/vnd.stardivision.impress', 'sdkd' => 'application/vnd.solent.sdkm+xml', 'sdkm' => 'application/vnd.solent.sdkm+xml', 'sdp' => 'application/sdp', 'sdw' => 'application/vnd.stardivision.writer', 'sea' => 'application/octet-stream', 'see' => 'application/vnd.seemail', 'seed' => 'application/vnd.fdsn.seed', 'sema' => 'application/vnd.sema', 'semd' => 'application/vnd.semd', 'semf' => 'application/vnd.semf', 'senmlx' => 'application/senml+xml', 'sensmlx' => 'application/sensml+xml', 'ser' => 'application/java-serialized-object', 'setpay' => 'application/set-payment-initiation', 'setreg' => 'application/set-registration-initiation', 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', 'sfs' => 'application/vnd.spotfire.sfs', 'sfv' => 'text/x-sfv', 'sgi' => 'image/sgi', 'sgl' => 'application/vnd.stardivision.writer-global', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'shex' => 'text/shex', 'shf' => 'application/shf+xml', 'shtml' => 'text/html', 'sid' => 'image/x-mrsid-image', 'sieve' => 'application/sieve', 'sig' => 'application/pgp-signature', 'sil' => 'audio/silk', 'silo' => 'model/mesh', 'sis' => 'application/vnd.symbian.install', 'sisx' => 'application/vnd.symbian.install', 'sit' => 'application/x-stuffit', 'sitx' => 'application/x-stuffitx', 'siv' => 'application/sieve', 'skd' => 'application/vnd.koan', 'skm' => 'application/vnd.koan', 'skp' => 'application/vnd.koan', 'skt' => 'application/vnd.koan', 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', 'slim' => 'text/slim', 'slm' => 'text/slim', 'sls' => 'application/route-s-tsid+xml', 'slt' => 'application/vnd.epson.salt', 'sm' => 'application/vnd.stepmania.stepchart', 'smf' => 'application/vnd.stardivision.math', 'smi' => 'application/smil', 'smil' => 'application/smil', 'smv' => 'video/x-smv', 'smzip' => 'application/vnd.stepmania.package', 'snd' => 'audio/basic', 'snf' => 'application/x-font-snf', 'so' => 'application/octet-stream', 'spc' => 'application/x-pkcs7-certificates', 'spdx' => 'text/spdx', 'spf' => 'application/vnd.yamaha.smaf-phrase', 'spl' => 'application/x-futuresplash', 'spot' => 'text/vnd.in3d.spot', 'spp' => 'application/scvp-vp-response', 'spq' => 'application/scvp-vp-request', 'spx' => 'audio/ogg', 'sql' => 'application/x-sql', 'src' => 'application/x-wais-source', 'srt' => 'application/x-subrip', 'sru' => 'application/sru+xml', 'srx' => 'application/sparql-results+xml', 'ssdl' => 'application/ssdl+xml', 'sse' => 'application/vnd.kodak-descriptor', 'ssf' => 'application/vnd.epson.ssf', 'ssml' => 'application/ssml+xml', 'sst' => 'application/octet-stream', 'st' => 'application/vnd.sailingtracker.track', 'stc' => 'application/vnd.sun.xml.calc.template', 'std' => 'application/vnd.sun.xml.draw.template', 'stf' => 'application/vnd.wt.stf', 'sti' => 'application/vnd.sun.xml.impress.template', 'stk' => 'application/hyperstudio', 'stl' => 'model/stl', 'stpx' => 'model/step+xml', 'stpxz' => 'model/step-xml+zip', 'stpz' => 'model/step+zip', 'str' => 'application/vnd.pg.format', 'stw' => 'application/vnd.sun.xml.writer.template', 'styl' => 'text/stylus', 'stylus' => 'text/stylus', 'sub' => 'text/vnd.dvb.subtitle', 'sus' => 'application/vnd.sus-calendar', 'susp' => 'application/vnd.sus-calendar', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'svc' => 'application/vnd.dvb.service', 'svd' => 'application/vnd.svd', 'svg' => 'image/svg+xml', 'svgz' => 'image/svg+xml', 'swa' => 'application/x-director', 'swf' => 'application/x-shockwave-flash', 'swi' => 'application/vnd.aristanetworks.swi', 'swidtag' => 'application/swid+xml', 'sxc' => 'application/vnd.sun.xml.calc', 'sxd' => 'application/vnd.sun.xml.draw', 'sxg' => 'application/vnd.sun.xml.writer.global', 'sxi' => 'application/vnd.sun.xml.impress', 'sxm' => 'application/vnd.sun.xml.math', 'sxw' => 'application/vnd.sun.xml.writer', 't' => 'text/troff', 't3' => 'application/x-t3vm-image', 't38' => 'image/t38', 'taglet' => 'application/vnd.mynfc', 'tao' => 'application/vnd.tao.intent-module-archive', 'tap' => 'image/vnd.tencent.tap', 'tar' => 'application/x-tar', 'tcap' => 'application/vnd.3gpp2.tcap', 'tcl' => 'application/x-tcl', 'td' => 'application/urc-targetdesc+xml', 'teacher' => 'application/vnd.smart.teacher', 'tei' => 'application/tei+xml', 'teicorpus' => 'application/tei+xml', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'text' => 'text/plain', 'tfi' => 'application/thraud+xml', 'tfm' => 'application/x-tex-tfm', 'tfx' => 'image/tiff-fx', 'tga' => 'image/x-tga', 'tgz' => 'application/x-tar', 'thmx' => 'application/vnd.ms-officetheme', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'tk' => 'application/x-tcl', 'tmo' => 'application/vnd.tmobile-livetv', 'toml' => 'application/toml', 'torrent' => 'application/x-bittorrent', 'tpl' => 'application/vnd.groove-tool-template', 'tpt' => 'application/vnd.trid.tpt', 'tr' => 'text/troff', 'tra' => 'application/vnd.trueapp', 'trig' => 'application/trig', 'trm' => 'application/x-msterminal', 'ts' => 'video/mp2t', 'tsd' => 'application/timestamped-data', 'tsv' => 'text/tab-separated-values', 'ttc' => 'font/collection', 'ttf' => 'font/ttf', 'ttl' => 'text/turtle', 'ttml' => 'application/ttml+xml', 'twd' => 'application/vnd.simtech-mindmapper', 'twds' => 'application/vnd.simtech-mindmapper', 'txd' => 'application/vnd.genomatix.tuxedo', 'txf' => 'application/vnd.mobius.txf', 'txt' => 'text/plain', 'u3d' => 'model/u3d', 'u8dsn' => 'message/global-delivery-status', 'u8hdr' => 'message/global-headers', 'u8mdn' => 'message/global-disposition-notification', 'u8msg' => 'message/global', 'u32' => 'application/x-authorware-bin', 'ubj' => 'application/ubjson', 'udeb' => 'application/x-debian-package', 'ufd' => 'application/vnd.ufdl', 'ufdl' => 'application/vnd.ufdl', 'ulx' => 'application/x-glulx', 'umj' => 'application/vnd.umajin', 'unityweb' => 'application/vnd.unity', 'uoml' => 'application/vnd.uoml+xml', 'uri' => 'text/uri-list', 'uris' => 'text/uri-list', 'urls' => 'text/uri-list', 'usdz' => 'model/vnd.usdz+zip', 'ustar' => 'application/x-ustar', 'utz' => 'application/vnd.uiq.theme', 'uu' => 'text/x-uuencode', 'uva' => 'audio/vnd.dece.audio', 'uvd' => 'application/vnd.dece.data', 'uvf' => 'application/vnd.dece.data', 'uvg' => 'image/vnd.dece.graphic', 'uvh' => 'video/vnd.dece.hd', 'uvi' => 'image/vnd.dece.graphic', 'uvm' => 'video/vnd.dece.mobile', 'uvp' => 'video/vnd.dece.pd', 'uvs' => 'video/vnd.dece.sd', 'uvt' => 'application/vnd.dece.ttml+xml', 'uvu' => 'video/vnd.uvvu.mp4', 'uvv' => 'video/vnd.dece.video', 'uvva' => 'audio/vnd.dece.audio', 'uvvd' => 'application/vnd.dece.data', 'uvvf' => 'application/vnd.dece.data', 'uvvg' => 'image/vnd.dece.graphic', 'uvvh' => 'video/vnd.dece.hd', 'uvvi' => 'image/vnd.dece.graphic', 'uvvm' => 'video/vnd.dece.mobile', 'uvvp' => 'video/vnd.dece.pd', 'uvvs' => 'video/vnd.dece.sd', 'uvvt' => 'application/vnd.dece.ttml+xml', 'uvvu' => 'video/vnd.uvvu.mp4', 'uvvv' => 'video/vnd.dece.video', 'uvvx' => 'application/vnd.dece.unspecified', 'uvvz' => 'application/vnd.dece.zip', 'uvx' => 'application/vnd.dece.unspecified', 'uvz' => 'application/vnd.dece.zip', 'vbox' => 'application/x-virtualbox-vbox', 'vbox-extpack' => 'application/x-virtualbox-vbox-extpack', 'vcard' => 'text/vcard', 'vcd' => 'application/x-cdlink', 'vcf' => 'text/x-vcard', 'vcg' => 'application/vnd.groove-vcard', 'vcs' => 'text/x-vcalendar', 'vcx' => 'application/vnd.vcx', 'vdi' => 'application/x-virtualbox-vdi', 'vds' => 'model/vnd.sap.vds', 'vhd' => 'application/x-virtualbox-vhd', 'vis' => 'application/vnd.visionary', 'viv' => 'video/vnd.vivo', 'vlc' => 'application/videolan', 'vmdk' => 'application/x-virtualbox-vmdk', 'vob' => 'video/x-ms-vob', 'vor' => 'application/vnd.stardivision.writer', 'vox' => 'application/x-authorware-bin', 'vrml' => 'model/vrml', 'vsd' => 'application/vnd.visio', 'vsf' => 'application/vnd.vsf', 'vss' => 'application/vnd.visio', 'vst' => 'application/vnd.visio', 'vsw' => 'application/vnd.visio', 'vtf' => 'image/vnd.valve.source.texture', 'vtt' => 'text/vtt', 'vtu' => 'model/vnd.vtu', 'vxml' => 'application/voicexml+xml', 'w3d' => 'application/x-director', 'wad' => 'application/x-doom', 'wadl' => 'application/vnd.sun.wadl+xml', 'war' => 'application/java-archive', 'wasm' => 'application/wasm', 'wav' => 'audio/x-wav', 'wax' => 'audio/x-ms-wax', 'wbmp' => 'image/vnd.wap.wbmp', 'wbs' => 'application/vnd.criticaltools.wbs+xml', 'wbxml' => 'application/wbxml', 'wcm' => 'application/vnd.ms-works', 'wdb' => 'application/vnd.ms-works', 'wdp' => 'image/vnd.ms-photo', 'weba' => 'audio/webm', 'webapp' => 'application/x-web-app-manifest+json', 'webm' => 'video/webm', 'webmanifest' => 'application/manifest+json', 'webp' => 'image/webp', 'wg' => 'application/vnd.pmi.widget', 'wgt' => 'application/widget', 'wif' => 'application/watcherinfo+xml', 'wks' => 'application/vnd.ms-works', 'wm' => 'video/x-ms-wm', 'wma' => 'audio/x-ms-wma', 'wmd' => 'application/x-ms-wmd', 'wmf' => 'image/wmf', 'wml' => 'text/vnd.wap.wml', 'wmlc' => 'application/wmlc', 'wmls' => 'text/vnd.wap.wmlscript', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wmz' => 'application/x-msmetafile', 'woff' => 'font/woff', 'woff2' => 'font/woff2', 'word' => 'application/msword', 'wpd' => 'application/vnd.wordperfect', 'wpl' => 'application/vnd.ms-wpl', 'wps' => 'application/vnd.ms-works', 'wqd' => 'application/vnd.wqd', 'wri' => 'application/x-mswrite', 'wrl' => 'model/vrml', 'wsc' => 'message/vnd.wfa.wsc', 'wsdl' => 'application/wsdl+xml', 'wspolicy' => 'application/wspolicy+xml', 'wtb' => 'application/vnd.webturbo', 'wvx' => 'video/x-ms-wvx', 'x3d' => 'model/x3d+xml', 'x3db' => 'model/x3d+fastinfoset', 'x3dbz' => 'model/x3d+binary', 'x3dv' => 'model/x3d-vrml', 'x3dvz' => 'model/x3d+vrml', 'x3dz' => 'model/x3d+xml', 'x32' => 'application/x-authorware-bin', 'x_b' => 'model/vnd.parasolid.transmit.binary', 'x_t' => 'model/vnd.parasolid.transmit.text', 'xaml' => 'application/xaml+xml', 'xap' => 'application/x-silverlight-app', 'xar' => 'application/vnd.xara', 'xav' => 'application/xcap-att+xml', 'xbap' => 'application/x-ms-xbap', 'xbd' => 'application/vnd.fujixerox.docuworks.binder', 'xbm' => 'image/x-xbitmap', 'xca' => 'application/xcap-caps+xml', 'xcs' => 'application/calendar+xml', 'xdf' => 'application/xcap-diff+xml', 'xdm' => 'application/vnd.syncml.dm+xml', 'xdp' => 'application/vnd.adobe.xdp+xml', 'xdssc' => 'application/dssc+xml', 'xdw' => 'application/vnd.fujixerox.docuworks', 'xel' => 'application/xcap-el+xml', 'xenc' => 'application/xenc+xml', 'xer' => 'application/patch-ops-error+xml', 'xfdf' => 'application/vnd.adobe.xfdf', 'xfdl' => 'application/vnd.xfdl', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xhvml' => 'application/xv+xml', 'xif' => 'image/vnd.xiff', 'xl' => 'application/excel', 'xla' => 'application/vnd.ms-excel', 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', 'xlc' => 'application/vnd.ms-excel', 'xlf' => 'application/xliff+xml', 'xlm' => 'application/vnd.ms-excel', 'xls' => 'application/vnd.ms-excel', 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'xlt' => 'application/vnd.ms-excel', 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'xlw' => 'application/vnd.ms-excel', 'xm' => 'audio/xm', 'xml' => 'application/xml', 'xns' => 'application/xcap-ns+xml', 'xo' => 'application/vnd.olpc-sugar', 'xop' => 'application/xop+xml', 'xpi' => 'application/x-xpinstall', 'xpl' => 'application/xproc+xml', 'xpm' => 'image/x-xpixmap', 'xpr' => 'application/vnd.is-xpr', 'xps' => 'application/vnd.ms-xpsdocument', 'xpw' => 'application/vnd.intercon.formnet', 'xpx' => 'application/vnd.intercon.formnet', 'xsd' => 'application/xml', 'xsl' => 'application/xml', 'xslt' => 'application/xslt+xml', 'xsm' => 'application/vnd.syncml+xml', 'xspf' => 'application/xspf+xml', 'xul' => 'application/vnd.mozilla.xul+xml', 'xvm' => 'application/xv+xml', 'xvml' => 'application/xv+xml', 'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz', 'xz' => 'application/x-xz', 'yaml' => 'text/yaml', 'yang' => 'application/yang', 'yin' => 'application/yin+xml', 'yml' => 'text/yaml', 'ymp' => 'text/x-suse-ymp', 'z' => 'application/x-compress', 'z1' => 'application/x-zmachine', 'z2' => 'application/x-zmachine', 'z3' => 'application/x-zmachine', 'z4' => 'application/x-zmachine', 'z5' => 'application/x-zmachine', 'z6' => 'application/x-zmachine', 'z7' => 'application/x-zmachine', 'z8' => 'application/x-zmachine', 'zaz' => 'application/vnd.zzazz.deck+xml', 'zip' => 'application/zip', 'zir' => 'application/vnd.zul', 'zirz' => 'application/vnd.zul', 'zmm' => 'application/vnd.handheld-entertainment+xml', 'zsh' => 'text/x-scriptzsh']; + /** + * Determines the mimetype of a file by looking at its extension. + * + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + */ + public static function fromFilename(string $filename) : ?string + { + return self::fromExtension(pathinfo($filename, \PATHINFO_EXTENSION)); + } + /** + * Maps a file extensions to a mimetype. + * + * @see https://raw.githubusercontent.com/jshttp/mime-db/master/db.json + */ + public static function fromExtension(string $extension) : ?string + { + return self::MIME_TYPES[strtolower($extension)] ?? null; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MultipartStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 0000000..5dda6c7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,124 @@ +boundary = $boundary ?: bin2hex(random_bytes(20)); + $this->stream = $this->createStream($elements); + } + public function getBoundary() : string + { + return $this->boundary; + } + public function isWritable() : bool + { + return \false; + } + /** + * Get the headers needed before transferring the content of a POST file + * + * @param array $headers + */ + private function getHeaders(array $headers) : string + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + } + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements = []) : StreamInterface + { + $stream = new AppendStream(); + foreach ($elements as $element) { + if (!is_array($element)) { + throw new \UnexpectedValueException('An array is expected'); + } + $this->addElement($stream, $element); + } + // Add the trailing boundary with CRLF + $stream->addStream(Utils::streamFor("--{$this->boundary}--\r\n")); + return $stream; + } + private function addElement(AppendStream $stream, array $element) : void + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + $element['contents'] = Utils::streamFor($element['contents']); + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if ($uri && \is_string($uri) && \substr($uri, 0, 6) !== 'php://' && \substr($uri, 0, 7) !== 'data://') { + $element['filename'] = $uri; + } + } + [$body, $headers] = $this->createElement($element['name'], $element['contents'], $element['filename'] ?? null, $element['headers'] ?? []); + $stream->addStream(Utils::streamFor($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(Utils::streamFor("\r\n")); + } + private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers) : array + { + // Set a default content-disposition header if one was no provided + $disposition = $this->getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = $filename === '0' || $filename ? sprintf('form-data; name="%s"; filename="%s"', $name, basename($filename)) : "form-data; name=\"{$name}\""; + } + // Set a default content-length header if one was no provided + $length = $this->getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + // Set a default Content-Type if one was not supplied + $type = $this->getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + if ($type = MimeType::fromFilename($filename)) { + $headers['Content-Type'] = $type; + } + } + return [$stream, $headers]; + } + private function getHeader(array $headers, string $key) + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower($k) === $lowercaseHeader) { + return $v; + } + } + return null; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/NoSeekStream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 0000000..8be49b0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,23 @@ +source = $source; + $this->size = $options['size'] ?? null; + $this->metadata = $options['metadata'] ?? []; + $this->buffer = new BufferStream(); + } + public function __toString() : string + { + try { + return Utils::copyToString($this); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR); + return ''; + } + } + public function close() : void + { + $this->detach(); + } + public function detach() + { + $this->tellPos = 0; + $this->source = null; + return null; + } + public function getSize() : ?int + { + return $this->size; + } + public function tell() : int + { + return $this->tellPos; + } + public function eof() : bool + { + return $this->source === null; + } + public function isSeekable() : bool + { + return \false; + } + public function rewind() : void + { + $this->seek(0); + } + public function seek($offset, $whence = \SEEK_SET) : void + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + public function isWritable() : bool + { + return \false; + } + public function write($string) : int + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + public function isReadable() : bool + { + return \true; + } + public function read($length) : string + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + return $data; + } + public function getContents() : string + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + return $result; + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + return $this->metadata[$key] ?? null; + } + private function pump(int $length) : void + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === \false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Query.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Query.php new file mode 100644 index 0000000..f9d3f6f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Query.php @@ -0,0 +1,104 @@ + '1', 'foo[b]' => '2'])`. + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + */ + public static function parse(string $str, $urlEncoding = \true) : array + { + $result = []; + if ($str === '') { + return $result; + } + if ($urlEncoding === \true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', (string) $value)); + }; + } elseif ($urlEncoding === \PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === \PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { + return $str; + }; + } + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!array_key_exists($key, $result)) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + return $result; + } + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function build(array $params, $encoding = \PHP_QUERY_RFC3986) : string + { + if (!$params) { + return ''; + } + if ($encoding === \false) { + $encoder = function (string $str) : string { + return $str; + }; + } elseif ($encoding === \PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === \PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? (int) $v : $v; + if ($v !== null) { + $qs .= '=' . $encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? (int) $vv : $vv; + if ($vv !== null) { + $qs .= '=' . $encoder((string) $vv); + } + $qs .= '&'; + } + } + } + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Request.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Request.php new file mode 100644 index 0000000..45c3eee --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,124 @@ + $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + */ + public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1') + { + $this->assertMethod($method); + if (!$uri instanceof UriInterface) { + $uri = new Uri($uri); + } + $this->method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($body); + } + } + public function getRequestTarget() : string + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + $target = $this->uri->getPath(); + if ($target === '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?' . $this->uri->getQuery(); + } + return $target; + } + public function withRequestTarget($requestTarget) : RequestInterface + { + if (preg_match('#\\s#', $requestTarget)) { + throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); + } + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + public function getMethod() : string + { + return $this->method; + } + public function withMethod($method) : RequestInterface + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + public function getUri() : UriInterface + { + return $this->uri; + } + public function withUri(UriInterface $uri, $preserveHost = \false) : RequestInterface + { + if ($uri === $this->uri) { + return $this; + } + $new = clone $this; + $new->uri = $uri; + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + return $new; + } + private function updateHostFromUri() : void + { + $host = $this->uri->getHost(); + if ($host == '') { + return; + } + if (($port = $this->uri->getPort()) !== null) { + $host .= ':' . $port; + } + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + /** + * @param mixed $method + */ + private function assertMethod($method) : void + { + if (!is_string($method) || $method === '') { + throw new InvalidArgumentException('Method must be a non-empty string.'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Response.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Response.php new file mode 100644 index 0000000..d880e8f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,78 @@ + 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', 200 => 'OK', 201 => 'Created', 202 => 'Accepted', 203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content', 206 => 'Partial Content', 207 => 'Multi-status', 208 => 'Already Reported', 300 => 'Multiple Choices', 301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other', 304 => 'Not Modified', 305 => 'Use Proxy', 306 => 'Switch Proxy', 307 => 'Temporary Redirect', 308 => 'Permanent Redirect', 400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required', 403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed', 406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Time-out', 409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required', 412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Large', 415 => 'Unsupported Media Type', 416 => 'Requested range not satisfiable', 417 => 'Expectation Failed', 418 => 'I\'m a teapot', 422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency', 425 => 'Unordered Collection', 426 => 'Upgrade Required', 428 => 'Precondition Required', 429 => 'Too Many Requests', 431 => 'Request Header Fields Too Large', 451 => 'Unavailable For Legal Reasons', 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Time-out', 505 => 'HTTP Version not supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage', 508 => 'Loop Detected', 510 => 'Not Extended', 511 => 'Network Authentication Required']; + /** @var string */ + private $reasonPhrase; + /** @var int */ + private $statusCode; + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|resource|StreamInterface|null $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct(int $status = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null) + { + $this->assertStatusCodeRange($status); + $this->statusCode = $status; + if ($body !== '' && $body !== null) { + $this->stream = Utils::streamFor($body); + } + $this->setHeaders($headers); + if ($reason == '' && isset(self::PHRASES[$this->statusCode])) { + $this->reasonPhrase = self::PHRASES[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + $this->protocol = $version; + } + public function getStatusCode() : int + { + return $this->statusCode; + } + public function getReasonPhrase() : string + { + return $this->reasonPhrase; + } + public function withStatus($code, $reasonPhrase = '') : ResponseInterface + { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + $new = clone $this; + $new->statusCode = $code; + if ($reasonPhrase == '' && isset(self::PHRASES[$new->statusCode])) { + $reasonPhrase = self::PHRASES[$new->statusCode]; + } + $new->reasonPhrase = (string) $reasonPhrase; + return $new; + } + /** + * @param mixed $statusCode + */ + private function assertStatusCodeIsInteger($statusCode) : void + { + if (filter_var($statusCode, \FILTER_VALIDATE_INT) === \false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + private function assertStatusCodeRange(int $statusCode) : void + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Rfc7230.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000..6c4c372 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,22 @@ +@,;:\\\"/[\\]?={}\x01- ]++):[ \t]*+((?:[ \t]*+[!-~\x80-\xff]++)*+)[ \t]*+\r?\n)m"; + public const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/ServerRequest.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 0000000..75cdb57 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,270 @@ + $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + * @param array $serverParams Typically the $_SERVER superglobal + */ + public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1', array $serverParams = []) + { + $this->serverParams = $serverParams; + parent::__construct($method, $uri, $headers, $body, $version); + } + /** + * Return an UploadedFile instance array. + * + * @param array $files An array which respect $_FILES structure + * + * @throws InvalidArgumentException for unrecognized values + */ + public static function normalizeFiles(array $files) : array + { + $normalized = []; + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + return $normalized; + } + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * + * @return UploadedFileInterface|UploadedFileInterface[] + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + return new UploadedFile($value['tmp_name'], (int) $value['size'], (int) $value['error'], $value['name'], $value['type']); + } + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []) : array + { + $normalizedFiles = []; + foreach (array_keys($files['tmp_name']) as $key) { + $spec = ['tmp_name' => $files['tmp_name'][$key], 'size' => $files['size'][$key] ?? null, 'error' => $files['error'][$key] ?? null, 'name' => $files['name'][$key] ?? null, 'type' => $files['type'][$key] ?? null]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + return $normalizedFiles; + } + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + */ + public static function fromGlobals() : ServerRequestInterface + { + $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + return $serverRequest->withCookieParams($_COOKIE)->withQueryParams($_GET)->withParsedBody($_POST)->withUploadedFiles(self::normalizeFiles($_FILES)); + } + private static function extractHostAndPortFromAuthority(string $authority) : array + { + $uri = 'http://' . $authority; + $parts = parse_url($uri); + if (\false === $parts) { + return [null, null]; + } + $host = $parts['host'] ?? null; + $port = $parts['port'] ?? null; + return [$host, $port]; + } + /** + * Get a Uri populated with values from $_SERVER. + */ + public static function getUriFromGlobals() : UriInterface + { + $uri = new Uri(''); + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + $hasPort = \false; + if (isset($_SERVER['HTTP_HOST'])) { + [$host, $port] = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + if ($port !== null) { + $hasPort = \true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + $hasQuery = \false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = \true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + return $uri; + } + public function getServerParams() : array + { + return $this->serverParams; + } + public function getUploadedFiles() : array + { + return $this->uploadedFiles; + } + public function withUploadedFiles(array $uploadedFiles) : ServerRequestInterface + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + return $new; + } + public function getCookieParams() : array + { + return $this->cookieParams; + } + public function withCookieParams(array $cookies) : ServerRequestInterface + { + $new = clone $this; + $new->cookieParams = $cookies; + return $new; + } + public function getQueryParams() : array + { + return $this->queryParams; + } + public function withQueryParams(array $query) : ServerRequestInterface + { + $new = clone $this; + $new->queryParams = $query; + return $new; + } + /** + * {@inheritdoc} + * + * @return array|object|null + */ + public function getParsedBody() + { + return $this->parsedBody; + } + public function withParsedBody($data) : ServerRequestInterface + { + $new = clone $this; + $new->parsedBody = $data; + return $new; + } + public function getAttributes() : array + { + return $this->attributes; + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getAttribute($attribute, $default = null) + { + if (\false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + return $this->attributes[$attribute]; + } + public function withAttribute($attribute, $value) : ServerRequestInterface + { + $new = clone $this; + $new->attributes[$attribute] = $value; + return $new; + } + public function withoutAttribute($attribute) : ServerRequestInterface + { + if (\false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + $new = clone $this; + unset($new->attributes[$attribute]); + return $new; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Stream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 0000000..35ba8c1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,237 @@ +size = $options['size']; + } + $this->customMetadata = $options['metadata'] ?? []; + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = (bool) preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool) preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->uri = $this->getMetadata('uri'); + } + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + public function __toString() : string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR); + return ''; + } + } + public function getContents() : string + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + return Utils::tryGetContents($this->stream); + } + public function close() : void + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + public function detach() + { + if (!isset($this->stream)) { + return null; + } + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = \false; + return $result; + } + public function getSize() : ?int + { + if ($this->size !== null) { + return $this->size; + } + if (!isset($this->stream)) { + return null; + } + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(\true, $this->uri); + } + $stats = fstat($this->stream); + if (is_array($stats) && isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + return null; + } + public function isReadable() : bool + { + return $this->readable; + } + public function isWritable() : bool + { + return $this->writable; + } + public function isSeekable() : bool + { + return $this->seekable; + } + public function eof() : bool + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + return feof($this->stream); + } + public function tell() : int + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + $result = ftell($this->stream); + if ($result === \false) { + throw new \RuntimeException('Unable to determine stream position'); + } + return $result; + } + public function rewind() : void + { + $this->seek(0); + } + public function seek($offset, $whence = \SEEK_SET) : void + { + $whence = (int) $whence; + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' . $offset . ' with whence ' . var_export($whence, \true)); + } + } + public function read($length) : string + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + if (0 === $length) { + return ''; + } + try { + $string = fread($this->stream, $length); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to read from stream', 0, $e); + } + if (\false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + return $string; + } + public function write($string) : int + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + if ($result === \false) { + throw new \RuntimeException('Unable to write to stream'); + } + return $result; + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + $meta = stream_get_meta_data($this->stream); + return $meta[$key] ?? null; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 0000000..a476377 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,133 @@ +stream = $stream; + } + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @return StreamInterface + */ + public function __get(string $name) + { + if ($name === 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + throw new \UnexpectedValueException("{$name} not found on class"); + } + public function __toString() : string + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Throwable $e) { + if (\PHP_VERSION_ID >= 70400) { + throw $e; + } + trigger_error(sprintf('%s::__toString exception: %s', self::class, (string) $e), \E_USER_ERROR); + return ''; + } + } + public function getContents() : string + { + return Utils::copyToString($this); + } + /** + * Allow decorators to implement custom methods + * + * @return mixed + */ + public function __call(string $method, array $args) + { + /** @var callable $callable */ + $callable = [$this->stream, $method]; + $result = call_user_func_array($callable, $args); + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + public function close() : void + { + $this->stream->close(); + } + /** + * {@inheritdoc} + * + * @return mixed + */ + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + public function detach() + { + return $this->stream->detach(); + } + public function getSize() : ?int + { + return $this->stream->getSize(); + } + public function eof() : bool + { + return $this->stream->eof(); + } + public function tell() : int + { + return $this->stream->tell(); + } + public function isReadable() : bool + { + return $this->stream->isReadable(); + } + public function isWritable() : bool + { + return $this->stream->isWritable(); + } + public function isSeekable() : bool + { + return $this->stream->isSeekable(); + } + public function rewind() : void + { + $this->seek(0); + } + public function seek($offset, $whence = \SEEK_SET) : void + { + $this->stream->seek($offset, $whence); + } + public function read($length) : string + { + return $this->stream->read($length); + } + public function write($string) : int + { + return $this->stream->write($string); + } + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @throws \BadMethodCallException + */ + protected function createStream() : StreamInterface + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/StreamWrapper.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 0000000..39995f1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,114 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' . 'writable, or both.'); + } + return fopen('guzzle://stream', $mode, \false, self::createStreamContext($stream)); + } + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create(['guzzle' => ['stream' => $stream]]); + } + /** + * Registers the stream wrapper if needed + */ + public static function register() : void + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + public function stream_open(string $path, string $mode, int $options, string &$opened_path = null) : bool + { + $options = stream_context_get_options($this->context); + if (!isset($options['guzzle']['stream'])) { + return \false; + } + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + return \true; + } + public function stream_read(int $count) : string + { + return $this->stream->read($count); + } + public function stream_write(string $data) : int + { + return $this->stream->write($data); + } + public function stream_tell() : int + { + return $this->stream->tell(); + } + public function stream_eof() : bool + { + return $this->stream->eof(); + } + public function stream_seek(int $offset, int $whence) : bool + { + $this->stream->seek($offset, $whence); + return \true; + } + /** + * @return resource|false + */ + public function stream_cast(int $cast_as) + { + $stream = clone $this->stream; + $resource = $stream->detach(); + return $resource ?? \false; + } + /** + * @return array + */ + public function stream_stat() : array + { + static $modeMap = ['r' => 33060, 'rb' => 33060, 'r+' => 33206, 'w' => 33188, 'wb' => 33188]; + return ['dev' => 0, 'ino' => 0, 'mode' => $modeMap[$this->mode], 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => $this->stream->getSize() ?: 0, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0]; + } + /** + * @return array + */ + public function url_stat(string $path, int $flags) : array + { + return ['dev' => 0, 'ino' => 0, 'mode' => 0, 'nlink' => 0, 'uid' => 0, 'gid' => 0, 'rdev' => 0, 'size' => 0, 'atime' => 0, 'mtime' => 0, 'ctime' => 0, 'blksize' => 0, 'blocks' => 0]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UploadedFile.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 0000000..4a00af8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,152 @@ +setError($errorStatus); + $this->size = $size; + $this->clientFilename = $clientFilename; + $this->clientMediaType = $clientMediaType; + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + /** + * Depending on the value set file or stream variable + * + * @param StreamInterface|string|resource $streamOrFile + * + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile) : void + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException('Invalid stream or file provided for UploadedFile'); + } + } + /** + * @throws InvalidArgumentException + */ + private function setError(int $error) : void + { + if (\false === in_array($error, UploadedFile::ERRORS, \true)) { + throw new InvalidArgumentException('Invalid error status for UploadedFile'); + } + $this->error = $error; + } + private function isStringNotEmpty($param) : bool + { + return is_string($param) && \false === empty($param); + } + /** + * Return true if there is no upload error + */ + private function isOk() : bool + { + return $this->error === \UPLOAD_ERR_OK; + } + public function isMoved() : bool + { + return $this->moved; + } + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive() : void + { + if (\false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + public function getStream() : StreamInterface + { + $this->validateActive(); + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + /** @var string $file */ + $file = $this->file; + return new LazyOpenStream($file, 'r+'); + } + public function moveTo($targetPath) : void + { + $this->validateActive(); + if (\false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException('Invalid path provided for move operation; must be a non-empty string'); + } + if ($this->file) { + $this->moved = \PHP_SAPI === 'cli' ? rename($this->file, $targetPath) : move_uploaded_file($this->file, $targetPath); + } else { + Utils::copyToStream($this->getStream(), new LazyOpenStream($targetPath, 'w')); + $this->moved = \true; + } + if (\false === $this->moved) { + throw new RuntimeException(sprintf('Uploaded file could not be moved to %s', $targetPath)); + } + } + public function getSize() : ?int + { + return $this->size; + } + public function getError() : int + { + return $this->error; + } + public function getClientFilename() : ?string + { + return $this->clientFilename; + } + public function getClientMediaType() : ?string + { + return $this->clientMediaType; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Uri.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 0000000..18e88f4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,570 @@ + 80, 'https' => 443, 'ftp' => 21, 'gopher' => 70, 'nntp' => 119, 'news' => 119, 'telnet' => 23, 'tn3270' => 23, 'imap' => 143, 'pop' => 110, 'ldap' => 389]; + /** + * Unreserved characters for use in a regex. + * + * @see https://tools.ietf.org/html/rfc3986#section-2.3 + */ + private const CHAR_UNRESERVED = 'a-zA-Z0-9_\\-\\.~'; + /** + * Sub-delims for use in a regex. + * + * @see https://tools.ietf.org/html/rfc3986#section-2.2 + */ + private const CHAR_SUB_DELIMS = '!\\$&\'\\(\\)\\*\\+,;='; + private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; + /** @var string Uri scheme. */ + private $scheme = ''; + /** @var string Uri user info. */ + private $userInfo = ''; + /** @var string Uri host. */ + private $host = ''; + /** @var int|null Uri port. */ + private $port; + /** @var string Uri path. */ + private $path = ''; + /** @var string Uri query string. */ + private $query = ''; + /** @var string Uri fragment. */ + private $fragment = ''; + /** @var string|null String representation */ + private $composedComponents; + public function __construct(string $uri = '') + { + if ($uri !== '') { + $parts = self::parse($uri); + if ($parts === \false) { + throw new MalformedUriException("Unable to parse URI: {$uri}"); + } + $this->applyParts($parts); + } + } + /** + * UTF-8 aware \parse_url() replacement. + * + * The internal function produces broken output for non ASCII domain names + * (IDN) when used with locales other than "C". + * + * On the other hand, cURL understands IDN correctly only when UTF-8 locale + * is configured ("C.UTF-8", "en_US.UTF-8", etc.). + * + * @see https://bugs.php.net/bug.php?id=52923 + * @see https://www.php.net/manual/en/function.parse-url.php#114817 + * @see https://curl.haxx.se/libcurl/c/CURLOPT_URL.html#ENCODING + * + * @return array|false + */ + private static function parse(string $url) + { + // If IPv6 + $prefix = ''; + if (preg_match('%^(.*://\\[[0-9:a-f]+\\])(.*?)$%', $url, $matches)) { + /** @var array{0:string, 1:string, 2:string} $matches */ + $prefix = $matches[1]; + $url = $matches[2]; + } + /** @var string */ + $encodedUrl = preg_replace_callback('%[^:/@?&=#]+%usD', static function ($matches) { + return urlencode($matches[0]); + }, $url); + $result = parse_url($prefix . $encodedUrl); + if ($result === \false) { + return \false; + } + return array_map('urldecode', $result); + } + public function __toString() : string + { + if ($this->composedComponents === null) { + $this->composedComponents = self::composeComponents($this->scheme, $this->getAuthority(), $this->path, $this->query, $this->fragment); + } + return $this->composedComponents; + } + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @see https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment) : string + { + $uri = ''; + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme . ':'; + } + if ($authority != '' || $scheme === 'file') { + $uri .= '//' . $authority; + } + if ($authority != '' && $path != '' && $path[0] != '/') { + $path = '/' . $path; + } + $uri .= $path; + if ($query != '') { + $uri .= '?' . $query; + } + if ($fragment != '') { + $uri .= '#' . $fragment; + } + return $uri; + } + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + */ + public static function isDefaultPort(UriInterface $uri) : bool + { + return $uri->getPort() === null || isset(self::DEFAULT_PORTS[$uri->getScheme()]) && $uri->getPort() === self::DEFAULT_PORTS[$uri->getScheme()]; + } + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @see https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri) : bool + { + return $uri->getScheme() !== ''; + } + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @see https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri) : bool + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @see https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri) : bool + { + return $uri->getScheme() === '' && $uri->getAuthority() === '' && isset($uri->getPath()[0]) && $uri->getPath()[0] === '/'; + } + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @see https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri) : bool + { + return $uri->getScheme() === '' && $uri->getAuthority() === '' && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @see https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) : bool + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + return $uri->getScheme() === $base->getScheme() && $uri->getAuthority() === $base->getAuthority() && $uri->getPath() === $base->getPath() && $uri->getQuery() === $base->getQuery(); + } + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + */ + public static function withoutQueryValue(UriInterface $uri, string $key) : UriInterface + { + $result = self::getFilteredQueryString($uri, [$key]); + return $uri->withQuery(implode('&', $result)); + } + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + */ + public static function withQueryValue(UriInterface $uri, string $key, ?string $value) : UriInterface + { + $result = self::getFilteredQueryString($uri, [$key]); + $result[] = self::generateQueryString($key, $value); + return $uri->withQuery(implode('&', $result)); + } + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray) : UriInterface + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString((string) $key, $value !== null ? (string) $value : null); + } + return $uri->withQuery(implode('&', $result)); + } + /** + * Creates a URI from a hash of `parse_url` components. + * + * @see http://php.net/manual/en/function.parse-url.php + * + * @throws MalformedUriException If the components do not form a valid URI. + */ + public static function fromParts(array $parts) : UriInterface + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + return $uri; + } + public function getScheme() : string + { + return $this->scheme; + } + public function getAuthority() : string + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + return $authority; + } + public function getUserInfo() : string + { + return $this->userInfo; + } + public function getHost() : string + { + return $this->host; + } + public function getPort() : ?int + { + return $this->port; + } + public function getPath() : string + { + return $this->path; + } + public function getQuery() : string + { + return $this->query; + } + public function getFragment() : string + { + return $this->fragment; + } + public function withScheme($scheme) : UriInterface + { + $scheme = $this->filterScheme($scheme); + if ($this->scheme === $scheme) { + return $this; + } + $new = clone $this; + $new->scheme = $scheme; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + return $new; + } + public function withUserInfo($user, $password = null) : UriInterface + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); + } + if ($this->userInfo === $info) { + return $this; + } + $new = clone $this; + $new->userInfo = $info; + $new->composedComponents = null; + $new->validateState(); + return $new; + } + public function withHost($host) : UriInterface + { + $host = $this->filterHost($host); + if ($this->host === $host) { + return $this; + } + $new = clone $this; + $new->host = $host; + $new->composedComponents = null; + $new->validateState(); + return $new; + } + public function withPort($port) : UriInterface + { + $port = $this->filterPort($port); + if ($this->port === $port) { + return $this; + } + $new = clone $this; + $new->port = $port; + $new->composedComponents = null; + $new->removeDefaultPort(); + $new->validateState(); + return $new; + } + public function withPath($path) : UriInterface + { + $path = $this->filterPath($path); + if ($this->path === $path) { + return $this; + } + $new = clone $this; + $new->path = $path; + $new->composedComponents = null; + $new->validateState(); + return $new; + } + public function withQuery($query) : UriInterface + { + $query = $this->filterQueryAndFragment($query); + if ($this->query === $query) { + return $this; + } + $new = clone $this; + $new->query = $query; + $new->composedComponents = null; + return $new; + } + public function withFragment($fragment) : UriInterface + { + $fragment = $this->filterQueryAndFragment($fragment); + if ($this->fragment === $fragment) { + return $this; + } + $new = clone $this; + $new->fragment = $fragment; + $new->composedComponents = null; + return $new; + } + public function jsonSerialize() : string + { + return $this->__toString(); + } + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts) : void + { + $this->scheme = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : ''; + $this->userInfo = isset($parts['user']) ? $this->filterUserInfoComponent($parts['user']) : ''; + $this->host = isset($parts['host']) ? $this->filterHost($parts['host']) : ''; + $this->port = isset($parts['port']) ? $this->filterPort($parts['port']) : null; + $this->path = isset($parts['path']) ? $this->filterPath($parts['path']) : ''; + $this->query = isset($parts['query']) ? $this->filterQueryAndFragment($parts['query']) : ''; + $this->fragment = isset($parts['fragment']) ? $this->filterQueryAndFragment($parts['fragment']) : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); + } + $this->removeDefaultPort(); + } + /** + * @param mixed $scheme + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme) : string + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + return \strtr($scheme, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + /** + * @param mixed $component + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component) : string + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + return preg_replace_callback('/(?:[^%' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . ']+|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $component); + } + /** + * @param mixed $host + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host) : string + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + return \strtr($host, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); + } + /** + * @param mixed $port + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port) : ?int + { + if ($port === null) { + return null; + } + $port = (int) $port; + if (0 > $port || 0xffff < $port) { + throw new \InvalidArgumentException(sprintf('Invalid port: %d. Must be between 0 and 65535', $port)); + } + return $port; + } + /** + * @param string[] $keys + * + * @return string[] + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys) : array + { + $current = $uri->getQuery(); + if ($current === '') { + return []; + } + $decodedKeys = array_map('rawurldecode', $keys); + return array_filter(explode('&', $current), function ($part) use($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, \true); + }); + } + private static function generateQueryString(string $key, ?string $value) : string + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::QUERY_SEPARATORS_REPLACEMENT); + if ($value !== null) { + $queryString .= '=' . strtr($value, self::QUERY_SEPARATORS_REPLACEMENT); + } + return $queryString; + } + private function removeDefaultPort() : void + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + /** + * Filters the path of a URI + * + * @param mixed $path + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path) : string + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + return preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\\/]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $path); + } + /** + * Filters the query string or fragment of a URI. + * + * @param mixed $str + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str) : string + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + return preg_replace_callback('/(?:[^' . self::CHAR_UNRESERVED . self::CHAR_SUB_DELIMS . '%:@\\/\\?]++|%(?![A-Fa-f0-9]{2}))/', [$this, 'rawurlencodeMatchZero'], $str); + } + private function rawurlencodeMatchZero(array $match) : string + { + return rawurlencode($match[0]); + } + private function validateState() : void + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new MalformedUriException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && \false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new MalformedUriException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriComparator.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriComparator.php new file mode 100644 index 0000000..be2f9f5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriComparator.php @@ -0,0 +1,43 @@ +getHost(), $modified->getHost()) !== 0) { + return \true; + } + if ($original->getScheme() !== $modified->getScheme()) { + return \true; + } + if (self::computePort($original) !== self::computePort($modified)) { + return \true; + } + return \false; + } + private static function computePort(UriInterface $uri) : int + { + $port = $uri->getPort(); + if (null !== $port) { + return $port; + } + return 'https' === $uri->getScheme() ? 443 : 80; + } + private function __construct() + { + // cannot be instantiated + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriNormalizer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 0000000..6467cf2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,175 @@ +getPath() === '' && ($uri->getScheme() === 'http' || $uri->getScheme() === 'https')) { + $uri = $uri->withPath('/'); + } + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + return $uri; + } + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @see https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS) : bool + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + private static function capitalizePercentEncoding(UriInterface $uri) : UriInterface + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + $callback = function (array $match) { + return strtoupper($match[0]); + }; + return $uri->withPath(preg_replace_callback($regex, $callback, $uri->getPath()))->withQuery(preg_replace_callback($regex, $callback, $uri->getQuery())); + } + private static function decodeUnreservedCharacters(UriInterface $uri) : UriInterface + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + $callback = function (array $match) { + return rawurldecode($match[0]); + }; + return $uri->withPath(preg_replace_callback($regex, $callback, $uri->getPath()))->withQuery(preg_replace_callback($regex, $callback, $uri->getQuery())); + } + private function __construct() + { + // cannot be instantiated + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriResolver.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 0000000..edf6072 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,180 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/' . $rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === \false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + return new Uri(Uri::composeComponents($base->getScheme(), $targetAuthority, $targetPath, $targetQuery, $rel->getFragment())); + } + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + */ + public static function relativize(UriInterface $base, UriInterface $target) : UriInterface + { + if ($target->getScheme() !== '' && ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '')) { + return $target; + } + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + /** @var string $lastSegment */ + $lastSegment = end($segments); + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + return $emptyPathUri; + } + private static function getRelativePath(UriInterface $base, UriInterface $target) : string + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || \false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./{$relativePath}"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".{$relativePath}"; + } else { + $relativePath = "./{$relativePath}"; + } + } + return $relativePath; + } + private function __construct() + { + // cannot be instantiated + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Utils.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Utils.php new file mode 100644 index 0000000..24b9a8c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/guzzlehttp/psr7/src/Utils.php @@ -0,0 +1,375 @@ + $v) { + if (!is_string($k) || !in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + return $result; + } + /** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ + public static function copyToStream(StreamInterface $source, StreamInterface $dest, int $maxLen = -1) : void + { + $bufferSize = 8192; + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } + } + /** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ + public static function copyToString(StreamInterface $stream, int $maxLen = -1) : string + { + $buffer = ''; + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + if ($buf === '') { + break; + } + $buffer .= $buf; + } + return $buffer; + } + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + if ($buf === '') { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + return $buffer; + } + /** + * Calculate a hash of a stream. + * + * This method reads the entire stream to calculate a rolling hash, based + * on PHP's `hash_init` functions. + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @throws \RuntimeException on error. + */ + public static function hash(StreamInterface $stream, string $algo, bool $rawOutput = \false) : string + { + $pos = $stream->tell(); + if ($pos > 0) { + $stream->rewind(); + } + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + $out = hash_final($ctx, $rawOutput); + $stream->seek($pos); + return $out; + } + /** + * Clone and modify a request with the given changes. + * + * This method is useful for reducing the number of clones needed to mutate + * a message. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + */ + public static function modifyRequest(RequestInterface $request, array $changes) : RequestInterface + { + if (!$changes) { + return $request; + } + $headers = $request->getHeaders(); + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':' . $port; + } + } + } + $uri = $changes['uri']; + } + if (!empty($changes['remove_headers'])) { + $headers = self::caselessRemove($changes['remove_headers'], $headers); + } + if (!empty($changes['set_headers'])) { + $headers = self::caselessRemove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + if ($request instanceof ServerRequestInterface) { + $new = (new ServerRequest($changes['method'] ?? $request->getMethod(), $uri, $headers, $changes['body'] ?? $request->getBody(), $changes['version'] ?? $request->getProtocolVersion(), $request->getServerParams()))->withParsedBody($request->getParsedBody())->withQueryParams($request->getQueryParams())->withCookieParams($request->getCookieParams())->withUploadedFiles($request->getUploadedFiles()); + foreach ($request->getAttributes() as $key => $value) { + $new = $new->withAttribute($key, $value); + } + return $new; + } + return new Request($changes['method'] ?? $request->getMethod(), $uri, $headers, $changes['body'] ?? $request->getBody(), $changes['version'] ?? $request->getProtocolVersion()); + } + /** + * Read a line from the stream up to the maximum allowed buffer length. + * + * @param StreamInterface $stream Stream to read from + * @param int|null $maxLength Maximum buffer length + */ + public static function readLine(StreamInterface $stream, ?int $maxLength = null) : string + { + $buffer = ''; + $size = 0; + while (!$stream->eof()) { + if ('' === ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + return $buffer; + } + /** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * This method accepts the following `$resource` types: + * - `Psr\Http\Message\StreamInterface`: Returns the value as-is. + * - `string`: Creates a stream object that uses the given string as the contents. + * - `resource`: Creates a stream object that wraps the given PHP stream resource. + * - `Iterator`: If the provided value implements `Iterator`, then a read-only + * stream object will be created that wraps the given iterable. Each time the + * stream is read from, data from the iterator will fill a buffer and will be + * continuously called until the buffer is equal to the requested read size. + * Subsequent read calls will first read from the buffer and then call `next` + * on the underlying iterator until it is exhausted. + * - `object` with `__toString()`: If the object has the `__toString()` method, + * the object will be cast to a string and then a stream will be returned that + * uses the string value. + * - `NULL`: When `null` is passed, an empty stream object is returned. + * - `callable` When a callable is passed, a read-only stream object will be + * created that invokes the given callable. The callable is invoked with the + * number of suggested bytes to read. The callable can return any number of + * bytes, but MUST return `false` when there is no more data to return. The + * stream object that wraps the callable will invoke the callable until the + * number of requested bytes are available. Any additional bytes will be + * buffered and used in subsequent reads. + * + * @param resource|string|int|float|bool|StreamInterface|callable|\Iterator|null $resource Entity body data + * @param array{size?: int, metadata?: array} $options Additional options + * + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ + public static function streamFor($resource = '', array $options = []) : StreamInterface + { + if (is_scalar($resource)) { + $stream = self::tryFopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, (string) $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + switch (gettype($resource)) { + case 'resource': + /* + * The 'php://input' is a special stream with quirks and inconsistencies. + * We avoid using that stream by reading it into php://temp + */ + /** @var resource $resource */ + if ((\stream_get_meta_data($resource)['uri'] ?? '') === 'php://input') { + $stream = self::tryFopen('php://temp', 'w+'); + stream_copy_to_stream($resource, $stream); + fseek($stream, 0); + $resource = $stream; + } + return new Stream($resource, $options); + case 'object': + /** @var object $resource */ + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use($resource) { + if (!$resource->valid()) { + return \false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return self::streamFor((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(self::tryFopen('php://temp', 'r+'), $options); + } + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); + } + /** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * + * @throws \RuntimeException if the file cannot be opened + */ + public static function tryFopen(string $filename, string $mode) + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use($filename, $mode, &$ex) : bool { + $ex = new \RuntimeException(sprintf('Unable to open "%s" using mode "%s": %s', $filename, $mode, $errstr)); + return \true; + }); + try { + /** @var resource $handle */ + $handle = fopen($filename, $mode); + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf('Unable to open "%s" using mode "%s": %s', $filename, $mode, $e->getMessage()), 0, $e); + } + restore_error_handler(); + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + return $handle; + } + /** + * Safely gets the contents of a given stream. + * + * When stream_get_contents fails, PHP normally raises a warning. This + * function adds an error handler that checks for errors and throws an + * exception instead. + * + * @param resource $stream + * + * @throws \RuntimeException if the stream cannot be read + */ + public static function tryGetContents($stream) : string + { + $ex = null; + set_error_handler(static function (int $errno, string $errstr) use(&$ex) : bool { + $ex = new \RuntimeException(sprintf('Unable to read stream contents: %s', $errstr)); + return \true; + }); + try { + /** @var string|false $contents */ + $contents = stream_get_contents($stream); + if ($contents === \false) { + $ex = new \RuntimeException('Unable to read stream contents'); + } + } catch (\Throwable $e) { + $ex = new \RuntimeException(sprintf('Unable to read stream contents: %s', $e->getMessage()), 0, $e); + } + restore_error_handler(); + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + return $contents; + } + /** + * Returns a UriInterface for the given value. + * + * This function accepts a string or UriInterface and returns a + * UriInterface for the given value. If the value is already a + * UriInterface, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @throws \InvalidArgumentException + */ + public static function uriFor($uri) : UriInterface + { + if ($uri instanceof UriInterface) { + return $uri; + } + if (is_string($uri)) { + return new Uri($uri); + } + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/LICENSE.txt b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/LICENSE.txt new file mode 100644 index 0000000..91acaca --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/LICENSE.txt @@ -0,0 +1,48 @@ +The MIT License (MIT) + +Copyright (c) 2016 - 2022 Paragon Initiative Enterprises + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +------------------------------------------------------------------------------ +This library was based on the work of Steve "Sc00bz" Thomas. +------------------------------------------------------------------------------ + +The MIT License (MIT) + +Copyright (c) 2014 Steve Thomas + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base32.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base32.php new file mode 100644 index 0000000..0b65be6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base32.php @@ -0,0 +1,404 @@ + 96 && $src < 123) $ret += $src - 97 + 1; // -64 + $ret += (0x60 - $src & $src - 0x7b) >> 8 & $src - 96; + // if ($src > 0x31 && $src < 0x38) $ret += $src - 24 + 1; // -23 + $ret += (0x31 - $src & $src - 0x38) >> 8 & $src - 23; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 5-bit integers + * into 8-bit integers. + * + * Uppercase variant. + * + * @param int $src + * @return int + */ + protected static function decode5BitsUpper(int $src) : int + { + $ret = -1; + // if ($src > 64 && $src < 91) $ret += $src - 65 + 1; // -64 + $ret += (0x40 - $src & $src - 0x5b) >> 8 & $src - 64; + // if ($src > 0x31 && $src < 0x38) $ret += $src - 24 + 1; // -23 + $ret += (0x31 - $src & $src - 0x38) >> 8 & $src - 23; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 5-bit integers. + * + * @param int $src + * @return string + */ + protected static function encode5Bits(int $src) : string + { + $diff = 0x61; + // if ($src > 25) $ret -= 72; + $diff -= 25 - $src >> 8 & 73; + return \pack('C', $src + $diff); + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 5-bit integers. + * + * Uppercase variant. + * + * @param int $src + * @return string + */ + protected static function encode5BitsUpper(int $src) : string + { + $diff = 0x41; + // if ($src > 25) $ret -= 40; + $diff -= 25 - $src >> 8 & 41; + return \pack('C', $src + $diff); + } + /** + * @param string $encodedString + * @param bool $upper + * @return string + */ + public static function decodeNoPadding(string $encodedString, bool $upper = \false) : string + { + $srcLen = Binary::safeStrlen($encodedString); + if ($srcLen === 0) { + return ''; + } + if (($srcLen & 7) === 0) { + for ($j = 0; $j < 7 && $j < $srcLen; ++$j) { + if ($encodedString[$srcLen - $j - 1] === '=') { + throw new InvalidArgumentException("decodeNoPadding() doesn't tolerate padding"); + } + } + } + return static::doDecode($encodedString, $upper, \true); + } + /** + * Base32 decoding + * + * @param string $src + * @param bool $upper + * @param bool $strictPadding + * @return string + * + * @throws TypeError + * @psalm-suppress RedundantCondition + */ + protected static function doDecode(string $src, bool $upper = \false, bool $strictPadding = \false) : string + { + // We do this to reduce code duplication: + $method = $upper ? 'decode5BitsUpper' : 'decode5Bits'; + // Remove padding + $srcLen = Binary::safeStrlen($src); + if ($srcLen === 0) { + return ''; + } + if ($strictPadding) { + if (($srcLen & 7) === 0) { + for ($j = 0; $j < 7; ++$j) { + if ($src[$srcLen - 1] === '=') { + $srcLen--; + } else { + break; + } + } + } + if (($srcLen & 7) === 1) { + throw new RangeException('Incorrect padding'); + } + } else { + $src = \rtrim($src, '='); + $srcLen = Binary::safeStrlen($src); + } + $err = 0; + $dest = ''; + // Main loop (no padding): + for ($i = 0; $i + 8 <= $srcLen; $i += 8) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 8)); + /** @var int $c0 */ + $c0 = static::$method($chunk[1]); + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + /** @var int $c2 */ + $c2 = static::$method($chunk[3]); + /** @var int $c3 */ + $c3 = static::$method($chunk[4]); + /** @var int $c4 */ + $c4 = static::$method($chunk[5]); + /** @var int $c5 */ + $c5 = static::$method($chunk[6]); + /** @var int $c6 */ + $c6 = static::$method($chunk[7]); + /** @var int $c7 */ + $c7 = static::$method($chunk[8]); + $dest .= \pack('CCCCC', ($c0 << 3 | $c1 >> 2) & 0xff, ($c1 << 6 | $c2 << 1 | $c3 >> 4) & 0xff, ($c3 << 4 | $c4 >> 1) & 0xff, ($c4 << 7 | $c5 << 2 | $c6 >> 3) & 0xff, ($c6 << 5 | $c7) & 0xff); + $err |= ($c0 | $c1 | $c2 | $c3 | $c4 | $c5 | $c6 | $c7) >> 8; + } + // The last chunk, which may have padding: + if ($i < $srcLen) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); + /** @var int $c0 */ + $c0 = static::$method($chunk[1]); + if ($i + 6 < $srcLen) { + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + /** @var int $c2 */ + $c2 = static::$method($chunk[3]); + /** @var int $c3 */ + $c3 = static::$method($chunk[4]); + /** @var int $c4 */ + $c4 = static::$method($chunk[5]); + /** @var int $c5 */ + $c5 = static::$method($chunk[6]); + /** @var int $c6 */ + $c6 = static::$method($chunk[7]); + $dest .= \pack('CCCC', ($c0 << 3 | $c1 >> 2) & 0xff, ($c1 << 6 | $c2 << 1 | $c3 >> 4) & 0xff, ($c3 << 4 | $c4 >> 1) & 0xff, ($c4 << 7 | $c5 << 2 | $c6 >> 3) & 0xff); + $err |= ($c0 | $c1 | $c2 | $c3 | $c4 | $c5 | $c6) >> 8; + if ($strictPadding) { + $err |= $c6 << 5 & 0xff; + } + } elseif ($i + 5 < $srcLen) { + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + /** @var int $c2 */ + $c2 = static::$method($chunk[3]); + /** @var int $c3 */ + $c3 = static::$method($chunk[4]); + /** @var int $c4 */ + $c4 = static::$method($chunk[5]); + /** @var int $c5 */ + $c5 = static::$method($chunk[6]); + $dest .= \pack('CCCC', ($c0 << 3 | $c1 >> 2) & 0xff, ($c1 << 6 | $c2 << 1 | $c3 >> 4) & 0xff, ($c3 << 4 | $c4 >> 1) & 0xff, ($c4 << 7 | $c5 << 2) & 0xff); + $err |= ($c0 | $c1 | $c2 | $c3 | $c4 | $c5) >> 8; + } elseif ($i + 4 < $srcLen) { + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + /** @var int $c2 */ + $c2 = static::$method($chunk[3]); + /** @var int $c3 */ + $c3 = static::$method($chunk[4]); + /** @var int $c4 */ + $c4 = static::$method($chunk[5]); + $dest .= \pack('CCC', ($c0 << 3 | $c1 >> 2) & 0xff, ($c1 << 6 | $c2 << 1 | $c3 >> 4) & 0xff, ($c3 << 4 | $c4 >> 1) & 0xff); + $err |= ($c0 | $c1 | $c2 | $c3 | $c4) >> 8; + if ($strictPadding) { + $err |= $c4 << 7 & 0xff; + } + } elseif ($i + 3 < $srcLen) { + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + /** @var int $c2 */ + $c2 = static::$method($chunk[3]); + /** @var int $c3 */ + $c3 = static::$method($chunk[4]); + $dest .= \pack('CC', ($c0 << 3 | $c1 >> 2) & 0xff, ($c1 << 6 | $c2 << 1 | $c3 >> 4) & 0xff); + $err |= ($c0 | $c1 | $c2 | $c3) >> 8; + if ($strictPadding) { + $err |= $c3 << 4 & 0xff; + } + } elseif ($i + 2 < $srcLen) { + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + /** @var int $c2 */ + $c2 = static::$method($chunk[3]); + $dest .= \pack('CC', ($c0 << 3 | $c1 >> 2) & 0xff, ($c1 << 6 | $c2 << 1) & 0xff); + $err |= ($c0 | $c1 | $c2) >> 8; + if ($strictPadding) { + $err |= $c2 << 6 & 0xff; + } + } elseif ($i + 1 < $srcLen) { + /** @var int $c1 */ + $c1 = static::$method($chunk[2]); + $dest .= \pack('C', ($c0 << 3 | $c1 >> 2) & 0xff); + $err |= ($c0 | $c1) >> 8; + if ($strictPadding) { + $err |= $c1 << 6 & 0xff; + } + } else { + $dest .= \pack('C', $c0 << 3 & 0xff); + $err |= $c0 >> 8; + } + } + $check = $err === 0; + if (!$check) { + throw new RangeException('Base32::doDecode() only expects characters in the correct base32 alphabet'); + } + return $dest; + } + /** + * Base32 Encoding + * + * @param string $src + * @param bool $upper + * @param bool $pad + * @return string + * @throws TypeError + */ + protected static function doEncode(string $src, bool $upper = \false, $pad = \true) : string + { + // We do this to reduce code duplication: + $method = $upper ? 'encode5BitsUpper' : 'encode5Bits'; + $dest = ''; + $srcLen = Binary::safeStrlen($src); + // Main loop (no padding): + for ($i = 0; $i + 5 <= $srcLen; $i += 5) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 5)); + $b0 = $chunk[1]; + $b1 = $chunk[2]; + $b2 = $chunk[3]; + $b3 = $chunk[4]; + $b4 = $chunk[5]; + $dest .= static::$method($b0 >> 3 & 31) . static::$method(($b0 << 2 | $b1 >> 6) & 31) . static::$method($b1 >> 1 & 31) . static::$method(($b1 << 4 | $b2 >> 4) & 31) . static::$method(($b2 << 1 | $b3 >> 7) & 31) . static::$method($b3 >> 2 & 31) . static::$method(($b3 << 3 | $b4 >> 5) & 31) . static::$method($b4 & 31); + } + // The last chunk, which may have padding: + if ($i < $srcLen) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); + $b0 = $chunk[1]; + if ($i + 3 < $srcLen) { + $b1 = $chunk[2]; + $b2 = $chunk[3]; + $b3 = $chunk[4]; + $dest .= static::$method($b0 >> 3 & 31) . static::$method(($b0 << 2 | $b1 >> 6) & 31) . static::$method($b1 >> 1 & 31) . static::$method(($b1 << 4 | $b2 >> 4) & 31) . static::$method(($b2 << 1 | $b3 >> 7) & 31) . static::$method($b3 >> 2 & 31) . static::$method($b3 << 3 & 31); + if ($pad) { + $dest .= '='; + } + } elseif ($i + 2 < $srcLen) { + $b1 = $chunk[2]; + $b2 = $chunk[3]; + $dest .= static::$method($b0 >> 3 & 31) . static::$method(($b0 << 2 | $b1 >> 6) & 31) . static::$method($b1 >> 1 & 31) . static::$method(($b1 << 4 | $b2 >> 4) & 31) . static::$method($b2 << 1 & 31); + if ($pad) { + $dest .= '==='; + } + } elseif ($i + 1 < $srcLen) { + $b1 = $chunk[2]; + $dest .= static::$method($b0 >> 3 & 31) . static::$method(($b0 << 2 | $b1 >> 6) & 31) . static::$method($b1 >> 1 & 31) . static::$method($b1 << 4 & 31); + if ($pad) { + $dest .= '===='; + } + } else { + $dest .= static::$method($b0 >> 3 & 31) . static::$method($b0 << 2 & 31); + if ($pad) { + $dest .= '======'; + } + } + } + return $dest; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base32Hex.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base32Hex.php new file mode 100644 index 0000000..d5c7566 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base32Hex.php @@ -0,0 +1,98 @@ + 0x30 && $src < 0x3a) ret += $src - 0x2e + 1; // -47 + $ret += (0x2f - $src & $src - 0x3a) >> 8 & $src - 47; + // if ($src > 0x60 && $src < 0x77) ret += $src - 0x61 + 10 + 1; // -86 + $ret += (0x60 - $src & $src - 0x77) >> 8 & $src - 86; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 5-bit integers + * into 8-bit integers. + * + * @param int $src + * @return int + */ + protected static function decode5BitsUpper(int $src) : int + { + $ret = -1; + // if ($src > 0x30 && $src < 0x3a) ret += $src - 0x2e + 1; // -47 + $ret += (0x2f - $src & $src - 0x3a) >> 8 & $src - 47; + // if ($src > 0x40 && $src < 0x57) ret += $src - 0x41 + 10 + 1; // -54 + $ret += (0x40 - $src & $src - 0x57) >> 8 & $src - 54; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 5-bit integers. + * + * @param int $src + * @return string + */ + protected static function encode5Bits(int $src) : string + { + $src += 0x30; + // if ($src > 0x39) $src += 0x61 - 0x3a; // 39 + $src += 0x39 - $src >> 8 & 39; + return \pack('C', $src); + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 5-bit integers. + * + * Uppercase variant. + * + * @param int $src + * @return string + */ + protected static function encode5BitsUpper(int $src) : string + { + $src += 0x30; + // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 + $src += 0x39 - $src >> 8 & 7; + return \pack('C', $src); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64.php new file mode 100644 index 0000000..9065117 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64.php @@ -0,0 +1,257 @@ + $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, 3)); + $b0 = $chunk[1]; + $b1 = $chunk[2]; + $b2 = $chunk[3]; + $dest .= static::encode6Bits($b0 >> 2) . static::encode6Bits(($b0 << 4 | $b1 >> 4) & 63) . static::encode6Bits(($b1 << 2 | $b2 >> 6) & 63) . static::encode6Bits($b2 & 63); + } + // The last chunk, which may have padding: + if ($i < $srcLen) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($src, $i, $srcLen - $i)); + $b0 = $chunk[1]; + if ($i + 1 < $srcLen) { + $b1 = $chunk[2]; + $dest .= static::encode6Bits($b0 >> 2) . static::encode6Bits(($b0 << 4 | $b1 >> 4) & 63) . static::encode6Bits($b1 << 2 & 63); + if ($pad) { + $dest .= '='; + } + } else { + $dest .= static::encode6Bits($b0 >> 2) . static::encode6Bits($b0 << 4 & 63); + if ($pad) { + $dest .= '=='; + } + } + } + return $dest; + } + /** + * decode from base64 into binary + * + * Base64 character set "./[A-Z][a-z][0-9]" + * + * @param string $encodedString + * @param bool $strictPadding + * @return string + * + * @throws RangeException + * @throws TypeError + * @psalm-suppress RedundantCondition + */ + public static function decode(string $encodedString, bool $strictPadding = \false) : string + { + // Remove padding + $srcLen = Binary::safeStrlen($encodedString); + if ($srcLen === 0) { + return ''; + } + if ($strictPadding) { + if (($srcLen & 3) === 0) { + if ($encodedString[$srcLen - 1] === '=') { + $srcLen--; + if ($encodedString[$srcLen - 1] === '=') { + $srcLen--; + } + } + } + if (($srcLen & 3) === 1) { + throw new RangeException('Incorrect padding'); + } + if ($encodedString[$srcLen - 1] === '=') { + throw new RangeException('Incorrect padding'); + } + } else { + $encodedString = \rtrim($encodedString, '='); + $srcLen = Binary::safeStrlen($encodedString); + } + $err = 0; + $dest = ''; + // Main loop (no padding): + for ($i = 0; $i + 4 <= $srcLen; $i += 4) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, 4)); + $c0 = static::decode6Bits($chunk[1]); + $c1 = static::decode6Bits($chunk[2]); + $c2 = static::decode6Bits($chunk[3]); + $c3 = static::decode6Bits($chunk[4]); + $dest .= \pack('CCC', ($c0 << 2 | $c1 >> 4) & 0xff, ($c1 << 4 | $c2 >> 2) & 0xff, ($c2 << 6 | $c3) & 0xff); + $err |= ($c0 | $c1 | $c2 | $c3) >> 8; + } + // The last chunk, which may have padding: + if ($i < $srcLen) { + /** @var array $chunk */ + $chunk = \unpack('C*', Binary::safeSubstr($encodedString, $i, $srcLen - $i)); + $c0 = static::decode6Bits($chunk[1]); + if ($i + 2 < $srcLen) { + $c1 = static::decode6Bits($chunk[2]); + $c2 = static::decode6Bits($chunk[3]); + $dest .= \pack('CC', ($c0 << 2 | $c1 >> 4) & 0xff, ($c1 << 4 | $c2 >> 2) & 0xff); + $err |= ($c0 | $c1 | $c2) >> 8; + if ($strictPadding) { + $err |= $c2 << 6 & 0xff; + } + } elseif ($i + 1 < $srcLen) { + $c1 = static::decode6Bits($chunk[2]); + $dest .= \pack('C', ($c0 << 2 | $c1 >> 4) & 0xff); + $err |= ($c0 | $c1) >> 8; + if ($strictPadding) { + $err |= $c1 << 4 & 0xff; + } + } elseif ($strictPadding) { + $err |= 1; + } + } + $check = $err === 0; + if (!$check) { + throw new RangeException('Base64::decode() only expects characters in the correct base64 alphabet'); + } + return $dest; + } + /** + * @param string $encodedString + * @return string + */ + public static function decodeNoPadding(string $encodedString) : string + { + $srcLen = Binary::safeStrlen($encodedString); + if ($srcLen === 0) { + return ''; + } + if (($srcLen & 3) === 0) { + if ($encodedString[$srcLen - 1] === '=') { + throw new InvalidArgumentException("decodeNoPadding() doesn't tolerate padding"); + } + if (($srcLen & 3) > 1) { + if ($encodedString[$srcLen - 2] === '=') { + throw new InvalidArgumentException("decodeNoPadding() doesn't tolerate padding"); + } + } + } + return static::decode($encodedString, \true); + } + /** + * Uses bitwise operators instead of table-lookups to turn 6-bit integers + * into 8-bit integers. + * + * Base64 character set: + * [A-Z] [a-z] [0-9] + / + * 0x41-0x5a, 0x61-0x7a, 0x30-0x39, 0x2b, 0x2f + * + * @param int $src + * @return int + */ + protected static function decode6Bits(int $src) : int + { + $ret = -1; + // if ($src > 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64 + $ret += (0x40 - $src & $src - 0x5b) >> 8 & $src - 64; + // if ($src > 0x60 && $src < 0x7b) $ret += $src - 0x61 + 26 + 1; // -70 + $ret += (0x60 - $src & $src - 0x7b) >> 8 & $src - 70; + // if ($src > 0x2f && $src < 0x3a) $ret += $src - 0x30 + 52 + 1; // 5 + $ret += (0x2f - $src & $src - 0x3a) >> 8 & $src + 5; + // if ($src == 0x2b) $ret += 62 + 1; + $ret += (0x2a - $src & $src - 0x2c) >> 8 & 63; + // if ($src == 0x2f) ret += 63 + 1; + $ret += (0x2e - $src & $src - 0x30) >> 8 & 64; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 6-bit integers. + * + * @param int $src + * @return string + */ + protected static function encode6Bits(int $src) : string + { + $diff = 0x41; + // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6 + $diff += 25 - $src >> 8 & 6; + // if ($src > 51) $diff += 0x30 - 0x61 - 26; // -75 + $diff -= 51 - $src >> 8 & 75; + // if ($src > 61) $diff += 0x2b - 0x30 - 10; // -15 + $diff -= 61 - $src >> 8 & 15; + // if ($src > 62) $diff += 0x2f - 0x2b - 1; // 3 + $diff += 62 - $src >> 8 & 3; + return \pack('C', $src + $diff); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64DotSlash.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64DotSlash.php new file mode 100644 index 0000000..80b8cd7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64DotSlash.php @@ -0,0 +1,78 @@ + 0x2d && $src < 0x30) ret += $src - 0x2e + 1; // -45 + $ret += (0x2d - $src & $src - 0x30) >> 8 & $src - 45; + // if ($src > 0x40 && $src < 0x5b) ret += $src - 0x41 + 2 + 1; // -62 + $ret += (0x40 - $src & $src - 0x5b) >> 8 & $src - 62; + // if ($src > 0x60 && $src < 0x7b) ret += $src - 0x61 + 28 + 1; // -68 + $ret += (0x60 - $src & $src - 0x7b) >> 8 & $src - 68; + // if ($src > 0x2f && $src < 0x3a) ret += $src - 0x30 + 54 + 1; // 7 + $ret += (0x2f - $src & $src - 0x3a) >> 8 & $src + 7; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 6-bit integers. + * + * @param int $src + * @return string + */ + protected static function encode6Bits(int $src) : string + { + $src += 0x2e; + // if ($src > 0x2f) $src += 0x41 - 0x30; // 17 + $src += 0x2f - $src >> 8 & 17; + // if ($src > 0x5a) $src += 0x61 - 0x5b; // 6 + $src += 0x5a - $src >> 8 & 6; + // if ($src > 0x7a) $src += 0x30 - 0x7b; // -75 + $src -= 0x7a - $src >> 8 & 75; + return \pack('C', $src); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php new file mode 100644 index 0000000..cee01f3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php @@ -0,0 +1,74 @@ + 0x2d && $src < 0x3a) ret += $src - 0x2e + 1; // -45 + $ret += (0x2d - $src & $src - 0x3a) >> 8 & $src - 45; + // if ($src > 0x40 && $src < 0x5b) ret += $src - 0x41 + 12 + 1; // -52 + $ret += (0x40 - $src & $src - 0x5b) >> 8 & $src - 52; + // if ($src > 0x60 && $src < 0x7b) ret += $src - 0x61 + 38 + 1; // -58 + $ret += (0x60 - $src & $src - 0x7b) >> 8 & $src - 58; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 6-bit integers. + * + * @param int $src + * @return string + */ + protected static function encode6Bits(int $src) : string + { + $src += 0x2e; + // if ($src > 0x39) $src += 0x41 - 0x3a; // 7 + $src += 0x39 - $src >> 8 & 7; + // if ($src > 0x5a) $src += 0x61 - 0x5b; // 6 + $src += 0x5a - $src >> 8 & 6; + return \pack('C', $src); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64UrlSafe.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64UrlSafe.php new file mode 100644 index 0000000..b939fd1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Base64UrlSafe.php @@ -0,0 +1,82 @@ + 0x40 && $src < 0x5b) $ret += $src - 0x41 + 1; // -64 + $ret += (0x40 - $src & $src - 0x5b) >> 8 & $src - 64; + // if ($src > 0x60 && $src < 0x7b) $ret += $src - 0x61 + 26 + 1; // -70 + $ret += (0x60 - $src & $src - 0x7b) >> 8 & $src - 70; + // if ($src > 0x2f && $src < 0x3a) $ret += $src - 0x30 + 52 + 1; // 5 + $ret += (0x2f - $src & $src - 0x3a) >> 8 & $src + 5; + // if ($src == 0x2c) $ret += 62 + 1; + $ret += (0x2c - $src & $src - 0x2e) >> 8 & 63; + // if ($src == 0x5f) ret += 63 + 1; + $ret += (0x5e - $src & $src - 0x60) >> 8 & 64; + return $ret; + } + /** + * Uses bitwise operators instead of table-lookups to turn 8-bit integers + * into 6-bit integers. + * + * @param int $src + * @return string + */ + protected static function encode6Bits(int $src) : string + { + $diff = 0x41; + // if ($src > 25) $diff += 0x61 - 0x41 - 26; // 6 + $diff += 25 - $src >> 8 & 6; + // if ($src > 51) $diff += 0x30 - 0x61 - 26; // -75 + $diff -= 51 - $src >> 8 & 75; + // if ($src > 61) $diff += 0x2d - 0x30 - 10; // -13 + $diff -= 61 - $src >> 8 & 13; + // if ($src > 62) $diff += 0x5f - 0x2b - 1; // 3 + $diff += 62 - $src >> 8 & 49; + return \pack('C', $src + $diff); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Binary.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Binary.php new file mode 100644 index 0000000..64a6c22 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/Binary.php @@ -0,0 +1,85 @@ + $chunk */ + $chunk = \unpack('C', $binString[$i]); + $c = $chunk[1] & 0xf; + $b = $chunk[1] >> 4; + $hex .= \pack('CC', 87 + $b + ($b - 10 >> 8 & ~38), 87 + $c + ($c - 10 >> 8 & ~38)); + } + return $hex; + } + /** + * Convert a binary string into a hexadecimal string without cache-timing + * leaks, returning uppercase letters (as per RFC 4648) + * + * @param string $binString (raw binary) + * @return string + * @throws TypeError + */ + public static function encodeUpper(string $binString) : string + { + $hex = ''; + $len = Binary::safeStrlen($binString); + for ($i = 0; $i < $len; ++$i) { + /** @var array $chunk */ + $chunk = \unpack('C', $binString[$i]); + $c = $chunk[1] & 0xf; + $b = $chunk[1] >> 4; + $hex .= \pack('CC', 55 + $b + ($b - 10 >> 8 & ~6), 55 + $c + ($c - 10 >> 8 & ~6)); + } + return $hex; + } + /** + * Convert a hexadecimal string into a binary string without cache-timing + * leaks + * + * @param string $encodedString + * @param bool $strictPadding + * @return string (raw binary) + * @throws RangeException + */ + public static function decode(string $encodedString, bool $strictPadding = \false) : string + { + $hex_pos = 0; + $bin = ''; + $c_acc = 0; + $hex_len = Binary::safeStrlen($encodedString); + $state = 0; + if (($hex_len & 1) !== 0) { + if ($strictPadding) { + throw new RangeException('Expected an even number of hexadecimal characters'); + } else { + $encodedString = '0' . $encodedString; + ++$hex_len; + } + } + /** @var array $chunk */ + $chunk = \unpack('C*', $encodedString); + while ($hex_pos < $hex_len) { + ++$hex_pos; + $c = $chunk[$hex_pos]; + $c_num = $c ^ 48; + $c_num0 = $c_num - 10 >> 8; + $c_alpha = ($c & ~32) - 55; + $c_alpha0 = ($c_alpha - 10 ^ $c_alpha - 16) >> 8; + if (($c_num0 | $c_alpha0) === 0) { + throw new RangeException('Expected hexadecimal character'); + } + $c_val = $c_num0 & $c_num | $c_alpha & $c_alpha0; + if ($state === 0) { + $c_acc = $c_val * 16; + } else { + $bin .= \pack('C', $c_acc | $c_val); + } + $state ^= 1; + } + return $bin; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/RFC4648.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/RFC4648.php new file mode 100644 index 0000000..9787155 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/constant_time_encoding/src/RFC4648.php @@ -0,0 +1,176 @@ + "Zm9v" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base64Encode(string $str) : string + { + return Base64::encode($str); + } + /** + * RFC 4648 Base64 decoding + * + * "Zm9v" -> "foo" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base64Decode(string $str) : string + { + return Base64::decode($str, \true); + } + /** + * RFC 4648 Base64 (URL Safe) encoding + * + * "foo" -> "Zm9v" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base64UrlSafeEncode(string $str) : string + { + return Base64UrlSafe::encode($str); + } + /** + * RFC 4648 Base64 (URL Safe) decoding + * + * "Zm9v" -> "foo" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base64UrlSafeDecode(string $str) : string + { + return Base64UrlSafe::decode($str, \true); + } + /** + * RFC 4648 Base32 encoding + * + * "foo" -> "MZXW6===" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base32Encode(string $str) : string + { + return Base32::encodeUpper($str); + } + /** + * RFC 4648 Base32 encoding + * + * "MZXW6===" -> "foo" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base32Decode(string $str) : string + { + return Base32::decodeUpper($str, \true); + } + /** + * RFC 4648 Base32-Hex encoding + * + * "foo" -> "CPNMU===" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base32HexEncode(string $str) : string + { + return Base32::encodeUpper($str); + } + /** + * RFC 4648 Base32-Hex decoding + * + * "CPNMU===" -> "foo" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base32HexDecode(string $str) : string + { + return Base32::decodeUpper($str, \true); + } + /** + * RFC 4648 Base16 decoding + * + * "foo" -> "666F6F" + * + * @param string $str + * @return string + * + * @throws TypeError + */ + public static function base16Encode(string $str) : string + { + return Hex::encodeUpper($str); + } + /** + * RFC 4648 Base16 decoding + * + * "666F6F" -> "foo" + * + * @param string $str + * @return string + */ + public static function base16Decode(string $str) : string + { + return Hex::decode($str, \true); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/LICENSE new file mode 100644 index 0000000..45c7017 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Paragon Initiative Enterprises + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/build-phar.sh b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/build-phar.sh new file mode 100644 index 0000000..b4a5ba3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/build-phar.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +basedir=$( dirname $( readlink -f ${BASH_SOURCE[0]} ) ) + +php -dphar.readonly=0 "$basedir/other/build_phar.php" $* \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/dist/random_compat.phar.pubkey b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/dist/random_compat.phar.pubkey new file mode 100644 index 0000000..eb50ebf --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/dist/random_compat.phar.pubkey @@ -0,0 +1,5 @@ +-----BEGIN PUBLIC KEY----- +MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEEd+wCqJDrx5B4OldM0dQE0ZMX+lx1ZWm +pui0SUqD4G29L3NGsz9UhJ/0HjBdbnkhIK5xviT0X5vtjacF6ajgcCArbTB+ds+p ++h7Q084NuSuIpNb6YPfoUFgC/CL9kAoc +-----END PUBLIC KEY----- diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/dist/random_compat.phar.pubkey.asc b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/dist/random_compat.phar.pubkey.asc new file mode 100644 index 0000000..6a1d7f3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/dist/random_compat.phar.pubkey.asc @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (MingW32) + +iQEcBAABAgAGBQJWtW1hAAoJEGuXocKCZATaJf0H+wbZGgskK1dcRTsuVJl9IWip +QwGw/qIKI280SD6/ckoUMxKDCJiFuPR14zmqnS36k7N5UNPnpdTJTS8T11jttSpg +1LCmgpbEIpgaTah+cELDqFCav99fS+bEiAL5lWDAHBTE/XPjGVCqeehyPYref4IW +NDBIEsvnHPHPLsn6X5jq4+Yj5oUixgxaMPiR+bcO4Sh+RzOVB6i2D0upWfRXBFXA +NNnsg9/zjvoC7ZW73y9uSH+dPJTt/Vgfeiv52/v41XliyzbUyLalf02GNPY+9goV +JHG1ulEEBJOCiUD9cE1PUIJwHA/HqyhHIvV350YoEFiHl8iSwm7SiZu5kPjaq74= +=B6+8 +-----END PGP SIGNATURE----- diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/lib/random.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/lib/random.php new file mode 100644 index 0000000..b58ba3b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/lib/random.php @@ -0,0 +1,34 @@ +buildFromDirectory(\dirname(__DIR__) . '/lib'); +\rename(\dirname(__DIR__) . '/lib/index.php', \dirname(__DIR__) . '/lib/random.php'); +/** + * If we pass an (optional) path to a private key as a second argument, we will + * sign the Phar with OpenSSL. + * + * If you leave this out, it will produce an unsigned .phar! + */ +if ($argc > 1) { + if (!@\is_readable($argv[1])) { + echo 'Could not read the private key file:', $argv[1], "\n"; + exit(255); + } + $pkeyFile = \file_get_contents($argv[1]); + $private = \openssl_get_privatekey($pkeyFile); + if ($private !== \false) { + $pkey = ''; + \openssl_pkey_export($private, $pkey); + $phar->setSignatureAlgorithm(\Phar::OPENSSL, $pkey); + /** + * Save the corresponding public key to the file + */ + if (!@\is_readable($dist . '/random_compat.phar.pubkey')) { + $details = \openssl_pkey_get_details($private); + \file_put_contents($dist . '/random_compat.phar.pubkey', $details['key']); + } + } else { + echo 'An error occurred reading the private key from OpenSSL.', "\n"; + exit(255); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/psalm-autoload.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/psalm-autoload.php new file mode 100644 index 0000000..86fba44 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/paragonie/random_compat/psalm-autoload.php @@ -0,0 +1,10 @@ + + + + + + + + + + + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/AUTHORS b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/AUTHORS new file mode 100644 index 0000000..9f10d26 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/AUTHORS @@ -0,0 +1,7 @@ +phpseclib Lead Developer: TerraFrost (Jim Wigginton) + +phpseclib Developers: monnerat (Patrick Monnerat) + bantu (Andreas Fischer) + petrich (Hans-Jürgen Petrich) + GrahamCampbell (Graham Campbell) + hc-jworman \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/LICENSE new file mode 100644 index 0000000..e7214eb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2011-2019 TerraFrost and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php new file mode 100644 index 0000000..cc7ca4f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php @@ -0,0 +1,454 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\ParagonIE\ConstantTime\Base64; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\ParagonIE\ConstantTime\Base64UrlSafe; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\ParagonIE\ConstantTime\Hex; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField; +/** + * Common String Functions + * + * @author Jim Wigginton + */ +abstract class Strings +{ + /** + * String Shift + * + * Inspired by array_shift + * + * @param string $string + * @param int $index + * @return string + */ + public static function shift(&$string, $index = 1) + { + $substr = substr($string, 0, $index); + $string = substr($string, $index); + return $substr; + } + /** + * String Pop + * + * Inspired by array_pop + * + * @param string $string + * @param int $index + * @return string + */ + public static function pop(&$string, $index = 1) + { + $substr = substr($string, -$index); + $string = substr($string, 0, -$index); + return $substr; + } + /** + * Parse SSH2-style string + * + * Returns either an array or a boolean if $data is malformed. + * + * Valid characters for $format are as follows: + * + * C = byte + * b = boolean (true/false) + * N = uint32 + * Q = uint64 + * s = string + * i = mpint + * L = name-list + * + * uint64 is not supported. + * + * @param string $format + * @param string $data + * @return mixed + */ + public static function unpackSSH2($format, &$data) + { + $format = self::formatPack($format); + $result = []; + for ($i = 0; $i < strlen($format); $i++) { + switch ($format[$i]) { + case 'C': + case 'b': + if (!strlen($data)) { + throw new \LengthException('At least one byte needs to be present for successful C / b decodes'); + } + break; + case 'N': + case 'i': + case 's': + case 'L': + if (strlen($data) < 4) { + throw new \LengthException('At least four byte needs to be present for successful N / i / s / L decodes'); + } + break; + case 'Q': + if (strlen($data) < 8) { + throw new \LengthException('At least eight byte needs to be present for successful N / i / s / L decodes'); + } + break; + default: + throw new \InvalidArgumentException('$format contains an invalid character'); + } + switch ($format[$i]) { + case 'C': + $result[] = ord(self::shift($data)); + continue 2; + case 'b': + $result[] = ord(self::shift($data)) != 0; + continue 2; + case 'N': + list(, $temp) = unpack('N', self::shift($data, 4)); + $result[] = $temp; + continue 2; + case 'Q': + // pack() added support for Q in PHP 5.6.3 and PHP 5.6 is phpseclib 3's minimum version + // so in theory we could support this BUT, "64-bit format codes are not available for + // 32-bit versions" and phpseclib works on 32-bit installs. on 32-bit installs + // 64-bit floats can be used to get larger numbers then 32-bit signed ints would allow + // for. sure, you're not gonna get the full precision of 64-bit numbers but just because + // you need > 32-bit precision doesn't mean you need the full 64-bit precision + extract(unpack('Nupper/Nlower', self::shift($data, 8))); + $temp = $upper ? 4294967296 * $upper : 0; + $temp += $lower < 0 ? ($lower & 0x7ffffffff) + 0x80000000 : $lower; + // $temp = hexdec(bin2hex(self::shift($data, 8))); + $result[] = $temp; + continue 2; + } + list(, $length) = unpack('N', self::shift($data, 4)); + if (strlen($data) < $length) { + throw new \LengthException("{$length} bytes needed; " . strlen($data) . ' bytes available'); + } + $temp = self::shift($data, $length); + switch ($format[$i]) { + case 'i': + $result[] = new BigInteger($temp, -256); + break; + case 's': + $result[] = $temp; + break; + case 'L': + $result[] = explode(',', $temp); + } + } + return $result; + } + /** + * Create SSH2-style string + * + * @param string $format + * @param string|int|float|array|bool ...$elements + * @return string + */ + public static function packSSH2($format, ...$elements) + { + $format = self::formatPack($format); + if (strlen($format) != count($elements)) { + throw new \InvalidArgumentException('There must be as many arguments as there are characters in the $format string'); + } + $result = ''; + for ($i = 0; $i < strlen($format); $i++) { + $element = $elements[$i]; + switch ($format[$i]) { + case 'C': + if (!is_int($element)) { + throw new \InvalidArgumentException('Bytes must be represented as an integer between 0 and 255, inclusive.'); + } + $result .= pack('C', $element); + break; + case 'b': + if (!is_bool($element)) { + throw new \InvalidArgumentException('A boolean parameter was expected.'); + } + $result .= $element ? "\x01" : "\x00"; + break; + case 'Q': + if (!is_int($element) && !is_float($element)) { + throw new \InvalidArgumentException('An integer was expected.'); + } + // 4294967296 == 1 << 32 + $result .= pack('NN', $element / 4294967296, $element); + break; + case 'N': + if (is_float($element)) { + $element = (int) $element; + } + if (!is_int($element)) { + throw new \InvalidArgumentException('An integer was expected.'); + } + $result .= pack('N', $element); + break; + case 's': + if (!self::is_stringable($element)) { + throw new \InvalidArgumentException('A string was expected.'); + } + $result .= pack('Na*', strlen($element), $element); + break; + case 'i': + if (!$element instanceof BigInteger && !$element instanceof FiniteField\Integer) { + throw new \InvalidArgumentException('A phpseclib3\\Math\\BigInteger or phpseclib3\\Math\\Common\\FiniteField\\Integer object was expected.'); + } + $element = $element->toBytes(\true); + $result .= pack('Na*', strlen($element), $element); + break; + case 'L': + if (!is_array($element)) { + throw new \InvalidArgumentException('An array was expected.'); + } + $element = implode(',', $element); + $result .= pack('Na*', strlen($element), $element); + break; + default: + throw new \InvalidArgumentException('$format contains an invalid character'); + } + } + return $result; + } + /** + * Expand a pack string + * + * Converts C5 to CCCCC, for example. + * + * @param string $format + * @return string + */ + private static function formatPack($format) + { + $parts = preg_split('#(\\d+)#', $format, -1, \PREG_SPLIT_DELIM_CAPTURE); + $format = ''; + for ($i = 1; $i < count($parts); $i += 2) { + $format .= substr($parts[$i - 1], 0, -1) . str_repeat(substr($parts[$i - 1], -1), $parts[$i]); + } + $format .= $parts[$i - 1]; + return $format; + } + /** + * Convert binary data into bits + * + * bin2hex / hex2bin refer to base-256 encoded data as binary, whilst + * decbin / bindec refer to base-2 encoded data as binary. For the purposes + * of this function, bin refers to base-256 encoded data whilst bits refers + * to base-2 encoded data + * + * @param string $x + * @return string + */ + public static function bits2bin($x) + { + /* + // the pure-PHP approach is faster than the GMP approach + if (function_exists('gmp_export')) { + return strlen($x) ? gmp_export(gmp_init($x, 2)) : gmp_init(0); + } + */ + if (preg_match('#[^01]#', $x)) { + throw new \RuntimeException('The only valid characters are 0 and 1'); + } + if (!defined('PHP_INT_MIN')) { + define('PHP_INT_MIN', ~\PHP_INT_MAX); + } + $length = strlen($x); + if (!$length) { + return ''; + } + $block_size = \PHP_INT_SIZE << 3; + $pad = $block_size - $length % $block_size; + if ($pad != $block_size) { + $x = str_repeat('0', $pad) . $x; + } + $parts = str_split($x, $block_size); + $str = ''; + foreach ($parts as $part) { + $xor = $part[0] == '1' ? \PHP_INT_MIN : 0; + $part[0] = '0'; + $str .= pack(\PHP_INT_SIZE == 4 ? 'N' : 'J', $xor ^ eval('return 0b' . $part . ';')); + } + return ltrim($str, "\x00"); + } + /** + * Convert bits to binary data + * + * @param string $x + * @return string + */ + public static function bin2bits($x, $trim = \true) + { + /* + // the pure-PHP approach is slower than the GMP approach BUT + // i want to the pure-PHP version to be easily unit tested as well + if (function_exists('gmp_import')) { + return gmp_strval(gmp_import($x), 2); + } + */ + $len = strlen($x); + $mod = $len % \PHP_INT_SIZE; + if ($mod) { + $x = str_pad($x, $len + \PHP_INT_SIZE - $mod, "\x00", \STR_PAD_LEFT); + } + $bits = ''; + if (\PHP_INT_SIZE == 4) { + $digits = unpack('N*', $x); + foreach ($digits as $digit) { + $bits .= sprintf('%032b', $digit); + } + } else { + $digits = unpack('J*', $x); + foreach ($digits as $digit) { + $bits .= sprintf('%064b', $digit); + } + } + return $trim ? ltrim($bits, '0') : $bits; + } + /** + * Switch Endianness Bit Order + * + * @param string $x + * @return string + */ + public static function switchEndianness($x) + { + $r = ''; + for ($i = strlen($x) - 1; $i >= 0; $i--) { + $b = ord($x[$i]); + if (\PHP_INT_SIZE === 8) { + // 3 operations + // from http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith64BitsDiv + $r .= chr(($b * 0x202020202 & 0x10884422010) % 1023); + } else { + // 7 operations + // from http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits + $p1 = $b * 0x802 & 0x22110; + $p2 = $b * 0x8020 & 0x88440; + $r .= chr(($p1 | $p2) * 0x10101 >> 16); + } + } + return $r; + } + /** + * Increment the current string + * + * @param string $var + * @return string + */ + public static function increment_str(&$var) + { + if (function_exists('sodium_increment')) { + $var = strrev($var); + sodium_increment($var); + $var = strrev($var); + return $var; + } + for ($i = 4; $i <= strlen($var); $i += 4) { + $temp = substr($var, -$i, 4); + switch ($temp) { + case "\xff\xff\xff\xff": + $var = substr_replace($var, "\x00\x00\x00\x00", -$i, 4); + break; + case "\xff\xff\xff": + $var = substr_replace($var, "\x80\x00\x00\x00", -$i, 4); + return $var; + default: + $temp = unpack('Nnum', $temp); + $var = substr_replace($var, pack('N', $temp['num'] + 1), -$i, 4); + return $var; + } + } + $remainder = strlen($var) % 4; + if ($remainder == 0) { + return $var; + } + $temp = unpack('Nnum', str_pad(substr($var, 0, $remainder), 4, "\x00", \STR_PAD_LEFT)); + $temp = substr(pack('N', $temp['num'] + 1), -$remainder); + $var = substr_replace($var, $temp, 0, $remainder); + return $var; + } + /** + * Find whether the type of a variable is string (or could be converted to one) + * + * @param mixed $var + * @return bool + * @psalm-assert-if-true string|\Stringable $var + */ + public static function is_stringable($var) + { + return is_string($var) || is_object($var) && method_exists($var, '__toString'); + } + /** + * Constant Time Base64-decoding + * + * ParagoneIE\ConstantTime doesn't use libsodium if it's available so we'll do so + * ourselves. see https://github.com/paragonie/constant_time_encoding/issues/39 + * + * @param string $data + * @return string + */ + public static function base64_decode($data) + { + return function_exists('sodium_base642bin') ? sodium_base642bin($data, \SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING, '=') : Base64::decode($data); + } + /** + * Constant Time Base64-decoding (URL safe) + * + * @param string $data + * @return string + */ + public static function base64url_decode($data) + { + // return self::base64_decode(str_replace(['-', '_'], ['+', '/'], $data)); + return function_exists('sodium_base642bin') ? sodium_base642bin($data, \SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING, '=') : Base64UrlSafe::decode($data); + } + /** + * Constant Time Base64-encoding + * + * @param string $data + * @return string + */ + public static function base64_encode($data) + { + return function_exists('sodium_bin2base64') ? sodium_bin2base64($data, \SODIUM_BASE64_VARIANT_ORIGINAL) : Base64::encode($data); + } + /** + * Constant Time Base64-encoding (URL safe) + * + * @param string $data + * @return string + */ + public static function base64url_encode($data) + { + // return str_replace(['+', '/'], ['-', '_'], self::base64_encode($data)); + return function_exists('sodium_bin2base64') ? sodium_bin2base64($data, \SODIUM_BASE64_VARIANT_URLSAFE) : Base64UrlSafe::encode($data); + } + /** + * Constant Time Hex Decoder + * + * @param string $data + * @return string + */ + public static function hex2bin($data) + { + return function_exists('sodium_hex2bin') ? sodium_hex2bin($data) : Hex::decode($data); + } + /** + * Constant Time Hex Encoder + * + * @param string $data + * @return string + */ + public static function bin2hex($data) + { + return function_exists('sodium_bin2hex') ? sodium_bin2hex($data) : Hex::encode($data); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/AES.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/AES.php new file mode 100644 index 0000000..82f852e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/AES.php @@ -0,0 +1,112 @@ + + * setKey('abcdefghijklmnop'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $aes->decrypt($aes->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2008 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +/** + * Pure-PHP implementation of AES. + * + * @author Jim Wigginton + */ +class AES extends Rijndael +{ + /** + * Dummy function + * + * Since \phpseclib3\Crypt\AES extends \phpseclib3\Crypt\Rijndael, this function is, technically, available, but it doesn't do anything. + * + * @see \phpseclib3\Crypt\Rijndael::setBlockLength() + * @param int $length + * @throws \BadMethodCallException anytime it's called + */ + public function setBlockLength($length) + { + throw new \BadMethodCallException('The block length cannot be set for AES.'); + } + /** + * Sets the key length + * + * Valid key lengths are 128, 192, and 256. Set the link to bool(false) to disable a fixed key length + * + * @see \phpseclib3\Crypt\Rijndael:setKeyLength() + * @param int $length + * @throws \LengthException if the key length isn't supported + */ + public function setKeyLength($length) + { + switch ($length) { + case 128: + case 192: + case 256: + break; + default: + throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 128, 192 or 256 supported'); + } + parent::setKeyLength($length); + } + /** + * Sets the key. + * + * Rijndael supports five different key lengths, AES only supports three. + * + * @see \phpseclib3\Crypt\Rijndael:setKey() + * @see setKeyLength() + * @param string $key + * @throws \LengthException if the key length isn't supported + */ + public function setKey($key) + { + switch (strlen($key)) { + case 16: + case 24: + case 32: + break; + default: + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); + } + parent::setKey($key); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php new file mode 100644 index 0000000..1befd35 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php @@ -0,0 +1,660 @@ + unpack('N*', $x), $blocks); it jumps up by an additional + * ~90MB, yielding a 106x increase in memory usage. Consequently, it bcrypt calls a different + * _encryptBlock() then the regular Blowfish does. That said, the Blowfish _encryptBlock() is + * basically just a thin wrapper around the bcrypt _encryptBlock(), so there's that. + * + * This explains 3 of the 4 _encryptBlock() implementations. the last _encryptBlock() + * implementation can best be understood by doing Ctrl + F and searching for where + * self::$use_reg_intval is defined. + * + * # phpseclib's three different _setupKey() implementations + * + * Every bcrypt round is the equivalent of encrypting 512KB of data. Since OpenSSH uses 16 + * rounds by default that's ~8MB of data that's essentially being encrypted whenever + * you use bcrypt. That's a lot of data, however, bcrypt operates within tighter constraints + * than regular Blowfish, so we can use that to our advantage. In particular, whereas Blowfish + * supports variable length keys, in bcrypt, the initial "key" is the sha512 hash of the + * password. sha512 hashes are 512 bits or 64 bytes long and thus the bcrypt keys are of a + * fixed length whereas Blowfish keys are not of a fixed length. + * + * bcrypt actually has two different key expansion steps. The first one (expandstate) is + * constantly XOR'ing every _encryptBlock() parameter against the salt prior _encryptBlock()'s + * being called. The second one (expand0state) is more similar to Blowfish's _setupKey() + * but it can still use the fixed length key optimization discussed above and can do away with + * the pack() / unpack() calls. + * + * I suppose _setupKey() could be made to be a thin wrapper around expandstate() but idk it's + * just a lot of work for very marginal benefits as _setupKey() is only called once for + * regular Blowfish vs the 128 times it's called --per round-- with bcrypt. + * + * # blowfish + bcrypt in the same class + * + * Altho there's a lot of Blowfish code that bcrypt doesn't re-use, bcrypt does re-use the + * initial S-boxes, the initial P-array and the int-only _encryptBlock() implementation. + * + * # Credit + * + * phpseclib's bcrypt implementation is based losely off of OpenSSH's implementation: + * + * https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/bcrypt_pbkdf.c + * + * Here's a short example of how to use this library: + * + * setKey('12345678901234567890123456789012'); + * + * $plaintext = str_repeat('a', 1024); + * + * echo $blowfish->decrypt($blowfish->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @author Hans-Juergen Petrich + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\BlockCipher; +/** + * Pure-PHP implementation of Blowfish. + * + * @author Jim Wigginton + * @author Hans-Juergen Petrich + */ +class Blowfish extends BlockCipher +{ + /** + * Block Length of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @var int + */ + protected $block_size = 8; + /** + * The mcrypt specific name of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @var string + */ + protected $cipher_name_mcrypt = 'blowfish'; + /** + * Optimizing value while CFB-encrypting + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @var int + */ + protected $cfb_init_len = 500; + /** + * The fixed subkeys boxes ($sbox0 - $sbox3) with 256 entries each + * + * S-Box 0 + * + * @var array + */ + private static $sbox0 = [0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7, 0xb8e1afed, 0x6a267e96, 0xba7c9045, 0xf12c7f99, 0x24a19947, 0xb3916cf7, 0x801f2e2, 0x858efc16, 0x636920d8, 0x71574e69, 0xa458fea3, 0xf4933d7e, 0xd95748f, 0x728eb658, 0x718bcd58, 0x82154aee, 0x7b54a41d, 0xc25a59b5, 0x9c30d539, 0x2af26013, 0xc5d1b023, 0x286085f0, 0xca417918, 0xb8db38ef, 0x8e79dcb0, 0x603a180e, 0x6c9e0e8b, 0xb01e8a3e, 0xd71577c1, 0xbd314b27, 0x78af2fda, 0x55605c60, 0xe65525f3, 0xaa55ab94, 0x57489862, 0x63e81440, 0x55ca396a, 0x2aab10b6, 0xb4cc5c34, 0x1141e8ce, 0xa15486af, 0x7c72e993, 0xb3ee1411, 0x636fbc2a, 0x2ba9c55d, 0x741831f6, 0xce5c3e16, 0x9b87931e, 0xafd6ba33, 0x6c24cf5c, 0x7a325381, 0x28958677, 0x3b8f4898, 0x6b4bb9af, 0xc4bfe81b, 0x66282193, 0x61d809cc, 0xfb21a991, 0x487cac60, 0x5dec8032, 0xef845d5d, 0xe98575b1, 0xdc262302, 0xeb651b88, 0x23893e81, 0xd396acc5, 0xf6d6ff3, 0x83f44239, 0x2e0b4482, 0xa4842004, 0x69c8f04a, 0x9e1f9b5e, 0x21c66842, 0xf6e96c9a, 0x670c9c61, 0xabd388f0, 0x6a51a0d2, 0xd8542f68, 0x960fa728, 0xab5133a3, 0x6eef0b6c, 0x137a3be4, 0xba3bf050, 0x7efb2a98, 0xa1f1651d, 0x39af0176, 0x66ca593e, 0x82430e88, 0x8cee8619, 0x456f9fb4, 0x7d84a5c3, 0x3b8b5ebe, 0xe06f75d8, 0x85c12073, 0x401a449f, 0x56c16aa6, 0x4ed3aa62, 0x363f7706, 0x1bfedf72, 0x429b023d, 0x37d0d724, 0xd00a1248, 0xdb0fead3, 0x49f1c09b, 0x75372c9, 0x80991b7b, 0x25d479d8, 0xf6e8def7, 0xe3fe501a, 0xb6794c3b, 0x976ce0bd, 0x4c006ba, 0xc1a94fb6, 0x409f60c4, 0x5e5c9ec2, 0x196a2463, 0x68fb6faf, 0x3e6c53b5, 0x1339b2eb, 0x3b52ec6f, 0x6dfc511f, 0x9b30952c, 0xcc814544, 0xaf5ebd09, 0xbee3d004, 0xde334afd, 0x660f2807, 0x192e4bb3, 0xc0cba857, 0x45c8740f, 0xd20b5f39, 0xb9d3fbdb, 0x5579c0bd, 0x1a60320a, 0xd6a100c6, 0x402c7279, 0x679f25fe, 0xfb1fa3cc, 0x8ea5e9f8, 0xdb3222f8, 0x3c7516df, 0xfd616b15, 0x2f501ec8, 0xad0552ab, 0x323db5fa, 0xfd238760, 0x53317b48, 0x3e00df82, 0x9e5c57bb, 0xca6f8ca0, 0x1a87562e, 0xdf1769db, 0xd542a8f6, 0x287effc3, 0xac6732c6, 0x8c4f5573, 0x695b27b0, 0xbbca58c8, 0xe1ffa35d, 0xb8f011a0, 0x10fa3d98, 0xfd2183b8, 0x4afcb56c, 0x2dd1d35b, 0x9a53e479, 0xb6f84565, 0xd28e49bc, 0x4bfb9790, 0xe1ddf2da, 0xa4cb7e33, 0x62fb1341, 0xcee4c6e8, 0xef20cada, 0x36774c01, 0xd07e9efe, 0x2bf11fb4, 0x95dbda4d, 0xae909198, 0xeaad8e71, 0x6b93d5a0, 0xd08ed1d0, 0xafc725e0, 0x8e3c5b2f, 0x8e7594b7, 0x8ff6e2fb, 0xf2122b64, 0x8888b812, 0x900df01c, 0x4fad5ea0, 0x688fc31c, 0xd1cff191, 0xb3a8c1ad, 0x2f2f2218, 0xbe0e1777, 0xea752dfe, 0x8b021fa1, 0xe5a0cc0f, 0xb56f74e8, 0x18acf3d6, 0xce89e299, 0xb4a84fe0, 0xfd13e0b7, 0x7cc43b81, 0xd2ada8d9, 0x165fa266, 0x80957705, 0x93cc7314, 0x211a1477, 0xe6ad2065, 0x77b5fa86, 0xc75442f5, 0xfb9d35cf, 0xebcdaf0c, 0x7b3e89a0, 0xd6411bd3, 0xae1e7e49, 0x250e2d, 0x2071b35e, 0x226800bb, 0x57b8e0af, 0x2464369b, 0xf009b91e, 0x5563911d, 0x59dfa6aa, 0x78c14389, 0xd95a537f, 0x207d5ba2, 0x2e5b9c5, 0x83260376, 0x6295cfa9, 0x11c81968, 0x4e734a41, 0xb3472dca, 0x7b14a94a, 0x1b510052, 0x9a532915, 0xd60f573f, 0xbc9bc6e4, 0x2b60a476, 0x81e67400, 0x8ba6fb5, 0x571be91f, 0xf296ec6b, 0x2a0dd915, 0xb6636521, 0xe7b9f9b6, 0xff34052e, 0xc5855664, 0x53b02d5d, 0xa99f8fa1, 0x8ba4799, 0x6e85076a]; + /** + * S-Box 1 + * + * @var array + */ + private static $sbox1 = [0x4b7a70e9, 0xb5b32944, 0xdb75092e, 0xc4192623, 0xad6ea6b0, 0x49a7df7d, 0x9cee60b8, 0x8fedb266, 0xecaa8c71, 0x699a17ff, 0x5664526c, 0xc2b19ee1, 0x193602a5, 0x75094c29, 0xa0591340, 0xe4183a3e, 0x3f54989a, 0x5b429d65, 0x6b8fe4d6, 0x99f73fd6, 0xa1d29c07, 0xefe830f5, 0x4d2d38e6, 0xf0255dc1, 0x4cdd2086, 0x8470eb26, 0x6382e9c6, 0x21ecc5e, 0x9686b3f, 0x3ebaefc9, 0x3c971814, 0x6b6a70a1, 0x687f3584, 0x52a0e286, 0xb79c5305, 0xaa500737, 0x3e07841c, 0x7fdeae5c, 0x8e7d44ec, 0x5716f2b8, 0xb03ada37, 0xf0500c0d, 0xf01c1f04, 0x200b3ff, 0xae0cf51a, 0x3cb574b2, 0x25837a58, 0xdc0921bd, 0xd19113f9, 0x7ca92ff6, 0x94324773, 0x22f54701, 0x3ae5e581, 0x37c2dadc, 0xc8b57634, 0x9af3dda7, 0xa9446146, 0xfd0030e, 0xecc8c73e, 0xa4751e41, 0xe238cd99, 0x3bea0e2f, 0x3280bba1, 0x183eb331, 0x4e548b38, 0x4f6db908, 0x6f420d03, 0xf60a04bf, 0x2cb81290, 0x24977c79, 0x5679b072, 0xbcaf89af, 0xde9a771f, 0xd9930810, 0xb38bae12, 0xdccf3f2e, 0x5512721f, 0x2e6b7124, 0x501adde6, 0x9f84cd87, 0x7a584718, 0x7408da17, 0xbc9f9abc, 0xe94b7d8c, 0xec7aec3a, 0xdb851dfa, 0x63094366, 0xc464c3d2, 0xef1c1847, 0x3215d908, 0xdd433b37, 0x24c2ba16, 0x12a14d43, 0x2a65c451, 0x50940002, 0x133ae4dd, 0x71dff89e, 0x10314e55, 0x81ac77d6, 0x5f11199b, 0x43556f1, 0xd7a3c76b, 0x3c11183b, 0x5924a509, 0xf28fe6ed, 0x97f1fbfa, 0x9ebabf2c, 0x1e153c6e, 0x86e34570, 0xeae96fb1, 0x860e5e0a, 0x5a3e2ab3, 0x771fe71c, 0x4e3d06fa, 0x2965dcb9, 0x99e71d0f, 0x803e89d6, 0x5266c825, 0x2e4cc978, 0x9c10b36a, 0xc6150eba, 0x94e2ea78, 0xa5fc3c53, 0x1e0a2df4, 0xf2f74ea7, 0x361d2b3d, 0x1939260f, 0x19c27960, 0x5223a708, 0xf71312b6, 0xebadfe6e, 0xeac31f66, 0xe3bc4595, 0xa67bc883, 0xb17f37d1, 0x18cff28, 0xc332ddef, 0xbe6c5aa5, 0x65582185, 0x68ab9802, 0xeecea50f, 0xdb2f953b, 0x2aef7dad, 0x5b6e2f84, 0x1521b628, 0x29076170, 0xecdd4775, 0x619f1510, 0x13cca830, 0xeb61bd96, 0x334fe1e, 0xaa0363cf, 0xb5735c90, 0x4c70a239, 0xd59e9e0b, 0xcbaade14, 0xeecc86bc, 0x60622ca7, 0x9cab5cab, 0xb2f3846e, 0x648b1eaf, 0x19bdf0ca, 0xa02369b9, 0x655abb50, 0x40685a32, 0x3c2ab4b3, 0x319ee9d5, 0xc021b8f7, 0x9b540b19, 0x875fa099, 0x95f7997e, 0x623d7da8, 0xf837889a, 0x97e32d77, 0x11ed935f, 0x16681281, 0xe358829, 0xc7e61fd6, 0x96dedfa1, 0x7858ba99, 0x57f584a5, 0x1b227263, 0x9b83c3ff, 0x1ac24696, 0xcdb30aeb, 0x532e3054, 0x8fd948e4, 0x6dbc3128, 0x58ebf2ef, 0x34c6ffea, 0xfe28ed61, 0xee7c3c73, 0x5d4a14d9, 0xe864b7e3, 0x42105d14, 0x203e13e0, 0x45eee2b6, 0xa3aaabea, 0xdb6c4f15, 0xfacb4fd0, 0xc742f442, 0xef6abbb5, 0x654f3b1d, 0x41cd2105, 0xd81e799e, 0x86854dc7, 0xe44b476a, 0x3d816250, 0xcf62a1f2, 0x5b8d2646, 0xfc8883a0, 0xc1c7b6a3, 0x7f1524c3, 0x69cb7492, 0x47848a0b, 0x5692b285, 0x95bbf00, 0xad19489d, 0x1462b174, 0x23820e00, 0x58428d2a, 0xc55f5ea, 0x1dadf43e, 0x233f7061, 0x3372f092, 0x8d937e41, 0xd65fecf1, 0x6c223bdb, 0x7cde3759, 0xcbee7460, 0x4085f2a7, 0xce77326e, 0xa6078084, 0x19f8509e, 0xe8efd855, 0x61d99735, 0xa969a7aa, 0xc50c06c2, 0x5a04abfc, 0x800bcadc, 0x9e447a2e, 0xc3453484, 0xfdd56705, 0xe1e9ec9, 0xdb73dbd3, 0x105588cd, 0x675fda79, 0xe3674340, 0xc5c43465, 0x713e38d8, 0x3d28f89e, 0xf16dff20, 0x153e21e7, 0x8fb03d4a, 0xe6e39f2b, 0xdb83adf7]; + /** + * S-Box 2 + * + * @var array + */ + private static $sbox2 = [0xe93d5a68, 0x948140f7, 0xf64c261c, 0x94692934, 0x411520f7, 0x7602d4f7, 0xbcf46b2e, 0xd4a20068, 0xd4082471, 0x3320f46a, 0x43b7d4b7, 0x500061af, 0x1e39f62e, 0x97244546, 0x14214f74, 0xbf8b8840, 0x4d95fc1d, 0x96b591af, 0x70f4ddd3, 0x66a02f45, 0xbfbc09ec, 0x3bd9785, 0x7fac6dd0, 0x31cb8504, 0x96eb27b3, 0x55fd3941, 0xda2547e6, 0xabca0a9a, 0x28507825, 0x530429f4, 0xa2c86da, 0xe9b66dfb, 0x68dc1462, 0xd7486900, 0x680ec0a4, 0x27a18dee, 0x4f3ffea2, 0xe887ad8c, 0xb58ce006, 0x7af4d6b6, 0xaace1e7c, 0xd3375fec, 0xce78a399, 0x406b2a42, 0x20fe9e35, 0xd9f385b9, 0xee39d7ab, 0x3b124e8b, 0x1dc9faf7, 0x4b6d1856, 0x26a36631, 0xeae397b2, 0x3a6efa74, 0xdd5b4332, 0x6841e7f7, 0xca7820fb, 0xfb0af54e, 0xd8feb397, 0x454056ac, 0xba489527, 0x55533a3a, 0x20838d87, 0xfe6ba9b7, 0xd096954b, 0x55a867bc, 0xa1159a58, 0xcca92963, 0x99e1db33, 0xa62a4a56, 0x3f3125f9, 0x5ef47e1c, 0x9029317c, 0xfdf8e802, 0x4272f70, 0x80bb155c, 0x5282ce3, 0x95c11548, 0xe4c66d22, 0x48c1133f, 0xc70f86dc, 0x7f9c9ee, 0x41041f0f, 0x404779a4, 0x5d886e17, 0x325f51eb, 0xd59bc0d1, 0xf2bcc18f, 0x41113564, 0x257b7834, 0x602a9c60, 0xdff8e8a3, 0x1f636c1b, 0xe12b4c2, 0x2e1329e, 0xaf664fd1, 0xcad18115, 0x6b2395e0, 0x333e92e1, 0x3b240b62, 0xeebeb922, 0x85b2a20e, 0xe6ba0d99, 0xde720c8c, 0x2da2f728, 0xd0127845, 0x95b794fd, 0x647d0862, 0xe7ccf5f0, 0x5449a36f, 0x877d48fa, 0xc39dfd27, 0xf33e8d1e, 0xa476341, 0x992eff74, 0x3a6f6eab, 0xf4f8fd37, 0xa812dc60, 0xa1ebddf8, 0x991be14c, 0xdb6e6b0d, 0xc67b5510, 0x6d672c37, 0x2765d43b, 0xdcd0e804, 0xf1290dc7, 0xcc00ffa3, 0xb5390f92, 0x690fed0b, 0x667b9ffb, 0xcedb7d9c, 0xa091cf0b, 0xd9155ea3, 0xbb132f88, 0x515bad24, 0x7b9479bf, 0x763bd6eb, 0x37392eb3, 0xcc115979, 0x8026e297, 0xf42e312d, 0x6842ada7, 0xc66a2b3b, 0x12754ccc, 0x782ef11c, 0x6a124237, 0xb79251e7, 0x6a1bbe6, 0x4bfb6350, 0x1a6b1018, 0x11caedfa, 0x3d25bdd8, 0xe2e1c3c9, 0x44421659, 0xa121386, 0xd90cec6e, 0xd5abea2a, 0x64af674e, 0xda86a85f, 0xbebfe988, 0x64e4c3fe, 0x9dbc8057, 0xf0f7c086, 0x60787bf8, 0x6003604d, 0xd1fd8346, 0xf6381fb0, 0x7745ae04, 0xd736fccc, 0x83426b33, 0xf01eab71, 0xb0804187, 0x3c005e5f, 0x77a057be, 0xbde8ae24, 0x55464299, 0xbf582e61, 0x4e58f48f, 0xf2ddfda2, 0xf474ef38, 0x8789bdc2, 0x5366f9c3, 0xc8b38e74, 0xb475f255, 0x46fcd9b9, 0x7aeb2661, 0x8b1ddf84, 0x846a0e79, 0x915f95e2, 0x466e598e, 0x20b45770, 0x8cd55591, 0xc902de4c, 0xb90bace1, 0xbb8205d0, 0x11a86248, 0x7574a99e, 0xb77f19b6, 0xe0a9dc09, 0x662d09a1, 0xc4324633, 0xe85a1f02, 0x9f0be8c, 0x4a99a025, 0x1d6efe10, 0x1ab93d1d, 0xba5a4df, 0xa186f20f, 0x2868f169, 0xdcb7da83, 0x573906fe, 0xa1e2ce9b, 0x4fcd7f52, 0x50115e01, 0xa70683fa, 0xa002b5c4, 0xde6d027, 0x9af88c27, 0x773f8641, 0xc3604c06, 0x61a806b5, 0xf0177a28, 0xc0f586e0, 0x6058aa, 0x30dc7d62, 0x11e69ed7, 0x2338ea63, 0x53c2dd94, 0xc2c21634, 0xbbcbee56, 0x90bcb6de, 0xebfc7da1, 0xce591d76, 0x6f05e409, 0x4b7c0188, 0x39720a3d, 0x7c927c24, 0x86e3725f, 0x724d9db9, 0x1ac15bb4, 0xd39eb8fc, 0xed545578, 0x8fca5b5, 0xd83d7cd3, 0x4dad0fc4, 0x1e50ef5e, 0xb161e6f8, 0xa28514d9, 0x6c51133c, 0x6fd5c7e7, 0x56e14ec4, 0x362abfce, 0xddc6c837, 0xd79a3234, 0x92638212, 0x670efa8e, 0x406000e0]; + /** + * S-Box 3 + * + * @var array + */ + private static $sbox3 = [0x3a39ce37, 0xd3faf5cf, 0xabc27737, 0x5ac52d1b, 0x5cb0679e, 0x4fa33742, 0xd3822740, 0x99bc9bbe, 0xd5118e9d, 0xbf0f7315, 0xd62d1c7e, 0xc700c47b, 0xb78c1b6b, 0x21a19045, 0xb26eb1be, 0x6a366eb4, 0x5748ab2f, 0xbc946e79, 0xc6a376d2, 0x6549c2c8, 0x530ff8ee, 0x468dde7d, 0xd5730a1d, 0x4cd04dc6, 0x2939bbdb, 0xa9ba4650, 0xac9526e8, 0xbe5ee304, 0xa1fad5f0, 0x6a2d519a, 0x63ef8ce2, 0x9a86ee22, 0xc089c2b8, 0x43242ef6, 0xa51e03aa, 0x9cf2d0a4, 0x83c061ba, 0x9be96a4d, 0x8fe51550, 0xba645bd6, 0x2826a2f9, 0xa73a3ae1, 0x4ba99586, 0xef5562e9, 0xc72fefd3, 0xf752f7da, 0x3f046f69, 0x77fa0a59, 0x80e4a915, 0x87b08601, 0x9b09e6ad, 0x3b3ee593, 0xe990fd5a, 0x9e34d797, 0x2cf0b7d9, 0x22b8b51, 0x96d5ac3a, 0x17da67d, 0xd1cf3ed6, 0x7c7d2d28, 0x1f9f25cf, 0xadf2b89b, 0x5ad6b472, 0x5a88f54c, 0xe029ac71, 0xe019a5e6, 0x47b0acfd, 0xed93fa9b, 0xe8d3c48d, 0x283b57cc, 0xf8d56629, 0x79132e28, 0x785f0191, 0xed756055, 0xf7960e44, 0xe3d35e8c, 0x15056dd4, 0x88f46dba, 0x3a16125, 0x564f0bd, 0xc3eb9e15, 0x3c9057a2, 0x97271aec, 0xa93a072a, 0x1b3f6d9b, 0x1e6321f5, 0xf59c66fb, 0x26dcf319, 0x7533d928, 0xb155fdf5, 0x3563482, 0x8aba3cbb, 0x28517711, 0xc20ad9f8, 0xabcc5167, 0xccad925f, 0x4de81751, 0x3830dc8e, 0x379d5862, 0x9320f991, 0xea7a90c2, 0xfb3e7bce, 0x5121ce64, 0x774fbe32, 0xa8b6e37e, 0xc3293d46, 0x48de5369, 0x6413e680, 0xa2ae0810, 0xdd6db224, 0x69852dfd, 0x9072166, 0xb39a460a, 0x6445c0dd, 0x586cdecf, 0x1c20c8ae, 0x5bbef7dd, 0x1b588d40, 0xccd2017f, 0x6bb4e3bb, 0xdda26a7e, 0x3a59ff45, 0x3e350a44, 0xbcb4cdd5, 0x72eacea8, 0xfa6484bb, 0x8d6612ae, 0xbf3c6f47, 0xd29be463, 0x542f5d9e, 0xaec2771b, 0xf64e6370, 0x740e0d8d, 0xe75b1357, 0xf8721671, 0xaf537d5d, 0x4040cb08, 0x4eb4e2cc, 0x34d2466a, 0x115af84, 0xe1b00428, 0x95983a1d, 0x6b89fb4, 0xce6ea048, 0x6f3f3b82, 0x3520ab82, 0x11a1d4b, 0x277227f8, 0x611560b1, 0xe7933fdc, 0xbb3a792b, 0x344525bd, 0xa08839e1, 0x51ce794b, 0x2f32c9b7, 0xa01fbac9, 0xe01cc87e, 0xbcc7d1f6, 0xcf0111c3, 0xa1e8aac7, 0x1a908749, 0xd44fbd9a, 0xd0dadecb, 0xd50ada38, 0x339c32a, 0xc6913667, 0x8df9317c, 0xe0b12b4f, 0xf79e59b7, 0x43f5bb3a, 0xf2d519ff, 0x27d9459c, 0xbf97222c, 0x15e6fc2a, 0xf91fc71, 0x9b941525, 0xfae59361, 0xceb69ceb, 0xc2a86459, 0x12baa8d1, 0xb6c1075e, 0xe3056a0c, 0x10d25065, 0xcb03a442, 0xe0ec6e0e, 0x1698db3b, 0x4c98a0be, 0x3278e964, 0x9f1f9532, 0xe0d392df, 0xd3a0342b, 0x8971f21e, 0x1b0a7441, 0x4ba3348c, 0xc5be7120, 0xc37632d8, 0xdf359f8d, 0x9b992f2e, 0xe60b6f47, 0xfe3f11d, 0xe54cda54, 0x1edad891, 0xce6279cf, 0xcd3e7e6f, 0x1618b166, 0xfd2c1d05, 0x848fd2c5, 0xf6fb2299, 0xf523f357, 0xa6327623, 0x93a83531, 0x56cccd02, 0xacf08162, 0x5a75ebb5, 0x6e163697, 0x88d273cc, 0xde966292, 0x81b949d0, 0x4c50901b, 0x71c65614, 0xe6c6c7bd, 0x327a140a, 0x45e1d006, 0xc3f27b9a, 0xc9aa53fd, 0x62a80f00, 0xbb25bfe2, 0x35bdd2f6, 0x71126905, 0xb2040222, 0xb6cbcf7c, 0xcd769c2b, 0x53113ec0, 0x1640e3d3, 0x38abbd60, 0x2547adf0, 0xba38209c, 0xf746ce76, 0x77afa1c5, 0x20756060, 0x85cbfe4e, 0x8ae88dd8, 0x7aaaf9b0, 0x4cf9aa7e, 0x1948c25c, 0x2fb8a8c, 0x1c36ae4, 0xd6ebe1f9, 0x90d4f869, 0xa65cdea0, 0x3f09252d, 0xc208e69f, 0xb74e6132, 0xce77e25b, 0x578fdfe3, 0x3ac372e6]; + /** + * P-Array consists of 18 32-bit subkeys + * + * @var array + */ + private static $parray = [0x243f6a88, 0x85a308d3, 0x13198a2e, 0x3707344, 0xa4093822, 0x299f31d0, 0x82efa98, 0xec4e6c89, 0x452821e6, 0x38d01377, 0xbe5466cf, 0x34e90c6c, 0xc0ac29b7, 0xc97c50dd, 0x3f84d5b5, 0xb5470917, 0x9216d5d9, 0x8979fb1b]; + /** + * The BCTX-working Array + * + * Holds the expanded key [p] and the key-depended s-boxes [sb] + * + * @var array + */ + private $bctx; + /** + * Holds the last used key + * + * @var array + */ + private $kl; + /** + * The Key Length (in bytes) + * {@internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk + * because the encryption / decryption / key schedule creation requires this number and not $key_length. We could + * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu + * of that, we'll just precompute it once.} + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKeyLength() + * @var int + */ + protected $key_length = 16; + /** + * Default Constructor. + * + * @param string $mode + * @throws \InvalidArgumentException if an invalid / unsupported mode is provided + */ + public function __construct($mode) + { + parent::__construct($mode); + if ($this->mode == self::MODE_STREAM) { + throw new \InvalidArgumentException('Block ciphers cannot be ran in stream mode'); + } + } + /** + * Sets the key length. + * + * Key lengths can be between 32 and 448 bits. + * + * @param int $length + */ + public function setKeyLength($length) + { + if ($length < 32 || $length > 448) { + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes between 32 and 448 bits are supported'); + } + $this->key_length = $length >> 3; + parent::setKeyLength($length); + } + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + if ($engine == self::ENGINE_OPENSSL) { + if ($this->key_length < 16) { + return \false; + } + // quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1 + // "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider" + // in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not + if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\\d+\\.\\d+\\.\\d+) .*#', '$1', \OPENSSL_VERSION_TEXT), '3.0.1', '>=')) { + return \false; + } + $this->cipher_name_openssl_ecb = 'bf-ecb'; + $this->cipher_name_openssl = 'bf-' . $this->openssl_translate_mode(); + } + return parent::isValidEngineHelper($engine); + } + /** + * Setup the key (expansion) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() + */ + protected function setupKey() + { + if (isset($this->kl['key']) && $this->key === $this->kl['key']) { + // already expanded + return; + } + $this->kl = ['key' => $this->key]; + /* key-expanding p[] and S-Box building sb[] */ + $this->bctx = ['p' => [], 'sb' => [self::$sbox0, self::$sbox1, self::$sbox2, self::$sbox3]]; + // unpack binary string in unsigned chars + $key = array_values(unpack('C*', $this->key)); + $keyl = count($key); + // with bcrypt $keyl will always be 16 (because the key is the sha512 of the key you provide) + for ($j = 0, $i = 0; $i < 18; ++$i) { + // xor P1 with the first 32-bits of the key, xor P2 with the second 32-bits ... + for ($data = 0, $k = 0; $k < 4; ++$k) { + $data = $data << 8 | $key[$j]; + if (++$j >= $keyl) { + $j = 0; + } + } + $this->bctx['p'][] = self::$parray[$i] ^ intval($data); + } + // encrypt the zero-string, replace P1 and P2 with the encrypted data, + // encrypt P3 and P4 with the new P1 and P2, do it with all P-array and subkeys + $data = "\x00\x00\x00\x00\x00\x00\x00\x00"; + for ($i = 0; $i < 18; $i += 2) { + list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data))); + $this->bctx['p'][$i] = $l; + $this->bctx['p'][$i + 1] = $r; + } + for ($i = 0; $i < 4; ++$i) { + for ($j = 0; $j < 256; $j += 2) { + list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data))); + $this->bctx['sb'][$i][$j] = $l; + $this->bctx['sb'][$i][$j + 1] = $r; + } + } + } + /** + * Initialize Static Variables + */ + protected static function initialize_static_variables() + { + if (is_float(self::$sbox2[0])) { + self::$sbox0 = array_map('intval', self::$sbox0); + self::$sbox1 = array_map('intval', self::$sbox1); + self::$sbox2 = array_map('intval', self::$sbox2); + self::$sbox3 = array_map('intval', self::$sbox3); + self::$parray = array_map('intval', self::$parray); + } + parent::initialize_static_variables(); + } + /** + * bcrypt + * + * @param string $sha2pass + * @param string $sha2salt + * @access private + * @return string + */ + private static function bcrypt_hash($sha2pass, $sha2salt) + { + $p = self::$parray; + $sbox0 = self::$sbox0; + $sbox1 = self::$sbox1; + $sbox2 = self::$sbox2; + $sbox3 = self::$sbox3; + $cdata = array_values(unpack('N*', 'OxychromaticBlowfishSwatDynamite')); + $sha2pass = array_values(unpack('N*', $sha2pass)); + $sha2salt = array_values(unpack('N*', $sha2salt)); + self::expandstate($sha2salt, $sha2pass, $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 0; $i < 64; $i++) { + self::expand0state($sha2salt, $sbox0, $sbox1, $sbox2, $sbox3, $p); + self::expand0state($sha2pass, $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + for ($i = 0; $i < 64; $i++) { + for ($j = 0; $j < 8; $j += 2) { + // count($cdata) == 8 + list($cdata[$j], $cdata[$j + 1]) = self::encryptBlockHelperFast($cdata[$j], $cdata[$j + 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + } + return pack('L*', ...$cdata); + } + /** + * Performs OpenSSH-style bcrypt + * + * @param string $pass + * @param string $salt + * @param int $keylen + * @param int $rounds + * @access public + * @return string + */ + public static function bcrypt_pbkdf($pass, $salt, $keylen, $rounds) + { + self::initialize_static_variables(); + if (\PHP_INT_SIZE == 4) { + throw new \RuntimeException('bcrypt is far too slow to be practical on 32-bit versions of PHP'); + } + $sha2pass = hash('sha512', $pass, \true); + $results = []; + $count = 1; + while (32 * count($results) < $keylen) { + $countsalt = $salt . pack('N', $count++); + $sha2salt = hash('sha512', $countsalt, \true); + $out = $tmpout = self::bcrypt_hash($sha2pass, $sha2salt); + for ($i = 1; $i < $rounds; $i++) { + $sha2salt = hash('sha512', $tmpout, \true); + $tmpout = self::bcrypt_hash($sha2pass, $sha2salt); + $out ^= $tmpout; + } + $results[] = $out; + } + $output = ''; + for ($i = 0; $i < 32; $i++) { + foreach ($results as $result) { + $output .= $result[$i]; + } + } + return substr($output, 0, $keylen); + } + /** + * Key expansion without salt + * + * @access private + * @param int[] $key + * @param int[] $sbox0 + * @param int[] $sbox1 + * @param int[] $sbox2 + * @param int[] $sbox3 + * @param int[] $p + * @see self::_bcrypt_hash() + */ + private static function expand0state(array $key, array &$sbox0, array &$sbox1, array &$sbox2, array &$sbox3, array &$p) + { + // expand0state is basically the same thing as this: + //return self::expandstate(array_fill(0, 16, 0), $key); + // but this separate function eliminates a bunch of XORs and array lookups + $p = [$p[0] ^ $key[0], $p[1] ^ $key[1], $p[2] ^ $key[2], $p[3] ^ $key[3], $p[4] ^ $key[4], $p[5] ^ $key[5], $p[6] ^ $key[6], $p[7] ^ $key[7], $p[8] ^ $key[8], $p[9] ^ $key[9], $p[10] ^ $key[10], $p[11] ^ $key[11], $p[12] ^ $key[12], $p[13] ^ $key[13], $p[14] ^ $key[14], $p[15] ^ $key[15], $p[16] ^ $key[0], $p[17] ^ $key[1]]; + // @codingStandardsIgnoreStart + list($p[0], $p[1]) = self::encryptBlockHelperFast(0, 0, $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[2], $p[3]) = self::encryptBlockHelperFast($p[0], $p[1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[4], $p[5]) = self::encryptBlockHelperFast($p[2], $p[3], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[6], $p[7]) = self::encryptBlockHelperFast($p[4], $p[5], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[8], $p[9]) = self::encryptBlockHelperFast($p[6], $p[7], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[10], $p[11]) = self::encryptBlockHelperFast($p[8], $p[9], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[12], $p[13]) = self::encryptBlockHelperFast($p[10], $p[11], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[14], $p[15]) = self::encryptBlockHelperFast($p[12], $p[13], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[16], $p[17]) = self::encryptBlockHelperFast($p[14], $p[15], $sbox0, $sbox1, $sbox2, $sbox3, $p); + // @codingStandardsIgnoreEnd + list($sbox0[0], $sbox0[1]) = self::encryptBlockHelperFast($p[16], $p[17], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2; $i < 256; $i += 2) { + list($sbox0[$i], $sbox0[$i + 1]) = self::encryptBlockHelperFast($sbox0[$i - 2], $sbox0[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + list($sbox1[0], $sbox1[1]) = self::encryptBlockHelperFast($sbox0[254], $sbox0[255], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2; $i < 256; $i += 2) { + list($sbox1[$i], $sbox1[$i + 1]) = self::encryptBlockHelperFast($sbox1[$i - 2], $sbox1[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + list($sbox2[0], $sbox2[1]) = self::encryptBlockHelperFast($sbox1[254], $sbox1[255], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2; $i < 256; $i += 2) { + list($sbox2[$i], $sbox2[$i + 1]) = self::encryptBlockHelperFast($sbox2[$i - 2], $sbox2[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + list($sbox3[0], $sbox3[1]) = self::encryptBlockHelperFast($sbox2[254], $sbox2[255], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2; $i < 256; $i += 2) { + list($sbox3[$i], $sbox3[$i + 1]) = self::encryptBlockHelperFast($sbox3[$i - 2], $sbox3[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + } + /** + * Key expansion with salt + * + * @access private + * @param int[] $data + * @param int[] $key + * @param int[] $sbox0 + * @param int[] $sbox1 + * @param int[] $sbox2 + * @param int[] $sbox3 + * @param int[] $p + * @see self::_bcrypt_hash() + */ + private static function expandstate(array $data, array $key, array &$sbox0, array &$sbox1, array &$sbox2, array &$sbox3, array &$p) + { + $p = [$p[0] ^ $key[0], $p[1] ^ $key[1], $p[2] ^ $key[2], $p[3] ^ $key[3], $p[4] ^ $key[4], $p[5] ^ $key[5], $p[6] ^ $key[6], $p[7] ^ $key[7], $p[8] ^ $key[8], $p[9] ^ $key[9], $p[10] ^ $key[10], $p[11] ^ $key[11], $p[12] ^ $key[12], $p[13] ^ $key[13], $p[14] ^ $key[14], $p[15] ^ $key[15], $p[16] ^ $key[0], $p[17] ^ $key[1]]; + // @codingStandardsIgnoreStart + list($p[0], $p[1]) = self::encryptBlockHelperFast($data[0], $data[1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[2], $p[3]) = self::encryptBlockHelperFast($data[2] ^ $p[0], $data[3] ^ $p[1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[4], $p[5]) = self::encryptBlockHelperFast($data[4] ^ $p[2], $data[5] ^ $p[3], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[6], $p[7]) = self::encryptBlockHelperFast($data[6] ^ $p[4], $data[7] ^ $p[5], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[8], $p[9]) = self::encryptBlockHelperFast($data[8] ^ $p[6], $data[9] ^ $p[7], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[10], $p[11]) = self::encryptBlockHelperFast($data[10] ^ $p[8], $data[11] ^ $p[9], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[12], $p[13]) = self::encryptBlockHelperFast($data[12] ^ $p[10], $data[13] ^ $p[11], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[14], $p[15]) = self::encryptBlockHelperFast($data[14] ^ $p[12], $data[15] ^ $p[13], $sbox0, $sbox1, $sbox2, $sbox3, $p); + list($p[16], $p[17]) = self::encryptBlockHelperFast($data[0] ^ $p[14], $data[1] ^ $p[15], $sbox0, $sbox1, $sbox2, $sbox3, $p); + // @codingStandardsIgnoreEnd + list($sbox0[0], $sbox0[1]) = self::encryptBlockHelperFast($data[2] ^ $p[16], $data[3] ^ $p[17], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2, $j = 4; $i < 256; $i += 2, $j = ($j + 2) % 16) { + // instead of 16 maybe count($data) would be better? + list($sbox0[$i], $sbox0[$i + 1]) = self::encryptBlockHelperFast($data[$j] ^ $sbox0[$i - 2], $data[$j + 1] ^ $sbox0[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + list($sbox1[0], $sbox1[1]) = self::encryptBlockHelperFast($data[2] ^ $sbox0[254], $data[3] ^ $sbox0[255], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2, $j = 4; $i < 256; $i += 2, $j = ($j + 2) % 16) { + list($sbox1[$i], $sbox1[$i + 1]) = self::encryptBlockHelperFast($data[$j] ^ $sbox1[$i - 2], $data[$j + 1] ^ $sbox1[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + list($sbox2[0], $sbox2[1]) = self::encryptBlockHelperFast($data[2] ^ $sbox1[254], $data[3] ^ $sbox1[255], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2, $j = 4; $i < 256; $i += 2, $j = ($j + 2) % 16) { + list($sbox2[$i], $sbox2[$i + 1]) = self::encryptBlockHelperFast($data[$j] ^ $sbox2[$i - 2], $data[$j + 1] ^ $sbox2[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + list($sbox3[0], $sbox3[1]) = self::encryptBlockHelperFast($data[2] ^ $sbox2[254], $data[3] ^ $sbox2[255], $sbox0, $sbox1, $sbox2, $sbox3, $p); + for ($i = 2, $j = 4; $i < 256; $i += 2, $j = ($j + 2) % 16) { + list($sbox3[$i], $sbox3[$i + 1]) = self::encryptBlockHelperFast($data[$j] ^ $sbox3[$i - 2], $data[$j + 1] ^ $sbox3[$i - 1], $sbox0, $sbox1, $sbox2, $sbox3, $p); + } + } + /** + * Encrypts a block + * + * @param string $in + * @return string + */ + protected function encryptBlock($in) + { + $p = $this->bctx['p']; + // extract($this->bctx['sb'], EXTR_PREFIX_ALL, 'sb'); // slower + $sb_0 = $this->bctx['sb'][0]; + $sb_1 = $this->bctx['sb'][1]; + $sb_2 = $this->bctx['sb'][2]; + $sb_3 = $this->bctx['sb'][3]; + $in = unpack('N*', $in); + $l = $in[1]; + $r = $in[2]; + list($r, $l) = \PHP_INT_SIZE == 4 ? self::encryptBlockHelperSlow($l, $r, $sb_0, $sb_1, $sb_2, $sb_3, $p) : self::encryptBlockHelperFast($l, $r, $sb_0, $sb_1, $sb_2, $sb_3, $p); + return pack("N*", $r, $l); + } + /** + * Fast helper function for block encryption + * + * @access private + * @param int $x0 + * @param int $x1 + * @param int[] $sbox0 + * @param int[] $sbox1 + * @param int[] $sbox2 + * @param int[] $sbox3 + * @param int[] $p + * @return int[] + */ + private static function encryptBlockHelperFast($x0, $x1, array $sbox0, array $sbox1, array $sbox2, array $sbox3, array $p) + { + $x0 ^= $p[0]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[1]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[2]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[3]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[4]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[5]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[6]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[7]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[8]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[9]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[10]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[11]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[12]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[13]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[14]; + $x1 ^= ($sbox0[($x0 & 0xff000000) >> 24] + $sbox1[($x0 & 0xff0000) >> 16] ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff] ^ $p[15]; + $x0 ^= ($sbox0[($x1 & 0xff000000) >> 24] + $sbox1[($x1 & 0xff0000) >> 16] ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff] ^ $p[16]; + return [$x1 & 0xffffffff ^ $p[17], $x0 & 0xffffffff]; + } + /** + * Slow helper function for block encryption + * + * @access private + * @param int $x0 + * @param int $x1 + * @param int[] $sbox0 + * @param int[] $sbox1 + * @param int[] $sbox2 + * @param int[] $sbox3 + * @param int[] $p + * @return int[] + */ + private static function encryptBlockHelperSlow($x0, $x1, array $sbox0, array $sbox1, array $sbox2, array $sbox3, array $p) + { + // -16777216 == intval(0xFF000000) on 32-bit PHP installs + $x0 ^= $p[0]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[1]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[2]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[3]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[4]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[5]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[6]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[7]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[8]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[9]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[10]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[11]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[12]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[13]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[14]; + $x1 ^= self::safe_intval((self::safe_intval($sbox0[($x0 & -16777216) >> 24 & 0xff] + $sbox1[($x0 & 0xff0000) >> 16]) ^ $sbox2[($x0 & 0xff00) >> 8]) + $sbox3[$x0 & 0xff]) ^ $p[15]; + $x0 ^= self::safe_intval((self::safe_intval($sbox0[($x1 & -16777216) >> 24 & 0xff] + $sbox1[($x1 & 0xff0000) >> 16]) ^ $sbox2[($x1 & 0xff00) >> 8]) + $sbox3[$x1 & 0xff]) ^ $p[16]; + return [$x1 ^ $p[17], $x0]; + } + /** + * Decrypts a block + * + * @param string $in + * @return string + */ + protected function decryptBlock($in) + { + $p = $this->bctx['p']; + $sb_0 = $this->bctx['sb'][0]; + $sb_1 = $this->bctx['sb'][1]; + $sb_2 = $this->bctx['sb'][2]; + $sb_3 = $this->bctx['sb'][3]; + $in = unpack('N*', $in); + $l = $in[1]; + $r = $in[2]; + for ($i = 17; $i > 2; $i -= 2) { + $l ^= $p[$i]; + $r ^= self::safe_intval((self::safe_intval($sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]) ^ $sb_2[$l >> 8 & 0xff]) + $sb_3[$l & 0xff]); + $r ^= $p[$i - 1]; + $l ^= self::safe_intval((self::safe_intval($sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]) ^ $sb_2[$r >> 8 & 0xff]) + $sb_3[$r & 0xff]); + } + return pack('N*', $r ^ $p[0], $l ^ $p[1]); + } + /** + * Setup the performance-optimized function for de/encrypt() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupInlineCrypt() + */ + protected function setupInlineCrypt() + { + $p = $this->bctx['p']; + $init_crypt = ' + static $sb_0, $sb_1, $sb_2, $sb_3; + if (!$sb_0) { + $sb_0 = $this->bctx["sb"][0]; + $sb_1 = $this->bctx["sb"][1]; + $sb_2 = $this->bctx["sb"][2]; + $sb_3 = $this->bctx["sb"][3]; + } + '; + $safeint = self::safe_intval_inline(); + // Generating encrypt code: + $encrypt_block = ' + $in = unpack("N*", $in); + $l = $in[1]; + $r = $in[2]; + '; + for ($i = 0; $i < 16; $i += 2) { + $encrypt_block .= ' + $l^= ' . $p[$i] . '; + $r^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]') . ' ^ + $sb_2[$l >> 8 & 0xff]) + + $sb_3[$l & 0xff]') . '; + + $r^= ' . $p[$i + 1] . '; + $l^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]') . ' ^ + $sb_2[$r >> 8 & 0xff]) + + $sb_3[$r & 0xff]') . '; + '; + } + $encrypt_block .= ' + $in = pack("N*", + $r ^ ' . $p[17] . ', + $l ^ ' . $p[16] . ' + ); + '; + // Generating decrypt code: + $decrypt_block = ' + $in = unpack("N*", $in); + $l = $in[1]; + $r = $in[2]; + '; + for ($i = 17; $i > 2; $i -= 2) { + $decrypt_block .= ' + $l^= ' . $p[$i] . '; + $r^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$l >> 24 & 0xff] + $sb_1[$l >> 16 & 0xff]') . ' ^ + $sb_2[$l >> 8 & 0xff]) + + $sb_3[$l & 0xff]') . '; + + $r^= ' . $p[$i - 1] . '; + $l^= ' . sprintf($safeint, '(' . sprintf($safeint, '$sb_0[$r >> 24 & 0xff] + $sb_1[$r >> 16 & 0xff]') . ' ^ + $sb_2[$r >> 8 & 0xff]) + + $sb_3[$r & 0xff]') . '; + '; + } + $decrypt_block .= ' + $in = pack("N*", + $r ^ ' . $p[0] . ', + $l ^ ' . $p[1] . ' + ); + '; + $this->inline_crypt = $this->createInlineCryptFunction(['init_crypt' => $init_crypt, 'init_encrypt' => '', 'init_decrypt' => '', 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/ChaCha20.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/ChaCha20.php new file mode 100644 index 0000000..f4680e5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/ChaCha20.php @@ -0,0 +1,999 @@ + + * @copyright 2019 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadDecryptionException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +/** + * Pure-PHP implementation of ChaCha20. + * + * @author Jim Wigginton + */ +class ChaCha20 extends Salsa20 +{ + /** + * The OpenSSL specific name of the cipher + * + * @var string + */ + protected $cipher_name_openssl = 'chacha20'; + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + switch ($engine) { + case self::ENGINE_LIBSODIUM: + // PHP 7.2.0 (30 Nov 2017) added support for libsodium + // we could probably make it so that if $this->counter == 0 then the first block would be done with either OpenSSL + // or PHP and then subsequent blocks would then be done with libsodium but idk - it's not a high priority atm + // we could also make it so that if $this->counter == 0 and $this->continuousBuffer then do the first string + // with libsodium and subsequent strings with openssl or pure-PHP but again not a high priority + return function_exists('sodium_crypto_aead_chacha20poly1305_ietf_encrypt') && $this->key_length == 32 && ($this->usePoly1305 && !isset($this->poly1305Key) && $this->counter == 0 || $this->counter == 1) && !$this->continuousBuffer; + case self::ENGINE_OPENSSL: + // OpenSSL 1.1.0 (released 25 Aug 2016) added support for chacha20. + // PHP didn't support OpenSSL 1.1.0 until 7.0.19 (11 May 2017) + // if you attempt to provide openssl with a 128 bit key (as opposed to a 256 bit key) openssl will null + // pad the key to 256 bits and still use the expansion constant for 256-bit keys. the fact that + // openssl treats the IV as both the counter and nonce, however, let's us use openssl in continuous mode + // whereas libsodium does not + if ($this->key_length != 32) { + return \false; + } + } + return parent::isValidEngineHelper($engine); + } + /** + * Encrypts a message. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see self::crypt() + * @param string $plaintext + * @return string $ciphertext + */ + public function encrypt($plaintext) + { + $this->setup(); + if ($this->engine == self::ENGINE_LIBSODIUM) { + return $this->encrypt_with_libsodium($plaintext); + } + return parent::encrypt($plaintext); + } + /** + * Decrypts a message. + * + * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). + * At least if the continuous buffer is disabled. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see self::crypt() + * @param string $ciphertext + * @return string $plaintext + */ + public function decrypt($ciphertext) + { + $this->setup(); + if ($this->engine == self::ENGINE_LIBSODIUM) { + return $this->decrypt_with_libsodium($ciphertext); + } + return parent::decrypt($ciphertext); + } + /** + * Encrypts a message with libsodium + * + * @see self::encrypt() + * @param string $plaintext + * @return string $text + */ + private function encrypt_with_libsodium($plaintext) + { + $params = [$plaintext, $this->aad, $this->nonce, $this->key]; + $ciphertext = strlen($this->nonce) == 8 ? sodium_crypto_aead_chacha20poly1305_encrypt(...$params) : sodium_crypto_aead_chacha20poly1305_ietf_encrypt(...$params); + if (!$this->usePoly1305) { + return substr($ciphertext, 0, strlen($plaintext)); + } + $newciphertext = substr($ciphertext, 0, strlen($plaintext)); + $this->newtag = $this->usingGeneratedPoly1305Key && strlen($this->nonce) == 12 ? substr($ciphertext, strlen($plaintext)) : $this->poly1305($newciphertext); + return $newciphertext; + } + /** + * Decrypts a message with libsodium + * + * @see self::decrypt() + * @param string $ciphertext + * @return string $text + */ + private function decrypt_with_libsodium($ciphertext) + { + $params = [$ciphertext, $this->aad, $this->nonce, $this->key]; + if (isset($this->poly1305Key)) { + if ($this->oldtag === \false) { + throw new InsufficientSetupException('Authentication Tag has not been set'); + } + if ($this->usingGeneratedPoly1305Key && strlen($this->nonce) == 12) { + $plaintext = sodium_crypto_aead_chacha20poly1305_ietf_decrypt(...$params); + $this->oldtag = \false; + if ($plaintext === \false) { + throw new BadDecryptionException('Derived authentication tag and supplied authentication tag do not match'); + } + return $plaintext; + } + $newtag = $this->poly1305($ciphertext); + if ($this->oldtag != substr($newtag, 0, strlen($this->oldtag))) { + $this->oldtag = \false; + throw new BadDecryptionException('Derived authentication tag and supplied authentication tag do not match'); + } + $this->oldtag = \false; + } + $plaintext = strlen($this->nonce) == 8 ? sodium_crypto_aead_chacha20poly1305_encrypt(...$params) : sodium_crypto_aead_chacha20poly1305_ietf_encrypt(...$params); + return substr($plaintext, 0, strlen($ciphertext)); + } + /** + * Sets the nonce. + * + * @param string $nonce + */ + public function setNonce($nonce) + { + if (!is_string($nonce)) { + throw new \UnexpectedValueException('The nonce should be a string'); + } + /* + from https://tools.ietf.org/html/rfc7539#page-7 + + "Note also that the original ChaCha had a 64-bit nonce and 64-bit + block count. We have modified this here to be more consistent with + recommendations in Section 3.2 of [RFC5116]." + */ + switch (strlen($nonce)) { + case 8: + // 64 bits + case 12: + // 96 bits + break; + default: + throw new \LengthException('Nonce of size ' . strlen($nonce) . ' not supported by this algorithm. Only 64-bit nonces or 96-bit nonces are supported'); + } + $this->nonce = $nonce; + $this->changed = \true; + $this->setEngine(); + } + /** + * Setup the self::ENGINE_INTERNAL $engine + * + * (re)init, if necessary, the internal cipher $engine + * + * _setup() will be called each time if $changed === true + * typically this happens when using one or more of following public methods: + * + * - setKey() + * + * - setNonce() + * + * - First run of encrypt() / decrypt() with no init-settings + * + * @see self::setKey() + * @see self::setNonce() + * @see self::disableContinuousBuffer() + */ + protected function setup() + { + if (!$this->changed) { + return; + } + $this->enbuffer = $this->debuffer = ['ciphertext' => '', 'counter' => $this->counter]; + $this->changed = $this->nonIVChanged = \false; + if ($this->nonce === \false) { + throw new InsufficientSetupException('No nonce has been defined'); + } + if ($this->key === \false) { + throw new InsufficientSetupException('No key has been defined'); + } + if ($this->usePoly1305 && !isset($this->poly1305Key)) { + $this->usingGeneratedPoly1305Key = \true; + if ($this->engine == self::ENGINE_LIBSODIUM) { + return; + } + $this->createPoly1305Key(); + } + $key = $this->key; + if (strlen($key) == 16) { + $constant = 'expand 16-byte k'; + $key .= $key; + } else { + $constant = 'expand 32-byte k'; + } + $this->p1 = $constant . $key; + $this->p2 = $this->nonce; + if (strlen($this->nonce) == 8) { + $this->p2 = "\x00\x00\x00\x00" . $this->p2; + } + } + /** + * The quarterround function + * + * @param int $a + * @param int $b + * @param int $c + * @param int $d + */ + protected static function quarterRound(&$a, &$b, &$c, &$d) + { + // in https://datatracker.ietf.org/doc/html/rfc7539#section-2.1 the addition, + // xor'ing and rotation are all on the same line so i'm keeping it on the same + // line here as well + // @codingStandardsIgnoreStart + $a += $b; + $d = self::leftRotate(intval($d) ^ intval($a), 16); + $c += $d; + $b = self::leftRotate(intval($b) ^ intval($c), 12); + $a += $b; + $d = self::leftRotate(intval($d) ^ intval($a), 8); + $c += $d; + $b = self::leftRotate(intval($b) ^ intval($c), 7); + // @codingStandardsIgnoreEnd + } + /** + * The doubleround function + * + * @param int $x0 (by reference) + * @param int $x1 (by reference) + * @param int $x2 (by reference) + * @param int $x3 (by reference) + * @param int $x4 (by reference) + * @param int $x5 (by reference) + * @param int $x6 (by reference) + * @param int $x7 (by reference) + * @param int $x8 (by reference) + * @param int $x9 (by reference) + * @param int $x10 (by reference) + * @param int $x11 (by reference) + * @param int $x12 (by reference) + * @param int $x13 (by reference) + * @param int $x14 (by reference) + * @param int $x15 (by reference) + */ + protected static function doubleRound(&$x0, &$x1, &$x2, &$x3, &$x4, &$x5, &$x6, &$x7, &$x8, &$x9, &$x10, &$x11, &$x12, &$x13, &$x14, &$x15) + { + // columnRound + static::quarterRound($x0, $x4, $x8, $x12); + static::quarterRound($x1, $x5, $x9, $x13); + static::quarterRound($x2, $x6, $x10, $x14); + static::quarterRound($x3, $x7, $x11, $x15); + // rowRound + static::quarterRound($x0, $x5, $x10, $x15); + static::quarterRound($x1, $x6, $x11, $x12); + static::quarterRound($x2, $x7, $x8, $x13); + static::quarterRound($x3, $x4, $x9, $x14); + } + /** + * The Salsa20 hash function function + * + * On my laptop this loop unrolled / function dereferenced version of parent::salsa20 encrypts 1mb of text in + * 0.65s vs the 0.85s that it takes with the parent method. + * + * If we were free to assume that the host OS would always be 64-bits then the if condition in leftRotate could + * be eliminated and we could knock this done to 0.60s. + * + * For comparison purposes, RC4 takes 0.16s and AES in CTR mode with the Eval engine takes 0.48s. + * AES in CTR mode with the PHP engine takes 1.19s. Salsa20 / ChaCha20 do not benefit as much from the Eval + * approach due to the fact that there are a lot less variables to de-reference, fewer loops to unroll, etc + * + * @param string $x + */ + protected static function salsa20($x) + { + list(, $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15) = unpack('V*', $x); + $z0 = $x0; + $z1 = $x1; + $z2 = $x2; + $z3 = $x3; + $z4 = $x4; + $z5 = $x5; + $z6 = $x6; + $z7 = $x7; + $z8 = $x8; + $z9 = $x9; + $z10 = $x10; + $z11 = $x11; + $z12 = $x12; + $z13 = $x13; + $z14 = $x14; + $z15 = $x15; + // @codingStandardsIgnoreStart + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // columnRound + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 16); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 12); + $x0 += $x4; + $x12 = self::leftRotate(intval($x12) ^ intval($x0), 8); + $x8 += $x12; + $x4 = self::leftRotate(intval($x4) ^ intval($x8), 7); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 16); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 12); + $x1 += $x5; + $x13 = self::leftRotate(intval($x13) ^ intval($x1), 8); + $x9 += $x13; + $x5 = self::leftRotate(intval($x5) ^ intval($x9), 7); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 16); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 12); + $x2 += $x6; + $x14 = self::leftRotate(intval($x14) ^ intval($x2), 8); + $x10 += $x14; + $x6 = self::leftRotate(intval($x6) ^ intval($x10), 7); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 16); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 12); + $x3 += $x7; + $x15 = self::leftRotate(intval($x15) ^ intval($x3), 8); + $x11 += $x15; + $x7 = self::leftRotate(intval($x7) ^ intval($x11), 7); + // rowRound + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 16); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 12); + $x0 += $x5; + $x15 = self::leftRotate(intval($x15) ^ intval($x0), 8); + $x10 += $x15; + $x5 = self::leftRotate(intval($x5) ^ intval($x10), 7); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 16); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 12); + $x1 += $x6; + $x12 = self::leftRotate(intval($x12) ^ intval($x1), 8); + $x11 += $x12; + $x6 = self::leftRotate(intval($x6) ^ intval($x11), 7); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 16); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 12); + $x2 += $x7; + $x13 = self::leftRotate(intval($x13) ^ intval($x2), 8); + $x8 += $x13; + $x7 = self::leftRotate(intval($x7) ^ intval($x8), 7); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 16); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 12); + $x3 += $x4; + $x14 = self::leftRotate(intval($x14) ^ intval($x3), 8); + $x9 += $x14; + $x4 = self::leftRotate(intval($x4) ^ intval($x9), 7); + // @codingStandardsIgnoreEnd + $x0 += $z0; + $x1 += $z1; + $x2 += $z2; + $x3 += $z3; + $x4 += $z4; + $x5 += $z5; + $x6 += $z6; + $x7 += $z7; + $x8 += $z8; + $x9 += $z9; + $x10 += $z10; + $x11 += $z11; + $x12 += $z12; + $x13 += $z13; + $x14 += $z14; + $x15 += $z15; + return pack('V*', $x0, $x1, $x2, $x3, $x4, $x5, $x6, $x7, $x8, $x9, $x10, $x11, $x12, $x13, $x14, $x15); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php new file mode 100644 index 0000000..8ced8b1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php @@ -0,0 +1,511 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\NoKeyLoadedException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Base Class for all asymmetric cipher classes + * + * @author Jim Wigginton + */ +abstract class AsymmetricKey +{ + /** + * Precomputed Zero + * + * @var \phpseclib3\Math\BigInteger + */ + protected static $zero; + /** + * Precomputed One + * + * @var \phpseclib3\Math\BigInteger + */ + protected static $one; + /** + * Format of the loaded key + * + * @var string + */ + protected $format; + /** + * Hash function + * + * @var \phpseclib3\Crypt\Hash + */ + protected $hash; + /** + * HMAC function + * + * @var \phpseclib3\Crypt\Hash + */ + private $hmac; + /** + * Supported plugins (lower case) + * + * @see self::initialize_static_variables() + * @var array + */ + private static $plugins = []; + /** + * Invisible plugins + * + * @see self::initialize_static_variables() + * @var array + */ + private static $invisiblePlugins = []; + /** + * Available Engines + * + * @var boolean[] + */ + protected static $engines = []; + /** + * Key Comment + * + * @var null|string + */ + private $comment; + /** + * @param string $type + * @return array|string + */ + public abstract function toString($type, array $options = []); + /** + * The constructor + */ + protected function __construct() + { + self::initialize_static_variables(); + $this->hash = new Hash('sha256'); + $this->hmac = new Hash('sha256'); + } + /** + * Initialize static variables + */ + protected static function initialize_static_variables() + { + if (!isset(self::$zero)) { + self::$zero = new BigInteger(0); + self::$one = new BigInteger(1); + } + self::loadPlugins('Keys'); + if (static::ALGORITHM != 'RSA' && static::ALGORITHM != 'DH') { + self::loadPlugins('Signature'); + } + } + /** + * Load the key + * + * @param string $key + * @param string $password optional + * @return \phpseclib3\Crypt\Common\PublicKey|\phpseclib3\Crypt\Common\PrivateKey + */ + public static function load($key, $password = \false) + { + self::initialize_static_variables(); + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('load() should not be called from final classes (' . static::class . ')'); + } + $components = \false; + foreach (self::$plugins[static::ALGORITHM]['Keys'] as $format) { + if (isset(self::$invisiblePlugins[static::ALGORITHM]) && in_array($format, self::$invisiblePlugins[static::ALGORITHM])) { + continue; + } + try { + $components = $format::load($key, $password); + } catch (\Exception $e) { + $components = \false; + } + if ($components !== \false) { + break; + } + } + if ($components === \false) { + throw new NoKeyLoadedException('Unable to read key'); + } + $components['format'] = $format; + $components['secret'] = isset($components['secret']) ? $components['secret'] : ''; + $comment = isset($components['comment']) ? $components['comment'] : null; + $new = static::onLoad($components); + $new->format = $format; + $new->comment = $comment; + return $new instanceof PrivateKey ? $new->withPassword($password) : $new; + } + /** + * Loads a private key + * + * @return PrivateKey + * @param string|array $key + * @param string $password optional + */ + public static function loadPrivateKey($key, $password = '') + { + $key = self::load($key, $password); + if (!$key instanceof PrivateKey) { + throw new NoKeyLoadedException('The key that was loaded was not a private key'); + } + return $key; + } + /** + * Loads a public key + * + * @return PublicKey + * @param string|array $key + */ + public static function loadPublicKey($key) + { + $key = self::load($key); + if (!$key instanceof PublicKey) { + throw new NoKeyLoadedException('The key that was loaded was not a public key'); + } + return $key; + } + /** + * Loads parameters + * + * @return AsymmetricKey + * @param string|array $key + */ + public static function loadParameters($key) + { + $key = self::load($key); + if (!$key instanceof PrivateKey && !$key instanceof PublicKey) { + throw new NoKeyLoadedException('The key that was loaded was not a parameter'); + } + return $key; + } + /** + * Load the key, assuming a specific format + * + * @param string $type + * @param string $key + * @param string $password optional + * @return static + */ + public static function loadFormat($type, $key, $password = \false) + { + self::initialize_static_variables(); + $components = \false; + $format = strtolower($type); + if (isset(self::$plugins[static::ALGORITHM]['Keys'][$format])) { + $format = self::$plugins[static::ALGORITHM]['Keys'][$format]; + $components = $format::load($key, $password); + } + if ($components === \false) { + throw new NoKeyLoadedException('Unable to read key'); + } + $components['format'] = $format; + $components['secret'] = isset($components['secret']) ? $components['secret'] : ''; + $new = static::onLoad($components); + $new->format = $format; + return $new instanceof PrivateKey ? $new->withPassword($password) : $new; + } + /** + * Loads a private key + * + * @return PrivateKey + * @param string $type + * @param string $key + * @param string $password optional + */ + public static function loadPrivateKeyFormat($type, $key, $password = \false) + { + $key = self::loadFormat($type, $key, $password); + if (!$key instanceof PrivateKey) { + throw new NoKeyLoadedException('The key that was loaded was not a private key'); + } + return $key; + } + /** + * Loads a public key + * + * @return PublicKey + * @param string $type + * @param string $key + */ + public static function loadPublicKeyFormat($type, $key) + { + $key = self::loadFormat($type, $key); + if (!$key instanceof PublicKey) { + throw new NoKeyLoadedException('The key that was loaded was not a public key'); + } + return $key; + } + /** + * Loads parameters + * + * @return AsymmetricKey + * @param string $type + * @param string|array $key + */ + public static function loadParametersFormat($type, $key) + { + $key = self::loadFormat($type, $key); + if (!$key instanceof PrivateKey && !$key instanceof PublicKey) { + throw new NoKeyLoadedException('The key that was loaded was not a parameter'); + } + return $key; + } + /** + * Validate Plugin + * + * @param string $format + * @param string $type + * @param string $method optional + * @return mixed + */ + protected static function validatePlugin($format, $type, $method = null) + { + $type = strtolower($type); + if (!isset(self::$plugins[static::ALGORITHM][$format][$type])) { + throw new UnsupportedFormatException("{$type} is not a supported format"); + } + $type = self::$plugins[static::ALGORITHM][$format][$type]; + if (isset($method) && !method_exists($type, $method)) { + throw new UnsupportedFormatException("{$type} does not implement {$method}"); + } + return $type; + } + /** + * Load Plugins + * + * @param string $format + */ + private static function loadPlugins($format) + { + if (!isset(self::$plugins[static::ALGORITHM][$format])) { + self::$plugins[static::ALGORITHM][$format] = []; + foreach (new \DirectoryIterator(__DIR__ . '/../' . static::ALGORITHM . '/Formats/' . $format . '/') as $file) { + if ($file->getExtension() != 'php') { + continue; + } + $name = $file->getBasename('.php'); + if ($name[0] == '.') { + continue; + } + $type = 'phpseclib3\\Crypt\\' . static::ALGORITHM . '\\Formats\\' . $format . '\\' . $name; + $reflect = new \ReflectionClass($type); + if ($reflect->isTrait()) { + continue; + } + self::$plugins[static::ALGORITHM][$format][strtolower($name)] = $type; + if ($reflect->hasConstant('IS_INVISIBLE')) { + self::$invisiblePlugins[static::ALGORITHM][] = $type; + } + } + } + } + /** + * Returns a list of supported formats. + * + * @return array + */ + public static function getSupportedKeyFormats() + { + self::initialize_static_variables(); + return self::$plugins[static::ALGORITHM]['Keys']; + } + /** + * Add a fileformat plugin + * + * The plugin needs to either already be loaded or be auto-loadable. + * Loading a plugin whose shortname overwrite an existing shortname will overwrite the old plugin. + * + * @see self::load() + * @param string $fullname + * @return bool + */ + public static function addFileFormat($fullname) + { + self::initialize_static_variables(); + if (class_exists($fullname)) { + $meta = new \ReflectionClass($fullname); + $shortname = $meta->getShortName(); + self::$plugins[static::ALGORITHM]['Keys'][strtolower($shortname)] = $fullname; + if ($meta->hasConstant('IS_INVISIBLE')) { + self::$invisiblePlugins[static::ALGORITHM][] = strtolower($shortname); + } + } + } + /** + * Returns the format of the loaded key. + * + * If the key that was loaded wasn't in a valid or if the key was auto-generated + * with RSA::createKey() then this will throw an exception. + * + * @see self::load() + * @return mixed + */ + public function getLoadedFormat() + { + if (empty($this->format)) { + throw new NoKeyLoadedException('This key was created with createKey - it was not loaded with load. Therefore there is no "loaded format"'); + } + $meta = new \ReflectionClass($this->format); + return $meta->getShortName(); + } + /** + * Returns the key's comment + * + * Not all key formats support comments. If you want to set a comment use toString() + * + * @return null|string + */ + public function getComment() + { + return $this->comment; + } + /** + * Tests engine validity + * + */ + public static function useBestEngine() + { + static::$engines = [ + 'PHP' => \true, + 'OpenSSL' => extension_loaded('openssl'), + // this test can be satisfied by either of the following: + // http://php.net/manual/en/book.sodium.php + // https://github.com/paragonie/sodium_compat + 'libsodium' => function_exists('sodium_crypto_sign_keypair'), + ]; + return static::$engines; + } + /** + * Flag to use internal engine only (useful for unit testing) + * + */ + public static function useInternalEngine() + { + static::$engines = ['PHP' => \true, 'OpenSSL' => \false, 'libsodium' => \false]; + } + /** + * __toString() magic method + * + * @return string + */ + public function __toString() + { + return $this->toString('PKCS8'); + } + /** + * Determines which hashing function should be used + * + * @param string $hash + */ + public function withHash($hash) + { + $new = clone $this; + $new->hash = new Hash($hash); + $new->hmac = new Hash($hash); + return $new; + } + /** + * Returns the hash algorithm currently being used + * + */ + public function getHash() + { + return clone $this->hash; + } + /** + * Compute the pseudorandom k for signature generation, + * using the process specified for deterministic DSA. + * + * @param string $h1 + * @return string + */ + protected function computek($h1) + { + $v = str_repeat("\x01", strlen($h1)); + $k = str_repeat("\x00", strlen($h1)); + $x = $this->int2octets($this->x); + $h1 = $this->bits2octets($h1); + $this->hmac->setKey($k); + $k = $this->hmac->hash($v . "\x00" . $x . $h1); + $this->hmac->setKey($k); + $v = $this->hmac->hash($v); + $k = $this->hmac->hash($v . "\x01" . $x . $h1); + $this->hmac->setKey($k); + $v = $this->hmac->hash($v); + $qlen = $this->q->getLengthInBytes(); + while (\true) { + $t = ''; + while (strlen($t) < $qlen) { + $v = $this->hmac->hash($v); + $t = $t . $v; + } + $k = $this->bits2int($t); + if (!$k->equals(self::$zero) && $k->compare($this->q) < 0) { + break; + } + $k = $this->hmac->hash($v . "\x00"); + $this->hmac->setKey($k); + $v = $this->hmac->hash($v); + } + return $k; + } + /** + * Integer to Octet String + * + * @param \phpseclib3\Math\BigInteger $v + * @return string + */ + private function int2octets($v) + { + $out = $v->toBytes(); + $rolen = $this->q->getLengthInBytes(); + if (strlen($out) < $rolen) { + return str_pad($out, $rolen, "\x00", \STR_PAD_LEFT); + } elseif (strlen($out) > $rolen) { + return substr($out, -$rolen); + } else { + return $out; + } + } + /** + * Bit String to Integer + * + * @param string $in + * @return \phpseclib3\Math\BigInteger + */ + protected function bits2int($in) + { + $v = new BigInteger($in, 256); + $vlen = strlen($in) << 3; + $qlen = $this->q->getLength(); + if ($vlen > $qlen) { + return $v->bitwise_rightShift($vlen - $qlen); + } + return $v; + } + /** + * Bit String to Octet String + * + * @param string $in + * @return string + */ + private function bits2octets($in) + { + $z1 = $this->bits2int($in); + $z2 = $z1->subtract($this->q); + return $z2->compare(self::$zero) < 0 ? $this->int2octets($z1) : $this->int2octets($z2); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php new file mode 100644 index 0000000..9102e4d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php @@ -0,0 +1,23 @@ + + * @author Hans-Juergen Petrich + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; + +/** + * Base Class for all block cipher classes + * + * @author Jim Wigginton + */ +abstract class BlockCipher extends SymmetricKey +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php new file mode 100644 index 0000000..1d5fd3d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php @@ -0,0 +1,62 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +/** + * JSON Web Key Formatted Key Handler + * + * @author Jim Wigginton + */ +abstract class JWK +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password + * @return array + */ + public static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + $key = preg_replace('#\\s#', '', $key); + // remove whitespace + if (\PHP_VERSION_ID >= 73000) { + $key = json_decode($key, null, 512, \JSON_THROW_ON_ERROR); + } else { + $key = json_decode($key); + if (!$key) { + throw new \RuntimeException('Unable to decode JSON'); + } + } + if (isset($key->kty)) { + return $key; + } + if (count($key->keys) != 1) { + throw new \RuntimeException('Although the JWK key format supports multiple keys phpseclib does not'); + } + return $key->keys[0]; + } + /** + * Wrap a key appropriately + * + * @return string + */ + protected static function wrapKey(array $key, array $options) + { + return json_encode(['keys' => [$key + $options]]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php new file mode 100644 index 0000000..9b47578 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php @@ -0,0 +1,195 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\AES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +/** + * OpenSSH Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class OpenSSH +{ + /** + * Default comment + * + * @var string + */ + protected static $comment = 'phpseclib-generated-key'; + /** + * Binary key flag + * + * @var bool + */ + protected static $binary = \false; + /** + * Sets the default comment + * + * @param string $comment + */ + public static function setComment($comment) + { + self::$comment = str_replace(["\r", "\n"], '', $comment); + } + /** + * Break a public or private key down into its constituent components + * + * $type can be either ssh-dss or ssh-rsa + * + * @param string $key + * @param string $password + * @return array + */ + public static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + // key format is described here: + // https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.key?annotate=HEAD + if (strpos($key, 'BEGIN OPENSSH PRIVATE KEY') !== \false) { + $key = preg_replace('#(?:^-.*?-[\\r\\n]*$)|\\s#ms', '', $key); + $key = Strings::base64_decode($key); + $magic = Strings::shift($key, 15); + if ($magic != "openssh-key-v1\x00") { + throw new \RuntimeException('Expected openssh-key-v1'); + } + list($ciphername, $kdfname, $kdfoptions, $numKeys) = Strings::unpackSSH2('sssN', $key); + if ($numKeys != 1) { + // if we wanted to support multiple keys we could update PublicKeyLoader to preview what the # of keys + // would be; it'd then call Common\Keys\OpenSSH.php::load() and get the paddedKey. it'd then pass + // that to the appropriate key loading parser $numKey times or something + throw new \RuntimeException('Although the OpenSSH private key format supports multiple keys phpseclib does not'); + } + switch ($ciphername) { + case 'none': + break; + case 'aes256-ctr': + if ($kdfname != 'bcrypt') { + throw new \RuntimeException('Only the bcrypt kdf is supported (' . $kdfname . ' encountered)'); + } + list($salt, $rounds) = Strings::unpackSSH2('sN', $kdfoptions); + $crypto = new AES('ctr'); + //$crypto->setKeyLength(256); + //$crypto->disablePadding(); + $crypto->setPassword($password, 'bcrypt', $salt, $rounds, 32); + break; + default: + throw new \RuntimeException('The only supported cipherse are: none, aes256-ctr (' . $ciphername . ' is being used)'); + } + list($publicKey, $paddedKey) = Strings::unpackSSH2('ss', $key); + list($type) = Strings::unpackSSH2('s', $publicKey); + if (isset($crypto)) { + $paddedKey = $crypto->decrypt($paddedKey); + } + list($checkint1, $checkint2) = Strings::unpackSSH2('NN', $paddedKey); + // any leftover bytes in $paddedKey are for padding? but they should be sequential bytes. eg. 1, 2, 3, etc. + if ($checkint1 != $checkint2) { + throw new \RuntimeException('The two checkints do not match'); + } + self::checkType($type); + return compact('type', 'publicKey', 'paddedKey'); + } + $parts = explode(' ', $key, 3); + if (!isset($parts[1])) { + $key = base64_decode($parts[0]); + $comment = \false; + } else { + $asciiType = $parts[0]; + self::checkType($parts[0]); + $key = base64_decode($parts[1]); + $comment = isset($parts[2]) ? $parts[2] : \false; + } + if ($key === \false) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + list($type) = Strings::unpackSSH2('s', $key); + self::checkType($type); + if (isset($asciiType) && $asciiType != $type) { + throw new \RuntimeException('Two different types of keys are claimed: ' . $asciiType . ' and ' . $type); + } + if (strlen($key) <= 4) { + throw new \UnexpectedValueException('Key appears to be malformed'); + } + $publicKey = $key; + return compact('type', 'publicKey', 'comment'); + } + /** + * Toggle between binary and printable keys + * + * Printable keys are what are generated by default. These are the ones that go in + * $HOME/.ssh/authorized_key. + * + * @param bool $enabled + */ + public static function setBinaryOutput($enabled) + { + self::$binary = $enabled; + } + /** + * Checks to see if the type is valid + * + * @param string $candidate + */ + private static function checkType($candidate) + { + if (!in_array($candidate, static::$types)) { + throw new \RuntimeException("The key type ({$candidate}) is not equal to: " . implode(',', static::$types)); + } + } + /** + * Wrap a private key appropriately + * + * @param string $publicKey + * @param string $privateKey + * @param string $password + * @param array $options + * @return string + */ + protected static function wrapPrivateKey($publicKey, $privateKey, $password, $options) + { + list(, $checkint) = unpack('N', Random::string(4)); + $comment = isset($options['comment']) ? $options['comment'] : self::$comment; + $paddedKey = Strings::packSSH2('NN', $checkint, $checkint) . $privateKey . Strings::packSSH2('s', $comment); + $usesEncryption = !empty($password) && is_string($password); + /* + from http://tools.ietf.org/html/rfc4253#section-6 : + + Note that the length of the concatenation of 'packet_length', + 'padding_length', 'payload', and 'random padding' MUST be a multiple + of the cipher block size or 8, whichever is larger. + */ + $blockSize = $usesEncryption ? 16 : 8; + $paddingLength = ($blockSize - 1) * strlen($paddedKey) % $blockSize; + for ($i = 1; $i <= $paddingLength; $i++) { + $paddedKey .= chr($i); + } + if (!$usesEncryption) { + $key = Strings::packSSH2('sssNss', 'none', 'none', '', 1, $publicKey, $paddedKey); + } else { + $rounds = isset($options['rounds']) ? $options['rounds'] : 16; + $salt = Random::string(16); + $kdfoptions = Strings::packSSH2('sN', $salt, $rounds); + $crypto = new AES('ctr'); + $crypto->setPassword($password, 'bcrypt', $salt, $rounds, 32); + $paddedKey = $crypto->encrypt($paddedKey); + $key = Strings::packSSH2('sssNss', 'aes256-ctr', 'bcrypt', $kdfoptions, 1, $publicKey, $paddedKey); + } + $key = "openssh-key-v1\x00{$key}"; + return "-----BEGIN OPENSSH PRIVATE KEY-----\n" . chunk_split(Strings::base64_encode($key), 70, "\n") . "-----END OPENSSH PRIVATE KEY-----\n"; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS.php new file mode 100644 index 0000000..8ac9018 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS.php @@ -0,0 +1,67 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys; + +/** + * PKCS1 Formatted Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS +{ + /** + * Auto-detect the format + */ + const MODE_ANY = 0; + /** + * Require base64-encoded PEM's be supplied + */ + const MODE_PEM = 1; + /** + * Require raw DER's be supplied + */ + const MODE_DER = 2; + /**#@-*/ + /** + * Is the key a base-64 encoded PEM, DER or should it be auto-detected? + * + * @var int + */ + protected static $format = self::MODE_ANY; + /** + * Require base64-encoded PEM's be supplied + * + */ + public static function requirePEM() + { + self::$format = self::MODE_PEM; + } + /** + * Require raw DER's be supplied + * + */ + public static function requireDER() + { + self::$format = self::MODE_DER; + } + /** + * Accept any format and auto detect the format + * + * This is the default setting + * + */ + public static function requireAny() + { + self::$format = self::MODE_ANY; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS1.php new file mode 100644 index 0000000..0c8a587 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS1.php @@ -0,0 +1,187 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\AES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\TripleDES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PKCS1 Formatted Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS1 extends PKCS +{ + /** + * Default encryption algorithm + * + * @var string + */ + private static $defaultEncryptionAlgorithm = 'AES-128-CBC'; + /** + * Sets the default encryption algorithm + * + * @param string $algo + */ + public static function setEncryptionAlgorithm($algo) + { + self::$defaultEncryptionAlgorithm = $algo; + } + /** + * Returns the mode constant corresponding to the mode string + * + * @param string $mode + * @return int + * @throws \UnexpectedValueException if the block cipher mode is unsupported + */ + private static function getEncryptionMode($mode) + { + switch ($mode) { + case 'CBC': + case 'ECB': + case 'CFB': + case 'OFB': + case 'CTR': + return $mode; + } + throw new \UnexpectedValueException('Unsupported block cipher mode of operation'); + } + /** + * Returns a cipher object corresponding to a string + * + * @param string $algo + * @return string + * @throws \UnexpectedValueException if the encryption algorithm is unsupported + */ + private static function getEncryptionObject($algo) + { + $modes = '(CBC|ECB|CFB|OFB|CTR)'; + switch (\true) { + case preg_match("#^AES-(128|192|256)-{$modes}\$#", $algo, $matches): + $cipher = new AES(self::getEncryptionMode($matches[2])); + $cipher->setKeyLength($matches[1]); + return $cipher; + case preg_match("#^DES-EDE3-{$modes}\$#", $algo, $matches): + return new TripleDES(self::getEncryptionMode($matches[1])); + case preg_match("#^DES-{$modes}\$#", $algo, $matches): + return new DES(self::getEncryptionMode($matches[1])); + default: + throw new UnsupportedAlgorithmException($algo . ' is not a supported algorithm'); + } + } + /** + * Generate a symmetric key for PKCS#1 keys + * + * @param string $password + * @param string $iv + * @param int $length + * @return string + */ + private static function generateSymmetricKey($password, $iv, $length) + { + $symkey = ''; + $iv = substr($iv, 0, 8); + while (strlen($symkey) < $length) { + $symkey .= md5($symkey . $password . $iv, \true); + } + return substr($symkey, 0, $length); + } + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + protected static function load($key, $password) + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + /* Although PKCS#1 proposes a format that public and private keys can use, encrypting them is + "outside the scope" of PKCS#1. PKCS#1 then refers you to PKCS#12 and PKCS#15 if you're wanting to + protect private keys, however, that's not what OpenSSL* does. OpenSSL protects private keys by adding + two new "fields" to the key - DEK-Info and Proc-Type. These fields are discussed here: + + http://tools.ietf.org/html/rfc1421#section-4.6.1.1 + http://tools.ietf.org/html/rfc1421#section-4.6.1.3 + + DES-EDE3-CBC as an algorithm, however, is not discussed anywhere, near as I can tell. + DES-CBC and DES-EDE are discussed in RFC1423, however, DES-EDE3-CBC isn't, nor is its key derivation + function. As is, the definitive authority on this encoding scheme isn't the IETF but rather OpenSSL's + own implementation. ie. the implementation *is* the standard and any bugs that may exist in that + implementation are part of the standard, as well. + + * OpenSSL is the de facto standard. It's utilized by OpenSSH and other projects */ + if (preg_match('#DEK-Info: (.+),(.+)#', $key, $matches)) { + $iv = Strings::hex2bin(trim($matches[2])); + // remove the Proc-Type / DEK-Info sections as they're no longer needed + $key = preg_replace('#^(?:Proc-Type|DEK-Info): .*#m', '', $key); + $ciphertext = ASN1::extractBER($key); + if ($ciphertext === \false) { + $ciphertext = $key; + } + $crypto = self::getEncryptionObject($matches[1]); + $crypto->setKey(self::generateSymmetricKey($password, $iv, $crypto->getKeyLength() >> 3)); + $crypto->setIV($iv); + $key = $crypto->decrypt($ciphertext); + } else { + if (self::$format != self::MODE_DER) { + $decoded = ASN1::extractBER($key); + if ($decoded !== \false) { + $key = $decoded; + } elseif (self::$format == self::MODE_PEM) { + throw new \UnexpectedValueException('Expected base64-encoded PEM format but was unable to decode base64 text'); + } + } + } + return $key; + } + /** + * Wrap a private key appropriately + * + * @param string $key + * @param string $type + * @param string $password + * @param array $options optional + * @return string + */ + protected static function wrapPrivateKey($key, $type, $password, array $options = []) + { + if (empty($password) || !is_string($password)) { + return "-----BEGIN {$type} PRIVATE KEY-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END {$type} PRIVATE KEY-----"; + } + $encryptionAlgorithm = isset($options['encryptionAlgorithm']) ? $options['encryptionAlgorithm'] : self::$defaultEncryptionAlgorithm; + $cipher = self::getEncryptionObject($encryptionAlgorithm); + $iv = Random::string($cipher->getBlockLength() >> 3); + $cipher->setKey(self::generateSymmetricKey($password, $iv, $cipher->getKeyLength() >> 3)); + $cipher->setIV($iv); + $iv = strtoupper(Strings::bin2hex($iv)); + return "-----BEGIN {$type} PRIVATE KEY-----\r\n" . "Proc-Type: 4,ENCRYPTED\r\n" . "DEK-Info: " . $encryptionAlgorithm . ",{$iv}\r\n" . "\r\n" . chunk_split(Strings::base64_encode($cipher->encrypt($key)), 64) . "-----END {$type} PRIVATE KEY-----"; + } + /** + * Wrap a public key appropriately + * + * @param string $key + * @param string $type + * @return string + */ + protected static function wrapPublicKey($key, $type) + { + return "-----BEGIN {$type} PUBLIC KEY-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END {$type} PUBLIC KEY-----"; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php new file mode 100644 index 0000000..46108cf --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php @@ -0,0 +1,599 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\AES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RC2; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RC4; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\TripleDES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +/** + * PKCS#8 Formatted Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS8 extends PKCS +{ + /** + * Default encryption algorithm + * + * @var string + */ + private static $defaultEncryptionAlgorithm = 'id-PBES2'; + /** + * Default encryption scheme + * + * Only used when defaultEncryptionAlgorithm is id-PBES2 + * + * @var string + */ + private static $defaultEncryptionScheme = 'aes128-CBC-PAD'; + /** + * Default PRF + * + * Only used when defaultEncryptionAlgorithm is id-PBES2 + * + * @var string + */ + private static $defaultPRF = 'id-hmacWithSHA256'; + /** + * Default Iteration Count + * + * @var int + */ + private static $defaultIterationCount = 2048; + /** + * OIDs loaded + * + * @var bool + */ + private static $oidsLoaded = \false; + /** + * Sets the default encryption algorithm + * + * @param string $algo + */ + public static function setEncryptionAlgorithm($algo) + { + self::$defaultEncryptionAlgorithm = $algo; + } + /** + * Sets the default encryption algorithm for PBES2 + * + * @param string $algo + */ + public static function setEncryptionScheme($algo) + { + self::$defaultEncryptionScheme = $algo; + } + /** + * Sets the iteration count + * + * @param int $count + */ + public static function setIterationCount($count) + { + self::$defaultIterationCount = $count; + } + /** + * Sets the PRF for PBES2 + * + * @param string $algo + */ + public static function setPRF($algo) + { + self::$defaultPRF = $algo; + } + /** + * Returns a SymmetricKey object based on a PBES1 $algo + * + * @return \phpseclib3\Crypt\Common\SymmetricKey + * @param string $algo + */ + private static function getPBES1EncryptionObject($algo) + { + $algo = preg_match('#^pbeWith(?:MD2|MD5|SHA1|SHA)And(.*?)-CBC$#', $algo, $matches) ? $matches[1] : substr($algo, 13); + // strlen('pbeWithSHAAnd') == 13 + switch ($algo) { + case 'DES': + $cipher = new DES('cbc'); + break; + case 'RC2': + $cipher = new RC2('cbc'); + $cipher->setKeyLength(64); + break; + case '3-KeyTripleDES': + $cipher = new TripleDES('cbc'); + break; + case '2-KeyTripleDES': + $cipher = new TripleDES('cbc'); + $cipher->setKeyLength(128); + break; + case '128BitRC2': + $cipher = new RC2('cbc'); + $cipher->setKeyLength(128); + break; + case '40BitRC2': + $cipher = new RC2('cbc'); + $cipher->setKeyLength(40); + break; + case '128BitRC4': + $cipher = new RC4(); + $cipher->setKeyLength(128); + break; + case '40BitRC4': + $cipher = new RC4(); + $cipher->setKeyLength(40); + break; + default: + throw new UnsupportedAlgorithmException("{$algo} is not a supported algorithm"); + } + return $cipher; + } + /** + * Returns a hash based on a PBES1 $algo + * + * @return string + * @param string $algo + */ + private static function getPBES1Hash($algo) + { + if (preg_match('#^pbeWith(MD2|MD5|SHA1|SHA)And.*?-CBC$#', $algo, $matches)) { + return $matches[1] == 'SHA' ? 'sha1' : $matches[1]; + } + return 'sha1'; + } + /** + * Returns a KDF baesd on a PBES1 $algo + * + * @return string + * @param string $algo + */ + private static function getPBES1KDF($algo) + { + switch ($algo) { + case 'pbeWithMD2AndDES-CBC': + case 'pbeWithMD2AndRC2-CBC': + case 'pbeWithMD5AndDES-CBC': + case 'pbeWithMD5AndRC2-CBC': + case 'pbeWithSHA1AndDES-CBC': + case 'pbeWithSHA1AndRC2-CBC': + return 'pbkdf1'; + } + return 'pkcs12'; + } + /** + * Returns a SymmetricKey object baesd on a PBES2 $algo + * + * @return SymmetricKey + * @param string $algo + */ + private static function getPBES2EncryptionObject($algo) + { + switch ($algo) { + case 'desCBC': + $cipher = new DES('cbc'); + break; + case 'des-EDE3-CBC': + $cipher = new TripleDES('cbc'); + break; + case 'rc2CBC': + $cipher = new RC2('cbc'); + // in theory this can be changed + $cipher->setKeyLength(128); + break; + case 'rc5-CBC-PAD': + throw new UnsupportedAlgorithmException('rc5-CBC-PAD is not supported for PBES2 PKCS#8 keys'); + case 'aes128-CBC-PAD': + case 'aes192-CBC-PAD': + case 'aes256-CBC-PAD': + $cipher = new AES('cbc'); + $cipher->setKeyLength(substr($algo, 3, 3)); + break; + default: + throw new UnsupportedAlgorithmException("{$algo} is not supported"); + } + return $cipher; + } + /** + * Initialize static variables + * + */ + private static function initialize_static_variables() + { + if (!isset(static::$childOIDsLoaded)) { + throw new InsufficientSetupException('This class should not be called directly'); + } + if (!static::$childOIDsLoaded) { + ASN1::loadOIDs(is_array(static::OID_NAME) ? array_combine(static::OID_NAME, static::OID_VALUE) : [static::OID_NAME => static::OID_VALUE]); + static::$childOIDsLoaded = \true; + } + if (!self::$oidsLoaded) { + // from https://tools.ietf.org/html/rfc2898 + ASN1::loadOIDs([ + // PBES1 encryption schemes + 'pbeWithMD2AndDES-CBC' => '1.2.840.113549.1.5.1', + 'pbeWithMD2AndRC2-CBC' => '1.2.840.113549.1.5.4', + 'pbeWithMD5AndDES-CBC' => '1.2.840.113549.1.5.3', + 'pbeWithMD5AndRC2-CBC' => '1.2.840.113549.1.5.6', + 'pbeWithSHA1AndDES-CBC' => '1.2.840.113549.1.5.10', + 'pbeWithSHA1AndRC2-CBC' => '1.2.840.113549.1.5.11', + // from PKCS#12: + // https://tools.ietf.org/html/rfc7292 + 'pbeWithSHAAnd128BitRC4' => '1.2.840.113549.1.12.1.1', + 'pbeWithSHAAnd40BitRC4' => '1.2.840.113549.1.12.1.2', + 'pbeWithSHAAnd3-KeyTripleDES-CBC' => '1.2.840.113549.1.12.1.3', + 'pbeWithSHAAnd2-KeyTripleDES-CBC' => '1.2.840.113549.1.12.1.4', + 'pbeWithSHAAnd128BitRC2-CBC' => '1.2.840.113549.1.12.1.5', + 'pbeWithSHAAnd40BitRC2-CBC' => '1.2.840.113549.1.12.1.6', + 'id-PBKDF2' => '1.2.840.113549.1.5.12', + 'id-PBES2' => '1.2.840.113549.1.5.13', + 'id-PBMAC1' => '1.2.840.113549.1.5.14', + // from PKCS#5 v2.1: + // http://www.rsa.com/rsalabs/pkcs/files/h11302-wp-pkcs5v2-1-password-based-cryptography-standard.pdf + 'id-hmacWithSHA1' => '1.2.840.113549.2.7', + 'id-hmacWithSHA224' => '1.2.840.113549.2.8', + 'id-hmacWithSHA256' => '1.2.840.113549.2.9', + 'id-hmacWithSHA384' => '1.2.840.113549.2.10', + 'id-hmacWithSHA512' => '1.2.840.113549.2.11', + 'id-hmacWithSHA512-224' => '1.2.840.113549.2.12', + 'id-hmacWithSHA512-256' => '1.2.840.113549.2.13', + 'desCBC' => '1.3.14.3.2.7', + 'des-EDE3-CBC' => '1.2.840.113549.3.7', + 'rc2CBC' => '1.2.840.113549.3.2', + 'rc5-CBC-PAD' => '1.2.840.113549.3.9', + 'aes128-CBC-PAD' => '2.16.840.1.101.3.4.1.2', + 'aes192-CBC-PAD' => '2.16.840.1.101.3.4.1.22', + 'aes256-CBC-PAD' => '2.16.840.1.101.3.4.1.42', + ]); + self::$oidsLoaded = \true; + } + } + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + protected static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + $isPublic = strpos($key, 'PUBLIC') !== \false; + $isPrivate = strpos($key, 'PRIVATE') !== \false; + $decoded = self::preParse($key); + $meta = []; + $decrypted = ASN1::asn1map($decoded[0], Maps\EncryptedPrivateKeyInfo::MAP); + if (strlen($password) && is_array($decrypted)) { + $algorithm = $decrypted['encryptionAlgorithm']['algorithm']; + switch ($algorithm) { + // PBES1 + case 'pbeWithMD2AndDES-CBC': + case 'pbeWithMD2AndRC2-CBC': + case 'pbeWithMD5AndDES-CBC': + case 'pbeWithMD5AndRC2-CBC': + case 'pbeWithSHA1AndDES-CBC': + case 'pbeWithSHA1AndRC2-CBC': + case 'pbeWithSHAAnd3-KeyTripleDES-CBC': + case 'pbeWithSHAAnd2-KeyTripleDES-CBC': + case 'pbeWithSHAAnd128BitRC2-CBC': + case 'pbeWithSHAAnd40BitRC2-CBC': + case 'pbeWithSHAAnd128BitRC4': + case 'pbeWithSHAAnd40BitRC4': + $cipher = self::getPBES1EncryptionObject($algorithm); + $hash = self::getPBES1Hash($algorithm); + $kdf = self::getPBES1KDF($algorithm); + $meta['meta']['algorithm'] = $algorithm; + $temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); + if (!$temp) { + throw new \RuntimeException('Unable to decode BER'); + } + extract(ASN1::asn1map($temp[0], Maps\PBEParameter::MAP)); + $iterationCount = (int) $iterationCount->toString(); + $cipher->setPassword($password, $kdf, $hash, $salt, $iterationCount); + $key = $cipher->decrypt($decrypted['encryptedData']); + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER 2'); + } + break; + case 'id-PBES2': + $meta['meta']['algorithm'] = $algorithm; + $temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); + if (!$temp) { + throw new \RuntimeException('Unable to decode BER'); + } + $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); + extract($temp); + $cipher = self::getPBES2EncryptionObject($encryptionScheme['algorithm']); + $meta['meta']['cipher'] = $encryptionScheme['algorithm']; + $temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); + if (!$temp) { + throw new \RuntimeException('Unable to decode BER'); + } + $temp = ASN1::asn1map($temp[0], Maps\PBES2params::MAP); + extract($temp); + if (!$cipher instanceof RC2) { + $cipher->setIV($encryptionScheme['parameters']['octetString']); + } else { + $temp = ASN1::decodeBER($encryptionScheme['parameters']); + if (!$temp) { + throw new \RuntimeException('Unable to decode BER'); + } + extract(ASN1::asn1map($temp[0], Maps\RC2CBCParameter::MAP)); + $effectiveKeyLength = (int) $rc2ParametersVersion->toString(); + switch ($effectiveKeyLength) { + case 160: + $effectiveKeyLength = 40; + break; + case 120: + $effectiveKeyLength = 64; + break; + case 58: + $effectiveKeyLength = 128; + break; + } + $cipher->setIV($iv); + $cipher->setKeyLength($effectiveKeyLength); + } + $meta['meta']['keyDerivationFunc'] = $keyDerivationFunc['algorithm']; + switch ($keyDerivationFunc['algorithm']) { + case 'id-PBKDF2': + $temp = ASN1::decodeBER($keyDerivationFunc['parameters']); + if (!$temp) { + throw new \RuntimeException('Unable to decode BER'); + } + $prf = ['algorithm' => 'id-hmacWithSHA1']; + $params = ASN1::asn1map($temp[0], Maps\PBKDF2params::MAP); + extract($params); + $meta['meta']['prf'] = $prf['algorithm']; + $hash = str_replace('-', '/', substr($prf['algorithm'], 11)); + $params = [$password, 'pbkdf2', $hash, $salt, (int) $iterationCount->toString()]; + if (isset($keyLength)) { + $params[] = (int) $keyLength->toString(); + } + $cipher->setPassword(...$params); + $key = $cipher->decrypt($decrypted['encryptedData']); + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER 3'); + } + break; + default: + throw new UnsupportedAlgorithmException('Only PBKDF2 is supported for PBES2 PKCS#8 keys'); + } + break; + case 'id-PBMAC1': + //$temp = ASN1::decodeBER($decrypted['encryptionAlgorithm']['parameters']); + //$value = ASN1::asn1map($temp[0], Maps\PBMAC1params::MAP); + // since i can't find any implementation that does PBMAC1 it is unsupported + throw new UnsupportedAlgorithmException('Only PBES1 and PBES2 PKCS#8 keys are supported.'); + } + } + $private = ASN1::asn1map($decoded[0], Maps\OneAsymmetricKey::MAP); + if (is_array($private)) { + if ($isPublic) { + throw new \UnexpectedValueException('Human readable string claims public key but DER encoded string claims private key'); + } + if (isset($private['privateKeyAlgorithm']['parameters']) && !$private['privateKeyAlgorithm']['parameters'] instanceof ASN1\Element && isset($decoded[0]['content'][1]['content'][1])) { + $temp = $decoded[0]['content'][1]['content'][1]; + $private['privateKeyAlgorithm']['parameters'] = new ASN1\Element(substr($key, $temp['start'], $temp['length'])); + } + if (is_array(static::OID_NAME)) { + if (!in_array($private['privateKeyAlgorithm']['algorithm'], static::OID_NAME)) { + throw new UnsupportedAlgorithmException($private['privateKeyAlgorithm']['algorithm'] . ' is not a supported key type'); + } + } else { + if ($private['privateKeyAlgorithm']['algorithm'] != static::OID_NAME) { + throw new UnsupportedAlgorithmException('Only ' . static::OID_NAME . ' keys are supported; this is a ' . $private['privateKeyAlgorithm']['algorithm'] . ' key'); + } + } + if (isset($private['publicKey'])) { + if ($private['publicKey'][0] != "\x00") { + throw new \UnexpectedValueException('The first byte of the public key should be null - not ' . bin2hex($private['publicKey'][0])); + } + $private['publicKey'] = substr($private['publicKey'], 1); + } + return $private + $meta; + } + // EncryptedPrivateKeyInfo and PublicKeyInfo have largely identical "signatures". the only difference + // is that the former has an octet string and the later has a bit string. the first byte of a bit + // string represents the number of bits in the last byte that are to be ignored but, currently, + // bit strings wanting a non-zero amount of bits trimmed are not supported + $public = ASN1::asn1map($decoded[0], Maps\PublicKeyInfo::MAP); + if (is_array($public)) { + if ($isPrivate) { + throw new \UnexpectedValueException('Human readable string claims private key but DER encoded string claims public key'); + } + if ($public['publicKey'][0] != "\x00") { + throw new \UnexpectedValueException('The first byte of the public key should be null - not ' . bin2hex($public['publicKey'][0])); + } + if (is_array(static::OID_NAME)) { + if (!in_array($public['publicKeyAlgorithm']['algorithm'], static::OID_NAME)) { + throw new UnsupportedAlgorithmException($public['publicKeyAlgorithm']['algorithm'] . ' is not a supported key type'); + } + } else { + if ($public['publicKeyAlgorithm']['algorithm'] != static::OID_NAME) { + throw new UnsupportedAlgorithmException('Only ' . static::OID_NAME . ' keys are supported; this is a ' . $public['publicKeyAlgorithm']['algorithm'] . ' key'); + } + } + if (isset($public['publicKeyAlgorithm']['parameters']) && !$public['publicKeyAlgorithm']['parameters'] instanceof ASN1\Element && isset($decoded[0]['content'][0]['content'][1])) { + $temp = $decoded[0]['content'][0]['content'][1]; + $public['publicKeyAlgorithm']['parameters'] = new ASN1\Element(substr($key, $temp['start'], $temp['length'])); + } + $public['publicKey'] = substr($public['publicKey'], 1); + return $public; + } + throw new \RuntimeException('Unable to parse using either OneAsymmetricKey or PublicKeyInfo ASN1 maps'); + } + /** + * Wrap a private key appropriately + * + * @param string $key + * @param string $attr + * @param mixed $params + * @param string $password + * @param string $oid optional + * @param string $publicKey optional + * @param array $options optional + * @return string + */ + protected static function wrapPrivateKey($key, $attr, $params, $password, $oid = null, $publicKey = '', array $options = []) + { + self::initialize_static_variables(); + $key = ['version' => 'v1', 'privateKeyAlgorithm' => ['algorithm' => is_string(static::OID_NAME) ? static::OID_NAME : $oid], 'privateKey' => $key]; + if ($oid != 'id-Ed25519' && $oid != 'id-Ed448') { + $key['privateKeyAlgorithm']['parameters'] = $params; + } + if (!empty($attr)) { + $key['attributes'] = $attr; + } + if (!empty($publicKey)) { + $key['version'] = 'v2'; + $key['publicKey'] = $publicKey; + } + $key = ASN1::encodeDER($key, Maps\OneAsymmetricKey::MAP); + if (!empty($password) && is_string($password)) { + $salt = Random::string(8); + $iterationCount = isset($options['iterationCount']) ? $options['iterationCount'] : self::$defaultIterationCount; + $encryptionAlgorithm = isset($options['encryptionAlgorithm']) ? $options['encryptionAlgorithm'] : self::$defaultEncryptionAlgorithm; + $encryptionScheme = isset($options['encryptionScheme']) ? $options['encryptionScheme'] : self::$defaultEncryptionScheme; + $prf = isset($options['PRF']) ? $options['PRF'] : self::$defaultPRF; + if ($encryptionAlgorithm == 'id-PBES2') { + $crypto = self::getPBES2EncryptionObject($encryptionScheme); + $hash = str_replace('-', '/', substr($prf, 11)); + $kdf = 'pbkdf2'; + $iv = Random::string($crypto->getBlockLength() >> 3); + $PBKDF2params = ['salt' => $salt, 'iterationCount' => $iterationCount, 'prf' => ['algorithm' => $prf, 'parameters' => null]]; + $PBKDF2params = ASN1::encodeDER($PBKDF2params, Maps\PBKDF2params::MAP); + if (!$crypto instanceof RC2) { + $params = ['octetString' => $iv]; + } else { + $params = ['rc2ParametersVersion' => 58, 'iv' => $iv]; + $params = ASN1::encodeDER($params, Maps\RC2CBCParameter::MAP); + $params = new ASN1\Element($params); + } + $params = ['keyDerivationFunc' => ['algorithm' => 'id-PBKDF2', 'parameters' => new ASN1\Element($PBKDF2params)], 'encryptionScheme' => ['algorithm' => $encryptionScheme, 'parameters' => $params]]; + $params = ASN1::encodeDER($params, Maps\PBES2params::MAP); + $crypto->setIV($iv); + } else { + $crypto = self::getPBES1EncryptionObject($encryptionAlgorithm); + $hash = self::getPBES1Hash($encryptionAlgorithm); + $kdf = self::getPBES1KDF($encryptionAlgorithm); + $params = ['salt' => $salt, 'iterationCount' => $iterationCount]; + $params = ASN1::encodeDER($params, Maps\PBEParameter::MAP); + } + $crypto->setPassword($password, $kdf, $hash, $salt, $iterationCount); + $key = $crypto->encrypt($key); + $key = ['encryptionAlgorithm' => ['algorithm' => $encryptionAlgorithm, 'parameters' => new ASN1\Element($params)], 'encryptedData' => $key]; + $key = ASN1::encodeDER($key, Maps\EncryptedPrivateKeyInfo::MAP); + return "-----BEGIN ENCRYPTED PRIVATE KEY-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END ENCRYPTED PRIVATE KEY-----"; + } + return "-----BEGIN PRIVATE KEY-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END PRIVATE KEY-----"; + } + /** + * Wrap a public key appropriately + * + * @param string $key + * @param mixed $params + * @param string $oid + * @return string + */ + protected static function wrapPublicKey($key, $params, $oid = null) + { + self::initialize_static_variables(); + $key = ['publicKeyAlgorithm' => ['algorithm' => is_string(static::OID_NAME) ? static::OID_NAME : $oid], 'publicKey' => "\x00" . $key]; + if ($oid != 'id-Ed25519' && $oid != 'id-Ed448') { + $key['publicKeyAlgorithm']['parameters'] = $params; + } + $key = ASN1::encodeDER($key, Maps\PublicKeyInfo::MAP); + return "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END PUBLIC KEY-----"; + } + /** + * Perform some preliminary parsing of the key + * + * @param string $key + * @return array + */ + private static function preParse(&$key) + { + self::initialize_static_variables(); + if (self::$format != self::MODE_DER) { + $decoded = ASN1::extractBER($key); + if ($decoded !== \false) { + $key = $decoded; + } elseif (self::$format == self::MODE_PEM) { + throw new \UnexpectedValueException('Expected base64-encoded PEM format but was unable to decode base64 text'); + } + } + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + return $decoded; + } + /** + * Returns the encryption parameters used by the key + * + * @param string $key + * @return array + */ + public static function extractEncryptionAlgorithm($key) + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + $decoded = self::preParse($key); + $r = ASN1::asn1map($decoded[0], ASN1\Maps\EncryptedPrivateKeyInfo::MAP); + if (!is_array($r)) { + throw new \RuntimeException('Unable to parse using EncryptedPrivateKeyInfo map'); + } + if ($r['encryptionAlgorithm']['algorithm'] == 'id-PBES2') { + $decoded = ASN1::decodeBER($r['encryptionAlgorithm']['parameters']->element); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $r['encryptionAlgorithm']['parameters'] = ASN1::asn1map($decoded[0], ASN1\Maps\PBES2params::MAP); + $kdf =& $r['encryptionAlgorithm']['parameters']['keyDerivationFunc']; + switch ($kdf['algorithm']) { + case 'id-PBKDF2': + $decoded = ASN1::decodeBER($kdf['parameters']->element); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $kdf['parameters'] = ASN1::asn1map($decoded[0], Maps\PBKDF2params::MAP); + } + } + return $r['encryptionAlgorithm']; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php new file mode 100644 index 0000000..ddcb6cb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php @@ -0,0 +1,324 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\AES; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +/** + * PuTTY Formatted Key Handler + * + * @author Jim Wigginton + */ +abstract class PuTTY +{ + /** + * Default comment + * + * @var string + */ + private static $comment = 'phpseclib-generated-key'; + /** + * Default version + * + * @var int + */ + private static $version = 2; + /** + * Sets the default comment + * + * @param string $comment + */ + public static function setComment($comment) + { + self::$comment = str_replace(["\r", "\n"], '', $comment); + } + /** + * Sets the default version + * + * @param int $version + */ + public static function setVersion($version) + { + if ($version != 2 && $version != 3) { + throw new \RuntimeException('Only supported versions are 2 and 3'); + } + self::$version = $version; + } + /** + * Generate a symmetric key for PuTTY v2 keys + * + * @param string $password + * @param int $length + * @return string + */ + private static function generateV2Key($password, $length) + { + $symkey = ''; + $sequence = 0; + while (strlen($symkey) < $length) { + $temp = pack('Na*', $sequence++, $password); + $symkey .= Strings::hex2bin(sha1($temp)); + } + return substr($symkey, 0, $length); + } + /** + * Generate a symmetric key for PuTTY v3 keys + * + * @param string $password + * @param string $flavour + * @param int $memory + * @param int $passes + * @param string $salt + * @return array + */ + private static function generateV3Key($password, $flavour, $memory, $passes, $salt) + { + if (!function_exists('sodium_crypto_pwhash')) { + throw new \RuntimeException('sodium_crypto_pwhash needs to exist for Argon2 password hasing'); + } + switch ($flavour) { + case 'Argon2i': + $flavour = \SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13; + break; + case 'Argon2id': + $flavour = \SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13; + break; + default: + throw new UnsupportedAlgorithmException('Only Argon2i and Argon2id are supported'); + } + $length = 80; + // keylen + ivlen + mac_keylen + $temp = sodium_crypto_pwhash($length, $password, $salt, $passes, $memory << 10, $flavour); + $symkey = substr($temp, 0, 32); + $symiv = substr($temp, 32, 16); + $hashkey = substr($temp, -32); + return compact('symkey', 'symiv', 'hashkey'); + } + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password + * @return array + */ + public static function load($key, $password) + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + if (strpos($key, 'BEGIN SSH2 PUBLIC KEY') !== \false) { + $lines = preg_split('#[\\r\\n]+#', $key); + switch (\true) { + case $lines[0] != '---- BEGIN SSH2 PUBLIC KEY ----': + throw new \UnexpectedValueException('Key doesn\'t start with ---- BEGIN SSH2 PUBLIC KEY ----'); + case $lines[count($lines) - 1] != '---- END SSH2 PUBLIC KEY ----': + throw new \UnexpectedValueException('Key doesn\'t end with ---- END SSH2 PUBLIC KEY ----'); + } + $lines = array_splice($lines, 1, -1); + $lines = array_map(function ($line) { + return rtrim($line, "\r\n"); + }, $lines); + $data = $current = ''; + $values = []; + $in_value = \false; + foreach ($lines as $line) { + switch (\true) { + case preg_match('#^(.*?): (.*)#', $line, $match): + $in_value = $line[strlen($line) - 1] == '\\'; + $current = strtolower($match[1]); + $values[$current] = $in_value ? substr($match[2], 0, -1) : $match[2]; + break; + case $in_value: + $in_value = $line[strlen($line) - 1] == '\\'; + $values[$current] .= $in_value ? substr($line, 0, -1) : $line; + break; + default: + $data .= $line; + } + } + $components = call_user_func([static::PUBLIC_HANDLER, 'load'], $data); + if ($components === \false) { + throw new \UnexpectedValueException('Unable to decode public key'); + } + $components += $values; + $components['comment'] = str_replace(['\\\\', '\\"'], ['\\', '"'], $values['comment']); + return $components; + } + $components = []; + $key = preg_split('#\\r\\n|\\r|\\n#', trim($key)); + if (Strings::shift($key[0], strlen('PuTTY-User-Key-File-')) != 'PuTTY-User-Key-File-') { + return \false; + } + $version = (int) Strings::shift($key[0], 3); + // should be either "2: " or "3: 0" prior to int casting + if ($version != 2 && $version != 3) { + throw new \RuntimeException('Only v2 and v3 PuTTY private keys are supported'); + } + $components['type'] = $type = rtrim($key[0]); + if (!in_array($type, static::$types)) { + $error = count(static::$types) == 1 ? 'Only ' . static::$types[0] . ' keys are supported. ' : ''; + throw new UnsupportedAlgorithmException($error . 'This is an unsupported ' . $type . ' key'); + } + $encryption = trim(preg_replace('#Encryption: (.+)#', '$1', $key[1])); + $components['comment'] = trim(preg_replace('#Comment: (.+)#', '$1', $key[2])); + $publicLength = trim(preg_replace('#Public-Lines: (\\d+)#', '$1', $key[3])); + $public = Strings::base64_decode(implode('', array_map('trim', array_slice($key, 4, $publicLength)))); + $source = Strings::packSSH2('ssss', $type, $encryption, $components['comment'], $public); + extract(unpack('Nlength', Strings::shift($public, 4))); + $newtype = Strings::shift($public, $length); + if ($newtype != $type) { + throw new \RuntimeException('The binary type does not match the human readable type field'); + } + $components['public'] = $public; + switch ($version) { + case 3: + $hashkey = ''; + break; + case 2: + $hashkey = 'putty-private-key-file-mac-key'; + } + $offset = $publicLength + 4; + switch ($encryption) { + case 'aes256-cbc': + $crypto = new AES('cbc'); + switch ($version) { + case 3: + $flavour = trim(preg_replace('#Key-Derivation: (.*)#', '$1', $key[$offset++])); + $memory = trim(preg_replace('#Argon2-Memory: (\\d+)#', '$1', $key[$offset++])); + $passes = trim(preg_replace('#Argon2-Passes: (\\d+)#', '$1', $key[$offset++])); + $parallelism = trim(preg_replace('#Argon2-Parallelism: (\\d+)#', '$1', $key[$offset++])); + $salt = Strings::hex2bin(trim(preg_replace('#Argon2-Salt: ([0-9a-f]+)#', '$1', $key[$offset++]))); + extract(self::generateV3Key($password, $flavour, $memory, $passes, $salt)); + break; + case 2: + $symkey = self::generateV2Key($password, 32); + $symiv = str_repeat("\x00", $crypto->getBlockLength() >> 3); + $hashkey .= $password; + } + } + switch ($version) { + case 3: + $hash = new Hash('sha256'); + $hash->setKey($hashkey); + break; + case 2: + $hash = new Hash('sha1'); + $hash->setKey(sha1($hashkey, \true)); + } + $privateLength = trim(preg_replace('#Private-Lines: (\\d+)#', '$1', $key[$offset++])); + $private = Strings::base64_decode(implode('', array_map('trim', array_slice($key, $offset, $privateLength)))); + if ($encryption != 'none') { + $crypto->setKey($symkey); + $crypto->setIV($symiv); + $crypto->disablePadding(); + $private = $crypto->decrypt($private); + } + $source .= Strings::packSSH2('s', $private); + $hmac = trim(preg_replace('#Private-MAC: (.+)#', '$1', $key[$offset + $privateLength])); + $hmac = Strings::hex2bin($hmac); + if (!hash_equals($hash->hash($source), $hmac)) { + throw new \UnexpectedValueException('MAC validation error'); + } + $components['private'] = $private; + return $components; + } + /** + * Wrap a private key appropriately + * + * @param string $public + * @param string $private + * @param string $type + * @param string $password + * @param array $options optional + * @return string + */ + protected static function wrapPrivateKey($public, $private, $type, $password, array $options = []) + { + $encryption = !empty($password) || is_string($password) ? 'aes256-cbc' : 'none'; + $comment = isset($options['comment']) ? $options['comment'] : self::$comment; + $version = isset($options['version']) ? $options['version'] : self::$version; + $key = "PuTTY-User-Key-File-{$version}: {$type}\r\n"; + $key .= "Encryption: {$encryption}\r\n"; + $key .= "Comment: {$comment}\r\n"; + $public = Strings::packSSH2('s', $type) . $public; + $source = Strings::packSSH2('ssss', $type, $encryption, $comment, $public); + $public = Strings::base64_encode($public); + $key .= "Public-Lines: " . (strlen($public) + 63 >> 6) . "\r\n"; + $key .= chunk_split($public, 64); + if (empty($password) && !is_string($password)) { + $source .= Strings::packSSH2('s', $private); + switch ($version) { + case 3: + $hash = new Hash('sha256'); + $hash->setKey(''); + break; + case 2: + $hash = new Hash('sha1'); + $hash->setKey(sha1('putty-private-key-file-mac-key', \true)); + } + } else { + $private .= Random::string(16 - (strlen($private) & 15)); + $source .= Strings::packSSH2('s', $private); + $crypto = new AES('cbc'); + switch ($version) { + case 3: + $salt = Random::string(16); + $key .= "Key-Derivation: Argon2id\r\n"; + $key .= "Argon2-Memory: 8192\r\n"; + $key .= "Argon2-Passes: 13\r\n"; + $key .= "Argon2-Parallelism: 1\r\n"; + $key .= "Argon2-Salt: " . Strings::bin2hex($salt) . "\r\n"; + extract(self::generateV3Key($password, 'Argon2id', 8192, 13, $salt)); + $hash = new Hash('sha256'); + $hash->setKey($hashkey); + break; + case 2: + $symkey = self::generateV2Key($password, 32); + $symiv = str_repeat("\x00", $crypto->getBlockLength() >> 3); + $hashkey = 'putty-private-key-file-mac-key' . $password; + $hash = new Hash('sha1'); + $hash->setKey(sha1($hashkey, \true)); + } + $crypto->setKey($symkey); + $crypto->setIV($symiv); + $crypto->disablePadding(); + $private = $crypto->encrypt($private); + $mac = $hash->hash($source); + } + $private = Strings::base64_encode($private); + $key .= 'Private-Lines: ' . (strlen($private) + 63 >> 6) . "\r\n"; + $key .= chunk_split($private, 64); + $key .= 'Private-MAC: ' . Strings::bin2hex($hash->hash($source)) . "\r\n"; + return $key; + } + /** + * Wrap a public key appropriately + * + * This is basically the format described in RFC 4716 (https://tools.ietf.org/html/rfc4716) + * + * @param string $key + * @param string $type + * @return string + */ + protected static function wrapPublicKey($key, $type) + { + $key = pack('Na*a*', strlen($type), $type, $key); + $key = "---- BEGIN SSH2 PUBLIC KEY ----\r\n" . 'Comment: "' . str_replace(['\\', '"'], ['\\\\', '\\"'], self::$comment) . "\"\r\n" . chunk_split(Strings::base64_encode($key), 64) . '---- END SSH2 PUBLIC KEY ----'; + return $key; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Signature/Raw.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Signature/Raw.php new file mode 100644 index 0000000..fd076e8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Signature/Raw.php @@ -0,0 +1,53 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Raw Signature Handler + * + * @author Jim Wigginton + */ +abstract class Raw +{ + /** + * Loads a signature + * + * @param array $sig + * @return array|bool + */ + public static function load($sig) + { + switch (\true) { + case !is_array($sig): + case !isset($sig['r']) || !isset($sig['s']): + case !$sig['r'] instanceof BigInteger: + case !$sig['s'] instanceof BigInteger: + return \false; + } + return ['r' => $sig['r'], 's' => $sig['s']]; + } + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @return string + */ + public static function save(BigInteger $r, BigInteger $s) + { + return compact('r', 's'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/PrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/PrivateKey.php new file mode 100644 index 0000000..36c6cb4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/PrivateKey.php @@ -0,0 +1,29 @@ + + * @copyright 2009 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; + +/** + * PrivateKey interface + * + * @author Jim Wigginton + */ +interface PrivateKey +{ + public function sign($message); + //public function decrypt($ciphertext); + public function getPublicKey(); + public function toString($type, array $options = []); + /** + * @param string|false $password + * @return mixed + */ + public function withPassword($password = \false); +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/PublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/PublicKey.php new file mode 100644 index 0000000..a46a1c9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/PublicKey.php @@ -0,0 +1,24 @@ + + * @copyright 2009 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; + +/** + * PublicKey interface + * + * @author Jim Wigginton + */ +interface PublicKey +{ + public function verify($message, $signature); + //public function encrypt($plaintext); + public function toString($type, array $options = []); + public function getFingerprint($algorithm); +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php new file mode 100644 index 0000000..1025ffd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php @@ -0,0 +1,51 @@ + + * @author Hans-Juergen Petrich + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; + +/** + * Base Class for all stream cipher classes + * + * @author Jim Wigginton + */ +abstract class StreamCipher extends SymmetricKey +{ + /** + * Block Length of the cipher + * + * Stream ciphers do not have a block size + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @var int + */ + protected $block_size = 0; + /** + * Default Constructor. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @return \phpseclib3\Crypt\Common\StreamCipher + */ + public function __construct() + { + parent::__construct('stream'); + } + /** + * Stream ciphers not use an IV + * + * @return bool + */ + public function usesIV() + { + return \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php new file mode 100644 index 0000000..cb729ca --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php @@ -0,0 +1,3096 @@ + + * @author Hans-Juergen Petrich + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Blowfish; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadDecryptionException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadModeException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InconsistentSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BinaryField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; +/** + * Base Class for all \phpseclib3\Crypt\* cipher classes + * + * @author Jim Wigginton + * @author Hans-Juergen Petrich + */ +abstract class SymmetricKey +{ + /** + * Encrypt / decrypt using the Counter mode. + * + * Set to -1 since that's what Crypt/Random.php uses to index the CTR mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29 + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_CTR = -1; + /** + * Encrypt / decrypt using the Electronic Code Book mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29 + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_ECB = 1; + /** + * Encrypt / decrypt using the Code Book Chaining mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29 + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_CBC = 2; + /** + * Encrypt / decrypt using the Cipher Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29 + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_CFB = 3; + /** + * Encrypt / decrypt using the Cipher Feedback mode (8bit) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_CFB8 = 7; + /** + * Encrypt / decrypt using the Output Feedback mode (8bit) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_OFB8 = 8; + /** + * Encrypt / decrypt using the Output Feedback mode. + * + * @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29 + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_OFB = 4; + /** + * Encrypt / decrypt using Galois/Counter mode. + * + * @link https://en.wikipedia.org/wiki/Galois/Counter_Mode + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_GCM = 5; + /** + * Encrypt / decrypt using streaming mode. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + */ + const MODE_STREAM = 6; + /** + * Mode Map + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const MODE_MAP = ['ctr' => self::MODE_CTR, 'ecb' => self::MODE_ECB, 'cbc' => self::MODE_CBC, 'cfb' => self::MODE_CFB, 'cfb8' => self::MODE_CFB8, 'ofb' => self::MODE_OFB, 'ofb8' => self::MODE_OFB8, 'gcm' => self::MODE_GCM, 'stream' => self::MODE_STREAM]; + /** + * Base value for the internal implementation $engine switch + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const ENGINE_INTERNAL = 1; + /** + * Base value for the eval() implementation $engine switch + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const ENGINE_EVAL = 2; + /** + * Base value for the mcrypt implementation $engine switch + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const ENGINE_MCRYPT = 3; + /** + * Base value for the openssl implementation $engine switch + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const ENGINE_OPENSSL = 4; + /** + * Base value for the libsodium implementation $engine switch + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const ENGINE_LIBSODIUM = 5; + /** + * Base value for the openssl / gcm implementation $engine switch + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + */ + const ENGINE_OPENSSL_GCM = 6; + /** + * Engine Reverse Map + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::getEngine() + */ + const ENGINE_MAP = [self::ENGINE_INTERNAL => 'PHP', self::ENGINE_EVAL => 'Eval', self::ENGINE_MCRYPT => 'mcrypt', self::ENGINE_OPENSSL => 'OpenSSL', self::ENGINE_LIBSODIUM => 'libsodium', self::ENGINE_OPENSSL_GCM => 'OpenSSL (GCM)']; + /** + * The Encryption Mode + * + * @see self::__construct() + * @var int + */ + protected $mode; + /** + * The Block Length of the block cipher + * + * @var int + */ + protected $block_size = 16; + /** + * The Key + * + * @see self::setKey() + * @var string + */ + protected $key = \false; + /** + * HMAC Key + * + * @see self::setupGCM() + * @var ?string + */ + protected $hKey = \false; + /** + * The Initialization Vector + * + * @see self::setIV() + * @var string + */ + protected $iv = \false; + /** + * A "sliding" Initialization Vector + * + * @see self::enableContinuousBuffer() + * @see self::clearBuffers() + * @var string + */ + protected $encryptIV; + /** + * A "sliding" Initialization Vector + * + * @see self::enableContinuousBuffer() + * @see self::clearBuffers() + * @var string + */ + protected $decryptIV; + /** + * Continuous Buffer status + * + * @see self::enableContinuousBuffer() + * @var bool + */ + protected $continuousBuffer = \false; + /** + * Encryption buffer for CTR, OFB and CFB modes + * + * @see self::encrypt() + * @see self::clearBuffers() + * @var array + */ + protected $enbuffer; + /** + * Decryption buffer for CTR, OFB and CFB modes + * + * @see self::decrypt() + * @see self::clearBuffers() + * @var array + */ + protected $debuffer; + /** + * mcrypt resource for encryption + * + * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. + * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. + * + * @see self::encrypt() + * @var resource + */ + private $enmcrypt; + /** + * mcrypt resource for decryption + * + * The mcrypt resource can be recreated every time something needs to be created or it can be created just once. + * Since mcrypt operates in continuous mode, by default, it'll need to be recreated when in non-continuous mode. + * + * @see self::decrypt() + * @var resource + */ + private $demcrypt; + /** + * Does the enmcrypt resource need to be (re)initialized? + * + * @see \phpseclib3\Crypt\Twofish::setKey() + * @see \phpseclib3\Crypt\Twofish::setIV() + * @var bool + */ + private $enchanged = \true; + /** + * Does the demcrypt resource need to be (re)initialized? + * + * @see \phpseclib3\Crypt\Twofish::setKey() + * @see \phpseclib3\Crypt\Twofish::setIV() + * @var bool + */ + private $dechanged = \true; + /** + * mcrypt resource for CFB mode + * + * mcrypt's CFB mode, in (and only in) buffered context, + * is broken, so phpseclib implements the CFB mode by it self, + * even when the mcrypt php extension is available. + * + * In order to do the CFB-mode work (fast) phpseclib + * use a separate ECB-mode mcrypt resource. + * + * @link http://phpseclib.sourceforge.net/cfb-demo.phps + * @see self::encrypt() + * @see self::decrypt() + * @see self::setupMcrypt() + * @var resource + */ + private $ecb; + /** + * Optimizing value while CFB-encrypting + * + * Only relevant if $continuousBuffer enabled + * and $engine == self::ENGINE_MCRYPT + * + * It's faster to re-init $enmcrypt if + * $buffer bytes > $cfb_init_len than + * using the $ecb resource furthermore. + * + * This value depends of the chosen cipher + * and the time it would be needed for it's + * initialization [by mcrypt_generic_init()] + * which, typically, depends on the complexity + * on its internaly Key-expanding algorithm. + * + * @see self::encrypt() + * @var int + */ + protected $cfb_init_len = 600; + /** + * Does internal cipher state need to be (re)initialized? + * + * @see self::setKey() + * @see self::setIV() + * @see self::disableContinuousBuffer() + * @var bool + */ + protected $changed = \true; + /** + * Does Eval engie need to be (re)initialized? + * + * @see self::setup() + * @var bool + */ + protected $nonIVChanged = \true; + /** + * Padding status + * + * @see self::enablePadding() + * @var bool + */ + private $padding = \true; + /** + * Is the mode one that is paddable? + * + * @see self::__construct() + * @var bool + */ + private $paddable = \false; + /** + * Holds which crypt engine internaly should be use, + * which will be determined automatically on __construct() + * + * Currently available $engines are: + * - self::ENGINE_LIBSODIUM (very fast, php-extension: libsodium, extension_loaded('libsodium') required) + * - self::ENGINE_OPENSSL_GCM (very fast, php-extension: openssl, extension_loaded('openssl') required) + * - self::ENGINE_OPENSSL (very fast, php-extension: openssl, extension_loaded('openssl') required) + * - self::ENGINE_MCRYPT (fast, php-extension: mcrypt, extension_loaded('mcrypt') required) + * - self::ENGINE_EVAL (medium, pure php-engine, no php-extension required) + * - self::ENGINE_INTERNAL (slower, pure php-engine, no php-extension required) + * + * @see self::setEngine() + * @see self::encrypt() + * @see self::decrypt() + * @var int + */ + protected $engine; + /** + * Holds the preferred crypt engine + * + * @see self::setEngine() + * @see self::setPreferredEngine() + * @var int + */ + private $preferredEngine; + /** + * The mcrypt specific name of the cipher + * + * Only used if $engine == self::ENGINE_MCRYPT + * + * @link http://www.php.net/mcrypt_module_open + * @link http://www.php.net/mcrypt_list_algorithms + * @see self::setupMcrypt() + * @var string + */ + protected $cipher_name_mcrypt; + /** + * The openssl specific name of the cipher + * + * Only used if $engine == self::ENGINE_OPENSSL + * + * @link http://www.php.net/openssl-get-cipher-methods + * @var string + */ + protected $cipher_name_openssl; + /** + * The openssl specific name of the cipher in ECB mode + * + * If OpenSSL does not support the mode we're trying to use (CTR) + * it can still be emulated with ECB mode. + * + * @link http://www.php.net/openssl-get-cipher-methods + * @var string + */ + protected $cipher_name_openssl_ecb; + /** + * The default salt used by setPassword() + * + * @see self::setPassword() + * @var string + */ + private $password_default_salt = 'phpseclib/salt'; + /** + * The name of the performance-optimized callback function + * + * Used by encrypt() / decrypt() + * only if $engine == self::ENGINE_INTERNAL + * + * @see self::encrypt() + * @see self::decrypt() + * @see self::setupInlineCrypt() + * @var Callback + */ + protected $inline_crypt; + /** + * If OpenSSL can be used in ECB but not in CTR we can emulate CTR + * + * @see self::openssl_ctr_process() + * @var bool + */ + private $openssl_emulate_ctr = \false; + /** + * Don't truncate / null pad key + * + * @see self::clearBuffers() + * @var bool + */ + private $skip_key_adjustment = \false; + /** + * Has the key length explicitly been set or should it be derived from the key, itself? + * + * @see self::setKeyLength() + * @var bool + */ + protected $explicit_key_length = \false; + /** + * Hash subkey for GHASH + * + * @see self::setupGCM() + * @see self::ghash() + * @var BinaryField\Integer + */ + private $h; + /** + * Additional authenticated data + * + * @var string + */ + protected $aad = ''; + /** + * Authentication Tag produced after a round of encryption + * + * @var string + */ + protected $newtag = \false; + /** + * Authentication Tag to be verified during decryption + * + * @var string + */ + protected $oldtag = \false; + /** + * GCM Binary Field + * + * @see self::__construct() + * @see self::ghash() + * @var BinaryField + */ + private static $gcmField; + /** + * Poly1305 Prime Field + * + * @see self::enablePoly1305() + * @see self::poly1305() + * @var PrimeField + */ + private static $poly1305Field; + /** + * Flag for using regular vs "safe" intval + * + * @see self::initialize_static_variables() + * @var boolean + */ + protected static $use_reg_intval; + /** + * Poly1305 Key + * + * @see self::setPoly1305Key() + * @see self::poly1305() + * @var string + */ + protected $poly1305Key; + /** + * Poly1305 Flag + * + * @see self::setPoly1305Key() + * @see self::enablePoly1305() + * @var boolean + */ + protected $usePoly1305 = \false; + /** + * The Original Initialization Vector + * + * GCM uses the nonce to build the IV but we want to be able to distinguish between nonce-derived + * IV's and user-set IV's + * + * @see self::setIV() + * @var string + */ + private $origIV = \false; + /** + * Nonce + * + * Only used with GCM. We could re-use setIV() but nonce's can be of a different length and + * toggling between GCM and other modes could be more complicated if we re-used setIV() + * + * @see self::setNonce() + * @var string + */ + protected $nonce = \false; + /** + * Default Constructor. + * + * $mode could be: + * + * - ecb + * + * - cbc + * + * - ctr + * + * - cfb + * + * - cfb8 + * + * - ofb + * + * - ofb8 + * + * - gcm + * + * @param string $mode + * @throws BadModeException if an invalid / unsupported mode is provided + */ + public function __construct($mode) + { + $mode = strtolower($mode); + // necessary because of 5.6 compatibility; we can't do isset(self::MODE_MAP[$mode]) in 5.6 + $map = self::MODE_MAP; + if (!isset($map[$mode])) { + throw new BadModeException('No valid mode has been specified'); + } + $mode = self::MODE_MAP[$mode]; + // $mode dependent settings + switch ($mode) { + case self::MODE_ECB: + case self::MODE_CBC: + $this->paddable = \true; + break; + case self::MODE_CTR: + case self::MODE_CFB: + case self::MODE_CFB8: + case self::MODE_OFB: + case self::MODE_OFB8: + case self::MODE_STREAM: + $this->paddable = \false; + break; + case self::MODE_GCM: + if ($this->block_size != 16) { + throw new BadModeException('GCM is only valid for block ciphers with a block size of 128 bits'); + } + if (!isset(self::$gcmField)) { + self::$gcmField = new BinaryField(128, 7, 2, 1, 0); + } + $this->paddable = \false; + break; + default: + throw new BadModeException('No valid mode has been specified'); + } + $this->mode = $mode; + static::initialize_static_variables(); + } + /** + * Initialize static variables + */ + protected static function initialize_static_variables() + { + if (!isset(self::$use_reg_intval)) { + switch (\true) { + // PHP_OS & "\xDF\xDF\xDF" == strtoupper(substr(PHP_OS, 0, 3)), but a lot faster + case (\PHP_OS & "\xdf\xdf\xdf") === 'WIN': + case !function_exists('php_uname'): + case !is_string(php_uname('m')): + case (php_uname('m') & "\xdf\xdf\xdf") != 'ARM': + case defined('PHP_INT_SIZE') && \PHP_INT_SIZE == 8: + self::$use_reg_intval = \true; + break; + case (php_uname('m') & "\xdf\xdf\xdf") == 'ARM': + switch (\true) { + /* PHP 7.0.0 introduced a bug that affected 32-bit ARM processors: + + https://github.com/php/php-src/commit/716da71446ebbd40fa6cf2cea8a4b70f504cc3cd + + altho the changelogs make no mention of it, this bug was fixed with this commit: + + https://github.com/php/php-src/commit/c1729272b17a1fe893d1a54e423d3b71470f3ee8 + + affected versions of PHP are: 7.0.x, 7.1.0 - 7.1.23 and 7.2.0 - 7.2.11 */ + case \PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID <= 70123: + case \PHP_VERSION_ID >= 70200 && \PHP_VERSION_ID <= 70211: + self::$use_reg_intval = \false; + break; + default: + self::$use_reg_intval = \true; + } + } + } + } + /** + * Sets the initialization vector. + * + * setIV() is not required when ecb or gcm modes are being used. + * + * {@internal Can be overwritten by a sub class, but does not have to be} + * + * @param string $iv + * @throws \LengthException if the IV length isn't equal to the block size + * @throws \BadMethodCallException if an IV is provided when one shouldn't be + */ + public function setIV($iv) + { + if ($this->mode == self::MODE_ECB) { + throw new \BadMethodCallException('This mode does not require an IV.'); + } + if ($this->mode == self::MODE_GCM) { + throw new \BadMethodCallException('Use setNonce instead'); + } + if (!$this->usesIV()) { + throw new \BadMethodCallException('This algorithm does not use an IV.'); + } + if (strlen($iv) != $this->block_size) { + throw new \LengthException('Received initialization vector of size ' . strlen($iv) . ', but size ' . $this->block_size . ' is required'); + } + $this->iv = $this->origIV = $iv; + $this->changed = \true; + } + /** + * Enables Poly1305 mode. + * + * Once enabled Poly1305 cannot be disabled. + * + * @throws \BadMethodCallException if Poly1305 is enabled whilst in GCM mode + */ + public function enablePoly1305() + { + if ($this->mode == self::MODE_GCM) { + throw new \BadMethodCallException('Poly1305 cannot be used in GCM mode'); + } + $this->usePoly1305 = \true; + } + /** + * Enables Poly1305 mode. + * + * Once enabled Poly1305 cannot be disabled. If $key is not passed then an attempt to call createPoly1305Key + * will be made. + * + * @param string $key optional + * @throws \LengthException if the key isn't long enough + * @throws \BadMethodCallException if Poly1305 is enabled whilst in GCM mode + */ + public function setPoly1305Key($key = null) + { + if ($this->mode == self::MODE_GCM) { + throw new \BadMethodCallException('Poly1305 cannot be used in GCM mode'); + } + if (!is_string($key) || strlen($key) != 32) { + throw new \LengthException('The Poly1305 key must be 32 bytes long (256 bits)'); + } + if (!isset(self::$poly1305Field)) { + // 2^130-5 + self::$poly1305Field = new PrimeField(new BigInteger('3fffffffffffffffffffffffffffffffb', 16)); + } + $this->poly1305Key = $key; + $this->usePoly1305 = \true; + } + /** + * Sets the nonce. + * + * setNonce() is only required when gcm is used + * + * @param string $nonce + * @throws \BadMethodCallException if an nonce is provided when one shouldn't be + */ + public function setNonce($nonce) + { + if ($this->mode != self::MODE_GCM) { + throw new \BadMethodCallException('Nonces are only used in GCM mode.'); + } + $this->nonce = $nonce; + $this->setEngine(); + } + /** + * Sets additional authenticated data + * + * setAAD() is only used by gcm or in poly1305 mode + * + * @param string $aad + * @throws \BadMethodCallException if mode isn't GCM or if poly1305 isn't being utilized + */ + public function setAAD($aad) + { + if ($this->mode != self::MODE_GCM && !$this->usePoly1305) { + throw new \BadMethodCallException('Additional authenticated data is only utilized in GCM mode or with Poly1305'); + } + $this->aad = $aad; + } + /** + * Returns whether or not the algorithm uses an IV + * + * @return bool + */ + public function usesIV() + { + return $this->mode != self::MODE_GCM && $this->mode != self::MODE_ECB; + } + /** + * Returns whether or not the algorithm uses a nonce + * + * @return bool + */ + public function usesNonce() + { + return $this->mode == self::MODE_GCM; + } + /** + * Returns the current key length in bits + * + * @return int + */ + public function getKeyLength() + { + return $this->key_length << 3; + } + /** + * Returns the current block length in bits + * + * @return int + */ + public function getBlockLength() + { + return $this->block_size << 3; + } + /** + * Returns the current block length in bytes + * + * @return int + */ + public function getBlockLengthInBytes() + { + return $this->block_size; + } + /** + * Sets the key length. + * + * Keys with explicitly set lengths need to be treated accordingly + * + * @param int $length + */ + public function setKeyLength($length) + { + $this->explicit_key_length = $length >> 3; + if (is_string($this->key) && strlen($this->key) != $this->explicit_key_length) { + $this->key = \false; + throw new InconsistentSetupException('Key has already been set and is not ' . $this->explicit_key_length . ' bytes long'); + } + } + /** + * Sets the key. + * + * The min/max length(s) of the key depends on the cipher which is used. + * If the key not fits the length(s) of the cipher it will paded with null bytes + * up to the closest valid key length. If the key is more than max length, + * we trim the excess bits. + * + * If the key is not explicitly set, it'll be assumed to be all null bytes. + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @param string $key + */ + public function setKey($key) + { + if ($this->explicit_key_length !== \false && strlen($key) != $this->explicit_key_length) { + throw new InconsistentSetupException('Key length has already been set to ' . $this->explicit_key_length . ' bytes and this key is ' . strlen($key) . ' bytes'); + } + $this->key = $key; + $this->key_length = strlen($key); + $this->setEngine(); + } + /** + * Sets the password. + * + * Depending on what $method is set to, setPassword()'s (optional) parameters are as follows: + * {@link http://en.wikipedia.org/wiki/PBKDF2 pbkdf2} or pbkdf1: + * $hash, $salt, $count, $dkLen + * + * Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php + * {@link https://en.wikipedia.org/wiki/Bcrypt bcypt}: + * $salt, $rounds, $keylen + * + * This is a modified version of bcrypt used by OpenSSH. + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see Crypt/Hash.php + * @param string $password + * @param string $method + * @param int|string ...$func_args + * @throws \LengthException if pbkdf1 is being used and the derived key length exceeds the hash length + * @throws \RuntimeException if bcrypt is being used and a salt isn't provided + * @return bool + */ + public function setPassword($password, $method = 'pbkdf2', ...$func_args) + { + $key = ''; + $method = strtolower($method); + switch ($method) { + case 'bcrypt': + if (!isset($func_args[2])) { + throw new \RuntimeException('A salt must be provided for bcrypt to work'); + } + $salt = $func_args[0]; + $rounds = isset($func_args[1]) ? $func_args[1] : 16; + $keylen = isset($func_args[2]) ? $func_args[2] : $this->key_length; + $key = Blowfish::bcrypt_pbkdf($password, $salt, $keylen + $this->block_size, $rounds); + $this->setKey(substr($key, 0, $keylen)); + $this->setIV(substr($key, $keylen)); + return \true; + case 'pkcs12': + // from https://tools.ietf.org/html/rfc7292#appendix-B.2 + case 'pbkdf1': + case 'pbkdf2': + // Hash function + $hash = isset($func_args[0]) ? strtolower($func_args[0]) : 'sha1'; + $hashObj = new Hash(); + $hashObj->setHash($hash); + // WPA and WPA2 use the SSID as the salt + $salt = isset($func_args[1]) ? $func_args[1] : $this->password_default_salt; + // RFC2898#section-4.2 uses 1,000 iterations by default + // WPA and WPA2 use 4,096. + $count = isset($func_args[2]) ? $func_args[2] : 1000; + // Keylength + if (isset($func_args[3])) { + if ($func_args[3] <= 0) { + throw new \LengthException('Derived key length cannot be longer 0 or less'); + } + $dkLen = $func_args[3]; + } else { + $key_length = $this->explicit_key_length !== \false ? $this->explicit_key_length : $this->key_length; + $dkLen = $method == 'pbkdf1' ? 2 * $key_length : $key_length; + } + switch (\true) { + case $method == 'pkcs12': + /* + In this specification, however, all passwords are created from + BMPStrings with a NULL terminator. This means that each character in + the original BMPString is encoded in 2 bytes in big-endian format + (most-significant byte first). There are no Unicode byte order + marks. The 2 bytes produced from the last character in the BMPString + are followed by 2 additional bytes with the value 0x00. + + -- https://tools.ietf.org/html/rfc7292#appendix-B.1 + */ + $password = "\x00" . chunk_split($password, 1, "\x00") . "\x00"; + /* + This standard specifies 3 different values for the ID byte mentioned + above: + + 1. If ID=1, then the pseudorandom bits being produced are to be used + as key material for performing encryption or decryption. + + 2. If ID=2, then the pseudorandom bits being produced are to be used + as an IV (Initial Value) for encryption or decryption. + + 3. If ID=3, then the pseudorandom bits being produced are to be used + as an integrity key for MACing. + */ + // Construct a string, D (the "diversifier"), by concatenating v/8 + // copies of ID. + $blockLength = $hashObj->getBlockLengthInBytes(); + $d1 = str_repeat(chr(1), $blockLength); + $d2 = str_repeat(chr(2), $blockLength); + $s = ''; + if (strlen($salt)) { + while (strlen($s) < $blockLength) { + $s .= $salt; + } + } + $s = substr($s, 0, $blockLength); + $p = ''; + if (strlen($password)) { + while (strlen($p) < $blockLength) { + $p .= $password; + } + } + $p = substr($p, 0, $blockLength); + $i = $s . $p; + $this->setKey(self::pkcs12helper($dkLen, $hashObj, $i, $d1, $count)); + if ($this->usesIV()) { + $this->setIV(self::pkcs12helper($this->block_size, $hashObj, $i, $d2, $count)); + } + return \true; + case $method == 'pbkdf1': + if ($dkLen > $hashObj->getLengthInBytes()) { + throw new \LengthException('Derived key length cannot be longer than the hash length'); + } + $t = $password . $salt; + for ($i = 0; $i < $count; ++$i) { + $t = $hashObj->hash($t); + } + $key = substr($t, 0, $dkLen); + $this->setKey(substr($key, 0, $dkLen >> 1)); + if ($this->usesIV()) { + $this->setIV(substr($key, $dkLen >> 1)); + } + return \true; + case !in_array($hash, hash_algos()): + $i = 1; + $hashObj->setKey($password); + while (strlen($key) < $dkLen) { + $f = $u = $hashObj->hash($salt . pack('N', $i++)); + for ($j = 2; $j <= $count; ++$j) { + $u = $hashObj->hash($u); + $f ^= $u; + } + $key .= $f; + } + $key = substr($key, 0, $dkLen); + break; + default: + $key = hash_pbkdf2($hash, $password, $salt, $count, $dkLen, \true); + } + break; + default: + throw new UnsupportedAlgorithmException($method . ' is not a supported password hashing method'); + } + $this->setKey($key); + return \true; + } + /** + * PKCS#12 KDF Helper Function + * + * As discussed here: + * + * {@link https://tools.ietf.org/html/rfc7292#appendix-B} + * + * @see self::setPassword() + * @param int $n + * @param \phpseclib3\Crypt\Hash $hashObj + * @param string $i + * @param string $d + * @param int $count + * @return string $a + */ + private static function pkcs12helper($n, $hashObj, $i, $d, $count) + { + static $one; + if (!isset($one)) { + $one = new BigInteger(1); + } + $blockLength = $hashObj->getBlockLength() >> 3; + $c = ceil($n / $hashObj->getLengthInBytes()); + $a = ''; + for ($j = 1; $j <= $c; $j++) { + $ai = $d . $i; + for ($k = 0; $k < $count; $k++) { + $ai = $hashObj->hash($ai); + } + $b = ''; + while (strlen($b) < $blockLength) { + $b .= $ai; + } + $b = substr($b, 0, $blockLength); + $b = new BigInteger($b, 256); + $newi = ''; + for ($k = 0; $k < strlen($i); $k += $blockLength) { + $temp = substr($i, $k, $blockLength); + $temp = new BigInteger($temp, 256); + $temp->setPrecision($blockLength << 3); + $temp = $temp->add($b); + $temp = $temp->add($one); + $newi .= $temp->toBytes(\false); + } + $i = $newi; + $a .= $ai; + } + return substr($a, 0, $n); + } + /** + * Encrypts a message. + * + * $plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other cipher + * implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's + * necessary are discussed in the following + * URL: + * + * {@link http://www.di-mgt.com.au/cryptopad.html http://www.di-mgt.com.au/cryptopad.html} + * + * An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. + * strlen($plaintext) will still need to be a multiple of the block size, however, arbitrary values can be added to make it that + * length. + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see self::decrypt() + * @param string $plaintext + * @return string $ciphertext + */ + public function encrypt($plaintext) + { + if ($this->paddable) { + $plaintext = $this->pad($plaintext); + } + $this->setup(); + if ($this->mode == self::MODE_GCM) { + $oldIV = $this->iv; + Strings::increment_str($this->iv); + $cipher = new static('ctr'); + $cipher->setKey($this->key); + $cipher->setIV($this->iv); + $ciphertext = $cipher->encrypt($plaintext); + $s = $this->ghash(self::nullPad128($this->aad) . self::nullPad128($ciphertext) . self::len64($this->aad) . self::len64($ciphertext)); + $cipher->encryptIV = $this->iv = $this->encryptIV = $this->decryptIV = $oldIV; + $this->newtag = $cipher->encrypt($s); + return $ciphertext; + } + if (isset($this->poly1305Key)) { + $cipher = clone $this; + unset($cipher->poly1305Key); + $this->usePoly1305 = \false; + $ciphertext = $cipher->encrypt($plaintext); + $this->newtag = $this->poly1305($ciphertext); + return $ciphertext; + } + if ($this->engine === self::ENGINE_OPENSSL) { + switch ($this->mode) { + case self::MODE_STREAM: + return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + case self::MODE_ECB: + return openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + case self::MODE_CBC: + $result = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $this->encryptIV); + if ($this->continuousBuffer) { + $this->encryptIV = substr($result, -$this->block_size); + } + return $result; + case self::MODE_CTR: + return $this->openssl_ctr_process($plaintext, $this->encryptIV, $this->enbuffer); + case self::MODE_CFB: + // cfb loosely routines inspired by openssl's: + // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} + $ciphertext = ''; + if ($this->continuousBuffer) { + $iv =& $this->encryptIV; + $pos =& $this->enbuffer['pos']; + } else { + $iv = $this->encryptIV; + $pos = 0; + } + $len = strlen($plaintext); + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $this->block_size - $pos; + if ($len >= $max) { + $i = $max; + $len -= $max; + $pos = 0; + } else { + $i = $len; + $pos += $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $ciphertext = substr($iv, $orig_pos) ^ $plaintext; + $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); + $plaintext = substr($plaintext, $i); + } + $overflow = $len % $this->block_size; + if ($overflow) { + $ciphertext .= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\x00", $this->block_size), $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $iv); + $iv = Strings::pop($ciphertext, $this->block_size); + $size = $len - $overflow; + $block = $iv ^ substr($plaintext, -$overflow); + $iv = substr_replace($iv, $block, 0, $overflow); + $ciphertext .= $block; + $pos = $overflow; + } elseif ($len) { + $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $iv); + $iv = substr($ciphertext, -$this->block_size); + } + return $ciphertext; + case self::MODE_CFB8: + $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $this->encryptIV); + if ($this->continuousBuffer) { + if (($len = strlen($ciphertext)) >= $this->block_size) { + $this->encryptIV = substr($ciphertext, -$this->block_size); + } else { + $this->encryptIV = substr($this->encryptIV, $len - $this->block_size) . substr($ciphertext, -$len); + } + } + return $ciphertext; + case self::MODE_OFB8: + $ciphertext = ''; + $len = strlen($plaintext); + $iv = $this->encryptIV; + for ($i = 0; $i < $len; ++$i) { + $xor = openssl_encrypt($iv, $this->cipher_name_openssl_ecb, $this->key, $this->openssl_options, $this->decryptIV); + $ciphertext .= $plaintext[$i] ^ $xor; + $iv = substr($iv, 1) . $xor[0]; + } + if ($this->continuousBuffer) { + $this->encryptIV = $iv; + } + break; + case self::MODE_OFB: + return $this->openssl_ofb_process($plaintext, $this->encryptIV, $this->enbuffer); + } + } + if ($this->engine === self::ENGINE_MCRYPT) { + set_error_handler(function () { + }); + if ($this->enchanged) { + mcrypt_generic_init($this->enmcrypt, $this->key, $this->getIV($this->encryptIV)); + $this->enchanged = \false; + } + // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} + // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's + // rewritten CFB implementation the above outputs the same thing twice. + if ($this->mode == self::MODE_CFB && $this->continuousBuffer) { + $block_size = $this->block_size; + $iv =& $this->encryptIV; + $pos =& $this->enbuffer['pos']; + $len = strlen($plaintext); + $ciphertext = ''; + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len -= $max; + $pos = 0; + } else { + $i = $len; + $pos += $len; + $len = 0; + } + $ciphertext = substr($iv, $orig_pos) ^ $plaintext; + $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); + $this->enbuffer['enmcrypt_init'] = \true; + } + if ($len >= $block_size) { + if ($this->enbuffer['enmcrypt_init'] === \false || $len > $this->cfb_init_len) { + if ($this->enbuffer['enmcrypt_init'] === \true) { + mcrypt_generic_init($this->enmcrypt, $this->key, $iv); + $this->enbuffer['enmcrypt_init'] = \false; + } + $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % $block_size)); + $iv = substr($ciphertext, -$block_size); + $len %= $block_size; + } else { + while ($len >= $block_size) { + $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, $block_size); + $ciphertext .= $iv; + $len -= $block_size; + $i += $block_size; + } + } + } + if ($len) { + $iv = mcrypt_generic($this->ecb, $iv); + $block = $iv ^ substr($plaintext, -$len); + $iv = substr_replace($iv, $block, 0, $len); + $ciphertext .= $block; + $pos = $len; + } + restore_error_handler(); + return $ciphertext; + } + $ciphertext = mcrypt_generic($this->enmcrypt, $plaintext); + if (!$this->continuousBuffer) { + mcrypt_generic_init($this->enmcrypt, $this->key, $this->getIV($this->encryptIV)); + } + restore_error_handler(); + return $ciphertext; + } + if ($this->engine === self::ENGINE_EVAL) { + $inline = $this->inline_crypt; + return $inline('encrypt', $plaintext); + } + $buffer =& $this->enbuffer; + $block_size = $this->block_size; + $ciphertext = ''; + switch ($this->mode) { + case self::MODE_ECB: + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $ciphertext .= $this->encryptBlock(substr($plaintext, $i, $block_size)); + } + break; + case self::MODE_CBC: + $xor = $this->encryptIV; + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $block = substr($plaintext, $i, $block_size); + $block = $this->encryptBlock($block ^ $xor); + $xor = $block; + $ciphertext .= $block; + } + if ($this->continuousBuffer) { + $this->encryptIV = $xor; + } + break; + case self::MODE_CTR: + $xor = $this->encryptIV; + if (strlen($buffer['ciphertext'])) { + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $block = substr($plaintext, $i, $block_size); + if (strlen($block) > strlen($buffer['ciphertext'])) { + $buffer['ciphertext'] .= $this->encryptBlock($xor); + Strings::increment_str($xor); + } + $key = Strings::shift($buffer['ciphertext'], $block_size); + $ciphertext .= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $block = substr($plaintext, $i, $block_size); + $key = $this->encryptBlock($xor); + Strings::increment_str($xor); + $ciphertext .= $block ^ $key; + } + } + if ($this->continuousBuffer) { + $this->encryptIV = $xor; + if ($start = strlen($plaintext) % $block_size) { + $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; + } + } + break; + case self::MODE_CFB: + // cfb loosely routines inspired by openssl's: + // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} + if ($this->continuousBuffer) { + $iv =& $this->encryptIV; + $pos =& $buffer['pos']; + } else { + $iv = $this->encryptIV; + $pos = 0; + } + $len = strlen($plaintext); + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len -= $max; + $pos = 0; + } else { + $i = $len; + $pos += $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $ciphertext = substr($iv, $orig_pos) ^ $plaintext; + $iv = substr_replace($iv, $ciphertext, $orig_pos, $i); + } + while ($len >= $block_size) { + $iv = $this->encryptBlock($iv) ^ substr($plaintext, $i, $block_size); + $ciphertext .= $iv; + $len -= $block_size; + $i += $block_size; + } + if ($len) { + $iv = $this->encryptBlock($iv); + $block = $iv ^ substr($plaintext, $i); + $iv = substr_replace($iv, $block, 0, $len); + $ciphertext .= $block; + $pos = $len; + } + break; + case self::MODE_CFB8: + $ciphertext = ''; + $len = strlen($plaintext); + $iv = $this->encryptIV; + for ($i = 0; $i < $len; ++$i) { + $ciphertext .= $c = $plaintext[$i] ^ $this->encryptBlock($iv); + $iv = substr($iv, 1) . $c; + } + if ($this->continuousBuffer) { + if ($len >= $block_size) { + $this->encryptIV = substr($ciphertext, -$block_size); + } else { + $this->encryptIV = substr($this->encryptIV, $len - $block_size) . substr($ciphertext, -$len); + } + } + break; + case self::MODE_OFB8: + $ciphertext = ''; + $len = strlen($plaintext); + $iv = $this->encryptIV; + for ($i = 0; $i < $len; ++$i) { + $xor = $this->encryptBlock($iv); + $ciphertext .= $plaintext[$i] ^ $xor; + $iv = substr($iv, 1) . $xor[0]; + } + if ($this->continuousBuffer) { + $this->encryptIV = $iv; + } + break; + case self::MODE_OFB: + $xor = $this->encryptIV; + if (strlen($buffer['xor'])) { + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $block = substr($plaintext, $i, $block_size); + if (strlen($block) > strlen($buffer['xor'])) { + $xor = $this->encryptBlock($xor); + $buffer['xor'] .= $xor; + } + $key = Strings::shift($buffer['xor'], $block_size); + $ciphertext .= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $xor = $this->encryptBlock($xor); + $ciphertext .= substr($plaintext, $i, $block_size) ^ $xor; + } + $key = $xor; + } + if ($this->continuousBuffer) { + $this->encryptIV = $xor; + if ($start = strlen($plaintext) % $block_size) { + $buffer['xor'] = substr($key, $start) . $buffer['xor']; + } + } + break; + case self::MODE_STREAM: + $ciphertext = $this->encryptBlock($plaintext); + break; + } + return $ciphertext; + } + /** + * Decrypts a message. + * + * If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until + * it is. + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see self::encrypt() + * @param string $ciphertext + * @return string $plaintext + * @throws \LengthException if we're inside a block cipher and the ciphertext length is not a multiple of the block size + */ + public function decrypt($ciphertext) + { + if ($this->paddable && strlen($ciphertext) % $this->block_size) { + throw new \LengthException('The ciphertext length (' . strlen($ciphertext) . ') needs to be a multiple of the block size (' . $this->block_size . ')'); + } + $this->setup(); + if ($this->mode == self::MODE_GCM || isset($this->poly1305Key)) { + if ($this->oldtag === \false) { + throw new InsufficientSetupException('Authentication Tag has not been set'); + } + if (isset($this->poly1305Key)) { + $newtag = $this->poly1305($ciphertext); + } else { + $oldIV = $this->iv; + Strings::increment_str($this->iv); + $cipher = new static('ctr'); + $cipher->setKey($this->key); + $cipher->setIV($this->iv); + $plaintext = $cipher->decrypt($ciphertext); + $s = $this->ghash(self::nullPad128($this->aad) . self::nullPad128($ciphertext) . self::len64($this->aad) . self::len64($ciphertext)); + $cipher->encryptIV = $this->iv = $this->encryptIV = $this->decryptIV = $oldIV; + $newtag = $cipher->encrypt($s); + } + if ($this->oldtag != substr($newtag, 0, strlen($newtag))) { + $cipher = clone $this; + unset($cipher->poly1305Key); + $this->usePoly1305 = \false; + $plaintext = $cipher->decrypt($ciphertext); + $this->oldtag = \false; + throw new BadDecryptionException('Derived authentication tag and supplied authentication tag do not match'); + } + $this->oldtag = \false; + return $plaintext; + } + if ($this->engine === self::ENGINE_OPENSSL) { + switch ($this->mode) { + case self::MODE_STREAM: + $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + break; + case self::MODE_ECB: + $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + break; + case self::MODE_CBC: + $offset = $this->block_size; + $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $this->decryptIV); + if ($this->continuousBuffer) { + $this->decryptIV = substr($ciphertext, -$offset, $this->block_size); + } + break; + case self::MODE_CTR: + $plaintext = $this->openssl_ctr_process($ciphertext, $this->decryptIV, $this->debuffer); + break; + case self::MODE_CFB: + // cfb loosely routines inspired by openssl's: + // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1} + $plaintext = ''; + if ($this->continuousBuffer) { + $iv =& $this->decryptIV; + $pos =& $this->debuffer['pos']; + } else { + $iv = $this->decryptIV; + $pos = 0; + } + $len = strlen($ciphertext); + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $this->block_size - $pos; + if ($len >= $max) { + $i = $max; + $len -= $max; + $pos = 0; + } else { + $i = $len; + $pos += $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $this->blocksize + $plaintext = substr($iv, $orig_pos) ^ $ciphertext; + $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); + $ciphertext = substr($ciphertext, $i); + } + $overflow = $len % $this->block_size; + if ($overflow) { + $plaintext .= openssl_decrypt(substr($ciphertext, 0, -$overflow), $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $iv); + if ($len - $overflow) { + $iv = substr($ciphertext, -$overflow - $this->block_size, -$overflow); + } + $iv = openssl_encrypt(str_repeat("\x00", $this->block_size), $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $iv); + $plaintext .= $iv ^ substr($ciphertext, -$overflow); + $iv = substr_replace($iv, substr($ciphertext, -$overflow), 0, $overflow); + $pos = $overflow; + } elseif ($len) { + $plaintext .= openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $iv); + $iv = substr($ciphertext, -$this->block_size); + } + break; + case self::MODE_CFB8: + $plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $this->decryptIV); + if ($this->continuousBuffer) { + if (($len = strlen($ciphertext)) >= $this->block_size) { + $this->decryptIV = substr($ciphertext, -$this->block_size); + } else { + $this->decryptIV = substr($this->decryptIV, $len - $this->block_size) . substr($ciphertext, -$len); + } + } + break; + case self::MODE_OFB8: + $plaintext = ''; + $len = strlen($ciphertext); + $iv = $this->decryptIV; + for ($i = 0; $i < $len; ++$i) { + $xor = openssl_encrypt($iv, $this->cipher_name_openssl_ecb, $this->key, $this->openssl_options, $this->decryptIV); + $plaintext .= $ciphertext[$i] ^ $xor; + $iv = substr($iv, 1) . $xor[0]; + } + if ($this->continuousBuffer) { + $this->decryptIV = $iv; + } + break; + case self::MODE_OFB: + $plaintext = $this->openssl_ofb_process($ciphertext, $this->decryptIV, $this->debuffer); + } + return $this->paddable ? $this->unpad($plaintext) : $plaintext; + } + if ($this->engine === self::ENGINE_MCRYPT) { + set_error_handler(function () { + }); + $block_size = $this->block_size; + if ($this->dechanged) { + mcrypt_generic_init($this->demcrypt, $this->key, $this->getIV($this->decryptIV)); + $this->dechanged = \false; + } + if ($this->mode == self::MODE_CFB && $this->continuousBuffer) { + $iv =& $this->decryptIV; + $pos =& $this->debuffer['pos']; + $len = strlen($ciphertext); + $plaintext = ''; + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len -= $max; + $pos = 0; + } else { + $i = $len; + $pos += $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $plaintext = substr($iv, $orig_pos) ^ $ciphertext; + $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); + } + if ($len >= $block_size) { + $cb = substr($ciphertext, $i, $len - $len % $block_size); + $plaintext .= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb; + $iv = substr($cb, -$block_size); + $len %= $block_size; + } + if ($len) { + $iv = mcrypt_generic($this->ecb, $iv); + $plaintext .= $iv ^ substr($ciphertext, -$len); + $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len); + $pos = $len; + } + restore_error_handler(); + return $plaintext; + } + $plaintext = mdecrypt_generic($this->demcrypt, $ciphertext); + if (!$this->continuousBuffer) { + mcrypt_generic_init($this->demcrypt, $this->key, $this->getIV($this->decryptIV)); + } + restore_error_handler(); + return $this->paddable ? $this->unpad($plaintext) : $plaintext; + } + if ($this->engine === self::ENGINE_EVAL) { + $inline = $this->inline_crypt; + return $inline('decrypt', $ciphertext); + } + $block_size = $this->block_size; + $buffer =& $this->debuffer; + $plaintext = ''; + switch ($this->mode) { + case self::MODE_ECB: + for ($i = 0; $i < strlen($ciphertext); $i += $block_size) { + $plaintext .= $this->decryptBlock(substr($ciphertext, $i, $block_size)); + } + break; + case self::MODE_CBC: + $xor = $this->decryptIV; + for ($i = 0; $i < strlen($ciphertext); $i += $block_size) { + $block = substr($ciphertext, $i, $block_size); + $plaintext .= $this->decryptBlock($block) ^ $xor; + $xor = $block; + } + if ($this->continuousBuffer) { + $this->decryptIV = $xor; + } + break; + case self::MODE_CTR: + $xor = $this->decryptIV; + if (strlen($buffer['ciphertext'])) { + for ($i = 0; $i < strlen($ciphertext); $i += $block_size) { + $block = substr($ciphertext, $i, $block_size); + if (strlen($block) > strlen($buffer['ciphertext'])) { + $buffer['ciphertext'] .= $this->encryptBlock($xor); + Strings::increment_str($xor); + } + $key = Strings::shift($buffer['ciphertext'], $block_size); + $plaintext .= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($ciphertext); $i += $block_size) { + $block = substr($ciphertext, $i, $block_size); + $key = $this->encryptBlock($xor); + Strings::increment_str($xor); + $plaintext .= $block ^ $key; + } + } + if ($this->continuousBuffer) { + $this->decryptIV = $xor; + if ($start = strlen($ciphertext) % $block_size) { + $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; + } + } + break; + case self::MODE_CFB: + if ($this->continuousBuffer) { + $iv =& $this->decryptIV; + $pos =& $buffer['pos']; + } else { + $iv = $this->decryptIV; + $pos = 0; + } + $len = strlen($ciphertext); + $i = 0; + if ($pos) { + $orig_pos = $pos; + $max = $block_size - $pos; + if ($len >= $max) { + $i = $max; + $len -= $max; + $pos = 0; + } else { + $i = $len; + $pos += $len; + $len = 0; + } + // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize + $plaintext = substr($iv, $orig_pos) ^ $ciphertext; + $iv = substr_replace($iv, substr($ciphertext, 0, $i), $orig_pos, $i); + } + while ($len >= $block_size) { + $iv = $this->encryptBlock($iv); + $cb = substr($ciphertext, $i, $block_size); + $plaintext .= $iv ^ $cb; + $iv = $cb; + $len -= $block_size; + $i += $block_size; + } + if ($len) { + $iv = $this->encryptBlock($iv); + $plaintext .= $iv ^ substr($ciphertext, $i); + $iv = substr_replace($iv, substr($ciphertext, $i), 0, $len); + $pos = $len; + } + break; + case self::MODE_CFB8: + $plaintext = ''; + $len = strlen($ciphertext); + $iv = $this->decryptIV; + for ($i = 0; $i < $len; ++$i) { + $plaintext .= $ciphertext[$i] ^ $this->encryptBlock($iv); + $iv = substr($iv, 1) . $ciphertext[$i]; + } + if ($this->continuousBuffer) { + if ($len >= $block_size) { + $this->decryptIV = substr($ciphertext, -$block_size); + } else { + $this->decryptIV = substr($this->decryptIV, $len - $block_size) . substr($ciphertext, -$len); + } + } + break; + case self::MODE_OFB8: + $plaintext = ''; + $len = strlen($ciphertext); + $iv = $this->decryptIV; + for ($i = 0; $i < $len; ++$i) { + $xor = $this->encryptBlock($iv); + $plaintext .= $ciphertext[$i] ^ $xor; + $iv = substr($iv, 1) . $xor[0]; + } + if ($this->continuousBuffer) { + $this->decryptIV = $iv; + } + break; + case self::MODE_OFB: + $xor = $this->decryptIV; + if (strlen($buffer['xor'])) { + for ($i = 0; $i < strlen($ciphertext); $i += $block_size) { + $block = substr($ciphertext, $i, $block_size); + if (strlen($block) > strlen($buffer['xor'])) { + $xor = $this->encryptBlock($xor); + $buffer['xor'] .= $xor; + } + $key = Strings::shift($buffer['xor'], $block_size); + $plaintext .= $block ^ $key; + } + } else { + for ($i = 0; $i < strlen($ciphertext); $i += $block_size) { + $xor = $this->encryptBlock($xor); + $plaintext .= substr($ciphertext, $i, $block_size) ^ $xor; + } + $key = $xor; + } + if ($this->continuousBuffer) { + $this->decryptIV = $xor; + if ($start = strlen($ciphertext) % $block_size) { + $buffer['xor'] = substr($key, $start) . $buffer['xor']; + } + } + break; + case self::MODE_STREAM: + $plaintext = $this->decryptBlock($ciphertext); + break; + } + return $this->paddable ? $this->unpad($plaintext) : $plaintext; + } + /** + * Get the authentication tag + * + * Only used in GCM or Poly1305 mode + * + * @see self::encrypt() + * @param int $length optional + * @return string + * @throws \LengthException if $length isn't of a sufficient length + * @throws \RuntimeException if GCM mode isn't being used + */ + public function getTag($length = 16) + { + if ($this->mode != self::MODE_GCM && !$this->usePoly1305) { + throw new \BadMethodCallException('Authentication tags are only utilized in GCM mode or with Poly1305'); + } + if ($this->newtag === \false) { + throw new \BadMethodCallException('A tag can only be returned after a round of encryption has been performed'); + } + // the tag is 128-bits. it can't be greater than 16 bytes because that's bigger than the tag is. if it + // were 0 you might as well be doing CTR and less than 4 provides minimal security that could be trivially + // easily brute forced. + // see https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf#page=36 + // for more info + if ($length < 4 || $length > 16) { + throw new \LengthException('The authentication tag must be between 4 and 16 bytes long'); + } + return $length == 16 ? $this->newtag : substr($this->newtag, 0, $length); + } + /** + * Sets the authentication tag + * + * Only used in GCM mode + * + * @see self::decrypt() + * @param string $tag + * @throws \LengthException if $length isn't of a sufficient length + * @throws \RuntimeException if GCM mode isn't being used + */ + public function setTag($tag) + { + if ($this->usePoly1305 && !isset($this->poly1305Key) && method_exists($this, 'createPoly1305Key')) { + $this->createPoly1305Key(); + } + if ($this->mode != self::MODE_GCM && !$this->usePoly1305) { + throw new \BadMethodCallException('Authentication tags are only utilized in GCM mode or with Poly1305'); + } + $length = strlen($tag); + if ($length < 4 || $length > 16) { + throw new \LengthException('The authentication tag must be between 4 and 16 bytes long'); + } + $this->oldtag = $tag; + } + /** + * Get the IV + * + * mcrypt requires an IV even if ECB is used + * + * @see self::encrypt() + * @see self::decrypt() + * @param string $iv + * @return string + */ + protected function getIV($iv) + { + return $this->mode == self::MODE_ECB ? str_repeat("\x00", $this->block_size) : $iv; + } + /** + * OpenSSL CTR Processor + * + * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream + * for CTR is the same for both encrypting and decrypting this function is re-used by both SymmetricKey::encrypt() + * and SymmetricKey::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this + * function will emulate CTR with ECB when necessary. + * + * @see self::encrypt() + * @see self::decrypt() + * @param string $plaintext + * @param string $encryptIV + * @param array $buffer + * @return string + */ + private function openssl_ctr_process($plaintext, &$encryptIV, &$buffer) + { + $ciphertext = ''; + $block_size = $this->block_size; + $key = $this->key; + if ($this->openssl_emulate_ctr) { + $xor = $encryptIV; + if (strlen($buffer['ciphertext'])) { + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $block = substr($plaintext, $i, $block_size); + if (strlen($block) > strlen($buffer['ciphertext'])) { + $buffer['ciphertext'] .= openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + } + Strings::increment_str($xor); + $otp = Strings::shift($buffer['ciphertext'], $block_size); + $ciphertext .= $block ^ $otp; + } + } else { + for ($i = 0; $i < strlen($plaintext); $i += $block_size) { + $block = substr($plaintext, $i, $block_size); + $otp = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + Strings::increment_str($xor); + $ciphertext .= $block ^ $otp; + } + } + if ($this->continuousBuffer) { + $encryptIV = $xor; + if ($start = strlen($plaintext) % $block_size) { + $buffer['ciphertext'] = substr($key, $start) . $buffer['ciphertext']; + } + } + return $ciphertext; + } + if (strlen($buffer['ciphertext'])) { + $ciphertext = $plaintext ^ Strings::shift($buffer['ciphertext'], strlen($plaintext)); + $plaintext = substr($plaintext, strlen($ciphertext)); + if (!strlen($plaintext)) { + return $ciphertext; + } + } + $overflow = strlen($plaintext) % $block_size; + if ($overflow) { + $plaintext2 = Strings::pop($plaintext, $overflow); + // ie. trim $plaintext to a multiple of $block_size and put rest of $plaintext in $plaintext2 + $encrypted = openssl_encrypt($plaintext . str_repeat("\x00", $block_size), $this->cipher_name_openssl, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $encryptIV); + $temp = Strings::pop($encrypted, $block_size); + $ciphertext .= $encrypted . ($plaintext2 ^ $temp); + if ($this->continuousBuffer) { + $buffer['ciphertext'] = substr($temp, $overflow); + $encryptIV = $temp; + } + } elseif (!strlen($buffer['ciphertext'])) { + $ciphertext .= openssl_encrypt($plaintext . str_repeat("\x00", $block_size), $this->cipher_name_openssl, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $encryptIV); + $temp = Strings::pop($ciphertext, $block_size); + if ($this->continuousBuffer) { + $encryptIV = $temp; + } + } + if ($this->continuousBuffer) { + $encryptIV = openssl_decrypt($encryptIV, $this->cipher_name_openssl_ecb, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING); + if ($overflow) { + Strings::increment_str($encryptIV); + } + } + return $ciphertext; + } + /** + * OpenSSL OFB Processor + * + * PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream + * for OFB is the same for both encrypting and decrypting this function is re-used by both SymmetricKey::encrypt() + * and SymmetricKey::decrypt(). + * + * @see self::encrypt() + * @see self::decrypt() + * @param string $plaintext + * @param string $encryptIV + * @param array $buffer + * @return string + */ + private function openssl_ofb_process($plaintext, &$encryptIV, &$buffer) + { + if (strlen($buffer['xor'])) { + $ciphertext = $plaintext ^ $buffer['xor']; + $buffer['xor'] = substr($buffer['xor'], strlen($ciphertext)); + $plaintext = substr($plaintext, strlen($ciphertext)); + } else { + $ciphertext = ''; + } + $block_size = $this->block_size; + $len = strlen($plaintext); + $key = $this->key; + $overflow = $len % $block_size; + if (strlen($plaintext)) { + if ($overflow) { + $ciphertext .= openssl_encrypt(substr($plaintext, 0, -$overflow) . str_repeat("\x00", $block_size), $this->cipher_name_openssl, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $encryptIV); + $xor = Strings::pop($ciphertext, $block_size); + if ($this->continuousBuffer) { + $encryptIV = $xor; + } + $ciphertext .= Strings::shift($xor, $overflow) ^ substr($plaintext, -$overflow); + if ($this->continuousBuffer) { + $buffer['xor'] = $xor; + } + } else { + $ciphertext = openssl_encrypt($plaintext, $this->cipher_name_openssl, $key, \OPENSSL_RAW_DATA | \OPENSSL_ZERO_PADDING, $encryptIV); + if ($this->continuousBuffer) { + $encryptIV = substr($ciphertext, -$block_size) ^ substr($plaintext, -$block_size); + } + } + } + return $ciphertext; + } + /** + * phpseclib <-> OpenSSL Mode Mapper + * + * May need to be overwritten by classes extending this one in some cases + * + * @return string + */ + protected function openssl_translate_mode() + { + switch ($this->mode) { + case self::MODE_ECB: + return 'ecb'; + case self::MODE_CBC: + return 'cbc'; + case self::MODE_CTR: + case self::MODE_GCM: + return 'ctr'; + case self::MODE_CFB: + return 'cfb'; + case self::MODE_CFB8: + return 'cfb8'; + case self::MODE_OFB: + return 'ofb'; + } + } + /** + * Pad "packets". + * + * Block ciphers working by encrypting between their specified [$this->]block_size at a time + * If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to + * pad the input so that it is of the proper length. + * + * Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH, + * where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping + * away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is + * transmitted separately) + * + * @see self::disablePadding() + */ + public function enablePadding() + { + $this->padding = \true; + } + /** + * Do not pad packets. + * + * @see self::enablePadding() + */ + public function disablePadding() + { + $this->padding = \false; + } + /** + * Treat consecutive "packets" as if they are a continuous buffer. + * + * Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets + * will yield different outputs: + * + * + * echo $rijndael->encrypt(substr($plaintext, 0, 16)); + * echo $rijndael->encrypt(substr($plaintext, 16, 16)); + * + * + * echo $rijndael->encrypt($plaintext); + * + * + * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates + * another, as demonstrated with the following: + * + * + * $rijndael->encrypt(substr($plaintext, 0, 16)); + * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16))); + * + * + * echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16))); + * + * + * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different + * outputs. The reason is due to the fact that the initialization vector's change after every encryption / + * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. + * + * Put another way, when the continuous buffer is enabled, the state of the \phpseclib3\Crypt\*() object changes after each + * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that + * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), + * however, they are also less intuitive and more likely to cause you problems. + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see self::disableContinuousBuffer() + */ + public function enableContinuousBuffer() + { + if ($this->mode == self::MODE_ECB) { + return; + } + if ($this->mode == self::MODE_GCM) { + throw new \BadMethodCallException('This mode does not run in continuous mode'); + } + $this->continuousBuffer = \true; + $this->setEngine(); + } + /** + * Treat consecutive packets as if they are a discontinuous buffer. + * + * The default behavior. + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see self::enableContinuousBuffer() + */ + public function disableContinuousBuffer() + { + if ($this->mode == self::MODE_ECB) { + return; + } + if (!$this->continuousBuffer) { + return; + } + $this->continuousBuffer = \false; + $this->setEngine(); + } + /** + * Test for engine validity + * + * @see self::__construct() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + switch ($engine) { + case self::ENGINE_OPENSSL: + $this->openssl_emulate_ctr = \false; + $result = $this->cipher_name_openssl && extension_loaded('openssl'); + if (!$result) { + return \false; + } + $methods = openssl_get_cipher_methods(); + if (in_array($this->cipher_name_openssl, $methods)) { + return \true; + } + // not all of openssl's symmetric cipher's support ctr. for those + // that don't we'll emulate it + switch ($this->mode) { + case self::MODE_CTR: + if (in_array($this->cipher_name_openssl_ecb, $methods)) { + $this->openssl_emulate_ctr = \true; + return \true; + } + } + return \false; + case self::ENGINE_MCRYPT: + set_error_handler(function () { + }); + $result = $this->cipher_name_mcrypt && extension_loaded('mcrypt') && in_array($this->cipher_name_mcrypt, mcrypt_list_algorithms()); + restore_error_handler(); + return $result; + case self::ENGINE_EVAL: + return method_exists($this, 'setupInlineCrypt'); + case self::ENGINE_INTERNAL: + return \true; + } + return \false; + } + /** + * Test for engine validity + * + * @see self::__construct() + * @param string $engine + * @return bool + */ + public function isValidEngine($engine) + { + static $reverseMap; + if (!isset($reverseMap)) { + $reverseMap = array_map('strtolower', self::ENGINE_MAP); + $reverseMap = array_flip($reverseMap); + } + $engine = strtolower($engine); + if (!isset($reverseMap[$engine])) { + return \false; + } + return $this->isValidEngineHelper($reverseMap[$engine]); + } + /** + * Sets the preferred crypt engine + * + * Currently, $engine could be: + * + * - libsodium[very fast] + * + * - OpenSSL [very fast] + * + * - mcrypt [fast] + * + * - Eval [slow] + * + * - PHP [slowest] + * + * If the preferred crypt engine is not available the fastest available one will be used + * + * @see self::__construct() + * @param string $engine + */ + public function setPreferredEngine($engine) + { + static $reverseMap; + if (!isset($reverseMap)) { + $reverseMap = array_map('strtolower', self::ENGINE_MAP); + $reverseMap = array_flip($reverseMap); + } + $engine = is_string($engine) ? strtolower($engine) : ''; + $this->preferredEngine = isset($reverseMap[$engine]) ? $reverseMap[$engine] : self::ENGINE_LIBSODIUM; + $this->setEngine(); + } + /** + * Returns the engine currently being utilized + * + * @see self::setEngine() + */ + public function getEngine() + { + return self::ENGINE_MAP[$this->engine]; + } + /** + * Sets the engine as appropriate + * + * @see self::__construct() + */ + protected function setEngine() + { + $this->engine = null; + $candidateEngines = [self::ENGINE_LIBSODIUM, self::ENGINE_OPENSSL_GCM, self::ENGINE_OPENSSL, self::ENGINE_MCRYPT, self::ENGINE_EVAL]; + if (isset($this->preferredEngine)) { + $temp = [$this->preferredEngine]; + $candidateEngines = array_merge($temp, array_diff($candidateEngines, $temp)); + } + foreach ($candidateEngines as $engine) { + if ($this->isValidEngineHelper($engine)) { + $this->engine = $engine; + break; + } + } + if (!$this->engine) { + $this->engine = self::ENGINE_INTERNAL; + } + if ($this->engine != self::ENGINE_MCRYPT && $this->enmcrypt) { + set_error_handler(function () { + }); + // Closing the current mcrypt resource(s). _mcryptSetup() will, if needed, + // (re)open them with the module named in $this->cipher_name_mcrypt + mcrypt_module_close($this->enmcrypt); + mcrypt_module_close($this->demcrypt); + $this->enmcrypt = null; + $this->demcrypt = null; + if ($this->ecb) { + mcrypt_module_close($this->ecb); + $this->ecb = null; + } + restore_error_handler(); + } + $this->changed = $this->nonIVChanged = \true; + } + /** + * Encrypts a block + * + * Note: Must be extended by the child \phpseclib3\Crypt\* class + * + * @param string $in + * @return string + */ + protected abstract function encryptBlock($in); + /** + * Decrypts a block + * + * Note: Must be extended by the child \phpseclib3\Crypt\* class + * + * @param string $in + * @return string + */ + protected abstract function decryptBlock($in); + /** + * Setup the key (expansion) + * + * Only used if $engine == self::ENGINE_INTERNAL + * + * Note: Must extend by the child \phpseclib3\Crypt\* class + * + * @see self::setup() + */ + protected abstract function setupKey(); + /** + * Setup the self::ENGINE_INTERNAL $engine + * + * (re)init, if necessary, the internal cipher $engine and flush all $buffers + * Used (only) if $engine == self::ENGINE_INTERNAL + * + * _setup() will be called each time if $changed === true + * typically this happens when using one or more of following public methods: + * + * - setKey() + * + * - setIV() + * + * - disableContinuousBuffer() + * + * - First run of encrypt() / decrypt() with no init-settings + * + * {@internal setup() is always called before en/decryption.} + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see self::setKey() + * @see self::setIV() + * @see self::disableContinuousBuffer() + */ + protected function setup() + { + if (!$this->changed) { + return; + } + $this->changed = \false; + if ($this->usePoly1305 && !isset($this->poly1305Key) && method_exists($this, 'createPoly1305Key')) { + $this->createPoly1305Key(); + } + $this->enbuffer = $this->debuffer = ['ciphertext' => '', 'xor' => '', 'pos' => 0, 'enmcrypt_init' => \true]; + //$this->newtag = $this->oldtag = false; + if ($this->usesNonce()) { + if ($this->nonce === \false) { + throw new InsufficientSetupException('No nonce has been defined'); + } + if ($this->mode == self::MODE_GCM && !in_array($this->engine, [self::ENGINE_LIBSODIUM, self::ENGINE_OPENSSL_GCM])) { + $this->setupGCM(); + } + } else { + $this->iv = $this->origIV; + } + if ($this->iv === \false && !in_array($this->mode, [self::MODE_STREAM, self::MODE_ECB])) { + if ($this->mode != self::MODE_GCM || !in_array($this->engine, [self::ENGINE_LIBSODIUM, self::ENGINE_OPENSSL_GCM])) { + throw new InsufficientSetupException('No IV has been defined'); + } + } + if ($this->key === \false) { + throw new InsufficientSetupException('No key has been defined'); + } + $this->encryptIV = $this->decryptIV = $this->iv; + switch ($this->engine) { + case self::ENGINE_MCRYPT: + $this->enchanged = $this->dechanged = \true; + set_error_handler(function () { + }); + if (!isset($this->enmcrypt)) { + static $mcrypt_modes = [self::MODE_CTR => 'ctr', self::MODE_ECB => \MCRYPT_MODE_ECB, self::MODE_CBC => \MCRYPT_MODE_CBC, self::MODE_CFB => 'ncfb', self::MODE_CFB8 => \MCRYPT_MODE_CFB, self::MODE_OFB => \MCRYPT_MODE_NOFB, self::MODE_OFB8 => \MCRYPT_MODE_OFB, self::MODE_STREAM => \MCRYPT_MODE_STREAM]; + $this->demcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); + $this->enmcrypt = mcrypt_module_open($this->cipher_name_mcrypt, '', $mcrypt_modes[$this->mode], ''); + // we need the $ecb mcrypt resource (only) in MODE_CFB with enableContinuousBuffer() + // to workaround mcrypt's broken ncfb implementation in buffered mode + // see: {@link http://phpseclib.sourceforge.net/cfb-demo.phps} + if ($this->mode == self::MODE_CFB) { + $this->ecb = mcrypt_module_open($this->cipher_name_mcrypt, '', \MCRYPT_MODE_ECB, ''); + } + } + // else should mcrypt_generic_deinit be called? + if ($this->mode == self::MODE_CFB) { + mcrypt_generic_init($this->ecb, $this->key, str_repeat("\x00", $this->block_size)); + } + restore_error_handler(); + break; + case self::ENGINE_INTERNAL: + $this->setupKey(); + break; + case self::ENGINE_EVAL: + if ($this->nonIVChanged) { + $this->setupKey(); + $this->setupInlineCrypt(); + } + } + $this->nonIVChanged = \false; + } + /** + * Pads a string + * + * Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize. + * $this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to + * chr($this->block_size - (strlen($text) % $this->block_size) + * + * If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless + * and padding will, hence forth, be enabled. + * + * @see self::unpad() + * @param string $text + * @throws \LengthException if padding is disabled and the plaintext's length is not a multiple of the block size + * @return string + */ + protected function pad($text) + { + $length = strlen($text); + if (!$this->padding) { + if ($length % $this->block_size == 0) { + return $text; + } else { + throw new \LengthException("The plaintext's length ({$length}) is not a multiple of the block size ({$this->block_size}). Try enabling padding."); + } + } + $pad = $this->block_size - $length % $this->block_size; + return str_pad($text, $length + $pad, chr($pad)); + } + /** + * Unpads a string. + * + * If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong + * and false will be returned. + * + * @see self::pad() + * @param string $text + * @throws \LengthException if the ciphertext's length is not a multiple of the block size + * @return string + */ + protected function unpad($text) + { + if (!$this->padding) { + return $text; + } + $length = ord($text[strlen($text) - 1]); + if (!$length || $length > $this->block_size) { + throw new BadDecryptionException("The ciphertext has an invalid padding length ({$length}) compared to the block size ({$this->block_size})"); + } + return substr($text, 0, -$length); + } + /** + * Setup the performance-optimized function for de/encrypt() + * + * Stores the created (or existing) callback function-name + * in $this->inline_crypt + * + * Internally for phpseclib developers: + * + * _setupInlineCrypt() would be called only if: + * + * - $this->engine === self::ENGINE_EVAL + * + * - each time on _setup(), after(!) _setupKey() + * + * + * This ensures that _setupInlineCrypt() has always a + * full ready2go initializated internal cipher $engine state + * where, for example, the keys already expanded, + * keys/block_size calculated and such. + * + * It is, each time if called, the responsibility of _setupInlineCrypt(): + * + * - to set $this->inline_crypt to a valid and fully working callback function + * as a (faster) replacement for encrypt() / decrypt() + * + * - NOT to create unlimited callback functions (for memory reasons!) + * no matter how often _setupInlineCrypt() would be called. At some + * point of amount they must be generic re-useable. + * + * - the code of _setupInlineCrypt() it self, + * and the generated callback code, + * must be, in following order: + * - 100% safe + * - 100% compatible to encrypt()/decrypt() + * - using only php5+ features/lang-constructs/php-extensions if + * compatibility (down to php4) or fallback is provided + * - readable/maintainable/understandable/commented and... not-cryptic-styled-code :-) + * - >= 10% faster than encrypt()/decrypt() [which is, by the way, + * the reason for the existence of _setupInlineCrypt() :-)] + * - memory-nice + * - short (as good as possible) + * + * Note: - _setupInlineCrypt() is using _createInlineCryptFunction() to create the full callback function code. + * - In case of using inline crypting, _setupInlineCrypt() must extend by the child \phpseclib3\Crypt\* class. + * - The following variable names are reserved: + * - $_* (all variable names prefixed with an underscore) + * - $self (object reference to it self. Do not use $this, but $self instead) + * - $in (the content of $in has to en/decrypt by the generated code) + * - The callback function should not use the 'return' statement, but en/decrypt'ing the content of $in only + * + * {@internal If a Crypt_* class providing inline crypting it must extend _setupInlineCrypt()} + * + * @see self::setup() + * @see self::createInlineCryptFunction() + * @see self::encrypt() + * @see self::decrypt() + */ + //protected function setupInlineCrypt(); + /** + * Creates the performance-optimized function for en/decrypt() + * + * Internally for phpseclib developers: + * + * _createInlineCryptFunction(): + * + * - merge the $cipher_code [setup'ed by _setupInlineCrypt()] + * with the current [$this->]mode of operation code + * + * - create the $inline function, which called by encrypt() / decrypt() + * as its replacement to speed up the en/decryption operations. + * + * - return the name of the created $inline callback function + * + * - used to speed up en/decryption + * + * + * + * The main reason why can speed up things [up to 50%] this way are: + * + * - using variables more effective then regular. + * (ie no use of expensive arrays but integers $k_0, $k_1 ... + * or even, for example, the pure $key[] values hardcoded) + * + * - avoiding 1000's of function calls of ie _encryptBlock() + * but inlining the crypt operations. + * in the mode of operation for() loop. + * + * - full loop unroll the (sometimes key-dependent) rounds + * avoiding this way ++$i counters and runtime-if's etc... + * + * The basic code architectur of the generated $inline en/decrypt() + * lambda function, in pseudo php, is: + * + * + * +----------------------------------------------------------------------------------------------+ + * | callback $inline = create_function: | + * | lambda_function_0001_crypt_ECB($action, $text) | + * | { | + * | INSERT PHP CODE OF: | + * | $cipher_code['init_crypt']; // general init code. | + * | // ie: $sbox'es declarations used for | + * | // encrypt and decrypt'ing. | + * | | + * | switch ($action) { | + * | case 'encrypt': | + * | INSERT PHP CODE OF: | + * | $cipher_code['init_encrypt']; // encrypt sepcific init code. | + * | ie: specified $key or $box | + * | declarations for encrypt'ing. | + * | | + * | foreach ($ciphertext) { | + * | $in = $block_size of $ciphertext; | + * | | + * | INSERT PHP CODE OF: | + * | $cipher_code['encrypt_block']; // encrypt's (string) $in, which is always: | + * | // strlen($in) == $this->block_size | + * | // here comes the cipher algorithm in action | + * | // for encryption. | + * | // $cipher_code['encrypt_block'] has to | + * | // encrypt the content of the $in variable | + * | | + * | $plaintext .= $in; | + * | } | + * | return $plaintext; | + * | | + * | case 'decrypt': | + * | INSERT PHP CODE OF: | + * | $cipher_code['init_decrypt']; // decrypt sepcific init code | + * | ie: specified $key or $box | + * | declarations for decrypt'ing. | + * | foreach ($plaintext) { | + * | $in = $block_size of $plaintext; | + * | | + * | INSERT PHP CODE OF: | + * | $cipher_code['decrypt_block']; // decrypt's (string) $in, which is always | + * | // strlen($in) == $this->block_size | + * | // here comes the cipher algorithm in action | + * | // for decryption. | + * | // $cipher_code['decrypt_block'] has to | + * | // decrypt the content of the $in variable | + * | $ciphertext .= $in; | + * | } | + * | return $ciphertext; | + * | } | + * | } | + * +----------------------------------------------------------------------------------------------+ + * + * + * See also the \phpseclib3\Crypt\*::_setupInlineCrypt()'s for + * productive inline $cipher_code's how they works. + * + * Structure of: + * + * $cipher_code = [ + * 'init_crypt' => (string) '', // optional + * 'init_encrypt' => (string) '', // optional + * 'init_decrypt' => (string) '', // optional + * 'encrypt_block' => (string) '', // required + * 'decrypt_block' => (string) '' // required + * ]; + * + * + * @see self::setupInlineCrypt() + * @see self::encrypt() + * @see self::decrypt() + * @param array $cipher_code + * @return string (the name of the created callback function) + */ + protected function createInlineCryptFunction($cipher_code) + { + $block_size = $this->block_size; + // optional + $init_crypt = isset($cipher_code['init_crypt']) ? $cipher_code['init_crypt'] : ''; + $init_encrypt = isset($cipher_code['init_encrypt']) ? $cipher_code['init_encrypt'] : ''; + $init_decrypt = isset($cipher_code['init_decrypt']) ? $cipher_code['init_decrypt'] : ''; + // required + $encrypt_block = $cipher_code['encrypt_block']; + $decrypt_block = $cipher_code['decrypt_block']; + // Generating mode of operation inline code, + // merged with the $cipher_code algorithm + // for encrypt- and decryption. + switch ($this->mode) { + case self::MODE_ECB: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_plaintext_len = strlen($_text); + + for ($_i = 0; $_i < $_plaintext_len; $_i+= ' . $block_size . ') { + $in = substr($_text, $_i, ' . $block_size . '); + ' . $encrypt_block . ' + $_ciphertext.= $in; + } + + return $_ciphertext; + '; + $decrypt = $init_decrypt . ' + $_plaintext = ""; + $_text = str_pad($_text, strlen($_text) + (' . $block_size . ' - strlen($_text) % ' . $block_size . ') % ' . $block_size . ', chr(0)); + $_ciphertext_len = strlen($_text); + + for ($_i = 0; $_i < $_ciphertext_len; $_i+= ' . $block_size . ') { + $in = substr($_text, $_i, ' . $block_size . '); + ' . $decrypt_block . ' + $_plaintext.= $in; + } + + return $this->unpad($_plaintext); + '; + break; + case self::MODE_CTR: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_plaintext_len = strlen($_text); + $_xor = $this->encryptIV; + $_buffer = &$this->enbuffer; + if (strlen($_buffer["ciphertext"])) { + for ($_i = 0; $_i < $_plaintext_len; $_i+= ' . $block_size . ') { + $_block = substr($_text, $_i, ' . $block_size . '); + if (strlen($_block) > strlen($_buffer["ciphertext"])) { + $in = $_xor; + ' . $encrypt_block . ' + \\phpseclib3\\Common\\Functions\\Strings::increment_str($_xor); + $_buffer["ciphertext"].= $in; + } + $_key = \\phpseclib3\\Common\\Functions\\Strings::shift($_buffer["ciphertext"], ' . $block_size . '); + $_ciphertext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_plaintext_len; $_i+= ' . $block_size . ') { + $_block = substr($_text, $_i, ' . $block_size . '); + $in = $_xor; + ' . $encrypt_block . ' + \\phpseclib3\\Common\\Functions\\Strings::increment_str($_xor); + $_key = $in; + $_ciphertext.= $_block ^ $_key; + } + } + if ($this->continuousBuffer) { + $this->encryptIV = $_xor; + if ($_start = $_plaintext_len % ' . $block_size . ') { + $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"]; + } + } + + return $_ciphertext; + '; + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_ciphertext_len = strlen($_text); + $_xor = $this->decryptIV; + $_buffer = &$this->debuffer; + + if (strlen($_buffer["ciphertext"])) { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= ' . $block_size . ') { + $_block = substr($_text, $_i, ' . $block_size . '); + if (strlen($_block) > strlen($_buffer["ciphertext"])) { + $in = $_xor; + ' . $encrypt_block . ' + \\phpseclib3\\Common\\Functions\\Strings::increment_str($_xor); + $_buffer["ciphertext"].= $in; + } + $_key = \\phpseclib3\\Common\\Functions\\Strings::shift($_buffer["ciphertext"], ' . $block_size . '); + $_plaintext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= ' . $block_size . ') { + $_block = substr($_text, $_i, ' . $block_size . '); + $in = $_xor; + ' . $encrypt_block . ' + \\phpseclib3\\Common\\Functions\\Strings::increment_str($_xor); + $_key = $in; + $_plaintext.= $_block ^ $_key; + } + } + if ($this->continuousBuffer) { + $this->decryptIV = $_xor; + if ($_start = $_ciphertext_len % ' . $block_size . ') { + $_buffer["ciphertext"] = substr($_key, $_start) . $_buffer["ciphertext"]; + } + } + + return $_plaintext; + '; + break; + case self::MODE_CFB: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_buffer = &$this->enbuffer; + + if ($this->continuousBuffer) { + $_iv = &$this->encryptIV; + $_pos = &$_buffer["pos"]; + } else { + $_iv = $this->encryptIV; + $_pos = 0; + } + $_len = strlen($_text); + $_i = 0; + if ($_pos) { + $_orig_pos = $_pos; + $_max = ' . $block_size . ' - $_pos; + if ($_len >= $_max) { + $_i = $_max; + $_len-= $_max; + $_pos = 0; + } else { + $_i = $_len; + $_pos+= $_len; + $_len = 0; + } + $_ciphertext = substr($_iv, $_orig_pos) ^ $_text; + $_iv = substr_replace($_iv, $_ciphertext, $_orig_pos, $_i); + } + while ($_len >= ' . $block_size . ') { + $in = $_iv; + ' . $encrypt_block . '; + $_iv = $in ^ substr($_text, $_i, ' . $block_size . '); + $_ciphertext.= $_iv; + $_len-= ' . $block_size . '; + $_i+= ' . $block_size . '; + } + if ($_len) { + $in = $_iv; + ' . $encrypt_block . ' + $_iv = $in; + $_block = $_iv ^ substr($_text, $_i); + $_iv = substr_replace($_iv, $_block, 0, $_len); + $_ciphertext.= $_block; + $_pos = $_len; + } + return $_ciphertext; + '; + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_buffer = &$this->debuffer; + + if ($this->continuousBuffer) { + $_iv = &$this->decryptIV; + $_pos = &$_buffer["pos"]; + } else { + $_iv = $this->decryptIV; + $_pos = 0; + } + $_len = strlen($_text); + $_i = 0; + if ($_pos) { + $_orig_pos = $_pos; + $_max = ' . $block_size . ' - $_pos; + if ($_len >= $_max) { + $_i = $_max; + $_len-= $_max; + $_pos = 0; + } else { + $_i = $_len; + $_pos+= $_len; + $_len = 0; + } + $_plaintext = substr($_iv, $_orig_pos) ^ $_text; + $_iv = substr_replace($_iv, substr($_text, 0, $_i), $_orig_pos, $_i); + } + while ($_len >= ' . $block_size . ') { + $in = $_iv; + ' . $encrypt_block . ' + $_iv = $in; + $cb = substr($_text, $_i, ' . $block_size . '); + $_plaintext.= $_iv ^ $cb; + $_iv = $cb; + $_len-= ' . $block_size . '; + $_i+= ' . $block_size . '; + } + if ($_len) { + $in = $_iv; + ' . $encrypt_block . ' + $_iv = $in; + $_plaintext.= $_iv ^ substr($_text, $_i); + $_iv = substr_replace($_iv, substr($_text, $_i), 0, $_len); + $_pos = $_len; + } + + return $_plaintext; + '; + break; + case self::MODE_CFB8: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_len = strlen($_text); + $_iv = $this->encryptIV; + + for ($_i = 0; $_i < $_len; ++$_i) { + $in = $_iv; + ' . $encrypt_block . ' + $_ciphertext .= ($_c = $_text[$_i] ^ $in); + $_iv = substr($_iv, 1) . $_c; + } + + if ($this->continuousBuffer) { + if ($_len >= ' . $block_size . ') { + $this->encryptIV = substr($_ciphertext, -' . $block_size . '); + } else { + $this->encryptIV = substr($this->encryptIV, $_len - ' . $block_size . ') . substr($_ciphertext, -$_len); + } + } + + return $_ciphertext; + '; + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_len = strlen($_text); + $_iv = $this->decryptIV; + + for ($_i = 0; $_i < $_len; ++$_i) { + $in = $_iv; + ' . $encrypt_block . ' + $_plaintext .= $_text[$_i] ^ $in; + $_iv = substr($_iv, 1) . $_text[$_i]; + } + + if ($this->continuousBuffer) { + if ($_len >= ' . $block_size . ') { + $this->decryptIV = substr($_text, -' . $block_size . '); + } else { + $this->decryptIV = substr($this->decryptIV, $_len - ' . $block_size . ') . substr($_text, -$_len); + } + } + + return $_plaintext; + '; + break; + case self::MODE_OFB8: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_len = strlen($_text); + $_iv = $this->encryptIV; + + for ($_i = 0; $_i < $_len; ++$_i) { + $in = $_iv; + ' . $encrypt_block . ' + $_ciphertext.= $_text[$_i] ^ $in; + $_iv = substr($_iv, 1) . $in[0]; + } + + if ($this->continuousBuffer) { + $this->encryptIV = $_iv; + } + + return $_ciphertext; + '; + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_len = strlen($_text); + $_iv = $this->decryptIV; + + for ($_i = 0; $_i < $_len; ++$_i) { + $in = $_iv; + ' . $encrypt_block . ' + $_plaintext.= $_text[$_i] ^ $in; + $_iv = substr($_iv, 1) . $in[0]; + } + + if ($this->continuousBuffer) { + $this->decryptIV = $_iv; + } + + return $_plaintext; + '; + break; + case self::MODE_OFB: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_plaintext_len = strlen($_text); + $_xor = $this->encryptIV; + $_buffer = &$this->enbuffer; + + if (strlen($_buffer["xor"])) { + for ($_i = 0; $_i < $_plaintext_len; $_i+= ' . $block_size . ') { + $_block = substr($_text, $_i, ' . $block_size . '); + if (strlen($_block) > strlen($_buffer["xor"])) { + $in = $_xor; + ' . $encrypt_block . ' + $_xor = $in; + $_buffer["xor"].= $_xor; + } + $_key = \\phpseclib3\\Common\\Functions\\Strings::shift($_buffer["xor"], ' . $block_size . '); + $_ciphertext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_plaintext_len; $_i+= ' . $block_size . ') { + $in = $_xor; + ' . $encrypt_block . ' + $_xor = $in; + $_ciphertext.= substr($_text, $_i, ' . $block_size . ') ^ $_xor; + } + $_key = $_xor; + } + if ($this->continuousBuffer) { + $this->encryptIV = $_xor; + if ($_start = $_plaintext_len % ' . $block_size . ') { + $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"]; + } + } + return $_ciphertext; + '; + $decrypt = $init_encrypt . ' + $_plaintext = ""; + $_ciphertext_len = strlen($_text); + $_xor = $this->decryptIV; + $_buffer = &$this->debuffer; + + if (strlen($_buffer["xor"])) { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= ' . $block_size . ') { + $_block = substr($_text, $_i, ' . $block_size . '); + if (strlen($_block) > strlen($_buffer["xor"])) { + $in = $_xor; + ' . $encrypt_block . ' + $_xor = $in; + $_buffer["xor"].= $_xor; + } + $_key = \\phpseclib3\\Common\\Functions\\Strings::shift($_buffer["xor"], ' . $block_size . '); + $_plaintext.= $_block ^ $_key; + } + } else { + for ($_i = 0; $_i < $_ciphertext_len; $_i+= ' . $block_size . ') { + $in = $_xor; + ' . $encrypt_block . ' + $_xor = $in; + $_plaintext.= substr($_text, $_i, ' . $block_size . ') ^ $_xor; + } + $_key = $_xor; + } + if ($this->continuousBuffer) { + $this->decryptIV = $_xor; + if ($_start = $_ciphertext_len % ' . $block_size . ') { + $_buffer["xor"] = substr($_key, $_start) . $_buffer["xor"]; + } + } + return $_plaintext; + '; + break; + case self::MODE_STREAM: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + ' . $encrypt_block . ' + return $_ciphertext; + '; + $decrypt = $init_decrypt . ' + $_plaintext = ""; + ' . $decrypt_block . ' + return $_plaintext; + '; + break; + // case self::MODE_CBC: + default: + $encrypt = $init_encrypt . ' + $_ciphertext = ""; + $_plaintext_len = strlen($_text); + + $in = $this->encryptIV; + + for ($_i = 0; $_i < $_plaintext_len; $_i+= ' . $block_size . ') { + $in = substr($_text, $_i, ' . $block_size . ') ^ $in; + ' . $encrypt_block . ' + $_ciphertext.= $in; + } + + if ($this->continuousBuffer) { + $this->encryptIV = $in; + } + + return $_ciphertext; + '; + $decrypt = $init_decrypt . ' + $_plaintext = ""; + $_text = str_pad($_text, strlen($_text) + (' . $block_size . ' - strlen($_text) % ' . $block_size . ') % ' . $block_size . ', chr(0)); + $_ciphertext_len = strlen($_text); + + $_iv = $this->decryptIV; + + for ($_i = 0; $_i < $_ciphertext_len; $_i+= ' . $block_size . ') { + $in = $_block = substr($_text, $_i, ' . $block_size . '); + ' . $decrypt_block . ' + $_plaintext.= $in ^ $_iv; + $_iv = $_block; + } + + if ($this->continuousBuffer) { + $this->decryptIV = $_iv; + } + + return $this->unpad($_plaintext); + '; + break; + } + // Before discrediting this, please read the following: + // @see https://github.com/phpseclib/phpseclib/issues/1293 + // @see https://github.com/phpseclib/phpseclib/pull/1143 + eval('$func = function ($_action, $_text) { ' . $init_crypt . 'if ($_action == "encrypt") { ' . $encrypt . ' } else { ' . $decrypt . ' }};'); + return \Closure::bind($func, $this, static::class); + } + /** + * Convert float to int + * + * On ARM CPUs converting floats to ints doesn't always work + * + * @param string $x + * @return int + */ + protected static function safe_intval($x) + { + if (is_int($x)) { + return $x; + } + if (self::$use_reg_intval) { + return \PHP_INT_SIZE == 4 && \PHP_VERSION_ID >= 80100 ? intval($x) : $x; + } + return fmod($x, 0x80000000) & 0x7fffffff | (fmod(floor($x / 0x80000000), 2) & 1) << 31; + } + /** + * eval()'able string for in-line float to int + * + * @return string + */ + protected static function safe_intval_inline() + { + if (self::$use_reg_intval) { + return \PHP_INT_SIZE == 4 && \PHP_VERSION_ID >= 80100 ? 'intval(%s)' : '%s'; + } + $safeint = '(is_int($temp = %s) ? $temp : (fmod($temp, 0x80000000) & 0x7FFFFFFF) | '; + return $safeint . '((fmod(floor($temp / 0x80000000), 2) & 1) << 31))'; + } + /** + * Sets up GCM parameters + * + * See steps 1-2 of https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf#page=23 + * for more info + * + */ + private function setupGCM() + { + // don't keep on re-calculating $this->h + if (!$this->h || $this->hKey != $this->key) { + $cipher = new static('ecb'); + $cipher->setKey($this->key); + $cipher->disablePadding(); + $this->h = self::$gcmField->newInteger(Strings::switchEndianness($cipher->encrypt("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"))); + $this->hKey = $this->key; + } + if (strlen($this->nonce) == 12) { + $this->iv = $this->nonce . "\x00\x00\x00\x01"; + } else { + $this->iv = $this->ghash(self::nullPad128($this->nonce) . str_repeat("\x00", 8) . self::len64($this->nonce)); + } + } + /** + * Performs GHASH operation + * + * See https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf#page=20 + * for more info + * + * @see self::decrypt() + * @see self::encrypt() + * @param string $x + * @return string + */ + private function ghash($x) + { + $h = $this->h; + $y = ["\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"]; + $x = str_split($x, 16); + $n = 0; + // the switchEndianness calls are necessary because the multiplication algorithm in BinaryField/Integer + // interprets strings as polynomials in big endian order whereas in GCM they're interpreted in little + // endian order per https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf#page=19. + // big endian order is what binary field elliptic curves use per http://www.secg.org/sec1-v2.pdf#page=18. + // we could switchEndianness here instead of in the while loop but doing so in the while loop seems like it + // might be slightly more performant + //$x = Strings::switchEndianness($x); + foreach ($x as $xn) { + $xn = Strings::switchEndianness($xn); + $t = $y[$n] ^ $xn; + $temp = self::$gcmField->newInteger($t); + $y[++$n] = $temp->multiply($h)->toBytes(); + $y[$n] = substr($y[$n], 1); + } + $y[$n] = Strings::switchEndianness($y[$n]); + return $y[$n]; + } + /** + * Returns the bit length of a string in a packed format + * + * @see self::decrypt() + * @see self::encrypt() + * @see self::setupGCM() + * @param string $str + * @return string + */ + private static function len64($str) + { + return "\x00\x00\x00\x00" . pack('N', 8 * strlen($str)); + } + /** + * NULL pads a string to be a multiple of 128 + * + * @see self::decrypt() + * @see self::encrypt() + * @see self::setupGCM() + * @param string $str + * @return string + */ + protected static function nullPad128($str) + { + $len = strlen($str); + return $str . str_repeat("\x00", 16 * ceil($len / 16) - $len); + } + /** + * Calculates Poly1305 MAC + * + * On my system ChaCha20, with libsodium, takes 0.5s. With this custom Poly1305 implementation + * it takes 1.2s. + * + * @see self::decrypt() + * @see self::encrypt() + * @param string $text + * @return string + */ + protected function poly1305($text) + { + $s = $this->poly1305Key; + // strlen($this->poly1305Key) == 32 + $r = Strings::shift($s, 16); + $r = strrev($r); + $r &= "\x0f\xff\xff\xfc\x0f\xff\xff\xfc\x0f\xff\xff\xfc\x0f\xff\xff\xff"; + $s = strrev($s); + $r = self::$poly1305Field->newInteger(new BigInteger($r, 256)); + $s = self::$poly1305Field->newInteger(new BigInteger($s, 256)); + $a = self::$poly1305Field->newInteger(new BigInteger()); + $blocks = str_split($text, 16); + foreach ($blocks as $block) { + $n = strrev($block . chr(1)); + $n = self::$poly1305Field->newInteger(new BigInteger($n, 256)); + $a = $a->add($n); + $a = $a->multiply($r); + } + $r = $a->toBigInteger()->add($s->toBigInteger()); + $mask = "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"; + return strrev($r->toBytes()) & $mask; + } + /** + * Return the mode + * + * You can do $obj instanceof AES or whatever to get the cipher but you can't do that to get the mode + * + * @return string + */ + public function getMode() + { + return array_flip(self::MODE_MAP)[$this->mode]; + } + /** + * Is the continuous buffer enabled? + * + * @return boolean + */ + public function continuousBufferEnabled() + { + return $this->continuousBuffer; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/Fingerprint.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/Fingerprint.php new file mode 100644 index 0000000..a584536 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/Fingerprint.php @@ -0,0 +1,55 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Traits; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +/** + * Fingerprint Trait for Private Keys + * + * @author Jim Wigginton + */ +trait Fingerprint +{ + /** + * Returns the public key's fingerprint + * + * The public key's fingerprint is returned, which is equivalent to running `ssh-keygen -lf rsa.pub`. If there is + * no public key currently loaded, false is returned. + * Example output (md5): "c1:b1:30:29:d7:b8:de:6c:97:77:10:d7:46:41:63:87" (as specified by RFC 4716) + * + * @param string $algorithm The hashing algorithm to be used. Valid options are 'md5' and 'sha256'. False is returned + * for invalid values. + * @return mixed + */ + public function getFingerprint($algorithm = 'md5') + { + $type = self::validatePlugin('Keys', 'OpenSSH', 'savePublicKey'); + if ($type === \false) { + return \false; + } + $key = $this->toString('OpenSSH', ['binary' => \true]); + if ($key === \false) { + return \false; + } + switch ($algorithm) { + case 'sha256': + $hash = new Hash('sha256'); + $base = base64_encode($hash->hash($key)); + return substr($base, 0, strlen($base) - 1); + case 'md5': + return substr(chunk_split(md5($key), 2, ':'), 0, -1); + default: + return \false; + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/PasswordProtected.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/PasswordProtected.php new file mode 100644 index 0000000..2d150fd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/PasswordProtected.php @@ -0,0 +1,44 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Traits; + +/** + * Password Protected Trait for Private Keys + * + * @author Jim Wigginton + */ +trait PasswordProtected +{ + /** + * Password + * + * @var string|bool + */ + private $password = \false; + /** + * Sets the password + * + * Private keys can be encrypted with a password. To unset the password, pass in the empty string or false. + * Or rather, pass in $password such that empty($password) && !is_string($password) is true. + * + * @see self::createKey() + * @see self::load() + * @param string|bool $password + */ + public function withPassword($password = \false) + { + $new = clone $this; + $new->password = $password; + return $new; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DES.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DES.php new file mode 100644 index 0000000..fa8549b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DES.php @@ -0,0 +1,522 @@ + + * setKey('abcdefgh'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $des->decrypt($des->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\BlockCipher; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadModeException; +/** + * Pure-PHP implementation of DES. + * + * @author Jim Wigginton + */ +class DES extends BlockCipher +{ + /** + * Contains $keys[self::ENCRYPT] + * + * @see \phpseclib3\Crypt\DES::setupKey() + * @see \phpseclib3\Crypt\DES::processBlock() + */ + const ENCRYPT = 0; + /** + * Contains $keys[self::DECRYPT] + * + * @see \phpseclib3\Crypt\DES::setupKey() + * @see \phpseclib3\Crypt\DES::processBlock() + */ + const DECRYPT = 1; + /** + * Block Length of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @var int + */ + protected $block_size = 8; + /** + * Key Length (in bytes) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKeyLength() + * @var int + */ + protected $key_length = 8; + /** + * The mcrypt specific name of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @var string + */ + protected $cipher_name_mcrypt = 'des'; + /** + * The OpenSSL names of the cipher / modes + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::openssl_mode_names + * @var array + */ + protected $openssl_mode_names = [self::MODE_ECB => 'des-ecb', self::MODE_CBC => 'des-cbc', self::MODE_CFB => 'des-cfb', self::MODE_OFB => 'des-ofb']; + /** + * Optimizing value while CFB-encrypting + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @var int + */ + protected $cfb_init_len = 500; + /** + * Switch for DES/3DES encryption + * + * Used only if $engine == self::ENGINE_INTERNAL + * + * @see self::setupKey() + * @see self::processBlock() + * @var int + */ + protected $des_rounds = 1; + /** + * max possible size of $key + * + * @see self::setKey() + * @var string + */ + protected $key_length_max = 8; + /** + * The Key Schedule + * + * @see self::setupKey() + * @var array + */ + private $keys; + /** + * Key Cache "key" + * + * @see self::setupKey() + * @var array + */ + private $kl; + /** + * Shuffle table. + * + * For each byte value index, the entry holds an 8-byte string + * with each byte containing all bits in the same state as the + * corresponding bit in the index value. + * + * @see self::processBlock() + * @see self::setupKey() + * @var array + */ + protected static $shuffle = ["\x00\x00\x00\x00\x00\x00\x00\x00", "\x00\x00\x00\x00\x00\x00\x00\xff", "\x00\x00\x00\x00\x00\x00\xff\x00", "\x00\x00\x00\x00\x00\x00\xff\xff", "\x00\x00\x00\x00\x00\xff\x00\x00", "\x00\x00\x00\x00\x00\xff\x00\xff", "\x00\x00\x00\x00\x00\xff\xff\x00", "\x00\x00\x00\x00\x00\xff\xff\xff", "\x00\x00\x00\x00\xff\x00\x00\x00", "\x00\x00\x00\x00\xff\x00\x00\xff", "\x00\x00\x00\x00\xff\x00\xff\x00", "\x00\x00\x00\x00\xff\x00\xff\xff", "\x00\x00\x00\x00\xff\xff\x00\x00", "\x00\x00\x00\x00\xff\xff\x00\xff", "\x00\x00\x00\x00\xff\xff\xff\x00", "\x00\x00\x00\x00\xff\xff\xff\xff", "\x00\x00\x00\xff\x00\x00\x00\x00", "\x00\x00\x00\xff\x00\x00\x00\xff", "\x00\x00\x00\xff\x00\x00\xff\x00", "\x00\x00\x00\xff\x00\x00\xff\xff", "\x00\x00\x00\xff\x00\xff\x00\x00", "\x00\x00\x00\xff\x00\xff\x00\xff", "\x00\x00\x00\xff\x00\xff\xff\x00", "\x00\x00\x00\xff\x00\xff\xff\xff", "\x00\x00\x00\xff\xff\x00\x00\x00", "\x00\x00\x00\xff\xff\x00\x00\xff", "\x00\x00\x00\xff\xff\x00\xff\x00", "\x00\x00\x00\xff\xff\x00\xff\xff", "\x00\x00\x00\xff\xff\xff\x00\x00", "\x00\x00\x00\xff\xff\xff\x00\xff", "\x00\x00\x00\xff\xff\xff\xff\x00", "\x00\x00\x00\xff\xff\xff\xff\xff", "\x00\x00\xff\x00\x00\x00\x00\x00", "\x00\x00\xff\x00\x00\x00\x00\xff", "\x00\x00\xff\x00\x00\x00\xff\x00", "\x00\x00\xff\x00\x00\x00\xff\xff", "\x00\x00\xff\x00\x00\xff\x00\x00", "\x00\x00\xff\x00\x00\xff\x00\xff", "\x00\x00\xff\x00\x00\xff\xff\x00", "\x00\x00\xff\x00\x00\xff\xff\xff", "\x00\x00\xff\x00\xff\x00\x00\x00", "\x00\x00\xff\x00\xff\x00\x00\xff", "\x00\x00\xff\x00\xff\x00\xff\x00", "\x00\x00\xff\x00\xff\x00\xff\xff", "\x00\x00\xff\x00\xff\xff\x00\x00", "\x00\x00\xff\x00\xff\xff\x00\xff", "\x00\x00\xff\x00\xff\xff\xff\x00", "\x00\x00\xff\x00\xff\xff\xff\xff", "\x00\x00\xff\xff\x00\x00\x00\x00", "\x00\x00\xff\xff\x00\x00\x00\xff", "\x00\x00\xff\xff\x00\x00\xff\x00", "\x00\x00\xff\xff\x00\x00\xff\xff", "\x00\x00\xff\xff\x00\xff\x00\x00", "\x00\x00\xff\xff\x00\xff\x00\xff", "\x00\x00\xff\xff\x00\xff\xff\x00", "\x00\x00\xff\xff\x00\xff\xff\xff", "\x00\x00\xff\xff\xff\x00\x00\x00", "\x00\x00\xff\xff\xff\x00\x00\xff", "\x00\x00\xff\xff\xff\x00\xff\x00", "\x00\x00\xff\xff\xff\x00\xff\xff", "\x00\x00\xff\xff\xff\xff\x00\x00", "\x00\x00\xff\xff\xff\xff\x00\xff", "\x00\x00\xff\xff\xff\xff\xff\x00", "\x00\x00\xff\xff\xff\xff\xff\xff", "\x00\xff\x00\x00\x00\x00\x00\x00", "\x00\xff\x00\x00\x00\x00\x00\xff", "\x00\xff\x00\x00\x00\x00\xff\x00", "\x00\xff\x00\x00\x00\x00\xff\xff", "\x00\xff\x00\x00\x00\xff\x00\x00", "\x00\xff\x00\x00\x00\xff\x00\xff", "\x00\xff\x00\x00\x00\xff\xff\x00", "\x00\xff\x00\x00\x00\xff\xff\xff", "\x00\xff\x00\x00\xff\x00\x00\x00", "\x00\xff\x00\x00\xff\x00\x00\xff", "\x00\xff\x00\x00\xff\x00\xff\x00", "\x00\xff\x00\x00\xff\x00\xff\xff", "\x00\xff\x00\x00\xff\xff\x00\x00", "\x00\xff\x00\x00\xff\xff\x00\xff", "\x00\xff\x00\x00\xff\xff\xff\x00", "\x00\xff\x00\x00\xff\xff\xff\xff", "\x00\xff\x00\xff\x00\x00\x00\x00", "\x00\xff\x00\xff\x00\x00\x00\xff", "\x00\xff\x00\xff\x00\x00\xff\x00", "\x00\xff\x00\xff\x00\x00\xff\xff", "\x00\xff\x00\xff\x00\xff\x00\x00", "\x00\xff\x00\xff\x00\xff\x00\xff", "\x00\xff\x00\xff\x00\xff\xff\x00", "\x00\xff\x00\xff\x00\xff\xff\xff", "\x00\xff\x00\xff\xff\x00\x00\x00", "\x00\xff\x00\xff\xff\x00\x00\xff", "\x00\xff\x00\xff\xff\x00\xff\x00", "\x00\xff\x00\xff\xff\x00\xff\xff", "\x00\xff\x00\xff\xff\xff\x00\x00", "\x00\xff\x00\xff\xff\xff\x00\xff", "\x00\xff\x00\xff\xff\xff\xff\x00", "\x00\xff\x00\xff\xff\xff\xff\xff", "\x00\xff\xff\x00\x00\x00\x00\x00", "\x00\xff\xff\x00\x00\x00\x00\xff", "\x00\xff\xff\x00\x00\x00\xff\x00", "\x00\xff\xff\x00\x00\x00\xff\xff", "\x00\xff\xff\x00\x00\xff\x00\x00", "\x00\xff\xff\x00\x00\xff\x00\xff", "\x00\xff\xff\x00\x00\xff\xff\x00", "\x00\xff\xff\x00\x00\xff\xff\xff", "\x00\xff\xff\x00\xff\x00\x00\x00", "\x00\xff\xff\x00\xff\x00\x00\xff", "\x00\xff\xff\x00\xff\x00\xff\x00", "\x00\xff\xff\x00\xff\x00\xff\xff", "\x00\xff\xff\x00\xff\xff\x00\x00", "\x00\xff\xff\x00\xff\xff\x00\xff", "\x00\xff\xff\x00\xff\xff\xff\x00", "\x00\xff\xff\x00\xff\xff\xff\xff", "\x00\xff\xff\xff\x00\x00\x00\x00", "\x00\xff\xff\xff\x00\x00\x00\xff", "\x00\xff\xff\xff\x00\x00\xff\x00", "\x00\xff\xff\xff\x00\x00\xff\xff", "\x00\xff\xff\xff\x00\xff\x00\x00", "\x00\xff\xff\xff\x00\xff\x00\xff", "\x00\xff\xff\xff\x00\xff\xff\x00", "\x00\xff\xff\xff\x00\xff\xff\xff", "\x00\xff\xff\xff\xff\x00\x00\x00", "\x00\xff\xff\xff\xff\x00\x00\xff", "\x00\xff\xff\xff\xff\x00\xff\x00", "\x00\xff\xff\xff\xff\x00\xff\xff", "\x00\xff\xff\xff\xff\xff\x00\x00", "\x00\xff\xff\xff\xff\xff\x00\xff", "\x00\xff\xff\xff\xff\xff\xff\x00", "\x00\xff\xff\xff\xff\xff\xff\xff", "\xff\x00\x00\x00\x00\x00\x00\x00", "\xff\x00\x00\x00\x00\x00\x00\xff", "\xff\x00\x00\x00\x00\x00\xff\x00", "\xff\x00\x00\x00\x00\x00\xff\xff", "\xff\x00\x00\x00\x00\xff\x00\x00", "\xff\x00\x00\x00\x00\xff\x00\xff", "\xff\x00\x00\x00\x00\xff\xff\x00", "\xff\x00\x00\x00\x00\xff\xff\xff", "\xff\x00\x00\x00\xff\x00\x00\x00", "\xff\x00\x00\x00\xff\x00\x00\xff", "\xff\x00\x00\x00\xff\x00\xff\x00", "\xff\x00\x00\x00\xff\x00\xff\xff", "\xff\x00\x00\x00\xff\xff\x00\x00", "\xff\x00\x00\x00\xff\xff\x00\xff", "\xff\x00\x00\x00\xff\xff\xff\x00", "\xff\x00\x00\x00\xff\xff\xff\xff", "\xff\x00\x00\xff\x00\x00\x00\x00", "\xff\x00\x00\xff\x00\x00\x00\xff", "\xff\x00\x00\xff\x00\x00\xff\x00", "\xff\x00\x00\xff\x00\x00\xff\xff", "\xff\x00\x00\xff\x00\xff\x00\x00", "\xff\x00\x00\xff\x00\xff\x00\xff", "\xff\x00\x00\xff\x00\xff\xff\x00", "\xff\x00\x00\xff\x00\xff\xff\xff", "\xff\x00\x00\xff\xff\x00\x00\x00", "\xff\x00\x00\xff\xff\x00\x00\xff", "\xff\x00\x00\xff\xff\x00\xff\x00", "\xff\x00\x00\xff\xff\x00\xff\xff", "\xff\x00\x00\xff\xff\xff\x00\x00", "\xff\x00\x00\xff\xff\xff\x00\xff", "\xff\x00\x00\xff\xff\xff\xff\x00", "\xff\x00\x00\xff\xff\xff\xff\xff", "\xff\x00\xff\x00\x00\x00\x00\x00", "\xff\x00\xff\x00\x00\x00\x00\xff", "\xff\x00\xff\x00\x00\x00\xff\x00", "\xff\x00\xff\x00\x00\x00\xff\xff", "\xff\x00\xff\x00\x00\xff\x00\x00", "\xff\x00\xff\x00\x00\xff\x00\xff", "\xff\x00\xff\x00\x00\xff\xff\x00", "\xff\x00\xff\x00\x00\xff\xff\xff", "\xff\x00\xff\x00\xff\x00\x00\x00", "\xff\x00\xff\x00\xff\x00\x00\xff", "\xff\x00\xff\x00\xff\x00\xff\x00", "\xff\x00\xff\x00\xff\x00\xff\xff", "\xff\x00\xff\x00\xff\xff\x00\x00", "\xff\x00\xff\x00\xff\xff\x00\xff", "\xff\x00\xff\x00\xff\xff\xff\x00", "\xff\x00\xff\x00\xff\xff\xff\xff", "\xff\x00\xff\xff\x00\x00\x00\x00", "\xff\x00\xff\xff\x00\x00\x00\xff", "\xff\x00\xff\xff\x00\x00\xff\x00", "\xff\x00\xff\xff\x00\x00\xff\xff", "\xff\x00\xff\xff\x00\xff\x00\x00", "\xff\x00\xff\xff\x00\xff\x00\xff", "\xff\x00\xff\xff\x00\xff\xff\x00", "\xff\x00\xff\xff\x00\xff\xff\xff", "\xff\x00\xff\xff\xff\x00\x00\x00", "\xff\x00\xff\xff\xff\x00\x00\xff", "\xff\x00\xff\xff\xff\x00\xff\x00", "\xff\x00\xff\xff\xff\x00\xff\xff", "\xff\x00\xff\xff\xff\xff\x00\x00", "\xff\x00\xff\xff\xff\xff\x00\xff", "\xff\x00\xff\xff\xff\xff\xff\x00", "\xff\x00\xff\xff\xff\xff\xff\xff", "\xff\xff\x00\x00\x00\x00\x00\x00", "\xff\xff\x00\x00\x00\x00\x00\xff", "\xff\xff\x00\x00\x00\x00\xff\x00", "\xff\xff\x00\x00\x00\x00\xff\xff", "\xff\xff\x00\x00\x00\xff\x00\x00", "\xff\xff\x00\x00\x00\xff\x00\xff", "\xff\xff\x00\x00\x00\xff\xff\x00", "\xff\xff\x00\x00\x00\xff\xff\xff", "\xff\xff\x00\x00\xff\x00\x00\x00", "\xff\xff\x00\x00\xff\x00\x00\xff", "\xff\xff\x00\x00\xff\x00\xff\x00", "\xff\xff\x00\x00\xff\x00\xff\xff", "\xff\xff\x00\x00\xff\xff\x00\x00", "\xff\xff\x00\x00\xff\xff\x00\xff", "\xff\xff\x00\x00\xff\xff\xff\x00", "\xff\xff\x00\x00\xff\xff\xff\xff", "\xff\xff\x00\xff\x00\x00\x00\x00", "\xff\xff\x00\xff\x00\x00\x00\xff", "\xff\xff\x00\xff\x00\x00\xff\x00", "\xff\xff\x00\xff\x00\x00\xff\xff", "\xff\xff\x00\xff\x00\xff\x00\x00", "\xff\xff\x00\xff\x00\xff\x00\xff", "\xff\xff\x00\xff\x00\xff\xff\x00", "\xff\xff\x00\xff\x00\xff\xff\xff", "\xff\xff\x00\xff\xff\x00\x00\x00", "\xff\xff\x00\xff\xff\x00\x00\xff", "\xff\xff\x00\xff\xff\x00\xff\x00", "\xff\xff\x00\xff\xff\x00\xff\xff", "\xff\xff\x00\xff\xff\xff\x00\x00", "\xff\xff\x00\xff\xff\xff\x00\xff", "\xff\xff\x00\xff\xff\xff\xff\x00", "\xff\xff\x00\xff\xff\xff\xff\xff", "\xff\xff\xff\x00\x00\x00\x00\x00", "\xff\xff\xff\x00\x00\x00\x00\xff", "\xff\xff\xff\x00\x00\x00\xff\x00", "\xff\xff\xff\x00\x00\x00\xff\xff", "\xff\xff\xff\x00\x00\xff\x00\x00", "\xff\xff\xff\x00\x00\xff\x00\xff", "\xff\xff\xff\x00\x00\xff\xff\x00", "\xff\xff\xff\x00\x00\xff\xff\xff", "\xff\xff\xff\x00\xff\x00\x00\x00", "\xff\xff\xff\x00\xff\x00\x00\xff", "\xff\xff\xff\x00\xff\x00\xff\x00", "\xff\xff\xff\x00\xff\x00\xff\xff", "\xff\xff\xff\x00\xff\xff\x00\x00", "\xff\xff\xff\x00\xff\xff\x00\xff", "\xff\xff\xff\x00\xff\xff\xff\x00", "\xff\xff\xff\x00\xff\xff\xff\xff", "\xff\xff\xff\xff\x00\x00\x00\x00", "\xff\xff\xff\xff\x00\x00\x00\xff", "\xff\xff\xff\xff\x00\x00\xff\x00", "\xff\xff\xff\xff\x00\x00\xff\xff", "\xff\xff\xff\xff\x00\xff\x00\x00", "\xff\xff\xff\xff\x00\xff\x00\xff", "\xff\xff\xff\xff\x00\xff\xff\x00", "\xff\xff\xff\xff\x00\xff\xff\xff", "\xff\xff\xff\xff\xff\x00\x00\x00", "\xff\xff\xff\xff\xff\x00\x00\xff", "\xff\xff\xff\xff\xff\x00\xff\x00", "\xff\xff\xff\xff\xff\x00\xff\xff", "\xff\xff\xff\xff\xff\xff\x00\x00", "\xff\xff\xff\xff\xff\xff\x00\xff", "\xff\xff\xff\xff\xff\xff\xff\x00", "\xff\xff\xff\xff\xff\xff\xff\xff"]; + /** + * IP mapping helper table. + * + * Indexing this table with each source byte performs the initial bit permutation. + * + * @var array + */ + protected static $ipmap = [0x0, 0x10, 0x1, 0x11, 0x20, 0x30, 0x21, 0x31, 0x2, 0x12, 0x3, 0x13, 0x22, 0x32, 0x23, 0x33, 0x40, 0x50, 0x41, 0x51, 0x60, 0x70, 0x61, 0x71, 0x42, 0x52, 0x43, 0x53, 0x62, 0x72, 0x63, 0x73, 0x4, 0x14, 0x5, 0x15, 0x24, 0x34, 0x25, 0x35, 0x6, 0x16, 0x7, 0x17, 0x26, 0x36, 0x27, 0x37, 0x44, 0x54, 0x45, 0x55, 0x64, 0x74, 0x65, 0x75, 0x46, 0x56, 0x47, 0x57, 0x66, 0x76, 0x67, 0x77, 0x80, 0x90, 0x81, 0x91, 0xa0, 0xb0, 0xa1, 0xb1, 0x82, 0x92, 0x83, 0x93, 0xa2, 0xb2, 0xa3, 0xb3, 0xc0, 0xd0, 0xc1, 0xd1, 0xe0, 0xf0, 0xe1, 0xf1, 0xc2, 0xd2, 0xc3, 0xd3, 0xe2, 0xf2, 0xe3, 0xf3, 0x84, 0x94, 0x85, 0x95, 0xa4, 0xb4, 0xa5, 0xb5, 0x86, 0x96, 0x87, 0x97, 0xa6, 0xb6, 0xa7, 0xb7, 0xc4, 0xd4, 0xc5, 0xd5, 0xe4, 0xf4, 0xe5, 0xf5, 0xc6, 0xd6, 0xc7, 0xd7, 0xe6, 0xf6, 0xe7, 0xf7, 0x8, 0x18, 0x9, 0x19, 0x28, 0x38, 0x29, 0x39, 0xa, 0x1a, 0xb, 0x1b, 0x2a, 0x3a, 0x2b, 0x3b, 0x48, 0x58, 0x49, 0x59, 0x68, 0x78, 0x69, 0x79, 0x4a, 0x5a, 0x4b, 0x5b, 0x6a, 0x7a, 0x6b, 0x7b, 0xc, 0x1c, 0xd, 0x1d, 0x2c, 0x3c, 0x2d, 0x3d, 0xe, 0x1e, 0xf, 0x1f, 0x2e, 0x3e, 0x2f, 0x3f, 0x4c, 0x5c, 0x4d, 0x5d, 0x6c, 0x7c, 0x6d, 0x7d, 0x4e, 0x5e, 0x4f, 0x5f, 0x6e, 0x7e, 0x6f, 0x7f, 0x88, 0x98, 0x89, 0x99, 0xa8, 0xb8, 0xa9, 0xb9, 0x8a, 0x9a, 0x8b, 0x9b, 0xaa, 0xba, 0xab, 0xbb, 0xc8, 0xd8, 0xc9, 0xd9, 0xe8, 0xf8, 0xe9, 0xf9, 0xca, 0xda, 0xcb, 0xdb, 0xea, 0xfa, 0xeb, 0xfb, 0x8c, 0x9c, 0x8d, 0x9d, 0xac, 0xbc, 0xad, 0xbd, 0x8e, 0x9e, 0x8f, 0x9f, 0xae, 0xbe, 0xaf, 0xbf, 0xcc, 0xdc, 0xcd, 0xdd, 0xec, 0xfc, 0xed, 0xfd, 0xce, 0xde, 0xcf, 0xdf, 0xee, 0xfe, 0xef, 0xff]; + /** + * Inverse IP mapping helper table. + * Indexing this table with a byte value reverses the bit order. + * + * @var array + */ + protected static $invipmap = [0x0, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x8, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x4, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0xc, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x2, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0xa, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x6, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0xe, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x1, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x9, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x5, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0xd, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x3, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0xb, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x7, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0xf, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff]; + /** + * Pre-permuted S-box1 + * + * Each box ($sbox1-$sbox8) has been vectorized, then each value pre-permuted using the + * P table: concatenation can then be replaced by exclusive ORs. + * + * @var array + */ + protected static $sbox1 = [0x808200, 0x0, 0x8000, 0x808202, 0x808002, 0x8202, 0x2, 0x8000, 0x200, 0x808200, 0x808202, 0x200, 0x800202, 0x808002, 0x800000, 0x2, 0x202, 0x800200, 0x800200, 0x8200, 0x8200, 0x808000, 0x808000, 0x800202, 0x8002, 0x800002, 0x800002, 0x8002, 0x0, 0x202, 0x8202, 0x800000, 0x8000, 0x808202, 0x2, 0x808000, 0x808200, 0x800000, 0x800000, 0x200, 0x808002, 0x8000, 0x8200, 0x800002, 0x200, 0x2, 0x800202, 0x8202, 0x808202, 0x8002, 0x808000, 0x800202, 0x800002, 0x202, 0x8202, 0x808200, 0x202, 0x800200, 0x800200, 0x0, 0x8002, 0x8200, 0x0, 0x808002]; + /** + * Pre-permuted S-box2 + * + * @var array + */ + protected static $sbox2 = [0x40084010, 0x40004000, 0x4000, 0x84010, 0x80000, 0x10, 0x40080010, 0x40004010, 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x80000, 0x10, 0x40080010, 0x84000, 0x80010, 0x40004010, 0x0, 0x40000000, 0x4000, 0x84010, 0x40080000, 0x80010, 0x40000010, 0x0, 0x84000, 0x4010, 0x40084000, 0x40080000, 0x4010, 0x0, 0x84010, 0x40080010, 0x80000, 0x40004010, 0x40080000, 0x40084000, 0x4000, 0x40080000, 0x40004000, 0x10, 0x40084010, 0x84010, 0x10, 0x4000, 0x40000000, 0x4010, 0x40084000, 0x80000, 0x40000010, 0x80010, 0x40004010, 0x40000010, 0x80010, 0x84000, 0x0, 0x40004000, 0x4010, 0x40000000, 0x40080010, 0x40084010, 0x84000]; + /** + * Pre-permuted S-box3 + * + * @var array + */ + protected static $sbox3 = [0x104, 0x4010100, 0x0, 0x4010004, 0x4000100, 0x0, 0x10104, 0x4000100, 0x10004, 0x4000004, 0x4000004, 0x10000, 0x4010104, 0x10004, 0x4010000, 0x104, 0x4000000, 0x4, 0x4010100, 0x100, 0x10100, 0x4010000, 0x4010004, 0x10104, 0x4000104, 0x10100, 0x10000, 0x4000104, 0x4, 0x4010104, 0x100, 0x4000000, 0x4010100, 0x4000000, 0x10004, 0x104, 0x10000, 0x4010100, 0x4000100, 0x0, 0x100, 0x10004, 0x4010104, 0x4000100, 0x4000004, 0x100, 0x0, 0x4010004, 0x4000104, 0x10000, 0x4000000, 0x4010104, 0x4, 0x10104, 0x10100, 0x4000004, 0x4010000, 0x4000104, 0x104, 0x4010000, 0x10104, 0x4, 0x4010004, 0x10100]; + /** + * Pre-permuted S-box4 + * + * @var array + */ + protected static $sbox4 = [0x80401000, 0x80001040, 0x80001040, 0x40, 0x401040, 0x80400040, 0x80400000, 0x80001000, 0x0, 0x401000, 0x401000, 0x80401040, 0x80000040, 0x0, 0x400040, 0x80400000, 0x80000000, 0x1000, 0x400000, 0x80401000, 0x40, 0x400000, 0x80001000, 0x1040, 0x80400040, 0x80000000, 0x1040, 0x400040, 0x1000, 0x401040, 0x80401040, 0x80000040, 0x400040, 0x80400000, 0x401000, 0x80401040, 0x80000040, 0x0, 0x0, 0x401000, 0x1040, 0x400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x40, 0x80401040, 0x80000040, 0x80000000, 0x1000, 0x80400000, 0x80001000, 0x401040, 0x80400040, 0x80001000, 0x1040, 0x400000, 0x80401000, 0x40, 0x400000, 0x1000, 0x401040]; + /** + * Pre-permuted S-box5 + * + * @var array + */ + protected static $sbox5 = [0x80, 0x1040080, 0x1040000, 0x21000080, 0x40000, 0x80, 0x20000000, 0x1040000, 0x20040080, 0x40000, 0x1000080, 0x20040080, 0x21000080, 0x21040000, 0x40080, 0x20000000, 0x1000000, 0x20040000, 0x20040000, 0x0, 0x20000080, 0x21040080, 0x21040080, 0x1000080, 0x21040000, 0x20000080, 0x0, 0x21000000, 0x1040080, 0x1000000, 0x21000000, 0x40080, 0x40000, 0x21000080, 0x80, 0x1000000, 0x20000000, 0x1040000, 0x21000080, 0x20040080, 0x1000080, 0x20000000, 0x21040000, 0x1040080, 0x20040080, 0x80, 0x1000000, 0x21040000, 0x21040080, 0x40080, 0x21000000, 0x21040080, 0x1040000, 0x0, 0x20040000, 0x21000000, 0x40080, 0x1000080, 0x20000080, 0x40000, 0x0, 0x20040000, 0x1040080, 0x20000080]; + /** + * Pre-permuted S-box6 + * + * @var array + */ + protected static $sbox6 = [0x10000008, 0x10200000, 0x2000, 0x10202008, 0x10200000, 0x8, 0x10202008, 0x200000, 0x10002000, 0x202008, 0x200000, 0x10000008, 0x200008, 0x10002000, 0x10000000, 0x2008, 0x0, 0x200008, 0x10002008, 0x2000, 0x202000, 0x10002008, 0x8, 0x10200008, 0x10200008, 0x0, 0x202008, 0x10202000, 0x2008, 0x202000, 0x10202000, 0x10000000, 0x10002000, 0x8, 0x10200008, 0x202000, 0x10202008, 0x200000, 0x2008, 0x10000008, 0x200000, 0x10002000, 0x10000000, 0x2008, 0x10000008, 0x10202008, 0x202000, 0x10200000, 0x202008, 0x10202000, 0x0, 0x10200008, 0x8, 0x2000, 0x10200000, 0x202008, 0x2000, 0x200008, 0x10002008, 0x0, 0x10202000, 0x10000000, 0x200008, 0x10002008]; + /** + * Pre-permuted S-box7 + * + * @var array + */ + protected static $sbox7 = [0x100000, 0x2100001, 0x2000401, 0x0, 0x400, 0x2000401, 0x100401, 0x2100400, 0x2100401, 0x100000, 0x0, 0x2000001, 0x1, 0x2000000, 0x2100001, 0x401, 0x2000400, 0x100401, 0x100001, 0x2000400, 0x2000001, 0x2100000, 0x2100400, 0x100001, 0x2100000, 0x400, 0x401, 0x2100401, 0x100400, 0x1, 0x2000000, 0x100400, 0x2000000, 0x100400, 0x100000, 0x2000401, 0x2000401, 0x2100001, 0x2100001, 0x1, 0x100001, 0x2000000, 0x2000400, 0x100000, 0x2100400, 0x401, 0x100401, 0x2100400, 0x401, 0x2000001, 0x2100401, 0x2100000, 0x100400, 0x0, 0x1, 0x2100401, 0x0, 0x100401, 0x2100000, 0x400, 0x2000001, 0x2000400, 0x400, 0x100001]; + /** + * Pre-permuted S-box8 + * + * @var array + */ + protected static $sbox8 = [0x8000820, 0x800, 0x20000, 0x8020820, 0x8000000, 0x8000820, 0x20, 0x8000000, 0x20020, 0x8020000, 0x8020820, 0x20800, 0x8020800, 0x20820, 0x800, 0x20, 0x8020000, 0x8000020, 0x8000800, 0x820, 0x20800, 0x20020, 0x8020020, 0x8020800, 0x820, 0x0, 0x0, 0x8020020, 0x8000020, 0x8000800, 0x20820, 0x20000, 0x20820, 0x20000, 0x8020800, 0x800, 0x20, 0x8020020, 0x800, 0x20820, 0x8000800, 0x20, 0x8000020, 0x8020000, 0x8020020, 0x8000000, 0x20000, 0x8000820, 0x0, 0x8020820, 0x20020, 0x8000020, 0x8020000, 0x8000800, 0x8000820, 0x0, 0x8020820, 0x20800, 0x20800, 0x820, 0x820, 0x20020, 0x8000000, 0x8020800]; + /** + * Default Constructor. + * + * @param string $mode + * @throws BadModeException if an invalid / unsupported mode is provided + */ + public function __construct($mode) + { + parent::__construct($mode); + if ($this->mode == self::MODE_STREAM) { + throw new BadModeException('Block ciphers cannot be ran in stream mode'); + } + } + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + if ($this->key_length_max == 8) { + if ($engine == self::ENGINE_OPENSSL) { + // quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1 + // "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider" + // in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not + if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\\d+\\.\\d+\\.\\d+) .*#', '$1', \OPENSSL_VERSION_TEXT), '3.0.1', '>=')) { + return \false; + } + $this->cipher_name_openssl_ecb = 'des-ecb'; + $this->cipher_name_openssl = 'des-' . $this->openssl_translate_mode(); + } + } + return parent::isValidEngineHelper($engine); + } + /** + * Sets the key. + * + * Keys must be 64-bits long or 8 bytes long. + * + * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() + * @param string $key + */ + public function setKey($key) + { + if (!$this instanceof TripleDES && strlen($key) != 8) { + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of size 8 are supported'); + } + // Sets the key + parent::setKey($key); + } + /** + * Encrypts a block + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see self::encrypt() + * @param string $in + * @return string + */ + protected function encryptBlock($in) + { + return $this->processBlock($in, self::ENCRYPT); + } + /** + * Decrypts a block + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see self::decrypt() + * @param string $in + * @return string + */ + protected function decryptBlock($in) + { + return $this->processBlock($in, self::DECRYPT); + } + /** + * Encrypts or decrypts a 64-bit block + * + * $mode should be either self::ENCRYPT or self::DECRYPT. See + * {@link http://en.wikipedia.org/wiki/Image:Feistel.png Feistel.png} to get a general + * idea of what this function does. + * + * @see self::encryptBlock() + * @see self::decryptBlock() + * @param string $block + * @param int $mode + * @return string + */ + private function processBlock($block, $mode) + { + static $sbox1, $sbox2, $sbox3, $sbox4, $sbox5, $sbox6, $sbox7, $sbox8, $shuffleip, $shuffleinvip; + if (!$sbox1) { + $sbox1 = array_map('intval', self::$sbox1); + $sbox2 = array_map('intval', self::$sbox2); + $sbox3 = array_map('intval', self::$sbox3); + $sbox4 = array_map('intval', self::$sbox4); + $sbox5 = array_map('intval', self::$sbox5); + $sbox6 = array_map('intval', self::$sbox6); + $sbox7 = array_map('intval', self::$sbox7); + $sbox8 = array_map('intval', self::$sbox8); + /* Merge $shuffle with $[inv]ipmap */ + for ($i = 0; $i < 256; ++$i) { + $shuffleip[] = self::$shuffle[self::$ipmap[$i]]; + $shuffleinvip[] = self::$shuffle[self::$invipmap[$i]]; + } + } + $keys = $this->keys[$mode]; + $ki = -1; + // Do the initial IP permutation. + $t = unpack('Nl/Nr', $block); + list($l, $r) = [$t['l'], $t['r']]; + $block = $shuffleip[$r & 0xff] & "\x80\x80\x80\x80\x80\x80\x80\x80" | $shuffleip[$r >> 8 & 0xff] & "@@@@@@@@" | $shuffleip[$r >> 16 & 0xff] & " " | $shuffleip[$r >> 24 & 0xff] & "\x10\x10\x10\x10\x10\x10\x10\x10" | $shuffleip[$l & 0xff] & "\x08\x08\x08\x08\x08\x08\x08\x08" | $shuffleip[$l >> 8 & 0xff] & "\x04\x04\x04\x04\x04\x04\x04\x04" | $shuffleip[$l >> 16 & 0xff] & "\x02\x02\x02\x02\x02\x02\x02\x02" | $shuffleip[$l >> 24 & 0xff] & "\x01\x01\x01\x01\x01\x01\x01\x01"; + // Extract L0 and R0. + $t = unpack('Nl/Nr', $block); + list($l, $r) = [$t['l'], $t['r']]; + for ($des_round = 0; $des_round < $this->des_rounds; ++$des_round) { + // Perform the 16 steps. + for ($i = 0; $i < 16; $i++) { + // start of "the Feistel (F) function" - see the following URL: + // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png + // Merge key schedule. + $b1 = $r >> 3 & 0x1fffffff ^ $r << 29 ^ $keys[++$ki]; + $b2 = $r >> 31 & 0x1 ^ $r << 1 ^ $keys[++$ki]; + // S-box indexing. + $t = $sbox1[$b1 >> 24 & 0x3f] ^ $sbox2[$b2 >> 24 & 0x3f] ^ $sbox3[$b1 >> 16 & 0x3f] ^ $sbox4[$b2 >> 16 & 0x3f] ^ $sbox5[$b1 >> 8 & 0x3f] ^ $sbox6[$b2 >> 8 & 0x3f] ^ $sbox7[$b1 & 0x3f] ^ $sbox8[$b2 & 0x3f] ^ $l; + // end of "the Feistel (F) function" + $l = $r; + $r = $t; + } + // Last step should not permute L & R. + $t = $l; + $l = $r; + $r = $t; + } + // Perform the inverse IP permutation. + return $shuffleinvip[$r >> 24 & 0xff] & "\x80\x80\x80\x80\x80\x80\x80\x80" | $shuffleinvip[$l >> 24 & 0xff] & "@@@@@@@@" | $shuffleinvip[$r >> 16 & 0xff] & " " | $shuffleinvip[$l >> 16 & 0xff] & "\x10\x10\x10\x10\x10\x10\x10\x10" | $shuffleinvip[$r >> 8 & 0xff] & "\x08\x08\x08\x08\x08\x08\x08\x08" | $shuffleinvip[$l >> 8 & 0xff] & "\x04\x04\x04\x04\x04\x04\x04\x04" | $shuffleinvip[$r & 0xff] & "\x02\x02\x02\x02\x02\x02\x02\x02" | $shuffleinvip[$l & 0xff] & "\x01\x01\x01\x01\x01\x01\x01\x01"; + } + /** + * Creates the key schedule + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + */ + protected function setupKey() + { + if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->des_rounds === $this->kl['des_rounds']) { + // already expanded + return; + } + $this->kl = ['key' => $this->key, 'des_rounds' => $this->des_rounds]; + static $shifts = [ + // number of key bits shifted per round + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + ]; + static $pc1map = [0x0, 0x0, 0x8, 0x8, 0x4, 0x4, 0xc, 0xc, 0x2, 0x2, 0xa, 0xa, 0x6, 0x6, 0xe, 0xe, 0x10, 0x10, 0x18, 0x18, 0x14, 0x14, 0x1c, 0x1c, 0x12, 0x12, 0x1a, 0x1a, 0x16, 0x16, 0x1e, 0x1e, 0x20, 0x20, 0x28, 0x28, 0x24, 0x24, 0x2c, 0x2c, 0x22, 0x22, 0x2a, 0x2a, 0x26, 0x26, 0x2e, 0x2e, 0x30, 0x30, 0x38, 0x38, 0x34, 0x34, 0x3c, 0x3c, 0x32, 0x32, 0x3a, 0x3a, 0x36, 0x36, 0x3e, 0x3e, 0x40, 0x40, 0x48, 0x48, 0x44, 0x44, 0x4c, 0x4c, 0x42, 0x42, 0x4a, 0x4a, 0x46, 0x46, 0x4e, 0x4e, 0x50, 0x50, 0x58, 0x58, 0x54, 0x54, 0x5c, 0x5c, 0x52, 0x52, 0x5a, 0x5a, 0x56, 0x56, 0x5e, 0x5e, 0x60, 0x60, 0x68, 0x68, 0x64, 0x64, 0x6c, 0x6c, 0x62, 0x62, 0x6a, 0x6a, 0x66, 0x66, 0x6e, 0x6e, 0x70, 0x70, 0x78, 0x78, 0x74, 0x74, 0x7c, 0x7c, 0x72, 0x72, 0x7a, 0x7a, 0x76, 0x76, 0x7e, 0x7e, 0x80, 0x80, 0x88, 0x88, 0x84, 0x84, 0x8c, 0x8c, 0x82, 0x82, 0x8a, 0x8a, 0x86, 0x86, 0x8e, 0x8e, 0x90, 0x90, 0x98, 0x98, 0x94, 0x94, 0x9c, 0x9c, 0x92, 0x92, 0x9a, 0x9a, 0x96, 0x96, 0x9e, 0x9e, 0xa0, 0xa0, 0xa8, 0xa8, 0xa4, 0xa4, 0xac, 0xac, 0xa2, 0xa2, 0xaa, 0xaa, 0xa6, 0xa6, 0xae, 0xae, 0xb0, 0xb0, 0xb8, 0xb8, 0xb4, 0xb4, 0xbc, 0xbc, 0xb2, 0xb2, 0xba, 0xba, 0xb6, 0xb6, 0xbe, 0xbe, 0xc0, 0xc0, 0xc8, 0xc8, 0xc4, 0xc4, 0xcc, 0xcc, 0xc2, 0xc2, 0xca, 0xca, 0xc6, 0xc6, 0xce, 0xce, 0xd0, 0xd0, 0xd8, 0xd8, 0xd4, 0xd4, 0xdc, 0xdc, 0xd2, 0xd2, 0xda, 0xda, 0xd6, 0xd6, 0xde, 0xde, 0xe0, 0xe0, 0xe8, 0xe8, 0xe4, 0xe4, 0xec, 0xec, 0xe2, 0xe2, 0xea, 0xea, 0xe6, 0xe6, 0xee, 0xee, 0xf0, 0xf0, 0xf8, 0xf8, 0xf4, 0xf4, 0xfc, 0xfc, 0xf2, 0xf2, 0xfa, 0xfa, 0xf6, 0xf6, 0xfe, 0xfe]; + // Mapping tables for the PC-2 transformation. + static $pc2mapc1 = [0x0, 0x400, 0x200000, 0x200400, 0x1, 0x401, 0x200001, 0x200401, 0x2000000, 0x2000400, 0x2200000, 0x2200400, 0x2000001, 0x2000401, 0x2200001, 0x2200401]; + static $pc2mapc2 = [0x0, 0x800, 0x8000000, 0x8000800, 0x10000, 0x10800, 0x8010000, 0x8010800, 0x0, 0x800, 0x8000000, 0x8000800, 0x10000, 0x10800, 0x8010000, 0x8010800, 0x100, 0x900, 0x8000100, 0x8000900, 0x10100, 0x10900, 0x8010100, 0x8010900, 0x100, 0x900, 0x8000100, 0x8000900, 0x10100, 0x10900, 0x8010100, 0x8010900, 0x10, 0x810, 0x8000010, 0x8000810, 0x10010, 0x10810, 0x8010010, 0x8010810, 0x10, 0x810, 0x8000010, 0x8000810, 0x10010, 0x10810, 0x8010010, 0x8010810, 0x110, 0x910, 0x8000110, 0x8000910, 0x10110, 0x10910, 0x8010110, 0x8010910, 0x110, 0x910, 0x8000110, 0x8000910, 0x10110, 0x10910, 0x8010110, 0x8010910, 0x40000, 0x40800, 0x8040000, 0x8040800, 0x50000, 0x50800, 0x8050000, 0x8050800, 0x40000, 0x40800, 0x8040000, 0x8040800, 0x50000, 0x50800, 0x8050000, 0x8050800, 0x40100, 0x40900, 0x8040100, 0x8040900, 0x50100, 0x50900, 0x8050100, 0x8050900, 0x40100, 0x40900, 0x8040100, 0x8040900, 0x50100, 0x50900, 0x8050100, 0x8050900, 0x40010, 0x40810, 0x8040010, 0x8040810, 0x50010, 0x50810, 0x8050010, 0x8050810, 0x40010, 0x40810, 0x8040010, 0x8040810, 0x50010, 0x50810, 0x8050010, 0x8050810, 0x40110, 0x40910, 0x8040110, 0x8040910, 0x50110, 0x50910, 0x8050110, 0x8050910, 0x40110, 0x40910, 0x8040110, 0x8040910, 0x50110, 0x50910, 0x8050110, 0x8050910, 0x1000000, 0x1000800, 0x9000000, 0x9000800, 0x1010000, 0x1010800, 0x9010000, 0x9010800, 0x1000000, 0x1000800, 0x9000000, 0x9000800, 0x1010000, 0x1010800, 0x9010000, 0x9010800, 0x1000100, 0x1000900, 0x9000100, 0x9000900, 0x1010100, 0x1010900, 0x9010100, 0x9010900, 0x1000100, 0x1000900, 0x9000100, 0x9000900, 0x1010100, 0x1010900, 0x9010100, 0x9010900, 0x1000010, 0x1000810, 0x9000010, 0x9000810, 0x1010010, 0x1010810, 0x9010010, 0x9010810, 0x1000010, 0x1000810, 0x9000010, 0x9000810, 0x1010010, 0x1010810, 0x9010010, 0x9010810, 0x1000110, 0x1000910, 0x9000110, 0x9000910, 0x1010110, 0x1010910, 0x9010110, 0x9010910, 0x1000110, 0x1000910, 0x9000110, 0x9000910, 0x1010110, 0x1010910, 0x9010110, 0x9010910, 0x1040000, 0x1040800, 0x9040000, 0x9040800, 0x1050000, 0x1050800, 0x9050000, 0x9050800, 0x1040000, 0x1040800, 0x9040000, 0x9040800, 0x1050000, 0x1050800, 0x9050000, 0x9050800, 0x1040100, 0x1040900, 0x9040100, 0x9040900, 0x1050100, 0x1050900, 0x9050100, 0x9050900, 0x1040100, 0x1040900, 0x9040100, 0x9040900, 0x1050100, 0x1050900, 0x9050100, 0x9050900, 0x1040010, 0x1040810, 0x9040010, 0x9040810, 0x1050010, 0x1050810, 0x9050010, 0x9050810, 0x1040010, 0x1040810, 0x9040010, 0x9040810, 0x1050010, 0x1050810, 0x9050010, 0x9050810, 0x1040110, 0x1040910, 0x9040110, 0x9040910, 0x1050110, 0x1050910, 0x9050110, 0x9050910, 0x1040110, 0x1040910, 0x9040110, 0x9040910, 0x1050110, 0x1050910, 0x9050110, 0x9050910]; + static $pc2mapc3 = [0x0, 0x4, 0x1000, 0x1004, 0x0, 0x4, 0x1000, 0x1004, 0x10000000, 0x10000004, 0x10001000, 0x10001004, 0x10000000, 0x10000004, 0x10001000, 0x10001004, 0x20, 0x24, 0x1020, 0x1024, 0x20, 0x24, 0x1020, 0x1024, 0x10000020, 0x10000024, 0x10001020, 0x10001024, 0x10000020, 0x10000024, 0x10001020, 0x10001024, 0x80000, 0x80004, 0x81000, 0x81004, 0x80000, 0x80004, 0x81000, 0x81004, 0x10080000, 0x10080004, 0x10081000, 0x10081004, 0x10080000, 0x10080004, 0x10081000, 0x10081004, 0x80020, 0x80024, 0x81020, 0x81024, 0x80020, 0x80024, 0x81020, 0x81024, 0x10080020, 0x10080024, 0x10081020, 0x10081024, 0x10080020, 0x10080024, 0x10081020, 0x10081024, 0x20000000, 0x20000004, 0x20001000, 0x20001004, 0x20000000, 0x20000004, 0x20001000, 0x20001004, 0x30000000, 0x30000004, 0x30001000, 0x30001004, 0x30000000, 0x30000004, 0x30001000, 0x30001004, 0x20000020, 0x20000024, 0x20001020, 0x20001024, 0x20000020, 0x20000024, 0x20001020, 0x20001024, 0x30000020, 0x30000024, 0x30001020, 0x30001024, 0x30000020, 0x30000024, 0x30001020, 0x30001024, 0x20080000, 0x20080004, 0x20081000, 0x20081004, 0x20080000, 0x20080004, 0x20081000, 0x20081004, 0x30080000, 0x30080004, 0x30081000, 0x30081004, 0x30080000, 0x30080004, 0x30081000, 0x30081004, 0x20080020, 0x20080024, 0x20081020, 0x20081024, 0x20080020, 0x20080024, 0x20081020, 0x20081024, 0x30080020, 0x30080024, 0x30081020, 0x30081024, 0x30080020, 0x30080024, 0x30081020, 0x30081024, 0x2, 0x6, 0x1002, 0x1006, 0x2, 0x6, 0x1002, 0x1006, 0x10000002, 0x10000006, 0x10001002, 0x10001006, 0x10000002, 0x10000006, 0x10001002, 0x10001006, 0x22, 0x26, 0x1022, 0x1026, 0x22, 0x26, 0x1022, 0x1026, 0x10000022, 0x10000026, 0x10001022, 0x10001026, 0x10000022, 0x10000026, 0x10001022, 0x10001026, 0x80002, 0x80006, 0x81002, 0x81006, 0x80002, 0x80006, 0x81002, 0x81006, 0x10080002, 0x10080006, 0x10081002, 0x10081006, 0x10080002, 0x10080006, 0x10081002, 0x10081006, 0x80022, 0x80026, 0x81022, 0x81026, 0x80022, 0x80026, 0x81022, 0x81026, 0x10080022, 0x10080026, 0x10081022, 0x10081026, 0x10080022, 0x10080026, 0x10081022, 0x10081026, 0x20000002, 0x20000006, 0x20001002, 0x20001006, 0x20000002, 0x20000006, 0x20001002, 0x20001006, 0x30000002, 0x30000006, 0x30001002, 0x30001006, 0x30000002, 0x30000006, 0x30001002, 0x30001006, 0x20000022, 0x20000026, 0x20001022, 0x20001026, 0x20000022, 0x20000026, 0x20001022, 0x20001026, 0x30000022, 0x30000026, 0x30001022, 0x30001026, 0x30000022, 0x30000026, 0x30001022, 0x30001026, 0x20080002, 0x20080006, 0x20081002, 0x20081006, 0x20080002, 0x20080006, 0x20081002, 0x20081006, 0x30080002, 0x30080006, 0x30081002, 0x30081006, 0x30080002, 0x30080006, 0x30081002, 0x30081006, 0x20080022, 0x20080026, 0x20081022, 0x20081026, 0x20080022, 0x20080026, 0x20081022, 0x20081026, 0x30080022, 0x30080026, 0x30081022, 0x30081026, 0x30080022, 0x30080026, 0x30081022, 0x30081026]; + static $pc2mapc4 = [0x0, 0x100000, 0x8, 0x100008, 0x200, 0x100200, 0x208, 0x100208, 0x0, 0x100000, 0x8, 0x100008, 0x200, 0x100200, 0x208, 0x100208, 0x4000000, 0x4100000, 0x4000008, 0x4100008, 0x4000200, 0x4100200, 0x4000208, 0x4100208, 0x4000000, 0x4100000, 0x4000008, 0x4100008, 0x4000200, 0x4100200, 0x4000208, 0x4100208, 0x2000, 0x102000, 0x2008, 0x102008, 0x2200, 0x102200, 0x2208, 0x102208, 0x2000, 0x102000, 0x2008, 0x102008, 0x2200, 0x102200, 0x2208, 0x102208, 0x4002000, 0x4102000, 0x4002008, 0x4102008, 0x4002200, 0x4102200, 0x4002208, 0x4102208, 0x4002000, 0x4102000, 0x4002008, 0x4102008, 0x4002200, 0x4102200, 0x4002208, 0x4102208, 0x0, 0x100000, 0x8, 0x100008, 0x200, 0x100200, 0x208, 0x100208, 0x0, 0x100000, 0x8, 0x100008, 0x200, 0x100200, 0x208, 0x100208, 0x4000000, 0x4100000, 0x4000008, 0x4100008, 0x4000200, 0x4100200, 0x4000208, 0x4100208, 0x4000000, 0x4100000, 0x4000008, 0x4100008, 0x4000200, 0x4100200, 0x4000208, 0x4100208, 0x2000, 0x102000, 0x2008, 0x102008, 0x2200, 0x102200, 0x2208, 0x102208, 0x2000, 0x102000, 0x2008, 0x102008, 0x2200, 0x102200, 0x2208, 0x102208, 0x4002000, 0x4102000, 0x4002008, 0x4102008, 0x4002200, 0x4102200, 0x4002208, 0x4102208, 0x4002000, 0x4102000, 0x4002008, 0x4102008, 0x4002200, 0x4102200, 0x4002208, 0x4102208, 0x20000, 0x120000, 0x20008, 0x120008, 0x20200, 0x120200, 0x20208, 0x120208, 0x20000, 0x120000, 0x20008, 0x120008, 0x20200, 0x120200, 0x20208, 0x120208, 0x4020000, 0x4120000, 0x4020008, 0x4120008, 0x4020200, 0x4120200, 0x4020208, 0x4120208, 0x4020000, 0x4120000, 0x4020008, 0x4120008, 0x4020200, 0x4120200, 0x4020208, 0x4120208, 0x22000, 0x122000, 0x22008, 0x122008, 0x22200, 0x122200, 0x22208, 0x122208, 0x22000, 0x122000, 0x22008, 0x122008, 0x22200, 0x122200, 0x22208, 0x122208, 0x4022000, 0x4122000, 0x4022008, 0x4122008, 0x4022200, 0x4122200, 0x4022208, 0x4122208, 0x4022000, 0x4122000, 0x4022008, 0x4122008, 0x4022200, 0x4122200, 0x4022208, 0x4122208, 0x20000, 0x120000, 0x20008, 0x120008, 0x20200, 0x120200, 0x20208, 0x120208, 0x20000, 0x120000, 0x20008, 0x120008, 0x20200, 0x120200, 0x20208, 0x120208, 0x4020000, 0x4120000, 0x4020008, 0x4120008, 0x4020200, 0x4120200, 0x4020208, 0x4120208, 0x4020000, 0x4120000, 0x4020008, 0x4120008, 0x4020200, 0x4120200, 0x4020208, 0x4120208, 0x22000, 0x122000, 0x22008, 0x122008, 0x22200, 0x122200, 0x22208, 0x122208, 0x22000, 0x122000, 0x22008, 0x122008, 0x22200, 0x122200, 0x22208, 0x122208, 0x4022000, 0x4122000, 0x4022008, 0x4122008, 0x4022200, 0x4122200, 0x4022208, 0x4122208, 0x4022000, 0x4122000, 0x4022008, 0x4122008, 0x4022200, 0x4122200, 0x4022208, 0x4122208]; + static $pc2mapd1 = [0x0, 0x1, 0x8000000, 0x8000001, 0x200000, 0x200001, 0x8200000, 0x8200001, 0x2, 0x3, 0x8000002, 0x8000003, 0x200002, 0x200003, 0x8200002, 0x8200003]; + static $pc2mapd2 = [0x0, 0x100000, 0x800, 0x100800, 0x0, 0x100000, 0x800, 0x100800, 0x4000000, 0x4100000, 0x4000800, 0x4100800, 0x4000000, 0x4100000, 0x4000800, 0x4100800, 0x4, 0x100004, 0x804, 0x100804, 0x4, 0x100004, 0x804, 0x100804, 0x4000004, 0x4100004, 0x4000804, 0x4100804, 0x4000004, 0x4100004, 0x4000804, 0x4100804, 0x0, 0x100000, 0x800, 0x100800, 0x0, 0x100000, 0x800, 0x100800, 0x4000000, 0x4100000, 0x4000800, 0x4100800, 0x4000000, 0x4100000, 0x4000800, 0x4100800, 0x4, 0x100004, 0x804, 0x100804, 0x4, 0x100004, 0x804, 0x100804, 0x4000004, 0x4100004, 0x4000804, 0x4100804, 0x4000004, 0x4100004, 0x4000804, 0x4100804, 0x200, 0x100200, 0xa00, 0x100a00, 0x200, 0x100200, 0xa00, 0x100a00, 0x4000200, 0x4100200, 0x4000a00, 0x4100a00, 0x4000200, 0x4100200, 0x4000a00, 0x4100a00, 0x204, 0x100204, 0xa04, 0x100a04, 0x204, 0x100204, 0xa04, 0x100a04, 0x4000204, 0x4100204, 0x4000a04, 0x4100a04, 0x4000204, 0x4100204, 0x4000a04, 0x4100a04, 0x200, 0x100200, 0xa00, 0x100a00, 0x200, 0x100200, 0xa00, 0x100a00, 0x4000200, 0x4100200, 0x4000a00, 0x4100a00, 0x4000200, 0x4100200, 0x4000a00, 0x4100a00, 0x204, 0x100204, 0xa04, 0x100a04, 0x204, 0x100204, 0xa04, 0x100a04, 0x4000204, 0x4100204, 0x4000a04, 0x4100a04, 0x4000204, 0x4100204, 0x4000a04, 0x4100a04, 0x20000, 0x120000, 0x20800, 0x120800, 0x20000, 0x120000, 0x20800, 0x120800, 0x4020000, 0x4120000, 0x4020800, 0x4120800, 0x4020000, 0x4120000, 0x4020800, 0x4120800, 0x20004, 0x120004, 0x20804, 0x120804, 0x20004, 0x120004, 0x20804, 0x120804, 0x4020004, 0x4120004, 0x4020804, 0x4120804, 0x4020004, 0x4120004, 0x4020804, 0x4120804, 0x20000, 0x120000, 0x20800, 0x120800, 0x20000, 0x120000, 0x20800, 0x120800, 0x4020000, 0x4120000, 0x4020800, 0x4120800, 0x4020000, 0x4120000, 0x4020800, 0x4120800, 0x20004, 0x120004, 0x20804, 0x120804, 0x20004, 0x120004, 0x20804, 0x120804, 0x4020004, 0x4120004, 0x4020804, 0x4120804, 0x4020004, 0x4120004, 0x4020804, 0x4120804, 0x20200, 0x120200, 0x20a00, 0x120a00, 0x20200, 0x120200, 0x20a00, 0x120a00, 0x4020200, 0x4120200, 0x4020a00, 0x4120a00, 0x4020200, 0x4120200, 0x4020a00, 0x4120a00, 0x20204, 0x120204, 0x20a04, 0x120a04, 0x20204, 0x120204, 0x20a04, 0x120a04, 0x4020204, 0x4120204, 0x4020a04, 0x4120a04, 0x4020204, 0x4120204, 0x4020a04, 0x4120a04, 0x20200, 0x120200, 0x20a00, 0x120a00, 0x20200, 0x120200, 0x20a00, 0x120a00, 0x4020200, 0x4120200, 0x4020a00, 0x4120a00, 0x4020200, 0x4120200, 0x4020a00, 0x4120a00, 0x20204, 0x120204, 0x20a04, 0x120a04, 0x20204, 0x120204, 0x20a04, 0x120a04, 0x4020204, 0x4120204, 0x4020a04, 0x4120a04, 0x4020204, 0x4120204, 0x4020a04, 0x4120a04]; + static $pc2mapd3 = [0x0, 0x10000, 0x2000000, 0x2010000, 0x20, 0x10020, 0x2000020, 0x2010020, 0x40000, 0x50000, 0x2040000, 0x2050000, 0x40020, 0x50020, 0x2040020, 0x2050020, 0x2000, 0x12000, 0x2002000, 0x2012000, 0x2020, 0x12020, 0x2002020, 0x2012020, 0x42000, 0x52000, 0x2042000, 0x2052000, 0x42020, 0x52020, 0x2042020, 0x2052020, 0x0, 0x10000, 0x2000000, 0x2010000, 0x20, 0x10020, 0x2000020, 0x2010020, 0x40000, 0x50000, 0x2040000, 0x2050000, 0x40020, 0x50020, 0x2040020, 0x2050020, 0x2000, 0x12000, 0x2002000, 0x2012000, 0x2020, 0x12020, 0x2002020, 0x2012020, 0x42000, 0x52000, 0x2042000, 0x2052000, 0x42020, 0x52020, 0x2042020, 0x2052020, 0x10, 0x10010, 0x2000010, 0x2010010, 0x30, 0x10030, 0x2000030, 0x2010030, 0x40010, 0x50010, 0x2040010, 0x2050010, 0x40030, 0x50030, 0x2040030, 0x2050030, 0x2010, 0x12010, 0x2002010, 0x2012010, 0x2030, 0x12030, 0x2002030, 0x2012030, 0x42010, 0x52010, 0x2042010, 0x2052010, 0x42030, 0x52030, 0x2042030, 0x2052030, 0x10, 0x10010, 0x2000010, 0x2010010, 0x30, 0x10030, 0x2000030, 0x2010030, 0x40010, 0x50010, 0x2040010, 0x2050010, 0x40030, 0x50030, 0x2040030, 0x2050030, 0x2010, 0x12010, 0x2002010, 0x2012010, 0x2030, 0x12030, 0x2002030, 0x2012030, 0x42010, 0x52010, 0x2042010, 0x2052010, 0x42030, 0x52030, 0x2042030, 0x2052030, 0x20000000, 0x20010000, 0x22000000, 0x22010000, 0x20000020, 0x20010020, 0x22000020, 0x22010020, 0x20040000, 0x20050000, 0x22040000, 0x22050000, 0x20040020, 0x20050020, 0x22040020, 0x22050020, 0x20002000, 0x20012000, 0x22002000, 0x22012000, 0x20002020, 0x20012020, 0x22002020, 0x22012020, 0x20042000, 0x20052000, 0x22042000, 0x22052000, 0x20042020, 0x20052020, 0x22042020, 0x22052020, 0x20000000, 0x20010000, 0x22000000, 0x22010000, 0x20000020, 0x20010020, 0x22000020, 0x22010020, 0x20040000, 0x20050000, 0x22040000, 0x22050000, 0x20040020, 0x20050020, 0x22040020, 0x22050020, 0x20002000, 0x20012000, 0x22002000, 0x22012000, 0x20002020, 0x20012020, 0x22002020, 0x22012020, 0x20042000, 0x20052000, 0x22042000, 0x22052000, 0x20042020, 0x20052020, 0x22042020, 0x22052020, 0x20000010, 0x20010010, 0x22000010, 0x22010010, 0x20000030, 0x20010030, 0x22000030, 0x22010030, 0x20040010, 0x20050010, 0x22040010, 0x22050010, 0x20040030, 0x20050030, 0x22040030, 0x22050030, 0x20002010, 0x20012010, 0x22002010, 0x22012010, 0x20002030, 0x20012030, 0x22002030, 0x22012030, 0x20042010, 0x20052010, 0x22042010, 0x22052010, 0x20042030, 0x20052030, 0x22042030, 0x22052030, 0x20000010, 0x20010010, 0x22000010, 0x22010010, 0x20000030, 0x20010030, 0x22000030, 0x22010030, 0x20040010, 0x20050010, 0x22040010, 0x22050010, 0x20040030, 0x20050030, 0x22040030, 0x22050030, 0x20002010, 0x20012010, 0x22002010, 0x22012010, 0x20002030, 0x20012030, 0x22002030, 0x22012030, 0x20042010, 0x20052010, 0x22042010, 0x22052010, 0x20042030, 0x20052030, 0x22042030, 0x22052030]; + static $pc2mapd4 = [0x0, 0x400, 0x1000000, 0x1000400, 0x0, 0x400, 0x1000000, 0x1000400, 0x100, 0x500, 0x1000100, 0x1000500, 0x100, 0x500, 0x1000100, 0x1000500, 0x10000000, 0x10000400, 0x11000000, 0x11000400, 0x10000000, 0x10000400, 0x11000000, 0x11000400, 0x10000100, 0x10000500, 0x11000100, 0x11000500, 0x10000100, 0x10000500, 0x11000100, 0x11000500, 0x80000, 0x80400, 0x1080000, 0x1080400, 0x80000, 0x80400, 0x1080000, 0x1080400, 0x80100, 0x80500, 0x1080100, 0x1080500, 0x80100, 0x80500, 0x1080100, 0x1080500, 0x10080000, 0x10080400, 0x11080000, 0x11080400, 0x10080000, 0x10080400, 0x11080000, 0x11080400, 0x10080100, 0x10080500, 0x11080100, 0x11080500, 0x10080100, 0x10080500, 0x11080100, 0x11080500, 0x8, 0x408, 0x1000008, 0x1000408, 0x8, 0x408, 0x1000008, 0x1000408, 0x108, 0x508, 0x1000108, 0x1000508, 0x108, 0x508, 0x1000108, 0x1000508, 0x10000008, 0x10000408, 0x11000008, 0x11000408, 0x10000008, 0x10000408, 0x11000008, 0x11000408, 0x10000108, 0x10000508, 0x11000108, 0x11000508, 0x10000108, 0x10000508, 0x11000108, 0x11000508, 0x80008, 0x80408, 0x1080008, 0x1080408, 0x80008, 0x80408, 0x1080008, 0x1080408, 0x80108, 0x80508, 0x1080108, 0x1080508, 0x80108, 0x80508, 0x1080108, 0x1080508, 0x10080008, 0x10080408, 0x11080008, 0x11080408, 0x10080008, 0x10080408, 0x11080008, 0x11080408, 0x10080108, 0x10080508, 0x11080108, 0x11080508, 0x10080108, 0x10080508, 0x11080108, 0x11080508, 0x1000, 0x1400, 0x1001000, 0x1001400, 0x1000, 0x1400, 0x1001000, 0x1001400, 0x1100, 0x1500, 0x1001100, 0x1001500, 0x1100, 0x1500, 0x1001100, 0x1001500, 0x10001000, 0x10001400, 0x11001000, 0x11001400, 0x10001000, 0x10001400, 0x11001000, 0x11001400, 0x10001100, 0x10001500, 0x11001100, 0x11001500, 0x10001100, 0x10001500, 0x11001100, 0x11001500, 0x81000, 0x81400, 0x1081000, 0x1081400, 0x81000, 0x81400, 0x1081000, 0x1081400, 0x81100, 0x81500, 0x1081100, 0x1081500, 0x81100, 0x81500, 0x1081100, 0x1081500, 0x10081000, 0x10081400, 0x11081000, 0x11081400, 0x10081000, 0x10081400, 0x11081000, 0x11081400, 0x10081100, 0x10081500, 0x11081100, 0x11081500, 0x10081100, 0x10081500, 0x11081100, 0x11081500, 0x1008, 0x1408, 0x1001008, 0x1001408, 0x1008, 0x1408, 0x1001008, 0x1001408, 0x1108, 0x1508, 0x1001108, 0x1001508, 0x1108, 0x1508, 0x1001108, 0x1001508, 0x10001008, 0x10001408, 0x11001008, 0x11001408, 0x10001008, 0x10001408, 0x11001008, 0x11001408, 0x10001108, 0x10001508, 0x11001108, 0x11001508, 0x10001108, 0x10001508, 0x11001108, 0x11001508, 0x81008, 0x81408, 0x1081008, 0x1081408, 0x81008, 0x81408, 0x1081008, 0x1081408, 0x81108, 0x81508, 0x1081108, 0x1081508, 0x81108, 0x81508, 0x1081108, 0x1081508, 0x10081008, 0x10081408, 0x11081008, 0x11081408, 0x10081008, 0x10081408, 0x11081008, 0x11081408, 0x10081108, 0x10081508, 0x11081108, 0x11081508, 0x10081108, 0x10081508, 0x11081108, 0x11081508]; + $keys = []; + for ($des_round = 0; $des_round < $this->des_rounds; ++$des_round) { + // pad the key and remove extra characters as appropriate. + $key = str_pad(substr($this->key, $des_round * 8, 8), 8, "\x00"); + // Perform the PC/1 transformation and compute C and D. + $t = unpack('Nl/Nr', $key); + list($l, $r) = [$t['l'], $t['r']]; + $key = self::$shuffle[$pc1map[$r & 0xff]] & "\x80\x80\x80\x80\x80\x80\x80\x00" | self::$shuffle[$pc1map[$r >> 8 & 0xff]] & "@@@@@@@\x00" | self::$shuffle[$pc1map[$r >> 16 & 0xff]] & " \x00" | self::$shuffle[$pc1map[$r >> 24 & 0xff]] & "\x10\x10\x10\x10\x10\x10\x10\x00" | self::$shuffle[$pc1map[$l & 0xff]] & "\x08\x08\x08\x08\x08\x08\x08\x00" | self::$shuffle[$pc1map[$l >> 8 & 0xff]] & "\x04\x04\x04\x04\x04\x04\x04\x00" | self::$shuffle[$pc1map[$l >> 16 & 0xff]] & "\x02\x02\x02\x02\x02\x02\x02\x00" | self::$shuffle[$pc1map[$l >> 24 & 0xff]] & "\x01\x01\x01\x01\x01\x01\x01\x00"; + $key = unpack('Nc/Nd', $key); + $c = $key['c'] >> 4 & 0xfffffff; + $d = $key['d'] >> 4 & 0xffffff0 | $key['c'] & 0xf; + $keys[$des_round] = [self::ENCRYPT => [], self::DECRYPT => array_fill(0, 32, 0)]; + for ($i = 0, $ki = 31; $i < 16; ++$i, $ki -= 2) { + $c <<= $shifts[$i]; + $c = ($c | $c >> 28) & 0xfffffff; + $d <<= $shifts[$i]; + $d = ($d | $d >> 28) & 0xfffffff; + // Perform the PC-2 transformation. + $cp = $pc2mapc1[$c >> 24] | $pc2mapc2[$c >> 16 & 0xff] | $pc2mapc3[$c >> 8 & 0xff] | $pc2mapc4[$c & 0xff]; + $dp = $pc2mapd1[$d >> 24] | $pc2mapd2[$d >> 16 & 0xff] | $pc2mapd3[$d >> 8 & 0xff] | $pc2mapd4[$d & 0xff]; + // Reorder: odd bytes/even bytes. Push the result in key schedule. + $val1 = $cp & intval(0xff000000) | $cp << 8 & 0xff0000 | $dp >> 16 & 0xff00 | $dp >> 8 & 0xff; + $val2 = $cp << 8 & intval(0xff000000) | $cp << 16 & 0xff0000 | $dp >> 8 & 0xff00 | $dp & 0xff; + $keys[$des_round][self::ENCRYPT][] = $val1; + $keys[$des_round][self::DECRYPT][$ki - 1] = $val1; + $keys[$des_round][self::ENCRYPT][] = $val2; + $keys[$des_round][self::DECRYPT][$ki] = $val2; + } + } + switch ($this->des_rounds) { + case 3: + // 3DES keys + $this->keys = [self::ENCRYPT => array_merge($keys[0][self::ENCRYPT], $keys[1][self::DECRYPT], $keys[2][self::ENCRYPT]), self::DECRYPT => array_merge($keys[2][self::DECRYPT], $keys[1][self::ENCRYPT], $keys[0][self::DECRYPT])]; + break; + // case 1: // DES keys + default: + $this->keys = [self::ENCRYPT => $keys[0][self::ENCRYPT], self::DECRYPT => $keys[0][self::DECRYPT]]; + } + } + /** + * Setup the performance-optimized function for de/encrypt() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() + */ + protected function setupInlineCrypt() + { + // Engine configuration for: + // - DES ($des_rounds == 1) or + // - 3DES ($des_rounds == 3) + $des_rounds = $this->des_rounds; + $init_crypt = 'static $sbox1, $sbox2, $sbox3, $sbox4, $sbox5, $sbox6, $sbox7, $sbox8, $shuffleip, $shuffleinvip; + if (!$sbox1) { + $sbox1 = array_map("intval", self::$sbox1); + $sbox2 = array_map("intval", self::$sbox2); + $sbox3 = array_map("intval", self::$sbox3); + $sbox4 = array_map("intval", self::$sbox4); + $sbox5 = array_map("intval", self::$sbox5); + $sbox6 = array_map("intval", self::$sbox6); + $sbox7 = array_map("intval", self::$sbox7); + $sbox8 = array_map("intval", self::$sbox8);' . ' + for ($i = 0; $i < 256; ++$i) { + $shuffleip[] = self::$shuffle[self::$ipmap[$i]]; + $shuffleinvip[] = self::$shuffle[self::$invipmap[$i]]; + } + } + '; + $k = [self::ENCRYPT => $this->keys[self::ENCRYPT], self::DECRYPT => $this->keys[self::DECRYPT]]; + $init_encrypt = ''; + $init_decrypt = ''; + // Creating code for en- and decryption. + $crypt_block = []; + foreach ([self::ENCRYPT, self::DECRYPT] as $c) { + /* Do the initial IP permutation. */ + $crypt_block[$c] = ' + $in = unpack("N*", $in); + $l = $in[1]; + $r = $in[2]; + $in = unpack("N*", + ($shuffleip[ $r & 0xFF] & "\\x80\\x80\\x80\\x80\\x80\\x80\\x80\\x80") | + ($shuffleip[($r >> 8) & 0xFF] & "\\x40\\x40\\x40\\x40\\x40\\x40\\x40\\x40") | + ($shuffleip[($r >> 16) & 0xFF] & "\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20") | + ($shuffleip[($r >> 24) & 0xFF] & "\\x10\\x10\\x10\\x10\\x10\\x10\\x10\\x10") | + ($shuffleip[ $l & 0xFF] & "\\x08\\x08\\x08\\x08\\x08\\x08\\x08\\x08") | + ($shuffleip[($l >> 8) & 0xFF] & "\\x04\\x04\\x04\\x04\\x04\\x04\\x04\\x04") | + ($shuffleip[($l >> 16) & 0xFF] & "\\x02\\x02\\x02\\x02\\x02\\x02\\x02\\x02") | + ($shuffleip[($l >> 24) & 0xFF] & "\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01") + ); + ' . ' + $l = $in[1]; + $r = $in[2]; + '; + $l = '$l'; + $r = '$r'; + // Perform DES or 3DES. + for ($ki = -1, $des_round = 0; $des_round < $des_rounds; ++$des_round) { + // Perform the 16 steps. + for ($i = 0; $i < 16; ++$i) { + // start of "the Feistel (F) function" - see the following URL: + // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png + // Merge key schedule. + $crypt_block[$c] .= ' + $b1 = ((' . $r . ' >> 3) & 0x1FFFFFFF) ^ (' . $r . ' << 29) ^ ' . $k[$c][++$ki] . '; + $b2 = ((' . $r . ' >> 31) & 0x00000001) ^ (' . $r . ' << 1) ^ ' . $k[$c][++$ki] . ';' . $l . ' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^ + $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^ + $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^ + $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ ' . $l . '; + '; + // end of "the Feistel (F) function" + // swap L & R + list($l, $r) = [$r, $l]; + } + list($l, $r) = [$r, $l]; + } + // Perform the inverse IP permutation. + $crypt_block[$c] .= '$in = + ($shuffleinvip[($l >> 24) & 0xFF] & "\\x80\\x80\\x80\\x80\\x80\\x80\\x80\\x80") | + ($shuffleinvip[($r >> 24) & 0xFF] & "\\x40\\x40\\x40\\x40\\x40\\x40\\x40\\x40") | + ($shuffleinvip[($l >> 16) & 0xFF] & "\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20") | + ($shuffleinvip[($r >> 16) & 0xFF] & "\\x10\\x10\\x10\\x10\\x10\\x10\\x10\\x10") | + ($shuffleinvip[($l >> 8) & 0xFF] & "\\x08\\x08\\x08\\x08\\x08\\x08\\x08\\x08") | + ($shuffleinvip[($r >> 8) & 0xFF] & "\\x04\\x04\\x04\\x04\\x04\\x04\\x04\\x04") | + ($shuffleinvip[ $l & 0xFF] & "\\x02\\x02\\x02\\x02\\x02\\x02\\x02\\x02") | + ($shuffleinvip[ $r & 0xFF] & "\\x01\\x01\\x01\\x01\\x01\\x01\\x01\\x01"); + '; + } + // Creates the inline-crypt function + $this->inline_crypt = $this->createInlineCryptFunction(['init_crypt' => $init_crypt, 'init_encrypt' => $init_encrypt, 'init_decrypt' => $init_decrypt, 'encrypt_block' => $crypt_block[self::ENCRYPT], 'decrypt_block' => $crypt_block[self::DECRYPT]]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH.php new file mode 100644 index 0000000..0f66e08 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH.php @@ -0,0 +1,295 @@ + + * + * + * + * @author Jim Wigginton + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\AsymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH\Parameters; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\NoKeyLoadedException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedOperationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Pure-PHP (EC)DH implementation + * + * @author Jim Wigginton + */ +abstract class DH extends AsymmetricKey +{ + /** + * Algorithm Name + * + * @var string + */ + const ALGORITHM = 'DH'; + /** + * DH prime + * + * @var \phpseclib3\Math\BigInteger + */ + protected $prime; + /** + * DH Base + * + * Prime divisor of p-1 + * + * @var \phpseclib3\Math\BigInteger + */ + protected $base; + /** + * Public Key + * + * @var \phpseclib3\Math\BigInteger + */ + protected $publicKey; + /** + * Create DH parameters + * + * This method is a bit polymorphic. It can take any of the following: + * - two BigInteger's (prime and base) + * - an integer representing the size of the prime in bits (the base is assumed to be 2) + * - a string (eg. diffie-hellman-group14-sha1) + * + * @return Parameters + */ + public static function createParameters(...$args) + { + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('createParameters() should not be called from final classes (' . static::class . ')'); + } + $params = new Parameters(); + if (count($args) == 2 && $args[0] instanceof BigInteger && $args[1] instanceof BigInteger) { + //if (!$args[0]->isPrime()) { + // throw new \InvalidArgumentException('The first parameter should be a prime number'); + //} + $params->prime = $args[0]; + $params->base = $args[1]; + return $params; + } elseif (count($args) == 1 && is_numeric($args[0])) { + $params->prime = BigInteger::randomPrime($args[0]); + $params->base = new BigInteger(2); + return $params; + } elseif (count($args) != 1 || !is_string($args[0])) { + throw new \InvalidArgumentException('Valid parameters are either: two BigInteger\'s (prime and base), a single integer (the length of the prime; base is assumed to be 2) or a string'); + } + switch ($args[0]) { + // see http://tools.ietf.org/html/rfc2409#section-6.2 and + // http://tools.ietf.org/html/rfc2412, appendex E + case 'diffie-hellman-group1-sha1': + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; + break; + // see http://tools.ietf.org/html/rfc3526#section-3 + case 'diffie-hellman-group14-sha1': + // 2048-bit MODP Group + case 'diffie-hellman-group14-sha256': + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF'; + break; + // see https://tools.ietf.org/html/rfc3526#section-4 + case 'diffie-hellman-group15-sha512': + // 3072-bit MODP Group + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33' . 'A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' . 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864' . 'D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E2' . '08E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF'; + break; + // see https://tools.ietf.org/html/rfc3526#section-5 + case 'diffie-hellman-group16-sha512': + // 4096-bit MODP Group + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33' . 'A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' . 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864' . 'D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E2' . '08E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7' . '88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8' . 'DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2' . '233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9' . '93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF'; + break; + // see https://tools.ietf.org/html/rfc3526#section-6 + case 'diffie-hellman-group17-sha512': + // 6144-bit MODP Group + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33' . 'A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' . 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864' . 'D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E2' . '08E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7' . '88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8' . 'DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2' . '233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9' . '93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026' . 'C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AE' . 'B06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B' . 'DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92EC' . 'F032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E' . '59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA' . 'CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76' . 'F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468' . '043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DCC4024FFFFFFFFFFFFFFFF'; + break; + // see https://tools.ietf.org/html/rfc3526#section-7 + case 'diffie-hellman-group18-sha512': + // 8192-bit MODP Group + $prime = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' . '020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437' . '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' . 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05' . '98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB' . '9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B' . 'E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718' . '3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33' . 'A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7' . 'ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864' . 'D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E2' . '08E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7' . '88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8' . 'DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2' . '233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9' . '93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C93402849236C3FAB4D27C7026' . 'C1D4DCB2602646DEC9751E763DBA37BDF8FF9406AD9E530EE5DB382F413001AE' . 'B06A53ED9027D831179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B' . 'DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF5983CA01C64B92EC' . 'F032EA15D1721D03F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E' . '59E7C97FBEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA' . 'CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58BB7C5DA76' . 'F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632387FE8D76E3C0468' . '043E8F663F4860EE12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E4' . '38777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300741FA7BF8AFC47ED' . '2576F6936BA424663AAB639C5AE4F5683423B4742BF1C978238F16CBE39D652D' . 'E3FDB8BEFC848AD922222E04A4037C0713EB57A81A23F0C73473FC646CEA306B' . '4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A062B3CF5B3A278A6' . '6D2A13F83F44F82DDF310EE074AB6A364597E899A0255DC164F31CC50846851D' . 'F9AB48195DED7EA1B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F92' . '4009438B481C6CD7889A002ED5EE382BC9190DA6FC026E479558E4475677E9AA' . '9E3050E2765694DFC81F56E880B96E7160C980DD98EDD3DFFFFFFFFFFFFFFFFF'; + break; + default: + throw new \InvalidArgumentException('Invalid named prime provided'); + } + $params->prime = new BigInteger($prime, 16); + $params->base = new BigInteger(2); + return $params; + } + /** + * Create public / private key pair. + * + * The rationale for the second parameter is described in http://tools.ietf.org/html/rfc4419#section-6.2 : + * + * "To increase the speed of the key exchange, both client and server may + * reduce the size of their private exponents. It should be at least + * twice as long as the key material that is generated from the shared + * secret. For more details, see the paper by van Oorschot and Wiener + * [VAN-OORSCHOT]." + * + * $length is in bits + * + * @param Parameters $params + * @param int $length optional + * @return DH\PrivateKey + */ + public static function createKey(Parameters $params, $length = 0) + { + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')'); + } + $one = new BigInteger(1); + if ($length) { + $max = $one->bitwise_leftShift($length); + $max = $max->subtract($one); + } else { + $max = $params->prime->subtract($one); + } + $key = new PrivateKey(); + $key->prime = $params->prime; + $key->base = $params->base; + $key->privateKey = BigInteger::randomRange($one, $max); + $key->publicKey = $key->base->powMod($key->privateKey, $key->prime); + return $key; + } + /** + * Compute Shared Secret + * + * @param PrivateKey|EC $private + * @param PublicKey|BigInteger|string $public + * @return mixed + */ + public static function computeSecret($private, $public) + { + if ($private instanceof PrivateKey) { + // DH\PrivateKey + switch (\true) { + case $public instanceof PublicKey: + if (!$private->prime->equals($public->prime) || !$private->base->equals($public->base)) { + throw new \InvalidArgumentException('The public and private key do not share the same prime and / or base numbers'); + } + return $public->publicKey->powMod($private->privateKey, $private->prime)->toBytes(\true); + case is_string($public): + $public = new BigInteger($public, -256); + // fall-through + case $public instanceof BigInteger: + return $public->powMod($private->privateKey, $private->prime)->toBytes(\true); + default: + throw new \InvalidArgumentException('$public needs to be an instance of DH\\PublicKey, a BigInteger or a string'); + } + } + if ($private instanceof EC\PrivateKey) { + switch (\true) { + case $public instanceof EC\PublicKey: + $public = $public->getEncodedCoordinates(); + // fall-through + case is_string($public): + $point = $private->multiply($public); + switch ($private->getCurve()) { + case 'Curve25519': + case 'Curve448': + $secret = $point; + break; + default: + // according to https://www.secg.org/sec1-v2.pdf#page=33 only X is returned + $secret = substr($point, 1, strlen($point) - 1 >> 1); + } + /* + if (($secret[0] & "\x80") === "\x80") { + $secret = "\0$secret"; + } + */ + return $secret; + default: + throw new \InvalidArgumentException('$public needs to be an instance of EC\\PublicKey or a string (an encoded coordinate)'); + } + } + } + /** + * Load the key + * + * @param string $key + * @param string $password optional + * @return AsymmetricKey + */ + public static function load($key, $password = \false) + { + try { + return EC::load($key, $password); + } catch (NoKeyLoadedException $e) { + } + return parent::load($key, $password); + } + /** + * OnLoad Handler + * + * @return bool + */ + protected static function onLoad(array $components) + { + if (!isset($components['privateKey']) && !isset($components['publicKey'])) { + $new = new Parameters(); + } else { + $new = isset($components['privateKey']) ? new PrivateKey() : new PublicKey(); + } + $new->prime = $components['prime']; + $new->base = $components['base']; + if (isset($components['privateKey'])) { + $new->privateKey = $components['privateKey']; + } + if (isset($components['publicKey'])) { + $new->publicKey = $components['publicKey']; + } + return $new; + } + /** + * Determines which hashing function should be used + * + * @param string $hash + */ + public function withHash($hash) + { + throw new UnsupportedOperationException('DH does not use a hash algorithm'); + } + /** + * Returns the hash algorithm currently being used + * + */ + public function getHash() + { + throw new UnsupportedOperationException('DH does not use a hash algorithm'); + } + /** + * Returns the parameters + * + * A public / private key is only returned if the currently loaded "key" contains an x or y + * value. + * + * @see self::getPublicKey() + * @return mixed + */ + public function getParameters() + { + $type = DH::validatePlugin('Keys', 'PKCS1', 'saveParameters'); + $key = $type::saveParameters($this->prime, $this->base); + return DH::load($key, 'PKCS1'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS1.php new file mode 100644 index 0000000..e6f9560 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS1.php @@ -0,0 +1,65 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS1 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * "PKCS1" Formatted DH Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS1 extends Progenitor +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $components = ASN1::asn1map($decoded[0], Maps\DHParameter::MAP); + if (!is_array($components)) { + throw new \RuntimeException('Unable to perform ASN1 mapping on parameters'); + } + return $components; + } + /** + * Convert EC parameters to the appropriate format + * + * @return string + */ + public static function saveParameters(BigInteger $prime, BigInteger $base, array $options = []) + { + $params = ['prime' => $prime, 'base' => $base]; + $params = ASN1::encodeDER($params, Maps\DHParameter::MAP); + return "-----BEGIN DH PARAMETERS-----\r\n" . chunk_split(base64_encode($params), 64) . "-----END DH PARAMETERS-----\r\n"; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php new file mode 100644 index 0000000..aefa769 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php @@ -0,0 +1,115 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#8 Formatted DH Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS8 extends Progenitor +{ + /** + * OID Name + * + * @var string + */ + const OID_NAME = 'dhKeyAgreement'; + /** + * OID Value + * + * @var string + */ + const OID_VALUE = '1.2.840.113549.1.3.1'; + /** + * Child OIDs loaded + * + * @var bool + */ + protected static $childOIDsLoaded = \false; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + $type = isset($key['privateKey']) ? 'privateKey' : 'publicKey'; + $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element); + if (empty($decoded)) { + throw new \RuntimeException('Unable to decode BER of parameters'); + } + $components = ASN1::asn1map($decoded[0], Maps\DHParameter::MAP); + if (!is_array($components)) { + throw new \RuntimeException('Unable to perform ASN1 mapping on parameters'); + } + $decoded = ASN1::decodeBER($key[$type]); + switch (\true) { + case !isset($decoded): + case !isset($decoded[0]['content']): + case !$decoded[0]['content'] instanceof BigInteger: + throw new \RuntimeException('Unable to decode BER of parameters'); + } + $components[$type] = $decoded[0]['content']; + return $components; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $prime + * @param \phpseclib3\Math\BigInteger $base + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Math\BigInteger $publicKey + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $prime, BigInteger $base, BigInteger $privateKey, BigInteger $publicKey, $password = '', array $options = []) + { + $params = ['prime' => $prime, 'base' => $base]; + $params = ASN1::encodeDER($params, Maps\DHParameter::MAP); + $params = new ASN1\Element($params); + $key = ASN1::encodeDER($privateKey, ['type' => ASN1::TYPE_INTEGER]); + return self::wrapPrivateKey($key, [], $params, $password, null, '', $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $prime + * @param \phpseclib3\Math\BigInteger $base + * @param \phpseclib3\Math\BigInteger $publicKey + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $prime, BigInteger $base, BigInteger $publicKey, array $options = []) + { + $params = ['prime' => $prime, 'base' => $base]; + $params = ASN1::encodeDER($params, Maps\DHParameter::MAP); + $params = new ASN1\Element($params); + $key = ASN1::encodeDER($publicKey, ['type' => ASN1::TYPE_INTEGER]); + return self::wrapPublicKey($key, $params); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php new file mode 100644 index 0000000..3d20cf9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php @@ -0,0 +1,33 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; +/** + * DH Parameters + * + * @author Jim Wigginton + */ +final class Parameters extends DH +{ + /** + * Returns the parameters + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type = 'PKCS1', array $options = []) + { + $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters'); + return $type::saveParameters($this->prime, $this->base, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php new file mode 100644 index 0000000..233edd7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php @@ -0,0 +1,64 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; +/** + * DH Private Key + * + * @author Jim Wigginton + */ +final class PrivateKey extends DH +{ + use Common\Traits\PasswordProtected; + /** + * Private Key + * + * @var \phpseclib3\Math\BigInteger + */ + protected $privateKey; + /** + * Public Key + * + * @var \phpseclib3\Math\BigInteger + */ + protected $publicKey; + /** + * Returns the public key + * + * @return DH\PublicKey + */ + public function getPublicKey() + { + $type = self::validatePlugin('Keys', 'PKCS8', 'savePublicKey'); + if (!isset($this->publicKey)) { + $this->publicKey = $this->base->powMod($this->privateKey, $this->prime); + } + $key = $type::savePublicKey($this->prime, $this->base, $this->publicKey); + return DH::loadFormat('PKCS8', $key); + } + /** + * Returns the private key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); + if (!isset($this->publicKey)) { + $this->publicKey = $this->base->powMod($this->privateKey, $this->prime); + } + return $type::savePrivateKey($this->prime, $this->base, $this->privateKey, $this->publicKey, $this->password, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php new file mode 100644 index 0000000..815ce7d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php @@ -0,0 +1,44 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; +/** + * DH Public Key + * + * @author Jim Wigginton + */ +final class PublicKey extends DH +{ + use Common\Traits\Fingerprint; + /** + * Returns the public key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePublicKey'); + return $type::savePublicKey($this->prime, $this->base, $this->publicKey, $options); + } + /** + * Returns the public key as a BigInteger + * + * @return \phpseclib3\Math\BigInteger + */ + public function toBigInteger() + { + return $this->publicKey; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA.php new file mode 100644 index 0000000..1108c00 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA.php @@ -0,0 +1,292 @@ + + * getPublicKey(); + * + * $plaintext = 'terrafrost'; + * + * $signature = $private->sign($plaintext); + * + * echo $public->verify($plaintext, $signature) ? 'verified' : 'unverified'; + * ?> + * + * + * @author Jim Wigginton + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\AsymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Parameters; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Pure-PHP FIPS 186-4 compliant implementation of DSA. + * + * @author Jim Wigginton + */ +abstract class DSA extends AsymmetricKey +{ + /** + * Algorithm Name + * + * @var string + */ + const ALGORITHM = 'DSA'; + /** + * DSA Prime P + * + * @var \phpseclib3\Math\BigInteger + */ + protected $p; + /** + * DSA Group Order q + * + * Prime divisor of p-1 + * + * @var \phpseclib3\Math\BigInteger + */ + protected $q; + /** + * DSA Group Generator G + * + * @var \phpseclib3\Math\BigInteger + */ + protected $g; + /** + * DSA public key value y + * + * @var \phpseclib3\Math\BigInteger + */ + protected $y; + /** + * Signature Format + * + * @var string + */ + protected $sigFormat; + /** + * Signature Format (Short) + * + * @var string + */ + protected $shortFormat; + /** + * Create DSA parameters + * + * @param int $L + * @param int $N + * @return \phpseclib3\Crypt\DSA|bool + */ + public static function createParameters($L = 2048, $N = 224) + { + self::initialize_static_variables(); + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('createParameters() should not be called from final classes (' . static::class . ')'); + } + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + switch (\true) { + case $N == 160: + /* + in FIPS 186-1 and 186-2 N was fixed at 160 whereas K had an upper bound of 1024. + RFC 4253 (SSH Transport Layer Protocol) references FIPS 186-2 and as such most + SSH DSA implementations only support keys with an N of 160. + puttygen let's you set the size of L (but not the size of N) and uses 2048 as the + default L value. that's not really compliant with any of the FIPS standards, however, + for the purposes of maintaining compatibility with puttygen, we'll support it + */ + //case ($L >= 512 || $L <= 1024) && (($L & 0x3F) == 0) && $N == 160: + // FIPS 186-3 changed this as follows: + //case $L == 1024 && $N == 160: + case $L == 2048 && $N == 224: + case $L == 2048 && $N == 256: + case $L == 3072 && $N == 256: + break; + default: + throw new \InvalidArgumentException('Invalid values for N and L'); + } + $two = new BigInteger(2); + $q = BigInteger::randomPrime($N); + $divisor = $q->multiply($two); + do { + $x = BigInteger::random($L); + list(, $c) = $x->divide($divisor); + $p = $x->subtract($c->subtract(self::$one)); + } while ($p->getLength() != $L || !$p->isPrime()); + $p_1 = $p->subtract(self::$one); + list($e) = $p_1->divide($q); + // quoting http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf#page=50 , + // "h could be obtained from a random number generator or from a counter that + // changes after each use". PuTTY (sshdssg.c) starts h off at 1 and increments + // it on each loop. wikipedia says "commonly h = 2 is used" so we'll just do that + $h = clone $two; + while (\true) { + $g = $h->powMod($e, $p); + if (!$g->equals(self::$one)) { + break; + } + $h = $h->add(self::$one); + } + $dsa = new Parameters(); + $dsa->p = $p; + $dsa->q = $q; + $dsa->g = $g; + return $dsa; + } + /** + * Create public / private key pair. + * + * This method is a bit polymorphic. It can take a DSA/Parameters object, L / N as two distinct parameters or + * no parameters (at which point L and N will be generated with this method) + * + * Returns the private key, from which the publickey can be extracted + * + * @param int[] ...$args + * @return DSA\PrivateKey + */ + public static function createKey(...$args) + { + self::initialize_static_variables(); + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')'); + } + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + if (count($args) == 2 && is_int($args[0]) && is_int($args[1])) { + $params = self::createParameters($args[0], $args[1]); + } elseif (count($args) == 1 && $args[0] instanceof Parameters) { + $params = $args[0]; + } elseif (!count($args)) { + $params = self::createParameters(); + } else { + throw new InsufficientSetupException('Valid parameters are either two integers (L and N), a single DSA object or no parameters at all.'); + } + $private = new PrivateKey(); + $private->p = $params->p; + $private->q = $params->q; + $private->g = $params->g; + $private->x = BigInteger::randomRange(self::$one, $private->q->subtract(self::$one)); + $private->y = $private->g->powMod($private->x, $private->p); + //$public = clone $private; + //unset($public->x); + return $private->withHash($params->hash->getHash())->withSignatureFormat($params->shortFormat); + } + /** + * OnLoad Handler + * + * @return bool + */ + protected static function onLoad(array $components) + { + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + if (!isset($components['x']) && !isset($components['y'])) { + $new = new Parameters(); + } elseif (isset($components['x'])) { + $new = new PrivateKey(); + $new->x = $components['x']; + } else { + $new = new PublicKey(); + } + $new->p = $components['p']; + $new->q = $components['q']; + $new->g = $components['g']; + if (isset($components['y'])) { + $new->y = $components['y']; + } + return $new; + } + /** + * Constructor + * + * PublicKey and PrivateKey objects can only be created from abstract RSA class + */ + protected function __construct() + { + $this->sigFormat = self::validatePlugin('Signature', 'ASN1'); + $this->shortFormat = 'ASN1'; + parent::__construct(); + } + /** + * Returns the key size + * + * More specifically, this L (the length of DSA Prime P) and N (the length of DSA Group Order q) + * + * @return array + */ + public function getLength() + { + return ['L' => $this->p->getLength(), 'N' => $this->q->getLength()]; + } + /** + * Returns the current engine being used + * + * @see self::useInternalEngine() + * @see self::useBestEngine() + * @return string + */ + public function getEngine() + { + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + return self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods()) ? 'OpenSSL' : 'PHP'; + } + /** + * Returns the parameters + * + * A public / private key is only returned if the currently loaded "key" contains an x or y + * value. + * + * @see self::getPublicKey() + * @return mixed + */ + public function getParameters() + { + $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters'); + $key = $type::saveParameters($this->p, $this->q, $this->g); + return DSA::load($key, 'PKCS1')->withHash($this->hash->getHash())->withSignatureFormat($this->shortFormat); + } + /** + * Determines the signature padding mode + * + * Valid values are: ASN1, SSH2, Raw + * + * @param string $format + */ + public function withSignatureFormat($format) + { + $new = clone $this; + $new->shortFormat = $format; + $new->sigFormat = self::validatePlugin('Signature', $format); + return $new; + } + /** + * Returns the signature format currently being used + * + */ + public function getSignatureFormat() + { + return $this->shortFormat; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/OpenSSH.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/OpenSSH.php new file mode 100644 index 0000000..ebb8973 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/OpenSSH.php @@ -0,0 +1,102 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\OpenSSH as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * OpenSSH Formatted DSA Key Handler + * + * @author Jim Wigginton + */ +abstract class OpenSSH extends Progenitor +{ + /** + * Supported Key Types + * + * @var array + */ + protected static $types = ['ssh-dss']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $parsed = parent::load($key, $password); + if (isset($parsed['paddedKey'])) { + list($type) = Strings::unpackSSH2('s', $parsed['paddedKey']); + if ($type != $parsed['type']) { + throw new \RuntimeException("The public and private keys are not of the same type ({$type} vs {$parsed['type']})"); + } + list($p, $q, $g, $y, $x, $comment) = Strings::unpackSSH2('i5s', $parsed['paddedKey']); + return compact('p', 'q', 'g', 'y', 'x', 'comment'); + } + list($p, $q, $g, $y) = Strings::unpackSSH2('iiii', $parsed['publicKey']); + $comment = $parsed['comment']; + return compact('p', 'q', 'g', 'y', 'comment'); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, array $options = []) + { + if ($q->getLength() != 160) { + throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); + } + // from : + // string "ssh-dss" + // mpint p + // mpint q + // mpint g + // mpint y + $DSAPublicKey = Strings::packSSH2('siiii', 'ssh-dss', $p, $q, $g, $y); + if (isset($options['binary']) ? $options['binary'] : self::$binary) { + return $DSAPublicKey; + } + $comment = isset($options['comment']) ? $options['comment'] : self::$comment; + $DSAPublicKey = 'ssh-dss ' . base64_encode($DSAPublicKey) . ' ' . $comment; + return $DSAPublicKey; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param \phpseclib3\Math\BigInteger $x + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []) + { + $publicKey = self::savePublicKey($p, $q, $g, $y, ['binary' => \true]); + $privateKey = Strings::packSSH2('si5', 'ssh-dss', $p, $q, $g, $y, $x); + return self::wrapPrivateKey($publicKey, $privateKey, $password, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS1.php new file mode 100644 index 0000000..b39bd81 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS1.php @@ -0,0 +1,115 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS1 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#1 Formatted DSA Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS1 extends Progenitor +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $key = ASN1::asn1map($decoded[0], Maps\DSAParams::MAP); + if (is_array($key)) { + return $key; + } + $key = ASN1::asn1map($decoded[0], Maps\DSAPrivateKey::MAP); + if (is_array($key)) { + return $key; + } + $key = ASN1::asn1map($decoded[0], Maps\DSAPublicKey::MAP); + if (is_array($key)) { + return $key; + } + throw new \RuntimeException('Unable to perform ASN1 mapping'); + } + /** + * Convert DSA parameters to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @return string + */ + public static function saveParameters(BigInteger $p, BigInteger $q, BigInteger $g) + { + $key = ['p' => $p, 'q' => $q, 'g' => $g]; + $key = ASN1::encodeDER($key, Maps\DSAParams::MAP); + return "-----BEGIN DSA PARAMETERS-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END DSA PARAMETERS-----\r\n"; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param \phpseclib3\Math\BigInteger $x + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []) + { + $key = ['version' => 0, 'p' => $p, 'q' => $q, 'g' => $g, 'y' => $y, 'x' => $x]; + $key = ASN1::encodeDER($key, Maps\DSAPrivateKey::MAP); + return self::wrapPrivateKey($key, 'DSA', $password, $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @return string + */ + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) + { + $key = ASN1::encodeDER($y, Maps\DSAPublicKey::MAP); + return self::wrapPublicKey($key, 'DSA'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php new file mode 100644 index 0000000..cf3f194 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php @@ -0,0 +1,125 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#8 Formatted DSA Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS8 extends Progenitor +{ + /** + * OID Name + * + * @var string + */ + const OID_NAME = 'id-dsa'; + /** + * OID Value + * + * @var string + */ + const OID_VALUE = '1.2.840.10040.4.1'; + /** + * Child OIDs loaded + * + * @var bool + */ + protected static $childOIDsLoaded = \false; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + $type = isset($key['privateKey']) ? 'privateKey' : 'publicKey'; + $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER of parameters'); + } + $components = ASN1::asn1map($decoded[0], Maps\DSAParams::MAP); + if (!is_array($components)) { + throw new \RuntimeException('Unable to perform ASN1 mapping on parameters'); + } + $decoded = ASN1::decodeBER($key[$type]); + if (empty($decoded)) { + throw new \RuntimeException('Unable to decode BER'); + } + $var = $type == 'privateKey' ? 'x' : 'y'; + $components[$var] = ASN1::asn1map($decoded[0], Maps\DSAPublicKey::MAP); + if (!$components[$var] instanceof BigInteger) { + throw new \RuntimeException('Unable to perform ASN1 mapping'); + } + if (isset($key['meta'])) { + $components['meta'] = $key['meta']; + } + return $components; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param \phpseclib3\Math\BigInteger $x + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '', array $options = []) + { + $params = ['p' => $p, 'q' => $q, 'g' => $g]; + $params = ASN1::encodeDER($params, Maps\DSAParams::MAP); + $params = new ASN1\Element($params); + $key = ASN1::encodeDER($x, Maps\DSAPublicKey::MAP); + return self::wrapPrivateKey($key, [], $params, $password, null, '', $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, array $options = []) + { + $params = ['p' => $p, 'q' => $q, 'g' => $g]; + $params = ASN1::encodeDER($params, Maps\DSAParams::MAP); + $params = new ASN1\Element($params); + $key = ASN1::encodeDER($y, Maps\DSAPublicKey::MAP); + return self::wrapPublicKey($key, $params); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php new file mode 100644 index 0000000..7a6a089 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php @@ -0,0 +1,98 @@ + 160 kinda useless, hence this handlers not supporting such keys. + * + * PHP version 5 + * + * @author Jim Wigginton + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PuTTY as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PuTTY Formatted DSA Key Handler + * + * @author Jim Wigginton + */ +abstract class PuTTY extends Progenitor +{ + /** + * Public Handler + * + * @var string + */ + const PUBLIC_HANDLER = 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\OpenSSH'; + /** + * Algorithm Identifier + * + * @var array + */ + protected static $types = ['ssh-dss']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $components = parent::load($key, $password); + if (!isset($components['private'])) { + return $components; + } + extract($components); + unset($components['public'], $components['private']); + list($p, $q, $g, $y) = Strings::unpackSSH2('iiii', $public); + list($x) = Strings::unpackSSH2('i', $private); + return compact('p', 'q', 'g', 'y', 'x', 'comment'); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param \phpseclib3\Math\BigInteger $x + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = \false, array $options = []) + { + if ($q->getLength() != 160) { + throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); + } + $public = Strings::packSSH2('iiii', $p, $q, $g, $y); + $private = Strings::packSSH2('i', $x); + return self::wrapPrivateKey($public, $private, 'ssh-dss', $password, $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @return string + */ + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) + { + if ($q->getLength() != 160) { + throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); + } + return self::wrapPublicKey(Strings::packSSH2('iiii', $p, $q, $g, $y), 'ssh-dss'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/Raw.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/Raw.php new file mode 100644 index 0000000..27aaf5e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/Raw.php @@ -0,0 +1,78 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Raw DSA Key Handler + * + * @author Jim Wigginton + */ +abstract class Raw +{ + /** + * Break a public or private key down into its constituent components + * + * @param array $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + if (!is_array($key)) { + throw new \UnexpectedValueException('Key should be a array - not a ' . gettype($key)); + } + switch (\true) { + case !isset($key['p']) || !isset($key['q']) || !isset($key['g']): + case !$key['p'] instanceof BigInteger: + case !$key['q'] instanceof BigInteger: + case !$key['g'] instanceof BigInteger: + case !isset($key['x']) && !isset($key['y']): + case isset($key['x']) && !$key['x'] instanceof BigInteger: + case isset($key['y']) && !$key['y'] instanceof BigInteger: + throw new \UnexpectedValueException('Key appears to be malformed'); + } + $options = ['p' => 1, 'q' => 1, 'g' => 1, 'x' => 1, 'y' => 1]; + return array_intersect_key($key, $options); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @param \phpseclib3\Math\BigInteger $x + * @param string $password optional + * @return string + */ + public static function savePrivateKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y, BigInteger $x, $password = '') + { + return compact('p', 'q', 'g', 'y', 'x'); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @return string + */ + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) + { + return compact('p', 'q', 'g', 'y'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/XML.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/XML.php new file mode 100644 index 0000000..8ad22c2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/XML.php @@ -0,0 +1,123 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * XML Formatted DSA Key Handler + * + * @author Jim Wigginton + */ +abstract class XML +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + if (!class_exists('DOMDocument')) { + throw new BadConfigurationException('The dom extension is not setup correctly on this system'); + } + $use_errors = libxml_use_internal_errors(\true); + $dom = new \DOMDocument(); + if (substr($key, 0, 5) != '' . $key . ''; + } + if (!$dom->loadXML($key)) { + libxml_use_internal_errors($use_errors); + throw new \UnexpectedValueException('Key does not appear to contain XML'); + } + $xpath = new \DOMXPath($dom); + $keys = ['p', 'q', 'g', 'y', 'j', 'seed', 'pgencounter']; + foreach ($keys as $key) { + // $dom->getElementsByTagName($key) is case-sensitive + $temp = $xpath->query("//*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='{$key}']"); + if (!$temp->length) { + continue; + } + $value = new BigInteger(Strings::base64_decode($temp->item(0)->nodeValue), 256); + switch ($key) { + case 'p': + // a prime modulus meeting the [DSS] requirements + // Parameters P, Q, and G can be public and common to a group of users. They might be known + // from application context. As such, they are optional but P and Q must either both appear + // or both be absent + $components['p'] = $value; + break; + case 'q': + // an integer in the range 2**159 < Q < 2**160 which is a prime divisor of P-1 + $components['q'] = $value; + break; + case 'g': + // an integer with certain properties with respect to P and Q + $components['g'] = $value; + break; + case 'y': + // G**X mod P (where X is part of the private key and not made public) + $components['y'] = $value; + // the remaining options do not do anything + case 'j': + // (P - 1) / Q + // Parameter J is available for inclusion solely for efficiency as it is calculatable from + // P and Q + case 'seed': + // a DSA prime generation seed + // Parameters seed and pgenCounter are used in the DSA prime number generation algorithm + // specified in [DSS]. As such, they are optional but must either both be present or both + // be absent + case 'pgencounter': + } + } + libxml_use_internal_errors($use_errors); + if (!isset($components['y'])) { + throw new \UnexpectedValueException('Key is missing y component'); + } + switch (\true) { + case !isset($components['p']): + case !isset($components['q']): + case !isset($components['g']): + return ['y' => $components['y']]; + } + return $components; + } + /** + * Convert a public key to the appropriate format + * + * See https://www.w3.org/TR/xmldsig-core/#sec-DSAKeyValue + * + * @param \phpseclib3\Math\BigInteger $p + * @param \phpseclib3\Math\BigInteger $q + * @param \phpseclib3\Math\BigInteger $g + * @param \phpseclib3\Math\BigInteger $y + * @return string + */ + public static function savePublicKey(BigInteger $p, BigInteger $q, BigInteger $g, BigInteger $y) + { + return "\r\n" . '

' . Strings::base64_encode($p->toBytes()) . "

\r\n" . ' ' . Strings::base64_encode($q->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($g->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($y->toBytes()) . "\r\n" . '
'; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/ASN1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/ASN1.php new file mode 100644 index 0000000..10d3ff3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/ASN1.php @@ -0,0 +1,57 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1 as Encoder; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * ASN1 Signature Handler + * + * @author Jim Wigginton + */ +abstract class ASN1 +{ + /** + * Loads a signature + * + * @param string $sig + * @return array|bool + */ + public static function load($sig) + { + if (!is_string($sig)) { + return \false; + } + $decoded = Encoder::decodeBER($sig); + if (empty($decoded)) { + return \false; + } + $components = Encoder::asn1map($decoded[0], Maps\DssSigValue::MAP); + return $components; + } + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @return string + */ + public static function save(BigInteger $r, BigInteger $s) + { + return Encoder::encodeDER(compact('r', 's'), Maps\DssSigValue::MAP); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/Raw.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/Raw.php new file mode 100644 index 0000000..2cd2bef --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/Raw.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Signature\Raw as Progenitor; +/** + * Raw DSA Signature Handler + * + * @author Jim Wigginton + */ +abstract class Raw extends Progenitor +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/SSH2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/SSH2.php new file mode 100644 index 0000000..0e2b973 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/SSH2.php @@ -0,0 +1,61 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * SSH2 Signature Handler + * + * @author Jim Wigginton + */ +abstract class SSH2 +{ + /** + * Loads a signature + * + * @param string $sig + * @return mixed + */ + public static function load($sig) + { + if (!is_string($sig)) { + return \false; + } + $result = Strings::unpackSSH2('ss', $sig); + if ($result === \false) { + return \false; + } + list($type, $blob) = $result; + if ($type != 'ssh-dss' || strlen($blob) != 40) { + return \false; + } + return ['r' => new BigInteger(substr($blob, 0, 20), 256), 's' => new BigInteger(substr($blob, 20), 256)]; + } + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @return string + */ + public static function save(BigInteger $r, BigInteger $s) + { + if ($r->getLength() > 160 || $s->getLength() > 160) { + return \false; + } + return Strings::packSSH2('ss', 'ssh-dss', str_pad($r->toBytes(), 20, "\x00", \STR_PAD_LEFT) . str_pad($s->toBytes(), 20, "\x00", \STR_PAD_LEFT)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php new file mode 100644 index 0000000..481cf86 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php @@ -0,0 +1,33 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +/** + * DSA Parameters + * + * @author Jim Wigginton + */ +final class Parameters extends DSA +{ + /** + * Returns the parameters + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type = 'PKCS1', array $options = []) + { + $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters'); + return $type::saveParameters($this->p, $this->q, $this->g, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php new file mode 100644 index 0000000..ae2bee1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php @@ -0,0 +1,131 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Signature\ASN1 as ASN1Signature; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * DSA Private Key + * + * @author Jim Wigginton + */ +final class PrivateKey extends DSA implements Common\PrivateKey +{ + use Common\Traits\PasswordProtected; + /** + * DSA secret exponent x + * + * @var \phpseclib3\Math\BigInteger + */ + protected $x; + /** + * Returns the public key + * + * If you do "openssl rsa -in private.rsa -pubout -outform PEM" you get a PKCS8 formatted key + * that contains a publicKeyAlgorithm AlgorithmIdentifier and a publicKey BIT STRING. + * An AlgorithmIdentifier contains an OID and a parameters field. With RSA public keys this + * parameters field is NULL. With DSA PKCS8 public keys it is not - it contains the p, q and g + * variables. The publicKey BIT STRING contains, simply, the y variable. This can be verified + * by getting a DSA PKCS8 public key: + * + * "openssl dsa -in private.dsa -pubout -outform PEM" + * + * ie. just swap out rsa with dsa in the rsa command above. + * + * A PKCS1 public key corresponds to the publicKey portion of the PKCS8 key. In the case of RSA + * the publicKey portion /is/ the key. In the case of DSA it is not. You cannot verify a signature + * without the parameters and the PKCS1 DSA public key format does not include the parameters. + * + * @see self::getPrivateKey() + * @return mixed + */ + public function getPublicKey() + { + $type = self::validatePlugin('Keys', 'PKCS8', 'savePublicKey'); + if (!isset($this->y)) { + $this->y = $this->g->powMod($this->x, $this->p); + } + $key = $type::savePublicKey($this->p, $this->q, $this->g, $this->y); + return DSA::loadFormat('PKCS8', $key)->withHash($this->hash->getHash())->withSignatureFormat($this->shortFormat); + } + /** + * Create a signature + * + * @see self::verify() + * @param string $message + * @return mixed + */ + public function sign($message) + { + $format = $this->sigFormat; + if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { + $signature = ''; + $result = openssl_sign($message, $signature, $this->toString('PKCS8'), $this->hash->getHash()); + if ($result) { + if ($this->shortFormat == 'ASN1') { + return $signature; + } + extract(ASN1Signature::load($signature)); + return $format::save($r, $s); + } + } + $h = $this->hash->hash($message); + $h = $this->bits2int($h); + while (\true) { + $k = BigInteger::randomRange(self::$one, $this->q->subtract(self::$one)); + $r = $this->g->powMod($k, $this->p); + list(, $r) = $r->divide($this->q); + if ($r->equals(self::$zero)) { + continue; + } + $kinv = $k->modInverse($this->q); + $temp = $h->add($this->x->multiply($r)); + $temp = $kinv->multiply($temp); + list(, $s) = $temp->divide($this->q); + if (!$s->equals(self::$zero)) { + break; + } + } + // the following is an RFC6979 compliant implementation of deterministic DSA + // it's unused because it's mainly intended for use when a good CSPRNG isn't + // available. if phpseclib's CSPRNG isn't good then even key generation is + // suspect + /* + $h1 = $this->hash->hash($message); + $k = $this->computek($h1); + $r = $this->g->powMod($k, $this->p); + list(, $r) = $r->divide($this->q); + $kinv = $k->modInverse($this->q); + $h1 = $this->bits2int($h1); + $temp = $h1->add($this->x->multiply($r)); + $temp = $kinv->multiply($temp); + list(, $s) = $temp->divide($this->q); + */ + return $format::save($r, $s); + } + /** + * Returns the private key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); + if (!isset($this->y)) { + $this->y = $this->g->powMod($this->x, $this->p); + } + return $type::savePrivateKey($this->p, $this->q, $this->g, $this->y, $this->x, $this->password, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php new file mode 100644 index 0000000..552fa01 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php @@ -0,0 +1,74 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA\Formats\Signature\ASN1 as ASN1Signature; +/** + * DSA Public Key + * + * @author Jim Wigginton + */ +final class PublicKey extends DSA implements Common\PublicKey +{ + use Common\Traits\Fingerprint; + /** + * Verify a signature + * + * @see self::verify() + * @param string $message + * @param string $signature + * @return mixed + */ + public function verify($message, $signature) + { + $format = $this->sigFormat; + $params = $format::load($signature); + if ($params === \false || count($params) != 2) { + return \false; + } + extract($params); + if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { + $sig = $format != 'ASN1' ? ASN1Signature::save($r, $s) : $signature; + $result = openssl_verify($message, $sig, $this->toString('PKCS8'), $this->hash->getHash()); + if ($result != -1) { + return (bool) $result; + } + } + $q_1 = $this->q->subtract(self::$one); + if (!$r->between(self::$one, $q_1) || !$s->between(self::$one, $q_1)) { + return \false; + } + $w = $s->modInverse($this->q); + $h = $this->hash->hash($message); + $h = $this->bits2int($h); + list(, $u1) = $h->multiply($w)->divide($this->q); + list(, $u2) = $r->multiply($w)->divide($this->q); + $v1 = $this->g->powMod($u1, $this->p); + $v2 = $this->y->powMod($u2, $this->p); + list(, $v) = $v1->multiply($v2)->divide($this->p); + list(, $v) = $v->divide($this->q); + return $v->equals($r); + } + /** + * Returns the public key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePublicKey'); + return $type::savePublicKey($this->p, $this->q, $this->g, $this->y, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC.php new file mode 100644 index 0000000..a112c7b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC.php @@ -0,0 +1,414 @@ + + * getPublicKey(); + * + * $plaintext = 'terrafrost'; + * + * $signature = $private->sign($plaintext); + * + * echo $public->verify($plaintext, $signature) ? 'verified' : 'unverified'; + * ?> + * + * + * @author Jim Wigginton + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\AsymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed448; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys\PKCS1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Parameters; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedOperationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps\ECParameters; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Pure-PHP implementation of EC. + * + * @author Jim Wigginton + */ +abstract class EC extends AsymmetricKey +{ + /** + * Algorithm Name + * + * @var string + */ + const ALGORITHM = 'EC'; + /** + * Public Key QA + * + * @var object[] + */ + protected $QA; + /** + * Curve + * + * @var \phpseclib3\Crypt\EC\BaseCurves\Base + */ + protected $curve; + /** + * Signature Format + * + * @var string + */ + protected $format; + /** + * Signature Format (Short) + * + * @var string + */ + protected $shortFormat; + /** + * Curve Name + * + * @var string + */ + private $curveName; + /** + * Curve Order + * + * Used for deterministic ECDSA + * + * @var \phpseclib3\Math\BigInteger + */ + protected $q; + /** + * Alias for the private key + * + * Used for deterministic ECDSA. AsymmetricKey expects $x. I don't like x because + * with x you have x * the base point yielding an (x, y)-coordinate that is the + * public key. But the x is different depending on which side of the equal sign + * you're on. It's less ambiguous if you do dA * base point = (x, y)-coordinate. + * + * @var \phpseclib3\Math\BigInteger + */ + protected $x; + /** + * Context + * + * @var string + */ + protected $context; + /** + * Signature Format + * + * @var string + */ + protected $sigFormat; + /** + * Create public / private key pair. + * + * @param string $curve + * @return \phpseclib3\Crypt\EC\PrivateKey + */ + public static function createKey($curve) + { + self::initialize_static_variables(); + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')'); + } + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + $curve = strtolower($curve); + if (self::$engines['libsodium'] && $curve == 'ed25519' && function_exists('sodium_crypto_sign_keypair')) { + $kp = sodium_crypto_sign_keypair(); + $privatekey = EC::loadFormat('libsodium', sodium_crypto_sign_secretkey($kp)); + //$publickey = EC::loadFormat('libsodium', sodium_crypto_sign_publickey($kp)); + $privatekey->curveName = 'Ed25519'; + //$publickey->curveName = $curve; + return $privatekey; + } + $privatekey = new PrivateKey(); + $curveName = $curve; + if (preg_match('#(?:^curve|^ed)\\d+$#', $curveName)) { + $curveName = ucfirst($curveName); + } elseif (substr($curveName, 0, 10) == 'brainpoolp') { + $curveName = 'brainpoolP' . substr($curveName, 10); + } + $curve = '\\phpseclib3\\Crypt\\EC\\Curves\\' . $curveName; + if (!class_exists($curve)) { + throw new UnsupportedCurveException('Named Curve of ' . $curveName . ' is not supported'); + } + $reflect = new \ReflectionClass($curve); + $curveName = $reflect->isFinal() ? $reflect->getParentClass()->getShortName() : $reflect->getShortName(); + $curve = new $curve(); + if ($curve instanceof TwistedEdwardsCurve) { + $arr = $curve->extractSecret(Random::string($curve instanceof Ed448 ? 57 : 32)); + $privatekey->dA = $dA = $arr['dA']; + $privatekey->secret = $arr['secret']; + } else { + $privatekey->dA = $dA = $curve->createRandomMultiplier(); + } + if ($curve instanceof Curve25519 && self::$engines['libsodium']) { + //$r = pack('H*', '0900000000000000000000000000000000000000000000000000000000000000'); + //$QA = sodium_crypto_scalarmult($dA->toBytes(), $r); + $QA = sodium_crypto_box_publickey_from_secretkey($dA->toBytes()); + $privatekey->QA = [$curve->convertInteger(new BigInteger(strrev($QA), 256))]; + } else { + $privatekey->QA = $curve->multiplyPoint($curve->getBasePoint(), $dA); + } + $privatekey->curve = $curve; + //$publickey = clone $privatekey; + //unset($publickey->dA); + //unset($publickey->x); + $privatekey->curveName = $curveName; + //$publickey->curveName = $curveName; + if ($privatekey->curve instanceof TwistedEdwardsCurve) { + return $privatekey->withHash($curve::HASH); + } + return $privatekey; + } + /** + * OnLoad Handler + * + * @return bool + */ + protected static function onLoad(array $components) + { + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + if (!isset($components['dA']) && !isset($components['QA'])) { + $new = new Parameters(); + $new->curve = $components['curve']; + return $new; + } + $new = isset($components['dA']) ? new PrivateKey() : new PublicKey(); + $new->curve = $components['curve']; + $new->QA = $components['QA']; + if (isset($components['dA'])) { + $new->dA = $components['dA']; + $new->secret = $components['secret']; + } + if ($new->curve instanceof TwistedEdwardsCurve) { + return $new->withHash($components['curve']::HASH); + } + return $new; + } + /** + * Constructor + * + * PublicKey and PrivateKey objects can only be created from abstract RSA class + */ + protected function __construct() + { + $this->sigFormat = self::validatePlugin('Signature', 'ASN1'); + $this->shortFormat = 'ASN1'; + parent::__construct(); + } + /** + * Returns the curve + * + * Returns a string if it's a named curve, an array if not + * + * @return string|array + */ + public function getCurve() + { + if ($this->curveName) { + return $this->curveName; + } + if ($this->curve instanceof MontgomeryCurve) { + $this->curveName = $this->curve instanceof Curve25519 ? 'Curve25519' : 'Curve448'; + return $this->curveName; + } + if ($this->curve instanceof TwistedEdwardsCurve) { + $this->curveName = $this->curve instanceof Ed25519 ? 'Ed25519' : 'Ed448'; + return $this->curveName; + } + $params = $this->getParameters()->toString('PKCS8', ['namedCurve' => \true]); + $decoded = ASN1::extractBER($params); + $decoded = ASN1::decodeBER($decoded); + $decoded = ASN1::asn1map($decoded[0], ECParameters::MAP); + if (isset($decoded['namedCurve'])) { + $this->curveName = $decoded['namedCurve']; + return $decoded['namedCurve']; + } + if (!$namedCurves) { + PKCS1::useSpecifiedCurve(); + } + return $decoded; + } + /** + * Returns the key size + * + * Quoting https://tools.ietf.org/html/rfc5656#section-2, + * + * "The size of a set of elliptic curve domain parameters on a prime + * curve is defined as the number of bits in the binary representation + * of the field order, commonly denoted by p. Size on a + * characteristic-2 curve is defined as the number of bits in the binary + * representation of the field, commonly denoted by m. A set of + * elliptic curve domain parameters defines a group of order n generated + * by a base point P" + * + * @return int + */ + public function getLength() + { + return $this->curve->getLength(); + } + /** + * Returns the current engine being used + * + * @see self::useInternalEngine() + * @see self::useBestEngine() + * @return string + */ + public function getEngine() + { + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + if ($this->curve instanceof TwistedEdwardsCurve) { + return $this->curve instanceof Ed25519 && self::$engines['libsodium'] && !isset($this->context) ? 'libsodium' : 'PHP'; + } + return self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods()) ? 'OpenSSL' : 'PHP'; + } + /** + * Returns the public key coordinates as a string + * + * Used by ECDH + * + * @return string + */ + public function getEncodedCoordinates() + { + if ($this->curve instanceof MontgomeryCurve) { + return strrev($this->QA[0]->toBytes(\true)); + } + if ($this->curve instanceof TwistedEdwardsCurve) { + return $this->curve->encodePoint($this->QA); + } + return "\x04" . $this->QA[0]->toBytes(\true) . $this->QA[1]->toBytes(\true); + } + /** + * Returns the parameters + * + * @see self::getPublicKey() + * @param string $type optional + * @return mixed + */ + public function getParameters($type = 'PKCS1') + { + $type = self::validatePlugin('Keys', $type, 'saveParameters'); + $key = $type::saveParameters($this->curve); + return EC::load($key, 'PKCS1')->withHash($this->hash->getHash())->withSignatureFormat($this->shortFormat); + } + /** + * Determines the signature padding mode + * + * Valid values are: ASN1, SSH2, Raw + * + * @param string $format + */ + public function withSignatureFormat($format) + { + if ($this->curve instanceof MontgomeryCurve) { + throw new UnsupportedOperationException('Montgomery Curves cannot be used to create signatures'); + } + $new = clone $this; + $new->shortFormat = $format; + $new->sigFormat = self::validatePlugin('Signature', $format); + return $new; + } + /** + * Returns the signature format currently being used + * + */ + public function getSignatureFormat() + { + return $this->shortFormat; + } + /** + * Sets the context + * + * Used by Ed25519 / Ed448. + * + * @see self::sign() + * @see self::verify() + * @param string $context optional + */ + public function withContext($context = null) + { + if (!$this->curve instanceof TwistedEdwardsCurve) { + throw new UnsupportedCurveException('Only Ed25519 and Ed448 support contexts'); + } + $new = clone $this; + if (!isset($context)) { + $new->context = null; + return $new; + } + if (!is_string($context)) { + throw new \InvalidArgumentException('setContext expects a string'); + } + if (strlen($context) > 255) { + throw new \LengthException('The context is supposed to be, at most, 255 bytes long'); + } + $new->context = $context; + return $new; + } + /** + * Returns the signature format currently being used + * + */ + public function getContext() + { + return $this->context; + } + /** + * Determines which hashing function should be used + * + * @param string $hash + */ + public function withHash($hash) + { + if ($this->curve instanceof MontgomeryCurve) { + throw new UnsupportedOperationException('Montgomery Curves cannot be used to create signatures'); + } + if ($this->curve instanceof Ed25519 && $hash != 'sha512') { + throw new UnsupportedAlgorithmException('Ed25519 only supports sha512 as a hash'); + } + if ($this->curve instanceof Ed448 && $hash != 'shake256-912') { + throw new UnsupportedAlgorithmException('Ed448 only supports shake256 with a length of 114 bytes'); + } + return parent::withHash($hash); + } + /** + * __toString() magic method + * + * @return string + */ + public function __toString() + { + if ($this->curve instanceof MontgomeryCurve) { + return ''; + } + return parent::__toString(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Base.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Base.php new file mode 100644 index 0000000..40cb80b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Base.php @@ -0,0 +1,192 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Base + * + * @author Jim Wigginton + */ +abstract class Base +{ + /** + * The Order + * + * @var BigInteger + */ + protected $order; + /** + * Finite Field Integer factory + * + * @var \phpseclib3\Math\FiniteField\Integer + */ + protected $factory; + /** + * Returns a random integer + * + * @return object + */ + public function randomInteger() + { + return $this->factory->randomInteger(); + } + /** + * Converts a BigInteger to a \phpseclib3\Math\FiniteField\Integer integer + * + * @return object + */ + public function convertInteger(BigInteger $x) + { + return $this->factory->newInteger($x); + } + /** + * Returns the length, in bytes, of the modulo + * + * @return integer + */ + public function getLengthInBytes() + { + return $this->factory->getLengthInBytes(); + } + /** + * Returns the length, in bits, of the modulo + * + * @return integer + */ + public function getLength() + { + return $this->factory->getLength(); + } + /** + * Multiply a point on the curve by a scalar + * + * Uses the montgomery ladder technique as described here: + * + * https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Montgomery_ladder + * https://github.com/phpecc/phpecc/issues/16#issuecomment-59176772 + * + * @return array + */ + public function multiplyPoint(array $p, BigInteger $d) + { + $alreadyInternal = isset($p[2]); + $r = $alreadyInternal ? [[], $p] : [[], $this->convertToInternal($p)]; + $d = $d->toBits(); + for ($i = 0; $i < strlen($d); $i++) { + $d_i = (int) $d[$i]; + $r[1 - $d_i] = $this->addPoint($r[0], $r[1]); + $r[$d_i] = $this->doublePoint($r[$d_i]); + } + return $alreadyInternal ? $r[0] : $this->convertToAffine($r[0]); + } + /** + * Creates a random scalar multiplier + * + * @return BigInteger + */ + public function createRandomMultiplier() + { + static $one; + if (!isset($one)) { + $one = new BigInteger(1); + } + return BigInteger::randomRange($one, $this->order->subtract($one)); + } + /** + * Performs range check + */ + public function rangeCheck(BigInteger $x) + { + static $zero; + if (!isset($zero)) { + $zero = new BigInteger(); + } + if (!isset($this->order)) { + throw new \RuntimeException('setOrder needs to be called before this method'); + } + if ($x->compare($this->order) > 0 || $x->compare($zero) <= 0) { + throw new \RangeException('x must be between 1 and the order of the curve'); + } + } + /** + * Sets the Order + */ + public function setOrder(BigInteger $order) + { + $this->order = $order; + } + /** + * Returns the Order + * + * @return \phpseclib3\Math\BigInteger + */ + public function getOrder() + { + return $this->order; + } + /** + * Use a custom defined modular reduction function + * + * @return object + */ + public function setReduction(callable $func) + { + $this->factory->setReduction($func); + } + /** + * Returns the affine point + * + * @return object[] + */ + public function convertToAffine(array $p) + { + return $p; + } + /** + * Converts an affine point to a jacobian coordinate + * + * @return object[] + */ + public function convertToInternal(array $p) + { + return $p; + } + /** + * Negates a point + * + * @return object[] + */ + public function negatePoint(array $p) + { + $temp = [$p[0], $p[1]->negate()]; + if (isset($p[2])) { + $temp[] = $p[2]; + } + return $temp; + } + /** + * Multiply and Add Points + * + * @return int[] + */ + public function multiplyAddPoints(array $points, array $scalars) + { + $p1 = $this->convertToInternal($points[0]); + $p2 = $this->convertToInternal($points[1]); + $p1 = $this->multiplyPoint($p1, $scalars[0]); + $p2 = $this->multiplyPoint($p2, $scalars[1]); + $r = $this->addPoint($p1, $p2); + return $this->convertToAffine($r); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Binary.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Binary.php new file mode 100644 index 0000000..6a64bb7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Binary.php @@ -0,0 +1,324 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BinaryField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BinaryField\Integer as BinaryInteger; +/** + * Curves over y^2 + x*y = x^3 + a*x^2 + b + * + * @author Jim Wigginton + */ +class Binary extends Base +{ + /** + * Binary Field Integer factory + * + * @var \phpseclib3\Math\BinaryField + */ + protected $factory; + /** + * Cofficient for x^1 + * + * @var object + */ + protected $a; + /** + * Cofficient for x^0 + * + * @var object + */ + protected $b; + /** + * Base Point + * + * @var object + */ + protected $p; + /** + * The number one over the specified finite field + * + * @var object + */ + protected $one; + /** + * The modulo + * + * @var BigInteger + */ + protected $modulo; + /** + * The Order + * + * @var BigInteger + */ + protected $order; + /** + * Sets the modulo + */ + public function setModulo(...$modulo) + { + $this->modulo = $modulo; + $this->factory = new BinaryField(...$modulo); + $this->one = $this->factory->newInteger("\x01"); + } + /** + * Set coefficients a and b + * + * @param string $a + * @param string $b + */ + public function setCoefficients($a, $b) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->a = $this->factory->newInteger(pack('H*', $a)); + $this->b = $this->factory->newInteger(pack('H*', $b)); + } + /** + * Set x and y coordinates for the base point + * + * @param string|BinaryInteger $x + * @param string|BinaryInteger $y + */ + public function setBasePoint($x, $y) + { + switch (\true) { + case !is_string($x) && !$x instanceof BinaryInteger: + throw new \UnexpectedValueException('Argument 1 passed to Binary::setBasePoint() must be a string or an instance of BinaryField\\Integer'); + case !is_string($y) && !$y instanceof BinaryInteger: + throw new \UnexpectedValueException('Argument 2 passed to Binary::setBasePoint() must be a string or an instance of BinaryField\\Integer'); + } + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->p = [is_string($x) ? $this->factory->newInteger(pack('H*', $x)) : $x, is_string($y) ? $this->factory->newInteger(pack('H*', $y)) : $y]; + } + /** + * Retrieve the base point as an array + * + * @return array + */ + public function getBasePoint() + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + /* + if (!isset($this->p)) { + throw new \RuntimeException('setBasePoint needs to be called before this method'); + } + */ + return $this->p; + } + /** + * Adds two points on the curve + * + * @return FiniteField[] + */ + public function addPoint(array $p, array $q) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p) || !count($q)) { + if (count($q)) { + return $q; + } + if (count($p)) { + return $p; + } + return []; + } + if (!isset($p[2]) || !isset($q[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to "Jacobi" coordinates or vice versa'); + } + if ($p[0]->equals($q[0])) { + return !$p[1]->equals($q[1]) ? [] : $this->doublePoint($p); + } + // formulas from http://hyperelliptic.org/EFD/g12o/auto-shortw-jacobian.html + list($x1, $y1, $z1) = $p; + list($x2, $y2, $z2) = $q; + $o1 = $z1->multiply($z1); + $b = $x2->multiply($o1); + if ($z2->equals($this->one)) { + $d = $y2->multiply($o1)->multiply($z1); + $e = $x1->add($b); + $f = $y1->add($d); + $z3 = $e->multiply($z1); + $h = $f->multiply($x2)->add($z3->multiply($y2)); + $i = $f->add($z3); + $g = $z3->multiply($z3); + $p1 = $this->a->multiply($g); + $p2 = $f->multiply($i); + $p3 = $e->multiply($e)->multiply($e); + $x3 = $p1->add($p2)->add($p3); + $y3 = $i->multiply($x3)->add($g->multiply($h)); + return [$x3, $y3, $z3]; + } + $o2 = $z2->multiply($z2); + $a = $x1->multiply($o2); + $c = $y1->multiply($o2)->multiply($z2); + $d = $y2->multiply($o1)->multiply($z1); + $e = $a->add($b); + $f = $c->add($d); + $g = $e->multiply($z1); + $h = $f->multiply($x2)->add($g->multiply($y2)); + $z3 = $g->multiply($z2); + $i = $f->add($z3); + $p1 = $this->a->multiply($z3->multiply($z3)); + $p2 = $f->multiply($i); + $p3 = $e->multiply($e)->multiply($e); + $x3 = $p1->add($p2)->add($p3); + $y3 = $i->multiply($x3)->add($g->multiply($g)->multiply($h)); + return [$x3, $y3, $z3]; + } + /** + * Doubles a point on a curve + * + * @return FiniteField[] + */ + public function doublePoint(array $p) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p)) { + return []; + } + if (!isset($p[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to "Jacobi" coordinates or vice versa'); + } + // formulas from http://hyperelliptic.org/EFD/g12o/auto-shortw-jacobian.html + list($x1, $y1, $z1) = $p; + $a = $x1->multiply($x1); + $b = $a->multiply($a); + if ($z1->equals($this->one)) { + $x3 = $b->add($this->b); + $z3 = clone $x1; + $p1 = $a->add($y1)->add($z3)->multiply($this->b); + $p2 = $a->add($y1)->multiply($b); + $y3 = $p1->add($p2); + return [$x3, $y3, $z3]; + } + $c = $z1->multiply($z1); + $d = $c->multiply($c); + $x3 = $b->add($this->b->multiply($d->multiply($d))); + $z3 = $x1->multiply($c); + $p1 = $b->multiply($z3); + $p2 = $a->add($y1->multiply($z1))->add($z3)->multiply($x3); + $y3 = $p1->add($p2); + return [$x3, $y3, $z3]; + } + /** + * Returns the X coordinate and the derived Y coordinate + * + * Not supported because it is covered by patents. + * Quoting https://www.openssl.org/docs/man1.1.0/apps/ecparam.html , + * + * "Due to patent issues the compressed option is disabled by default for binary curves + * and can be enabled by defining the preprocessor macro OPENSSL_EC_BIN_PT_COMP at + * compile time." + * + * @return array + */ + public function derivePoint($m) + { + throw new \RuntimeException('Point compression on binary finite field elliptic curves is not supported'); + } + /** + * Tests whether or not the x / y values satisfy the equation + * + * @return boolean + */ + public function verifyPoint(array $p) + { + list($x, $y) = $p; + $lhs = $y->multiply($y); + $lhs = $lhs->add($x->multiply($y)); + $x2 = $x->multiply($x); + $x3 = $x2->multiply($x); + $rhs = $x3->add($this->a->multiply($x2))->add($this->b); + return $lhs->equals($rhs); + } + /** + * Returns the modulo + * + * @return \phpseclib3\Math\BigInteger + */ + public function getModulo() + { + return $this->modulo; + } + /** + * Returns the a coefficient + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function getA() + { + return $this->a; + } + /** + * Returns the a coefficient + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function getB() + { + return $this->b; + } + /** + * Returns the affine point + * + * A Jacobian Coordinate is of the form (x, y, z). + * To convert a Jacobian Coordinate to an Affine Point + * you do (x / z^2, y / z^3) + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToAffine(array $p) + { + if (!isset($p[2])) { + return $p; + } + list($x, $y, $z) = $p; + $z = $this->one->divide($z); + $z2 = $z->multiply($z); + return [$x->multiply($z2), $y->multiply($z2)->multiply($z)]; + } + /** + * Converts an affine point to a jacobian coordinate + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToInternal(array $p) + { + if (isset($p[2])) { + return $p; + } + $p[2] = clone $this->one; + $p['fresh'] = \true; + return $p; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/KoblitzPrime.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/KoblitzPrime.php new file mode 100644 index 0000000..e420721 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/KoblitzPrime.php @@ -0,0 +1,273 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; +/** + * Curves over y^2 = x^3 + b + * + * @author Jim Wigginton + */ +class KoblitzPrime extends Prime +{ + /** + * Basis + * + * @var list + */ + protected $basis; + /** + * Beta + * + * @var PrimeField\Integer + */ + protected $beta; + // don't overwrite setCoefficients() with one that only accepts one parameter so that + // one might be able to switch between KoblitzPrime and Prime more easily (for benchmarking + // purposes). + /** + * Multiply and Add Points + * + * Uses a efficiently computable endomorphism to achieve a slight speedup + * + * Adapted from: + * https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/curve/short.js#L219 + * + * @return int[] + */ + public function multiplyAddPoints(array $points, array $scalars) + { + static $zero, $one, $two; + if (!isset($two)) { + $two = new BigInteger(2); + $one = new BigInteger(1); + } + if (!isset($this->beta)) { + // get roots + $inv = $this->one->divide($this->two)->negate(); + $s = $this->three->negate()->squareRoot()->multiply($inv); + $betas = [$inv->add($s), $inv->subtract($s)]; + $this->beta = $betas[0]->compare($betas[1]) < 0 ? $betas[0] : $betas[1]; + //echo strtoupper($this->beta->toHex(true)) . "\n"; exit; + } + if (!isset($this->basis)) { + $factory = new PrimeField($this->order); + $tempOne = $factory->newInteger($one); + $tempTwo = $factory->newInteger($two); + $tempThree = $factory->newInteger(new BigInteger(3)); + $inv = $tempOne->divide($tempTwo)->negate(); + $s = $tempThree->negate()->squareRoot()->multiply($inv); + $lambdas = [$inv->add($s), $inv->subtract($s)]; + $lhs = $this->multiplyPoint($this->p, $lambdas[0])[0]; + $rhs = $this->p[0]->multiply($this->beta); + $lambda = $lhs->equals($rhs) ? $lambdas[0] : $lambdas[1]; + $this->basis = static::extendedGCD($lambda->toBigInteger(), $this->order); + ///* + foreach ($this->basis as $basis) { + echo strtoupper($basis['a']->toHex(\true)) . "\n"; + echo strtoupper($basis['b']->toHex(\true)) . "\n\n"; + } + exit; + //*/ + } + $npoints = $nscalars = []; + for ($i = 0; $i < count($points); $i++) { + $p = $points[$i]; + $k = $scalars[$i]->toBigInteger(); + // begin split + list($v1, $v2) = $this->basis; + $c1 = $v2['b']->multiply($k); + list($c1, $r) = $c1->divide($this->order); + if ($this->order->compare($r->multiply($two)) <= 0) { + $c1 = $c1->add($one); + } + $c2 = $v1['b']->negate()->multiply($k); + list($c2, $r) = $c2->divide($this->order); + if ($this->order->compare($r->multiply($two)) <= 0) { + $c2 = $c2->add($one); + } + $p1 = $c1->multiply($v1['a']); + $p2 = $c2->multiply($v2['a']); + $q1 = $c1->multiply($v1['b']); + $q2 = $c2->multiply($v2['b']); + $k1 = $k->subtract($p1)->subtract($p2); + $k2 = $q1->add($q2)->negate(); + // end split + $beta = [$p[0]->multiply($this->beta), $p[1], clone $this->one]; + if (isset($p['naf'])) { + $beta['naf'] = array_map(function ($p) { + return [$p[0]->multiply($this->beta), $p[1], clone $this->one]; + }, $p['naf']); + $beta['nafwidth'] = $p['nafwidth']; + } + if ($k1->isNegative()) { + $k1 = $k1->negate(); + $p = $this->negatePoint($p); + } + if ($k2->isNegative()) { + $k2 = $k2->negate(); + $beta = $this->negatePoint($beta); + } + $pos = 2 * $i; + $npoints[$pos] = $p; + $nscalars[$pos] = $this->factory->newInteger($k1); + $pos++; + $npoints[$pos] = $beta; + $nscalars[$pos] = $this->factory->newInteger($k2); + } + return parent::multiplyAddPoints($npoints, $nscalars); + } + /** + * Returns the numerator and denominator of the slope + * + * @return FiniteField[] + */ + protected function doublePointHelper(array $p) + { + $numerator = $this->three->multiply($p[0])->multiply($p[0]); + $denominator = $this->two->multiply($p[1]); + return [$numerator, $denominator]; + } + /** + * Doubles a jacobian coordinate on the curve + * + * See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l + * + * @return FiniteField[] + */ + protected function jacobianDoublePoint(array $p) + { + list($x1, $y1, $z1) = $p; + $a = $x1->multiply($x1); + $b = $y1->multiply($y1); + $c = $b->multiply($b); + $d = $x1->add($b); + $d = $d->multiply($d)->subtract($a)->subtract($c)->multiply($this->two); + $e = $this->three->multiply($a); + $f = $e->multiply($e); + $x3 = $f->subtract($this->two->multiply($d)); + $y3 = $e->multiply($d->subtract($x3))->subtract($this->eight->multiply($c)); + $z3 = $this->two->multiply($y1)->multiply($z1); + return [$x3, $y3, $z3]; + } + /** + * Doubles a "fresh" jacobian coordinate on the curve + * + * See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-mdbl-2007-bl + * + * @return FiniteField[] + */ + protected function jacobianDoublePointMixed(array $p) + { + list($x1, $y1) = $p; + $xx = $x1->multiply($x1); + $yy = $y1->multiply($y1); + $yyyy = $yy->multiply($yy); + $s = $x1->add($yy); + $s = $s->multiply($s)->subtract($xx)->subtract($yyyy)->multiply($this->two); + $m = $this->three->multiply($xx); + $t = $m->multiply($m)->subtract($this->two->multiply($s)); + $x3 = $t; + $y3 = $s->subtract($t); + $y3 = $m->multiply($y3)->subtract($this->eight->multiply($yyyy)); + $z3 = $this->two->multiply($y1); + return [$x3, $y3, $z3]; + } + /** + * Tests whether or not the x / y values satisfy the equation + * + * @return boolean + */ + public function verifyPoint(array $p) + { + list($x, $y) = $p; + $lhs = $y->multiply($y); + $temp = $x->multiply($x)->multiply($x); + $rhs = $temp->add($this->b); + return $lhs->equals($rhs); + } + /** + * Calculates the parameters needed from the Euclidean algorithm as discussed at + * http://diamond.boisestate.edu/~liljanab/MATH308/GuideToECC.pdf#page=148 + * + * @param BigInteger $u + * @param BigInteger $v + * @return BigInteger[] + */ + protected static function extendedGCD(BigInteger $u, BigInteger $v) + { + $one = new BigInteger(1); + $zero = new BigInteger(); + $a = clone $one; + $b = clone $zero; + $c = clone $zero; + $d = clone $one; + $stop = $v->bitwise_rightShift($v->getLength() >> 1); + $a1 = clone $zero; + $b1 = clone $zero; + $a2 = clone $zero; + $b2 = clone $zero; + $postGreatestIndex = 0; + while (!$v->equals($zero)) { + list($q) = $u->divide($v); + $temp = $u; + $u = $v; + $v = $temp->subtract($v->multiply($q)); + $temp = $a; + $a = $c; + $c = $temp->subtract($a->multiply($q)); + $temp = $b; + $b = $d; + $d = $temp->subtract($b->multiply($q)); + if ($v->compare($stop) > 0) { + $a0 = $v; + $b0 = $c; + } else { + $postGreatestIndex++; + } + if ($postGreatestIndex == 1) { + $a1 = $v; + $b1 = $c->negate(); + } + if ($postGreatestIndex == 2) { + $rhs = $a0->multiply($a0)->add($b0->multiply($b0)); + $lhs = $v->multiply($v)->add($b->multiply($b)); + if ($lhs->compare($rhs) <= 0) { + $a2 = $a0; + $b2 = $b0->negate(); + } else { + $a2 = $v; + $b2 = $c->negate(); + } + break; + } + } + return [['a' => $a1, 'b' => $b1], ['a' => $a2, 'b' => $b2]]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php new file mode 100644 index 0000000..3776e9f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php @@ -0,0 +1,246 @@ + + * @copyright 2019 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField\Integer as PrimeInteger; +/** + * Curves over y^2 = x^3 + a*x + x + * + * @author Jim Wigginton + */ +class Montgomery extends Base +{ + /** + * Prime Field Integer factory + * + * @var \phpseclib3\Math\PrimeField + */ + protected $factory; + /** + * Cofficient for x + * + * @var object + */ + protected $a; + /** + * Constant used for point doubling + * + * @var object + */ + protected $a24; + /** + * The Number Zero + * + * @var object + */ + protected $zero; + /** + * The Number One + * + * @var object + */ + protected $one; + /** + * Base Point + * + * @var object + */ + protected $p; + /** + * The modulo + * + * @var BigInteger + */ + protected $modulo; + /** + * The Order + * + * @var BigInteger + */ + protected $order; + /** + * Sets the modulo + */ + public function setModulo(BigInteger $modulo) + { + $this->modulo = $modulo; + $this->factory = new PrimeField($modulo); + $this->zero = $this->factory->newInteger(new BigInteger()); + $this->one = $this->factory->newInteger(new BigInteger(1)); + } + /** + * Set coefficients a + */ + public function setCoefficients(BigInteger $a) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->a = $this->factory->newInteger($a); + $two = $this->factory->newInteger(new BigInteger(2)); + $four = $this->factory->newInteger(new BigInteger(4)); + $this->a24 = $this->a->subtract($two)->divide($four); + } + /** + * Set x and y coordinates for the base point + * + * @param BigInteger|PrimeInteger $x + * @param BigInteger|PrimeInteger $y + * @return PrimeInteger[] + */ + public function setBasePoint($x, $y) + { + switch (\true) { + case !$x instanceof BigInteger && !$x instanceof PrimeInteger: + throw new \UnexpectedValueException('Argument 1 passed to Prime::setBasePoint() must be an instance of either BigInteger or PrimeField\\Integer'); + case !$y instanceof BigInteger && !$y instanceof PrimeInteger: + throw new \UnexpectedValueException('Argument 2 passed to Prime::setBasePoint() must be an instance of either BigInteger or PrimeField\\Integer'); + } + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->p = [$x instanceof BigInteger ? $this->factory->newInteger($x) : $x, $y instanceof BigInteger ? $this->factory->newInteger($y) : $y]; + } + /** + * Retrieve the base point as an array + * + * @return array + */ + public function getBasePoint() + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + /* + if (!isset($this->p)) { + throw new \RuntimeException('setBasePoint needs to be called before this method'); + } + */ + return $this->p; + } + /** + * Doubles and adds a point on a curve + * + * See https://tools.ietf.org/html/draft-ietf-tls-curve25519-01#appendix-A.1.3 + * + * @return FiniteField[][] + */ + private function doubleAndAddPoint(array $p, array $q, PrimeInteger $x1) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p) || !count($q)) { + return []; + } + if (!isset($p[1])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to XZ coordinates'); + } + list($x2, $z2) = $p; + list($x3, $z3) = $q; + $a = $x2->add($z2); + $aa = $a->multiply($a); + $b = $x2->subtract($z2); + $bb = $b->multiply($b); + $e = $aa->subtract($bb); + $c = $x3->add($z3); + $d = $x3->subtract($z3); + $da = $d->multiply($a); + $cb = $c->multiply($b); + $temp = $da->add($cb); + $x5 = $temp->multiply($temp); + $temp = $da->subtract($cb); + $z5 = $x1->multiply($temp->multiply($temp)); + $x4 = $aa->multiply($bb); + $temp = static::class == Curve25519::class ? $bb : $aa; + $z4 = $e->multiply($temp->add($this->a24->multiply($e))); + return [[$x4, $z4], [$x5, $z5]]; + } + /** + * Multiply a point on the curve by a scalar + * + * Uses the montgomery ladder technique as described here: + * + * https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication#Montgomery_ladder + * https://github.com/phpecc/phpecc/issues/16#issuecomment-59176772 + * + * @return array + */ + public function multiplyPoint(array $p, BigInteger $d) + { + $p1 = [$this->one, $this->zero]; + $alreadyInternal = isset($x[1]); + $p2 = $this->convertToInternal($p); + $x = $p[0]; + $b = $d->toBits(); + $b = str_pad($b, 256, '0', \STR_PAD_LEFT); + for ($i = 0; $i < strlen($b); $i++) { + $b_i = (int) $b[$i]; + if ($b_i) { + list($p2, $p1) = $this->doubleAndAddPoint($p2, $p1, $x); + } else { + list($p1, $p2) = $this->doubleAndAddPoint($p1, $p2, $x); + } + } + return $alreadyInternal ? $p1 : $this->convertToAffine($p1); + } + /** + * Converts an affine point to an XZ coordinate + * + * From https://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html + * + * XZ coordinates represent x y as X Z satsfying the following equations: + * + * x=X/Z + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToInternal(array $p) + { + if (empty($p)) { + return [clone $this->zero, clone $this->one]; + } + if (isset($p[1])) { + return $p; + } + $p[1] = clone $this->one; + return $p; + } + /** + * Returns the affine point + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToAffine(array $p) + { + if (!isset($p[1])) { + return $p; + } + list($x, $z) = $p; + return [$x->divide($z)]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php new file mode 100644 index 0000000..7ed1fbe --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php @@ -0,0 +1,695 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField\Integer; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField\Integer as PrimeInteger; +/** + * Curves over y^2 = x^3 + a*x + b + * + * @author Jim Wigginton + */ +class Prime extends Base +{ + /** + * Prime Field Integer factory + * + * @var \phpseclib3\Math\PrimeFields + */ + protected $factory; + /** + * Cofficient for x^1 + * + * @var object + */ + protected $a; + /** + * Cofficient for x^0 + * + * @var object + */ + protected $b; + /** + * Base Point + * + * @var object + */ + protected $p; + /** + * The number one over the specified finite field + * + * @var object + */ + protected $one; + /** + * The number two over the specified finite field + * + * @var object + */ + protected $two; + /** + * The number three over the specified finite field + * + * @var object + */ + protected $three; + /** + * The number four over the specified finite field + * + * @var object + */ + protected $four; + /** + * The number eight over the specified finite field + * + * @var object + */ + protected $eight; + /** + * The modulo + * + * @var BigInteger + */ + protected $modulo; + /** + * The Order + * + * @var BigInteger + */ + protected $order; + /** + * Sets the modulo + */ + public function setModulo(BigInteger $modulo) + { + $this->modulo = $modulo; + $this->factory = new PrimeField($modulo); + $this->two = $this->factory->newInteger(new BigInteger(2)); + $this->three = $this->factory->newInteger(new BigInteger(3)); + // used by jacobian coordinates + $this->one = $this->factory->newInteger(new BigInteger(1)); + $this->four = $this->factory->newInteger(new BigInteger(4)); + $this->eight = $this->factory->newInteger(new BigInteger(8)); + } + /** + * Set coefficients a and b + */ + public function setCoefficients(BigInteger $a, BigInteger $b) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->a = $this->factory->newInteger($a); + $this->b = $this->factory->newInteger($b); + } + /** + * Set x and y coordinates for the base point + * + * @param BigInteger|PrimeInteger $x + * @param BigInteger|PrimeInteger $y + * @return PrimeInteger[] + */ + public function setBasePoint($x, $y) + { + switch (\true) { + case !$x instanceof BigInteger && !$x instanceof PrimeInteger: + throw new \UnexpectedValueException('Argument 1 passed to Prime::setBasePoint() must be an instance of either BigInteger or PrimeField\\Integer'); + case !$y instanceof BigInteger && !$y instanceof PrimeInteger: + throw new \UnexpectedValueException('Argument 2 passed to Prime::setBasePoint() must be an instance of either BigInteger or PrimeField\\Integer'); + } + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->p = [$x instanceof BigInteger ? $this->factory->newInteger($x) : $x, $y instanceof BigInteger ? $this->factory->newInteger($y) : $y]; + } + /** + * Retrieve the base point as an array + * + * @return array + */ + public function getBasePoint() + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + /* + if (!isset($this->p)) { + throw new \RuntimeException('setBasePoint needs to be called before this method'); + } + */ + return $this->p; + } + /** + * Adds two "fresh" jacobian form on the curve + * + * @return FiniteField[] + */ + protected function jacobianAddPointMixedXY(array $p, array $q) + { + list($u1, $s1) = $p; + list($u2, $s2) = $q; + if ($u1->equals($u2)) { + if (!$s1->equals($s2)) { + return []; + } else { + return $this->doublePoint($p); + } + } + $h = $u2->subtract($u1); + $r = $s2->subtract($s1); + $h2 = $h->multiply($h); + $h3 = $h2->multiply($h); + $v = $u1->multiply($h2); + $x3 = $r->multiply($r)->subtract($h3)->subtract($v->multiply($this->two)); + $y3 = $r->multiply($v->subtract($x3))->subtract($s1->multiply($h3)); + return [$x3, $y3, $h]; + } + /** + * Adds one "fresh" jacobian form on the curve + * + * The second parameter should be the "fresh" one + * + * @return FiniteField[] + */ + protected function jacobianAddPointMixedX(array $p, array $q) + { + list($u1, $s1, $z1) = $p; + list($x2, $y2) = $q; + $z12 = $z1->multiply($z1); + $u2 = $x2->multiply($z12); + $s2 = $y2->multiply($z12->multiply($z1)); + if ($u1->equals($u2)) { + if (!$s1->equals($s2)) { + return []; + } else { + return $this->doublePoint($p); + } + } + $h = $u2->subtract($u1); + $r = $s2->subtract($s1); + $h2 = $h->multiply($h); + $h3 = $h2->multiply($h); + $v = $u1->multiply($h2); + $x3 = $r->multiply($r)->subtract($h3)->subtract($v->multiply($this->two)); + $y3 = $r->multiply($v->subtract($x3))->subtract($s1->multiply($h3)); + $z3 = $h->multiply($z1); + return [$x3, $y3, $z3]; + } + /** + * Adds two jacobian coordinates on the curve + * + * @return FiniteField[] + */ + protected function jacobianAddPoint(array $p, array $q) + { + list($x1, $y1, $z1) = $p; + list($x2, $y2, $z2) = $q; + $z12 = $z1->multiply($z1); + $z22 = $z2->multiply($z2); + $u1 = $x1->multiply($z22); + $u2 = $x2->multiply($z12); + $s1 = $y1->multiply($z22->multiply($z2)); + $s2 = $y2->multiply($z12->multiply($z1)); + if ($u1->equals($u2)) { + if (!$s1->equals($s2)) { + return []; + } else { + return $this->doublePoint($p); + } + } + $h = $u2->subtract($u1); + $r = $s2->subtract($s1); + $h2 = $h->multiply($h); + $h3 = $h2->multiply($h); + $v = $u1->multiply($h2); + $x3 = $r->multiply($r)->subtract($h3)->subtract($v->multiply($this->two)); + $y3 = $r->multiply($v->subtract($x3))->subtract($s1->multiply($h3)); + $z3 = $h->multiply($z1)->multiply($z2); + return [$x3, $y3, $z3]; + } + /** + * Adds two points on the curve + * + * @return FiniteField[] + */ + public function addPoint(array $p, array $q) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p) || !count($q)) { + if (count($q)) { + return $q; + } + if (count($p)) { + return $p; + } + return []; + } + // use jacobian coordinates + if (isset($p[2]) && isset($q[2])) { + if (isset($p['fresh']) && isset($q['fresh'])) { + return $this->jacobianAddPointMixedXY($p, $q); + } + if (isset($p['fresh'])) { + return $this->jacobianAddPointMixedX($q, $p); + } + if (isset($q['fresh'])) { + return $this->jacobianAddPointMixedX($p, $q); + } + return $this->jacobianAddPoint($p, $q); + } + if (isset($p[2]) || isset($q[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to Jacobi coordinates or vice versa'); + } + if ($p[0]->equals($q[0])) { + if (!$p[1]->equals($q[1])) { + return []; + } else { + // eg. doublePoint + list($numerator, $denominator) = $this->doublePointHelper($p); + } + } else { + $numerator = $q[1]->subtract($p[1]); + $denominator = $q[0]->subtract($p[0]); + } + $slope = $numerator->divide($denominator); + $x = $slope->multiply($slope)->subtract($p[0])->subtract($q[0]); + $y = $slope->multiply($p[0]->subtract($x))->subtract($p[1]); + return [$x, $y]; + } + /** + * Returns the numerator and denominator of the slope + * + * @return FiniteField[] + */ + protected function doublePointHelper(array $p) + { + $numerator = $this->three->multiply($p[0])->multiply($p[0])->add($this->a); + $denominator = $this->two->multiply($p[1]); + return [$numerator, $denominator]; + } + /** + * Doubles a jacobian coordinate on the curve + * + * @return FiniteField[] + */ + protected function jacobianDoublePoint(array $p) + { + list($x, $y, $z) = $p; + $x2 = $x->multiply($x); + $y2 = $y->multiply($y); + $z2 = $z->multiply($z); + $s = $this->four->multiply($x)->multiply($y2); + $m1 = $this->three->multiply($x2); + $m2 = $this->a->multiply($z2->multiply($z2)); + $m = $m1->add($m2); + $x1 = $m->multiply($m)->subtract($this->two->multiply($s)); + $y1 = $m->multiply($s->subtract($x1))->subtract($this->eight->multiply($y2->multiply($y2))); + $z1 = $this->two->multiply($y)->multiply($z); + return [$x1, $y1, $z1]; + } + /** + * Doubles a "fresh" jacobian coordinate on the curve + * + * @return FiniteField[] + */ + protected function jacobianDoublePointMixed(array $p) + { + list($x, $y) = $p; + $x2 = $x->multiply($x); + $y2 = $y->multiply($y); + $s = $this->four->multiply($x)->multiply($y2); + $m1 = $this->three->multiply($x2); + $m = $m1->add($this->a); + $x1 = $m->multiply($m)->subtract($this->two->multiply($s)); + $y1 = $m->multiply($s->subtract($x1))->subtract($this->eight->multiply($y2->multiply($y2))); + $z1 = $this->two->multiply($y); + return [$x1, $y1, $z1]; + } + /** + * Doubles a point on a curve + * + * @return FiniteField[] + */ + public function doublePoint(array $p) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p)) { + return []; + } + // use jacobian coordinates + if (isset($p[2])) { + if (isset($p['fresh'])) { + return $this->jacobianDoublePointMixed($p); + } + return $this->jacobianDoublePoint($p); + } + list($numerator, $denominator) = $this->doublePointHelper($p); + $slope = $numerator->divide($denominator); + $x = $slope->multiply($slope)->subtract($p[0])->subtract($p[0]); + $y = $slope->multiply($p[0]->subtract($x))->subtract($p[1]); + return [$x, $y]; + } + /** + * Returns the X coordinate and the derived Y coordinate + * + * @return array + */ + public function derivePoint($m) + { + $y = ord(Strings::shift($m)); + $x = new BigInteger($m, 256); + $xp = $this->convertInteger($x); + switch ($y) { + case 2: + $ypn = \false; + break; + case 3: + $ypn = \true; + break; + default: + throw new \RuntimeException('Coordinate not in recognized format'); + } + $temp = $xp->multiply($this->a); + $temp = $xp->multiply($xp)->multiply($xp)->add($temp); + $temp = $temp->add($this->b); + $b = $temp->squareRoot(); + if (!$b) { + throw new \RuntimeException('Unable to derive Y coordinate'); + } + $bn = $b->isOdd(); + $yp = $ypn == $bn ? $b : $b->negate(); + return [$xp, $yp]; + } + /** + * Tests whether or not the x / y values satisfy the equation + * + * @return boolean + */ + public function verifyPoint(array $p) + { + list($x, $y) = $p; + $lhs = $y->multiply($y); + $temp = $x->multiply($this->a); + $temp = $x->multiply($x)->multiply($x)->add($temp); + $rhs = $temp->add($this->b); + return $lhs->equals($rhs); + } + /** + * Returns the modulo + * + * @return \phpseclib3\Math\BigInteger + */ + public function getModulo() + { + return $this->modulo; + } + /** + * Returns the a coefficient + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function getA() + { + return $this->a; + } + /** + * Returns the a coefficient + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function getB() + { + return $this->b; + } + /** + * Multiply and Add Points + * + * Adapted from: + * https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/curve/base.js#L125 + * + * @return int[] + */ + public function multiplyAddPoints(array $points, array $scalars) + { + $length = count($points); + foreach ($points as &$point) { + $point = $this->convertToInternal($point); + } + $wnd = [$this->getNAFPoints($points[0], 7)]; + $wndWidth = [isset($points[0]['nafwidth']) ? $points[0]['nafwidth'] : 7]; + for ($i = 1; $i < $length; $i++) { + $wnd[] = $this->getNAFPoints($points[$i], 1); + $wndWidth[] = isset($points[$i]['nafwidth']) ? $points[$i]['nafwidth'] : 1; + } + $naf = []; + // comb all window NAFs + $max = 0; + for ($i = $length - 1; $i >= 1; $i -= 2) { + $a = $i - 1; + $b = $i; + if ($wndWidth[$a] != 1 || $wndWidth[$b] != 1) { + $naf[$a] = $scalars[$a]->getNAF($wndWidth[$a]); + $naf[$b] = $scalars[$b]->getNAF($wndWidth[$b]); + $max = max(count($naf[$a]), count($naf[$b]), $max); + continue; + } + $comb = [ + $points[$a], + // 1 + null, + // 3 + null, + // 5 + $points[$b], + ]; + $comb[1] = $this->addPoint($points[$a], $points[$b]); + $comb[2] = $this->addPoint($points[$a], $this->negatePoint($points[$b])); + $index = [ + -3, + /* -1 -1 */ + -1, + /* -1 0 */ + -5, + /* -1 1 */ + -7, + /* 0 -1 */ + 0, + /* 0 -1 */ + 7, + /* 0 1 */ + 5, + /* 1 -1 */ + 1, + /* 1 0 */ + 3, + ]; + $jsf = self::getJSFPoints($scalars[$a], $scalars[$b]); + $max = max(count($jsf[0]), $max); + if ($max > 0) { + $naf[$a] = array_fill(0, $max, 0); + $naf[$b] = array_fill(0, $max, 0); + } else { + $naf[$a] = []; + $naf[$b] = []; + } + for ($j = 0; $j < $max; $j++) { + $ja = isset($jsf[0][$j]) ? $jsf[0][$j] : 0; + $jb = isset($jsf[1][$j]) ? $jsf[1][$j] : 0; + $naf[$a][$j] = $index[3 * ($ja + 1) + $jb + 1]; + $naf[$b][$j] = 0; + $wnd[$a] = $comb; + } + } + $acc = []; + $temp = [0, 0, 0, 0]; + for ($i = $max; $i >= 0; $i--) { + $k = 0; + while ($i >= 0) { + $zero = \true; + for ($j = 0; $j < $length; $j++) { + $temp[$j] = isset($naf[$j][$i]) ? $naf[$j][$i] : 0; + if ($temp[$j] != 0) { + $zero = \false; + } + } + if (!$zero) { + break; + } + $k++; + $i--; + } + if ($i >= 0) { + $k++; + } + while ($k--) { + $acc = $this->doublePoint($acc); + } + if ($i < 0) { + break; + } + for ($j = 0; $j < $length; $j++) { + $z = $temp[$j]; + $p = null; + if ($z == 0) { + continue; + } + $p = $z > 0 ? $wnd[$j][$z - 1 >> 1] : $this->negatePoint($wnd[$j][-$z - 1 >> 1]); + $acc = $this->addPoint($acc, $p); + } + } + return $this->convertToAffine($acc); + } + /** + * Precomputes NAF points + * + * Adapted from: + * https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/curve/base.js#L351 + * + * @return int[] + */ + private function getNAFPoints(array $point, $wnd) + { + if (isset($point['naf'])) { + return $point['naf']; + } + $res = [$point]; + $max = (1 << $wnd) - 1; + $dbl = $max == 1 ? null : $this->doublePoint($point); + for ($i = 1; $i < $max; $i++) { + $res[] = $this->addPoint($res[$i - 1], $dbl); + } + $point['naf'] = $res; + /* + $str = ''; + foreach ($res as $re) { + $re[0] = bin2hex($re[0]->toBytes()); + $re[1] = bin2hex($re[1]->toBytes()); + $str.= " ['$re[0]', '$re[1]'],\r\n"; + } + file_put_contents('temp.txt', $str); + exit; + */ + return $res; + } + /** + * Precomputes points in Joint Sparse Form + * + * Adapted from: + * https://github.com/indutny/elliptic/blob/725bd91/lib/elliptic/utils.js#L96 + * + * @return int[] + */ + private static function getJSFPoints(Integer $k1, Integer $k2) + { + static $three; + if (!isset($three)) { + $three = new BigInteger(3); + } + $jsf = [[], []]; + $k1 = $k1->toBigInteger(); + $k2 = $k2->toBigInteger(); + $d1 = 0; + $d2 = 0; + while ($k1->compare(new BigInteger(-$d1)) > 0 || $k2->compare(new BigInteger(-$d2)) > 0) { + // first phase + $m14 = $k1->testBit(0) + 2 * $k1->testBit(1); + $m14 += $d1; + $m14 &= 3; + $m24 = $k2->testBit(0) + 2 * $k2->testBit(1); + $m24 += $d2; + $m24 &= 3; + if ($m14 == 3) { + $m14 = -1; + } + if ($m24 == 3) { + $m24 = -1; + } + $u1 = 0; + if ($m14 & 1) { + // if $m14 is odd + $m8 = $k1->testBit(0) + 2 * $k1->testBit(1) + 4 * $k1->testBit(2); + $m8 += $d1; + $m8 &= 7; + $u1 = ($m8 == 3 || $m8 == 5) && $m24 == 2 ? -$m14 : $m14; + } + $jsf[0][] = $u1; + $u2 = 0; + if ($m24 & 1) { + // if $m24 is odd + $m8 = $k2->testBit(0) + 2 * $k2->testBit(1) + 4 * $k2->testBit(2); + $m8 += $d2; + $m8 &= 7; + $u2 = ($m8 == 3 || $m8 == 5) && $m14 == 2 ? -$m24 : $m24; + } + $jsf[1][] = $u2; + // second phase + if (2 * $d1 == $u1 + 1) { + $d1 = 1 - $d1; + } + if (2 * $d2 == $u2 + 1) { + $d2 = 1 - $d2; + } + $k1 = $k1->bitwise_rightShift(1); + $k2 = $k2->bitwise_rightShift(1); + } + return $jsf; + } + /** + * Returns the affine point + * + * A Jacobian Coordinate is of the form (x, y, z). + * To convert a Jacobian Coordinate to an Affine Point + * you do (x / z^2, y / z^3) + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToAffine(array $p) + { + if (!isset($p[2])) { + return $p; + } + list($x, $y, $z) = $p; + $z = $this->one->divide($z); + $z2 = $z->multiply($z); + return [$x->multiply($z2), $y->multiply($z2)->multiply($z)]; + } + /** + * Converts an affine point to a jacobian coordinate + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToInternal(array $p) + { + if (isset($p[2])) { + return $p; + } + $p[2] = clone $this->one; + $p['fresh'] = \true; + return $p; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php new file mode 100644 index 0000000..6692bc0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php @@ -0,0 +1,190 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField\Integer as PrimeInteger; +/** + * Curves over a*x^2 + y^2 = 1 + d*x^2*y^2 + * + * @author Jim Wigginton + */ +class TwistedEdwards extends Base +{ + /** + * The modulo + * + * @var BigInteger + */ + protected $modulo; + /** + * Cofficient for x^2 + * + * @var object + */ + protected $a; + /** + * Cofficient for x^2*y^2 + * + * @var object + */ + protected $d; + /** + * Base Point + * + * @var object[] + */ + protected $p; + /** + * The number zero over the specified finite field + * + * @var object + */ + protected $zero; + /** + * The number one over the specified finite field + * + * @var object + */ + protected $one; + /** + * The number two over the specified finite field + * + * @var object + */ + protected $two; + /** + * Sets the modulo + */ + public function setModulo(BigInteger $modulo) + { + $this->modulo = $modulo; + $this->factory = new PrimeField($modulo); + $this->zero = $this->factory->newInteger(new BigInteger(0)); + $this->one = $this->factory->newInteger(new BigInteger(1)); + $this->two = $this->factory->newInteger(new BigInteger(2)); + } + /** + * Set coefficients a and b + */ + public function setCoefficients(BigInteger $a, BigInteger $d) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->a = $this->factory->newInteger($a); + $this->d = $this->factory->newInteger($d); + } + /** + * Set x and y coordinates for the base point + */ + public function setBasePoint($x, $y) + { + switch (\true) { + case !$x instanceof BigInteger && !$x instanceof PrimeInteger: + throw new \UnexpectedValueException('Argument 1 passed to Prime::setBasePoint() must be an instance of either BigInteger or PrimeField\\Integer'); + case !$y instanceof BigInteger && !$y instanceof PrimeInteger: + throw new \UnexpectedValueException('Argument 2 passed to Prime::setBasePoint() must be an instance of either BigInteger or PrimeField\\Integer'); + } + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + $this->p = [$x instanceof BigInteger ? $this->factory->newInteger($x) : $x, $y instanceof BigInteger ? $this->factory->newInteger($y) : $y]; + } + /** + * Returns the a coefficient + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function getA() + { + return $this->a; + } + /** + * Returns the a coefficient + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function getD() + { + return $this->d; + } + /** + * Retrieve the base point as an array + * + * @return array + */ + public function getBasePoint() + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + /* + if (!isset($this->p)) { + throw new \RuntimeException('setBasePoint needs to be called before this method'); + } + */ + return $this->p; + } + /** + * Returns the affine point + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToAffine(array $p) + { + if (!isset($p[2])) { + return $p; + } + list($x, $y, $z) = $p; + $z = $this->one->divide($z); + return [$x->multiply($z), $y->multiply($z)]; + } + /** + * Returns the modulo + * + * @return \phpseclib3\Math\BigInteger + */ + public function getModulo() + { + return $this->modulo; + } + /** + * Tests whether or not the x / y values satisfy the equation + * + * @return boolean + */ + public function verifyPoint(array $p) + { + list($x, $y) = $p; + $x2 = $x->multiply($x); + $y2 = $y->multiply($y); + $lhs = $this->a->multiply($x2)->add($y2); + $rhs = $this->d->multiply($x2)->multiply($y2)->add($this->one); + return $lhs->equals($rhs); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve25519.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve25519.php new file mode 100644 index 0000000..acb8412 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve25519.php @@ -0,0 +1,73 @@ + + * @copyright 2019 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class Curve25519 extends Montgomery +{ + public function __construct() + { + // 2^255 - 19 + $this->setModulo(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED', 16)); + $this->a24 = $this->factory->newInteger(new BigInteger('121666')); + $this->p = [$this->factory->newInteger(new BigInteger(9))]; + // 2^252 + 0x14def9dea2f79cd65812631a5cf5d3ed + $this->setOrder(new BigInteger('1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED', 16)); + /* + $this->setCoefficients( + new BigInteger('486662'), // a + ); + $this->setBasePoint( + new BigInteger(9), + new BigInteger('14781619447589544791020593568409986887264606134616475288964881837755586237401') + ); + */ + } + /** + * Multiply a point on the curve by a scalar + * + * Modifies the scalar as described at https://tools.ietf.org/html/rfc7748#page-8 + * + * @return array + */ + public function multiplyPoint(array $p, BigInteger $d) + { + //$r = strrev(sodium_crypto_scalarmult($d->toBytes(), strrev($p[0]->toBytes()))); + //return [$this->factory->newInteger(new BigInteger($r, 256))]; + $d = $d->toBytes(); + $d &= "\xf8" . str_repeat("\xff", 30) . ""; + $d = strrev($d); + $d |= "@"; + $d = new BigInteger($d, -256); + return parent::multiplyPoint($p, $d); + } + /** + * Creates a random scalar multiplier + * + * @return BigInteger + */ + public function createRandomMultiplier() + { + return BigInteger::random(256); + } + /** + * Performs range check + */ + public function rangeCheck(BigInteger $x) + { + if ($x->getLength() > 256 || $x->isNegative()) { + throw new \RangeException('x must be a positive integer less than 256 bytes in length'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve448.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve448.php new file mode 100644 index 0000000..69cae0e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve448.php @@ -0,0 +1,76 @@ + + * @copyright 2019 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class Curve448 extends Montgomery +{ + public function __construct() + { + // 2^448 - 2^224 - 1 + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16)); + $this->a24 = $this->factory->newInteger(new BigInteger('39081')); + $this->p = [$this->factory->newInteger(new BigInteger(5))]; + // 2^446 - 0x8335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d + $this->setOrder(new BigInteger('3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . '7CCA23E9C44EDB49AED63690216CC2728DC58F552378C292AB5844F3', 16)); + /* + $this->setCoefficients( + new BigInteger('156326'), // a + ); + $this->setBasePoint( + new BigInteger(5), + new BigInteger( + '355293926785568175264127502063783334808976399387714271831880898' . + '435169088786967410002932673765864550910142774147268105838985595290' . + '606362') + ); + */ + } + /** + * Multiply a point on the curve by a scalar + * + * Modifies the scalar as described at https://tools.ietf.org/html/rfc7748#page-8 + * + * @return array + */ + public function multiplyPoint(array $p, BigInteger $d) + { + //$r = strrev(sodium_crypto_scalarmult($d->toBytes(), strrev($p[0]->toBytes()))); + //return [$this->factory->newInteger(new BigInteger($r, 256))]; + $d = $d->toBytes(); + $d[0] = $d[0] & "\xfc"; + $d = strrev($d); + $d |= "\x80"; + $d = new BigInteger($d, 256); + return parent::multiplyPoint($p, $d); + } + /** + * Creates a random scalar multiplier + * + * @return BigInteger + */ + public function createRandomMultiplier() + { + return BigInteger::random(446); + } + /** + * Performs range check + */ + public function rangeCheck(BigInteger $x) + { + if ($x->getLength() > 448 || $x->isNegative()) { + throw new \RangeException('x must be a positive integer less than 446 bytes in length'); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed25519.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed25519.php new file mode 100644 index 0000000..d5a6e1b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed25519.php @@ -0,0 +1,295 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class Ed25519 extends TwistedEdwards +{ + const HASH = 'sha512'; + /* + Per https://tools.ietf.org/html/rfc8032#page-6 EdDSA has several parameters, one of which is b: + + 2. An integer b with 2^(b-1) > p. EdDSA public keys have exactly b + bits, and EdDSA signatures have exactly 2*b bits. b is + recommended to be a multiple of 8, so public key and signature + lengths are an integral number of octets. + + SIZE corresponds to b + */ + const SIZE = 32; + public function __construct() + { + // 2^255 - 19 + $this->setModulo(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFED', 16)); + $this->setCoefficients( + // -1 + new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEC', 16), + // a + // -121665/121666 + new BigInteger('52036CEE2B6FFE738CC740797779E89800700A4D4141D8AB75EB4DCA135978A3', 16) + ); + $this->setBasePoint(new BigInteger('216936D3CD6E53FEC0A4E231FDD6DC5C692CC7609525A7B2C9562D608F25D51A', 16), new BigInteger('6666666666666666666666666666666666666666666666666666666666666658', 16)); + $this->setOrder(new BigInteger('1000000000000000000000000000000014DEF9DEA2F79CD65812631A5CF5D3ED', 16)); + // algorithm 14.47 from http://cacr.uwaterloo.ca/hac/about/chap14.pdf#page=16 + /* + $this->setReduction(function($x) { + $parts = $x->bitwise_split(255); + $className = $this->className; + + if (count($parts) > 2) { + list(, $r) = $x->divide($className::$modulo); + return $r; + } + + $zero = new BigInteger(); + $c = new BigInteger(19); + + switch (count($parts)) { + case 2: + list($qi, $ri) = $parts; + break; + case 1: + $qi = $zero; + list($ri) = $parts; + break; + case 0: + return $zero; + } + $r = $ri; + + while ($qi->compare($zero) > 0) { + $temp = $qi->multiply($c)->bitwise_split(255); + if (count($temp) == 2) { + list($qi, $ri) = $temp; + } else { + $qi = $zero; + list($ri) = $temp; + } + $r = $r->add($ri); + } + + while ($r->compare($className::$modulo) > 0) { + $r = $r->subtract($className::$modulo); + } + return $r; + }); + */ + } + /** + * Recover X from Y + * + * Implements steps 2-4 at https://tools.ietf.org/html/rfc8032#section-5.1.3 + * + * Used by EC\Keys\Common.php + * + * @param BigInteger $y + * @param boolean $sign + * @return object[] + */ + public function recoverX(BigInteger $y, $sign) + { + $y = $this->factory->newInteger($y); + $y2 = $y->multiply($y); + $u = $y2->subtract($this->one); + $v = $this->d->multiply($y2)->add($this->one); + $x2 = $u->divide($v); + if ($x2->equals($this->zero)) { + if ($sign) { + throw new \RuntimeException('Unable to recover X coordinate (x2 = 0)'); + } + return clone $this->zero; + } + // find the square root + /* we don't do $x2->squareRoot() because, quoting from + https://tools.ietf.org/html/rfc8032#section-5.1.1: + + "For point decoding or "decompression", square roots modulo p are + needed. They can be computed using the Tonelli-Shanks algorithm or + the special case for p = 5 (mod 8). To find a square root of a, + first compute the candidate root x = a^((p+3)/8) (mod p)." + */ + $exp = $this->getModulo()->add(new BigInteger(3)); + $exp = $exp->bitwise_rightShift(3); + $x = $x2->pow($exp); + // If v x^2 = -u (mod p), set x <-- x * 2^((p-1)/4), which is a square root. + if (!$x->multiply($x)->subtract($x2)->equals($this->zero)) { + $temp = $this->getModulo()->subtract(new BigInteger(1)); + $temp = $temp->bitwise_rightShift(2); + $temp = $this->two->pow($temp); + $x = $x->multiply($temp); + if (!$x->multiply($x)->subtract($x2)->equals($this->zero)) { + throw new \RuntimeException('Unable to recover X coordinate'); + } + } + if ($x->isOdd() != $sign) { + $x = $x->negate(); + } + return [$x, $y]; + } + /** + * Extract Secret Scalar + * + * Implements steps 1-3 at https://tools.ietf.org/html/rfc8032#section-5.1.5 + * + * Used by the various key handlers + * + * @param string $str + * @return array + */ + public function extractSecret($str) + { + if (strlen($str) != 32) { + throw new \LengthException('Private Key should be 32-bytes long'); + } + // 1. Hash the 32-byte private key using SHA-512, storing the digest in + // a 64-octet large buffer, denoted h. Only the lower 32 bytes are + // used for generating the public key. + $hash = new Hash('sha512'); + $h = $hash->hash($str); + $h = substr($h, 0, 32); + // 2. Prune the buffer: The lowest three bits of the first octet are + // cleared, the highest bit of the last octet is cleared, and the + // second highest bit of the last octet is set. + $h[0] = $h[0] & chr(0xf8); + $h = strrev($h); + $h[0] = $h[0] & chr(0x3f) | chr(0x40); + // 3. Interpret the buffer as the little-endian integer, forming a + // secret scalar s. + $dA = new BigInteger($h, 256); + return ['dA' => $dA, 'secret' => $str]; + } + /** + * Encode a point as a string + * + * @param array $point + * @return string + */ + public function encodePoint($point) + { + list($x, $y) = $point; + $y = $y->toBytes(); + $y[0] = $y[0] & chr(0x7f); + if ($x->isOdd()) { + $y[0] = $y[0] | chr(0x80); + } + $y = strrev($y); + return $y; + } + /** + * Creates a random scalar multiplier + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function createRandomMultiplier() + { + return $this->extractSecret(Random::string(32))['dA']; + } + /** + * Converts an affine point to an extended homogeneous coordinate + * + * From https://tools.ietf.org/html/rfc8032#section-5.1.4 : + * + * A point (x,y) is represented in extended homogeneous coordinates (X, Y, Z, T), + * with x = X/Z, y = Y/Z, x * y = T/Z. + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToInternal(array $p) + { + if (empty($p)) { + return [clone $this->zero, clone $this->one, clone $this->one, clone $this->zero]; + } + if (isset($p[2])) { + return $p; + } + $p[2] = clone $this->one; + $p[3] = $p[0]->multiply($p[1]); + return $p; + } + /** + * Doubles a point on a curve + * + * @return FiniteField[] + */ + public function doublePoint(array $p) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p)) { + return []; + } + if (!isset($p[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to "Jacobi" coordinates or vice versa'); + } + // from https://tools.ietf.org/html/rfc8032#page-12 + list($x1, $y1, $z1, $t1) = $p; + $a = $x1->multiply($x1); + $b = $y1->multiply($y1); + $c = $this->two->multiply($z1)->multiply($z1); + $h = $a->add($b); + $temp = $x1->add($y1); + $e = $h->subtract($temp->multiply($temp)); + $g = $a->subtract($b); + $f = $c->add($g); + $x3 = $e->multiply($f); + $y3 = $g->multiply($h); + $t3 = $e->multiply($h); + $z3 = $f->multiply($g); + return [$x3, $y3, $z3, $t3]; + } + /** + * Adds two points on the curve + * + * @return FiniteField[] + */ + public function addPoint(array $p, array $q) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p) || !count($q)) { + if (count($q)) { + return $q; + } + if (count($p)) { + return $p; + } + return []; + } + if (!isset($p[2]) || !isset($q[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to "Jacobi" coordinates or vice versa'); + } + if ($p[0]->equals($q[0])) { + return !$p[1]->equals($q[1]) ? [] : $this->doublePoint($p); + } + // from https://tools.ietf.org/html/rfc8032#page-12 + list($x1, $y1, $z1, $t1) = $p; + list($x2, $y2, $z2, $t2) = $q; + $a = $y1->subtract($x1)->multiply($y2->subtract($x2)); + $b = $y1->add($x1)->multiply($y2->add($x2)); + $c = $t1->multiply($this->two)->multiply($this->d)->multiply($t2); + $d = $z1->multiply($this->two)->multiply($z2); + $e = $b->subtract($a); + $f = $d->subtract($c); + $g = $d->add($c); + $h = $b->add($a); + $x3 = $e->multiply($f); + $y3 = $g->multiply($h); + $t3 = $e->multiply($h); + $z3 = $f->multiply($g); + return [$x3, $y3, $z3, $t3]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed448.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed448.php new file mode 100644 index 0000000..12fd7db --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed448.php @@ -0,0 +1,222 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class Ed448 extends TwistedEdwards +{ + const HASH = 'shake256-912'; + const SIZE = 57; + public function __construct() + { + // 2^448 - 2^224 - 1 + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 16)); + $this->setCoefficients( + new BigInteger(1), + // -39081 + new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6756', 16) + ); + $this->setBasePoint(new BigInteger('4F1970C66BED0DED221D15A622BF36DA9E146570470F1767EA6DE324' . 'A3D3A46412AE1AF72AB66511433B80E18B00938E2626A82BC70CC05E', 16), new BigInteger('693F46716EB6BC248876203756C9C7624BEA73736CA3984087789C1E' . '05A0C2D73AD3FF1CE67C39C4FDBD132C4ED7C8AD9808795BF230FA14', 16)); + $this->setOrder(new BigInteger('3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . '7CCA23E9C44EDB49AED63690216CC2728DC58F552378C292AB5844F3', 16)); + } + /** + * Recover X from Y + * + * Implements steps 2-4 at https://tools.ietf.org/html/rfc8032#section-5.2.3 + * + * Used by EC\Keys\Common.php + * + * @param BigInteger $y + * @param boolean $sign + * @return object[] + */ + public function recoverX(BigInteger $y, $sign) + { + $y = $this->factory->newInteger($y); + $y2 = $y->multiply($y); + $u = $y2->subtract($this->one); + $v = $this->d->multiply($y2)->subtract($this->one); + $x2 = $u->divide($v); + if ($x2->equals($this->zero)) { + if ($sign) { + throw new \RuntimeException('Unable to recover X coordinate (x2 = 0)'); + } + return clone $this->zero; + } + // find the square root + $exp = $this->getModulo()->add(new BigInteger(1)); + $exp = $exp->bitwise_rightShift(2); + $x = $x2->pow($exp); + if (!$x->multiply($x)->subtract($x2)->equals($this->zero)) { + throw new \RuntimeException('Unable to recover X coordinate'); + } + if ($x->isOdd() != $sign) { + $x = $x->negate(); + } + return [$x, $y]; + } + /** + * Extract Secret Scalar + * + * Implements steps 1-3 at https://tools.ietf.org/html/rfc8032#section-5.2.5 + * + * Used by the various key handlers + * + * @param string $str + * @return array + */ + public function extractSecret($str) + { + if (strlen($str) != 57) { + throw new \LengthException('Private Key should be 57-bytes long'); + } + // 1. Hash the 57-byte private key using SHAKE256(x, 114), storing the + // digest in a 114-octet large buffer, denoted h. Only the lower 57 + // bytes are used for generating the public key. + $hash = new Hash('shake256-912'); + $h = $hash->hash($str); + $h = substr($h, 0, 57); + // 2. Prune the buffer: The two least significant bits of the first + // octet are cleared, all eight bits the last octet are cleared, and + // the highest bit of the second to last octet is set. + $h[0] = $h[0] & chr(0xfc); + $h = strrev($h); + $h[0] = "\x00"; + $h[1] = $h[1] | chr(0x80); + // 3. Interpret the buffer as the little-endian integer, forming a + // secret scalar s. + $dA = new BigInteger($h, 256); + return ['dA' => $dA, 'secret' => $str]; + $dA->secret = $str; + return $dA; + } + /** + * Encode a point as a string + * + * @param array $point + * @return string + */ + public function encodePoint($point) + { + list($x, $y) = $point; + $y = "\x00" . $y->toBytes(); + if ($x->isOdd()) { + $y[0] = $y[0] | chr(0x80); + } + $y = strrev($y); + return $y; + } + /** + * Creates a random scalar multiplier + * + * @return \phpseclib3\Math\PrimeField\Integer + */ + public function createRandomMultiplier() + { + return $this->extractSecret(Random::string(57))['dA']; + } + /** + * Converts an affine point to an extended homogeneous coordinate + * + * From https://tools.ietf.org/html/rfc8032#section-5.2.4 : + * + * A point (x,y) is represented in extended homogeneous coordinates (X, Y, Z, T), + * with x = X/Z, y = Y/Z, x * y = T/Z. + * + * @return \phpseclib3\Math\PrimeField\Integer[] + */ + public function convertToInternal(array $p) + { + if (empty($p)) { + return [clone $this->zero, clone $this->one, clone $this->one]; + } + if (isset($p[2])) { + return $p; + } + $p[2] = clone $this->one; + return $p; + } + /** + * Doubles a point on a curve + * + * @return FiniteField[] + */ + public function doublePoint(array $p) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p)) { + return []; + } + if (!isset($p[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to "Jacobi" coordinates or vice versa'); + } + // from https://tools.ietf.org/html/rfc8032#page-18 + list($x1, $y1, $z1) = $p; + $b = $x1->add($y1); + $b = $b->multiply($b); + $c = $x1->multiply($x1); + $d = $y1->multiply($y1); + $e = $c->add($d); + $h = $z1->multiply($z1); + $j = $e->subtract($this->two->multiply($h)); + $x3 = $b->subtract($e)->multiply($j); + $y3 = $c->subtract($d)->multiply($e); + $z3 = $e->multiply($j); + return [$x3, $y3, $z3]; + } + /** + * Adds two points on the curve + * + * @return FiniteField[] + */ + public function addPoint(array $p, array $q) + { + if (!isset($this->factory)) { + throw new \RuntimeException('setModulo needs to be called before this method'); + } + if (!count($p) || !count($q)) { + if (count($q)) { + return $q; + } + if (count($p)) { + return $p; + } + return []; + } + if (!isset($p[2]) || !isset($q[2])) { + throw new \RuntimeException('Affine coordinates need to be manually converted to "Jacobi" coordinates or vice versa'); + } + if ($p[0]->equals($q[0])) { + return !$p[1]->equals($q[1]) ? [] : $this->doublePoint($p); + } + // from https://tools.ietf.org/html/rfc8032#page-17 + list($x1, $y1, $z1) = $p; + list($x2, $y2, $z2) = $q; + $a = $z1->multiply($z2); + $b = $a->multiply($a); + $c = $x1->multiply($x2); + $d = $y1->multiply($y2); + $e = $this->d->multiply($c)->multiply($d); + $f = $b->subtract($e); + $g = $b->add($e); + $h = $x1->add($y1)->multiply($x2->add($y2)); + $x3 = $a->multiply($f)->multiply($h->subtract($c)->subtract($d)); + $y3 = $a->multiply($g)->multiply($d->subtract($c)); + $z3 = $f->multiply($g); + return [$x3, $y3, $z3]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160r1.php new file mode 100644 index 0000000..d9f3654 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP160r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('E95E4A5F737059DC60DFC7AD95B3D8139515620F', 16)); + $this->setCoefficients(new BigInteger('340E7BE2A280EB74E2BE61BADA745D97E8F7C300', 16), new BigInteger('1E589A8595423412134FAA2DBDEC95C8D8675E58', 16)); + $this->setBasePoint(new BigInteger('BED5AF16EA3F6A4F62938C4631EB5AF7BDBCDBC3', 16), new BigInteger('1667CB477A1A8EC338F94741669C976316DA6321', 16)); + $this->setOrder(new BigInteger('E95E4A5F737059DC60DF5991D45029409E60FC09', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160t1.php new file mode 100644 index 0000000..54245e0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160t1.php @@ -0,0 +1,43 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP160t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('E95E4A5F737059DC60DFC7AD95B3D8139515620F', 16)); + $this->setCoefficients( + new BigInteger('E95E4A5F737059DC60DFC7AD95B3D8139515620C', 16), + // eg. -3 + new BigInteger('7A556B6DAE535B7B51ED2C4D7DAA7A0B5C55F380', 16) + ); + $this->setBasePoint(new BigInteger('B199B13B9B34EFC1397E64BAEB05ACC265FF2378', 16), new BigInteger('ADD6718B7C7C1961F0991B842443772152C9E0AD', 16)); + $this->setOrder(new BigInteger('E95E4A5F737059DC60DF5991D45029409E60FC09', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192r1.php new file mode 100644 index 0000000..ee7b125 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP192r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('C302F41D932A36CDA7A3463093D18DB78FCE476DE1A86297', 16)); + $this->setCoefficients(new BigInteger('6A91174076B1E0E19C39C031FE8685C1CAE040E5C69A28EF', 16), new BigInteger('469A28EF7C28CCA3DC721D044F4496BCCA7EF4146FBF25C9', 16)); + $this->setBasePoint(new BigInteger('C0A0647EAAB6A48753B033C56CB0F0900A2F5C4853375FD6', 16), new BigInteger('14B690866ABD5BB88B5F4828C1490002E6773FA2FA299B8F', 16)); + $this->setOrder(new BigInteger('C302F41D932A36CDA7A3462F9E9E916B5BE8F1029AC4ACC1', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192t1.php new file mode 100644 index 0000000..db2bc59 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192t1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP192t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('C302F41D932A36CDA7A3463093D18DB78FCE476DE1A86297', 16)); + $this->setCoefficients( + new BigInteger('C302F41D932A36CDA7A3463093D18DB78FCE476DE1A86294', 16), + // eg. -3 + new BigInteger('13D56FFAEC78681E68F9DEB43B35BEC2FB68542E27897B79', 16) + ); + $this->setBasePoint(new BigInteger('3AE9E58C82F63C30282E1FE7BBF43FA72C446AF6F4618129', 16), new BigInteger('097E2C5667C2223A902AB5CA449D0084B7E5B3DE7CCC01C9', 16)); + $this->setOrder(new BigInteger('C302F41D932A36CDA7A3462F9E9E916B5BE8F1029AC4ACC1', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224r1.php new file mode 100644 index 0000000..ee396bb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP224r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('D7C134AA264366862A18302575D1D787B09F075797DA89F57EC8C0FF', 16)); + $this->setCoefficients(new BigInteger('68A5E62CA9CE6C1C299803A6C1530B514E182AD8B0042A59CAD29F43', 16), new BigInteger('2580F63CCFE44138870713B1A92369E33E2135D266DBB372386C400B', 16)); + $this->setBasePoint(new BigInteger('0D9029AD2C7E5CF4340823B2A87DC68C9E4CE3174C1E6EFDEE12C07D', 16), new BigInteger('58AA56F772C0726F24C6B89E4ECDAC24354B9E99CAA3F6D3761402CD', 16)); + $this->setOrder(new BigInteger('D7C134AA264366862A18302575D0FB98D116BC4B6DDEBCA3A5A7939F', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224t1.php new file mode 100644 index 0000000..b725771 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224t1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP224t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('D7C134AA264366862A18302575D1D787B09F075797DA89F57EC8C0FF', 16)); + $this->setCoefficients( + new BigInteger('D7C134AA264366862A18302575D1D787B09F075797DA89F57EC8C0FC', 16), + // eg. -3 + new BigInteger('4B337D934104CD7BEF271BF60CED1ED20DA14C08B3BB64F18A60888D', 16) + ); + $this->setBasePoint(new BigInteger('6AB1E344CE25FF3896424E7FFE14762ECB49F8928AC0C76029B4D580', 16), new BigInteger('0374E9F5143E568CD23F3F4D7C0D4B1E41C8CC0D1C6ABD5F1A46DB4C', 16)); + $this->setOrder(new BigInteger('D7C134AA264366862A18302575D0FB98D116BC4B6DDEBCA3A5A7939F', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256r1.php new file mode 100644 index 0000000..0abdf5c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP256r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377', 16)); + $this->setCoefficients(new BigInteger('7D5A0975FC2C3057EEF67530417AFFE7FB8055C126DC5C6CE94A4B44F330B5D9', 16), new BigInteger('26DC5C6CE94A4B44F330B5D9BBD77CBF958416295CF7E1CE6BCCDC18FF8C07B6', 16)); + $this->setBasePoint(new BigInteger('8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262', 16), new BigInteger('547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997', 16)); + $this->setOrder(new BigInteger('A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256t1.php new file mode 100644 index 0000000..6db2ea1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256t1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP256t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377', 16)); + $this->setCoefficients( + new BigInteger('A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5374', 16), + // eg. -3 + new BigInteger('662C61C430D84EA4FE66A7733D0B76B7BF93EBC4AF2F49256AE58101FEE92B04', 16) + ); + $this->setBasePoint(new BigInteger('A3E8EB3CC1CFE7B7732213B23A656149AFA142C47AAFBC2B79A191562E1305F4', 16), new BigInteger('2D996C823439C56D7F7B22E14644417E69BCB6DE39D027001DABE8F35B25C9BE', 16)); + $this->setOrder(new BigInteger('A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320r1.php new file mode 100644 index 0000000..406980a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP320r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('D35E472036BC4FB7E13C785ED201E065F98FCFA6F6F40DEF4F9' . '2B9EC7893EC28FCD412B1F1B32E27', 16)); + $this->setCoefficients(new BigInteger('3EE30B568FBAB0F883CCEBD46D3F3BB8A2A73513F5EB79DA66190EB085FFA9F4' . '92F375A97D860EB4', 16), new BigInteger('520883949DFDBC42D3AD198640688A6FE13F41349554B49ACC31DCCD88453981' . '6F5EB4AC8FB1F1A6', 16)); + $this->setBasePoint(new BigInteger('43BD7E9AFB53D8B85289BCC48EE5BFE6F20137D10A087EB6E7871E2A10A599C7' . '10AF8D0D39E20611', 16), new BigInteger('14FDD05545EC1CC8AB4093247F77275E0743FFED117182EAA9C77877AAAC6AC7' . 'D35245D1692E8EE1', 16)); + $this->setOrder(new BigInteger('D35E472036BC4FB7E13C785ED201E065F98FCFA5B68F12A32D4' . '82EC7EE8658E98691555B44C59311', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320t1.php new file mode 100644 index 0000000..31dd78e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320t1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP320t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('D35E472036BC4FB7E13C785ED201E065F98FCFA6F6F40DEF4F9' . '2B9EC7893EC28FCD412B1F1B32E27', 16)); + $this->setCoefficients( + new BigInteger('D35E472036BC4FB7E13C785ED201E065F98FCFA6F6F40DEF4F92B9EC7893EC28' . 'FCD412B1F1B32E24', 16), + // eg. -3 + new BigInteger('A7F561E038EB1ED560B3D147DB782013064C19F27ED27C6780AAF77FB8A547CE' . 'B5B4FEF422340353', 16) + ); + $this->setBasePoint(new BigInteger('925BE9FB01AFC6FB4D3E7D4990010F813408AB106C4F09CB7EE07868CC136FFF' . '3357F624A21BED52', 16), new BigInteger('63BA3A7A27483EBF6671DBEF7ABB30EBEE084E58A0B077AD42A5A0989D1EE71B' . '1B9BC0455FB0D2C3', 16)); + $this->setOrder(new BigInteger('D35E472036BC4FB7E13C785ED201E065F98FCFA5B68F12A32D4' . '82EC7EE8658E98691555B44C59311', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384r1.php new file mode 100644 index 0000000..d655989 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP384r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123ACD3A729901D1A7' . '1874700133107EC53', 16)); + $this->setCoefficients(new BigInteger('7BC382C63D8C150C3C72080ACE05AFA0C2BEA28E4FB22787139165EFBA91F90F8AA5814A503' . 'AD4EB04A8C7DD22CE2826', 16), new BigInteger('4A8C7DD22CE28268B39B55416F0447C2FB77DE107DCD2A62E880EA53EEB62D57CB4390295DB' . 'C9943AB78696FA504C11', 16)); + $this->setBasePoint(new BigInteger('1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D' . '646AAEF87B2E247D4AF1E', 16), new BigInteger('8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E464621779' . '1811142820341263C5315', 16)); + $this->setOrder(new BigInteger('8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B31F166E6CAC0425A7CF3AB6AF6B7FC31' . '03B883202E9046565', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384t1.php new file mode 100644 index 0000000..f751302 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384t1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP384t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123ACD3A729901D1A7' . '1874700133107EC53', 16)); + $this->setCoefficients( + new BigInteger('8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123ACD3A729901' . 'D1A71874700133107EC50', 16), + // eg. -3 + new BigInteger('7F519EADA7BDA81BD826DBA647910F8C4B9346ED8CCDC64E4B1ABD11756DCE1D2074AA263B8' . '8805CED70355A33B471EE', 16) + ); + $this->setBasePoint(new BigInteger('18DE98B02DB9A306F2AFCD7235F72A819B80AB12EBD653172476FECD462AABFFC4FF191B946' . 'A5F54D8D0AA2F418808CC', 16), new BigInteger('25AB056962D30651A114AFD2755AD336747F93475B7A1FCA3B88F2B6A208CCFE469408584DC' . '2B2912675BF5B9E582928', 16)); + $this->setOrder(new BigInteger('8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B31F166E6CAC0425A7CF3AB6AF6B7FC31' . '03B883202E9046565', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512r1.php new file mode 100644 index 0000000..14f3565 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP512r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA703308717D4D9B009BC' . '66842AECDA12AE6A380E62881FF2F2D82C68528AA6056583A48F3', 16)); + $this->setCoefficients(new BigInteger('7830A3318B603B89E2327145AC234CC594CBDD8D3DF91610A83441CAEA9863BC2DED5D5AA82' . '53AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CA', 16), new BigInteger('3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C' . '1AC4D77FC94CADC083E67984050B75EBAE5DD2809BD638016F723', 16)); + $this->setBasePoint(new BigInteger('81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D' . '0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822', 16), new BigInteger('7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5' . 'F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892', 16)); + $this->setOrder(new BigInteger('AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA70330870553E5C414CA' . '92619418661197FAC10471DB1D381085DDADDB58796829CA90069', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512t1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512t1.php new file mode 100644 index 0000000..486b0c7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512t1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class brainpoolP512t1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA703308717D4D9B009BC' . '66842AECDA12AE6A380E62881FF2F2D82C68528AA6056583A48F3', 16)); + $this->setCoefficients( + new BigInteger('AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA703308717D4D9B009BC' . '66842AECDA12AE6A380E62881FF2F2D82C68528AA6056583A48F0', 16), + // eg. -3 + new BigInteger('7CBBBCF9441CFAB76E1890E46884EAE321F70C0BCB4981527897504BEC3E36A62BCDFA23049' . '76540F6450085F2DAE145C22553B465763689180EA2571867423E', 16) + ); + $this->setBasePoint(new BigInteger('640ECE5C12788717B9C1BA06CBC2A6FEBA85842458C56DDE9DB1758D39C0313D82BA51735CD' . 'B3EA499AA77A7D6943A64F7A3F25FE26F06B51BAA2696FA9035DA', 16), new BigInteger('5B534BD595F5AF0FA2C892376C84ACE1BB4E3019B71634C01131159CAE03CEE9D9932184BEE' . 'F216BD71DF2DADF86A627306ECFF96DBB8BACE198B61E00F8B332', 16)); + $this->setOrder(new BigInteger('AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA70330870553E5C414CA' . '92619418661197FAC10471DB1D381085DDADDB58796829CA90069', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb233.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb233.php new file mode 100644 index 0000000..26e7c6a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb233.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistb233 extends sect233r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb409.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb409.php new file mode 100644 index 0000000..8b287a8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb409.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistb409 extends sect409r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk163.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk163.php new file mode 100644 index 0000000..de60039 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk163.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistk163 extends sect163k1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk233.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk233.php new file mode 100644 index 0000000..c83340e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk233.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistk233 extends sect233k1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk283.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk283.php new file mode 100644 index 0000000..203af2a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk283.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistk283 extends sect283k1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk409.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk409.php new file mode 100644 index 0000000..fe1a8c9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk409.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistk409 extends sect409k1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp192.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp192.php new file mode 100644 index 0000000..d7b2644 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp192.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistp192 extends secp192r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp224.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp224.php new file mode 100644 index 0000000..af3a6e7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp224.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistp224 extends secp224r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp256.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp256.php new file mode 100644 index 0000000..141bc71 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp256.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistp256 extends secp256r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp384.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp384.php new file mode 100644 index 0000000..f2c5c1f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp384.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistp384 extends secp384r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp521.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp521.php new file mode 100644 index 0000000..4fe7bc3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp521.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistp521 extends secp521r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistt571.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistt571.php new file mode 100644 index 0000000..b93244b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistt571.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class nistt571 extends sect571k1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v1.php new file mode 100644 index 0000000..ae26172 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v1.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class prime192v1 extends secp192r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v2.php new file mode 100644 index 0000000..a309b80 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v2.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class prime192v2 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC', 16), new BigInteger('CC22D6DFB95C6B25E49C0D6364A4E5980C393AA21668D953', 16)); + $this->setBasePoint(new BigInteger('EEA2BAE7E1497842F2DE7769CFE9C989C072AD696F48034A', 16), new BigInteger('6574D11D69B6EC7A672BB82A083DF2F2B0847DE970B2DE15', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFE5FB1A724DC80418648D8DD31', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v3.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v3.php new file mode 100644 index 0000000..565c564 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v3.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class prime192v3 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC', 16), new BigInteger('22123DC2395A05CAA7423DAECCC94760A7D462256BD56916', 16)); + $this->setBasePoint(new BigInteger('7D29778100C65A1DA1783716588DCE2B8B4AEE8E228F1896', 16), new BigInteger('38A90F22637337334B49DCB66A6DC8F9978ACA7648A943B0', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFF7A62D031C83F4294F640EC13', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v1.php new file mode 100644 index 0000000..7931d80 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class prime239v1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC', 16), new BigInteger('6B016C3BDCF18941D0D654921475CA71A9DB2FB27D1D37796185C2942C0A', 16)); + $this->setBasePoint(new BigInteger('0FFA963CDCA8816CCC33B8642BEDF905C3D358573D3F27FBBD3B3CB9AAAF', 16), new BigInteger('7DEBE8E4E90A5DAE6E4054CA530BA04654B36818CE226B39FCCB7B02F1AE', 16)); + $this->setOrder(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFF9E5E9A9F5D9071FBD1522688909D0B', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v2.php new file mode 100644 index 0000000..782baef --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v2.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class prime239v2 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC', 16), new BigInteger('617FAB6832576CBBFED50D99F0249C3FEE58B94BA0038C7AE84C8C832F2C', 16)); + $this->setBasePoint(new BigInteger('38AF09D98727705120C921BB5E9E26296A3CDCF2F35757A0EAFD87B830E7', 16), new BigInteger('5B0125E4DBEA0EC7206DA0FC01D9B081329FB555DE6EF460237DFF8BE4BA', 16)); + $this->setOrder(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF800000CFA7E8594377D414C03821BC582063', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v3.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v3.php new file mode 100644 index 0000000..d9bec22 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v3.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class prime239v3 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFF8000000000007FFFFFFFFFFC', 16), new BigInteger('255705FA2A306654B1F4CB03D6A750A30C250102D4988717D9BA15AB6D3E', 16)); + $this->setBasePoint(new BigInteger('6768AE8E18BB92CFCF005C949AA2C6D94853D0E660BBF854B1C9505FE95A', 16), new BigInteger('1607E6898F390C06BC1D552BAD226F3B6FCFE48B6E818499AF18E3ED6CF3', 16)); + $this->setOrder(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFF7FFFFF975DEB41B3A6057C3C432146526551', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime256v1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime256v1.php new file mode 100644 index 0000000..6276fb4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime256v1.php @@ -0,0 +1,17 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +final class prime256v1 extends secp256r1 +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r1.php new file mode 100644 index 0000000..08daafe --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp112r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('DB7C2ABF62E35E668076BEAD208B', 16)); + $this->setCoefficients(new BigInteger('DB7C2ABF62E35E668076BEAD2088', 16), new BigInteger('659EF8BA043916EEDE8911702B22', 16)); + $this->setBasePoint(new BigInteger('09487239995A5EE76B55F9C2F098', 16), new BigInteger('A89CE5AF8724C0A23E0E0FF77500', 16)); + $this->setOrder(new BigInteger('DB7C2ABF62E35E7628DFAC6561C5', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r2.php new file mode 100644 index 0000000..a45982c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r2.php @@ -0,0 +1,27 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp112r2 extends Prime +{ + public function __construct() + { + // same modulo as secp112r1 + $this->setModulo(new BigInteger('DB7C2ABF62E35E668076BEAD208B', 16)); + $this->setCoefficients(new BigInteger('6127C24C05F38A0AAAF65C0EF02C', 16), new BigInteger('51DEF1815DB5ED74FCC34C85D709', 16)); + $this->setBasePoint(new BigInteger('4BA30AB5E892B4E1649DD0928643', 16), new BigInteger('ADCD46F5882E3747DEF36E956E97', 16)); + $this->setOrder(new BigInteger('36DF0AAFD8B8D7597CA10520D04B', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r1.php new file mode 100644 index 0000000..009767f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp128r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC', 16), new BigInteger('E87579C11079F43DD824993C2CEE5ED3', 16)); + $this->setBasePoint(new BigInteger('161FF7528B899B2D0C28607CA52C5B86', 16), new BigInteger('CF5AC8395BAFEB13C02DA292DDED7A83', 16)); + $this->setOrder(new BigInteger('FFFFFFFE0000000075A30D1B9038A115', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r2.php new file mode 100644 index 0000000..8a36940 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r2.php @@ -0,0 +1,27 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp128r2 extends Prime +{ + public function __construct() + { + // same as secp128r1 + $this->setModulo(new BigInteger('FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('D6031998D1B3BBFEBF59CC9BBFF9AEE1', 16), new BigInteger('5EEEFCA380D02919DC2C6558BB6D8A5D', 16)); + $this->setBasePoint(new BigInteger('7B6AA5D85E572983E6FB32A7CDEBC140', 16), new BigInteger('27B6916A894D3AEE7106FE805FC34B44', 16)); + $this->setOrder(new BigInteger('3FFFFFFF7FFFFFFFBE0024720613B5A3', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160k1.php new file mode 100644 index 0000000..e39820f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160k1.php @@ -0,0 +1,31 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\KoblitzPrime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp160k1 extends KoblitzPrime +{ + public function __construct() + { + // same as secp160r2 + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73', 16)); + $this->setCoefficients(new BigInteger('0000000000000000000000000000000000000000', 16), new BigInteger('0000000000000000000000000000000000000007', 16)); + $this->setBasePoint(new BigInteger('3B4C382CE37AA192A4019E763036F4F5DD4D7EBB', 16), new BigInteger('938CF935318FDCED6BC28286531733C3F03C4FEE', 16)); + $this->setOrder(new BigInteger('0100000000000000000001B8FA16DFAB9ACA16B6B3', 16)); + $this->basis = []; + $this->basis[] = ['a' => new BigInteger('0096341F1138933BC2F505', -16), 'b' => new BigInteger('FF6E9D0418C67BB8D5F562', -16)]; + $this->basis[] = ['a' => new BigInteger('01BDCB3A09AAAABEAFF4A8', -16), 'b' => new BigInteger('04D12329FF0EF498EA67', -16)]; + $this->beta = $this->factory->newInteger(new BigInteger('645B7345A143464942CC46D7CF4D5D1E1E6CBB68', -16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r1.php new file mode 100644 index 0000000..9900a25 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp160r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC', 16), new BigInteger('1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45', 16)); + $this->setBasePoint(new BigInteger('4A96B5688EF573284664698968C38BB913CBFC82', 16), new BigInteger('23A628553168947D59DCC912042351377AC5FB32', 16)); + $this->setOrder(new BigInteger('0100000000000000000001F4C8F927AED3CA752257', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r2.php new file mode 100644 index 0000000..34e47fd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r2.php @@ -0,0 +1,27 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp160r2 extends Prime +{ + public function __construct() + { + // same as secp160k1 + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC70', 16), new BigInteger('B4E134D3FB59EB8BAB57274904664D5AF50388BA', 16)); + $this->setBasePoint(new BigInteger('52DCB034293A117E1F4FF11B30F7199D3144CE6D', 16), new BigInteger('FEAFFEF2E331F296E071FA0DF9982CFEA7D43F2E', 16)); + $this->setOrder(new BigInteger('0100000000000000000000351EE786A818F3A1A16B', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192k1.php new file mode 100644 index 0000000..a570a9e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192k1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\KoblitzPrime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp192k1 extends KoblitzPrime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37', 16)); + $this->setCoefficients(new BigInteger('000000000000000000000000000000000000000000000000', 16), new BigInteger('000000000000000000000000000000000000000000000003', 16)); + $this->setBasePoint(new BigInteger('DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D', 16), new BigInteger('9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D', 16)); + $this->basis = []; + $this->basis[] = ['a' => new BigInteger('00B3FB3400DEC5C4ADCEB8655C', -16), 'b' => new BigInteger('8EE96418CCF4CFC7124FDA0F', -16)]; + $this->basis[] = ['a' => new BigInteger('01D90D03E8F096B9948B20F0A9', -16), 'b' => new BigInteger('42E49819ABBA9474E1083F6B', -16)]; + $this->beta = $this->factory->newInteger(new BigInteger('447A96E6C647963E2F7809FEAAB46947F34B0AA3CA0BBA74', -16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192r1.php new file mode 100644 index 0000000..5ac3768 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192r1.php @@ -0,0 +1,68 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp192r1 extends Prime +{ + public function __construct() + { + $modulo = new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF', 16); + $this->setModulo($modulo); + // algorithm 2.27 from http://diamond.boisestate.edu/~liljanab/MATH308/GuideToECC.pdf#page=66 + /* in theory this should be faster than regular modular reductions save for one small issue. + to convert to / from base-2**8 with BCMath you have to call bcmul() and bcdiv() a lot. + to convert to / from base-2**8 with PHP64 you have to call base256_rshift() a lot. + in short, converting to / from base-2**8 is pretty expensive and that expense is + enough to offset whatever else might be gained by a simplified reduction algorithm. + now, if PHP supported unsigned integers things might be different. no bit-shifting + would be required for the PHP engine and it'd be a lot faster. but as is, BigInteger + uses base-2**31 or base-2**26 depending on whether or not the system is has a 32-bit + or a 64-bit OS. + */ + /* + $m_length = $this->getLengthInBytes(); + $this->setReduction(function($c) use ($m_length) { + $cBytes = $c->toBytes(); + $className = $this->className; + + if (strlen($cBytes) > 2 * $m_length) { + list(, $r) = $c->divide($className::$modulo); + return $r; + } + + $c = str_pad($cBytes, 48, "\0", STR_PAD_LEFT); + $c = array_reverse(str_split($c, 8)); + + $null = "\0\0\0\0\0\0\0\0"; + $s1 = new BigInteger($c[2] . $c[1] . $c[0], 256); + $s2 = new BigInteger($null . $c[3] . $c[3], 256); + $s3 = new BigInteger($c[4] . $c[4] . $null, 256); + $s4 = new BigInteger($c[5] . $c[5] . $c[5], 256); + + $r = $s1->add($s2)->add($s3)->add($s4); + while ($r->compare($className::$modulo) >= 0) { + $r = $r->subtract($className::$modulo); + } + + return $r; + }); + */ + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC', 16), new BigInteger('64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1', 16)); + $this->setBasePoint(new BigInteger('188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012', 16), new BigInteger('07192B95FFC8DA78631011ED6B24CDD573F977A11E794811', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224k1.php new file mode 100644 index 0000000..4600e15 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224k1.php @@ -0,0 +1,30 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\KoblitzPrime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp224k1 extends KoblitzPrime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D', 16)); + $this->setCoefficients(new BigInteger('00000000000000000000000000000000000000000000000000000000', 16), new BigInteger('00000000000000000000000000000000000000000000000000000005', 16)); + $this->setBasePoint(new BigInteger('A1455B334DF099DF30FC28A169A467E9E47075A90F7E650EB6B7A45C', 16), new BigInteger('7E089FED7FBA344282CAFBD6F7E319F7C0B0BD59E2CA4BDB556D61A5', 16)); + $this->setOrder(new BigInteger('010000000000000000000000000001DCE8D2EC6184CAF0A971769FB1F7', 16)); + $this->basis = []; + $this->basis[] = ['a' => new BigInteger('00B8ADF1378A6EB73409FA6C9C637D', -16), 'b' => new BigInteger('94730F82B358A3776A826298FA6F', -16)]; + $this->basis[] = ['a' => new BigInteger('01DCE8D2EC6184CAF0A972769FCC8B', -16), 'b' => new BigInteger('4D2100BA3DC75AAB747CCF355DEC', -16)]; + $this->beta = $this->factory->newInteger(new BigInteger('01F178FFA4B17C89E6F73AECE2AAD57AF4C0A748B63C830947B27E04', -16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224r1.php new file mode 100644 index 0000000..1f893f0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp224r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE', 16), new BigInteger('B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4', 16)); + $this->setBasePoint(new BigInteger('B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21', 16), new BigInteger('BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256k1.php new file mode 100644 index 0000000..e5db4f5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256k1.php @@ -0,0 +1,34 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +//use phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\KoblitzPrime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +//class secp256k1 extends Prime +class secp256k1 extends KoblitzPrime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F', 16)); + $this->setCoefficients(new BigInteger('0000000000000000000000000000000000000000000000000000000000000000', 16), new BigInteger('0000000000000000000000000000000000000000000000000000000000000007', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141', 16)); + $this->setBasePoint(new BigInteger('79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798', 16), new BigInteger('483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8', 16)); + $this->basis = []; + $this->basis[] = ['a' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16), 'b' => new BigInteger('FF1BBC8129FEF177D790AB8056F5401B3D', -16)]; + $this->basis[] = ['a' => new BigInteger('114CA50F7A8E2F3F657C1108D9D44CFD8', -16), 'b' => new BigInteger('3086D221A7D46BCDE86C90E49284EB15', -16)]; + $this->beta = $this->factory->newInteger(new BigInteger('7AE96A2B657C07106E64479EAC3434E99CF0497512F58995C1396C28719501EE', -16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256r1.php new file mode 100644 index 0000000..25d4028 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp256r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC', 16), new BigInteger('5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B', 16)); + $this->setBasePoint(new BigInteger('6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296', 16), new BigInteger('4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5', 16)); + $this->setOrder(new BigInteger('FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp384r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp384r1.php new file mode 100644 index 0000000..ccaa78e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp384r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp384r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF', 16)); + $this->setCoefficients(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC', 16), new BigInteger('B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF', 16)); + $this->setBasePoint(new BigInteger('AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7', 16), new BigInteger('3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A147CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F', 16)); + $this->setOrder(new BigInteger('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp521r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp521r1.php new file mode 100644 index 0000000..2bbe080 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp521r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class secp521r1 extends Prime +{ + public function __construct() + { + $this->setModulo(new BigInteger('01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFF', 16)); + $this->setCoefficients(new BigInteger('01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFC', 16), new BigInteger('0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF1' . '09E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B50' . '3F00', 16)); + $this->setBasePoint(new BigInteger('00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D' . '3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5' . 'BD66', 16), new BigInteger('011839296A789A3BC0045C8A5FB42C7D1BD998F54449579B446817AFBD17273E' . '662C97EE72995EF42640C550B9013FAD0761353C7086A272C24088BE94769FD1' . '6650', 16)); + $this->setOrder(new BigInteger('01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'FFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E9138' . '6409', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r1.php new file mode 100644 index 0000000..a18b09c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect113r1 extends Binary +{ + public function __construct() + { + $this->setModulo(113, 9, 0); + $this->setCoefficients('003088250CA6E7C7FE649CE85820F7', '00E8BEE4D3E2260744188BE0E9C723'); + $this->setBasePoint('009D73616F35F4AB1407D73562C10F', '00A52830277958EE84D1315ED31886'); + $this->setOrder(new BigInteger('0100000000000000D9CCEC8A39E56F', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r2.php new file mode 100644 index 0000000..138ad6b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r2.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect113r2 extends Binary +{ + public function __construct() + { + $this->setModulo(113, 9, 0); + $this->setCoefficients('00689918DBEC7E5A0DD6DFC0AA55C7', '0095E9A9EC9B297BD4BF36E059184F'); + $this->setBasePoint('01A57A6A7B26CA5EF52FCDB8164797', '00B3ADC94ED1FE674C06E695BABA1D'); + $this->setOrder(new BigInteger('010000000000000108789B2496AF93', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r1.php new file mode 100644 index 0000000..2370c8a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect131r1 extends Binary +{ + public function __construct() + { + $this->setModulo(131, 8, 3, 2, 0); + $this->setCoefficients('07A11B09A76B562144418FF3FF8C2570B8', '0217C05610884B63B9C6C7291678F9D341'); + $this->setBasePoint('0081BAF91FDF9833C40F9C181343638399', '078C6E7EA38C001F73C8134B1B4EF9E150'); + $this->setOrder(new BigInteger('0400000000000000023123953A9464B54D', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r2.php new file mode 100644 index 0000000..29d0851 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r2.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect131r2 extends Binary +{ + public function __construct() + { + $this->setModulo(131, 8, 3, 2, 0); + $this->setCoefficients('03E5A88919D7CAFCBF415F07C2176573B2', '04B8266A46C55657AC734CE38F018F2192'); + $this->setBasePoint('0356DCD8F2F95031AD652D23951BB366A8', '0648F06D867940A5366D9E265DE9EB240F'); + $this->setOrder(new BigInteger('0400000000000000016954A233049BA98F', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163k1.php new file mode 100644 index 0000000..0637dac --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163k1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect163k1 extends Binary +{ + public function __construct() + { + $this->setModulo(163, 7, 6, 3, 0); + $this->setCoefficients('000000000000000000000000000000000000000001', '000000000000000000000000000000000000000001'); + $this->setBasePoint('02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8', '0289070FB05D38FF58321F2E800536D538CCDAA3D9'); + $this->setOrder(new BigInteger('04000000000000000000020108A2E0CC0D99F8A5EF', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r1.php new file mode 100644 index 0000000..5be6ecb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect163r1 extends Binary +{ + public function __construct() + { + $this->setModulo(163, 7, 6, 3, 0); + $this->setCoefficients('07B6882CAAEFA84F9554FF8428BD88E246D2782AE2', '0713612DCDDCB40AAB946BDA29CA91F73AF958AFD9'); + $this->setBasePoint('0369979697AB43897789566789567F787A7876A654', '00435EDB42EFAFB2989D51FEFCE3C80988F41FF883'); + $this->setOrder(new BigInteger('03FFFFFFFFFFFFFFFFFFFF48AAB689C29CA710279B', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r2.php new file mode 100644 index 0000000..d10ef32 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r2.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect163r2 extends Binary +{ + public function __construct() + { + $this->setModulo(163, 7, 6, 3, 0); + $this->setCoefficients('000000000000000000000000000000000000000001', '020A601907B8C953CA1481EB10512F78744A3205FD'); + $this->setBasePoint('03F0EBA16286A2D57EA0991168D4994637E8343E36', '00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1'); + $this->setOrder(new BigInteger('040000000000000000000292FE77E70C12A4234C33', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r1.php new file mode 100644 index 0000000..b6d5c17 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect193r1 extends Binary +{ + public function __construct() + { + $this->setModulo(193, 15, 0); + $this->setCoefficients('0017858FEB7A98975169E171F77B4087DE098AC8A911DF7B01', '00FDFB49BFE6C3A89FACADAA7A1E5BBC7CC1C2E5D831478814'); + $this->setBasePoint('01F481BC5F0FF84A74AD6CDF6FDEF4BF6179625372D8C0C5E1', '0025E399F2903712CCF3EA9E3A1AD17FB0B3201B6AF7CE1B05'); + $this->setOrder(new BigInteger('01000000000000000000000000C7F34A778F443ACC920EBA49', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r2.php new file mode 100644 index 0000000..82157ea --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r2.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect193r2 extends Binary +{ + public function __construct() + { + $this->setModulo(193, 15, 0); + $this->setCoefficients('0163F35A5137C2CE3EA6ED8667190B0BC43ECD69977702709B', '00C9BB9E8927D4D64C377E2AB2856A5B16E3EFB7F61D4316AE'); + $this->setBasePoint('00D9B67D192E0367C803F39E1A7E82CA14A651350AAE617E8F', '01CE94335607C304AC29E7DEFBD9CA01F596F927224CDECF6C'); + $this->setOrder(new BigInteger('010000000000000000000000015AAB561B005413CCD4EE99D5', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233k1.php new file mode 100644 index 0000000..85a2b65 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233k1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect233k1 extends Binary +{ + public function __construct() + { + $this->setModulo(233, 74, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000000', '000000000000000000000000000000000000000000000000000000000001'); + $this->setBasePoint('017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126', '01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3'); + $this->setOrder(new BigInteger('8000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233r1.php new file mode 100644 index 0000000..ff3a77d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect233r1 extends Binary +{ + public function __construct() + { + $this->setModulo(233, 74, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000001', '0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD'); + $this->setBasePoint('00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B', '01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052'); + $this->setOrder(new BigInteger('01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect239k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect239k1.php new file mode 100644 index 0000000..adcf1fa --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect239k1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect239k1 extends Binary +{ + public function __construct() + { + $this->setModulo(239, 158, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000000', '000000000000000000000000000000000000000000000000000000000001'); + $this->setBasePoint('29A0B6A887A983E9730988A68727A8B2D126C44CC2CC7B2A6555193035DC', '76310804F12E549BDB011C103089E73510ACB275FC312A5DC6B76553F0CA'); + $this->setOrder(new BigInteger('2000000000000000000000000000005A79FEC67CB6E91F1C1DA800E478A5', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283k1.php new file mode 100644 index 0000000..14124d1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283k1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect283k1 extends Binary +{ + public function __construct() + { + $this->setModulo(283, 12, 7, 5, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000000000000000000', '000000000000000000000000000000000000000000000000000000000000000000000001'); + $this->setBasePoint('0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836', '01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259'); + $this->setOrder(new BigInteger('01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283r1.php new file mode 100644 index 0000000..af3e526 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect283r1 extends Binary +{ + public function __construct() + { + $this->setModulo(283, 12, 7, 5, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000000000000000001', '027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5'); + $this->setBasePoint('05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053', '03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4'); + $this->setOrder(new BigInteger('03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409k1.php new file mode 100644 index 0000000..5cc74e0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409k1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect409k1 extends Binary +{ + public function __construct() + { + $this->setModulo(409, 87, 0); + $this->setCoefficients('00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'); + $this->setBasePoint('0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746', '01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B'); + $this->setOrder(new BigInteger('7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F' . '83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409r1.php new file mode 100644 index 0000000..e5dedd5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect409r1 extends Binary +{ + public function __construct() + { + $this->setModulo(409, 87, 0); + $this->setCoefficients('00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001', '0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F'); + $this->setBasePoint('015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7', '0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706'); + $this->setOrder(new BigInteger('010000000000000000000000000000000000000000000000000001E2' . 'AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571k1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571k1.php new file mode 100644 index 0000000..2e82ab7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571k1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect571k1 extends Binary +{ + public function __construct() + { + $this->setModulo(571, 10, 5, 2, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000000000000000000' . '000000000000000000000000000000000000000000000000000000000000000000000000', '000000000000000000000000000000000000000000000000000000000000000000000000' . '000000000000000000000000000000000000000000000000000000000000000000000001'); + $this->setBasePoint('026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA443709584' . '93B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972', '0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0' . 'AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3'); + $this->setOrder(new BigInteger('020000000000000000000000000000000000000000000000000000000000000000000000' . '131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571r1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571r1.php new file mode 100644 index 0000000..5e70c54 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571r1.php @@ -0,0 +1,26 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +class sect571r1 extends Binary +{ + public function __construct() + { + $this->setModulo(571, 10, 5, 2, 0); + $this->setCoefficients('000000000000000000000000000000000000000000000000000000000000000000000000' . '000000000000000000000000000000000000000000000000000000000000000000000001', '02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD' . '8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A'); + $this->setBasePoint('0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950' . 'F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19', '037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43' . 'BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B'); + $this->setOrder(new BigInteger('03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' . 'E661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47', 16)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/Common.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/Common.php new file mode 100644 index 0000000..c3fe53c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/Common.php @@ -0,0 +1,489 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Binary as BinaryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime as PrimeCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Generic EC Key Parsing Helper functions + * + * @author Jim Wigginton + */ +trait Common +{ + /** + * Curve OIDs + * + * @var array + */ + private static $curveOIDs = []; + /** + * Child OIDs loaded + * + * @var bool + */ + protected static $childOIDsLoaded = \false; + /** + * Use Named Curves + * + * @var bool + */ + private static $useNamedCurves = \true; + /** + * Initialize static variables + */ + private static function initialize_static_variables() + { + if (empty(self::$curveOIDs)) { + // the sec* curves are from the standards for efficient cryptography group + // sect* curves are curves over binary finite fields + // secp* curves are curves over prime finite fields + // sec*r* curves are regular curves; sec*k* curves are koblitz curves + // brainpool*r* curves are regular prime finite field curves + // brainpool*t* curves are twisted versions of the brainpool*r* curves + self::$curveOIDs = [ + 'prime192v1' => '1.2.840.10045.3.1.1', + // J.5.1, example 1 (aka secp192r1) + 'prime192v2' => '1.2.840.10045.3.1.2', + // J.5.1, example 2 + 'prime192v3' => '1.2.840.10045.3.1.3', + // J.5.1, example 3 + 'prime239v1' => '1.2.840.10045.3.1.4', + // J.5.2, example 1 + 'prime239v2' => '1.2.840.10045.3.1.5', + // J.5.2, example 2 + 'prime239v3' => '1.2.840.10045.3.1.6', + // J.5.2, example 3 + 'prime256v1' => '1.2.840.10045.3.1.7', + // J.5.3, example 1 (aka secp256r1) + // https://tools.ietf.org/html/rfc5656#section-10 + 'nistp256' => '1.2.840.10045.3.1.7', + // aka secp256r1 + 'nistp384' => '1.3.132.0.34', + // aka secp384r1 + 'nistp521' => '1.3.132.0.35', + // aka secp521r1 + 'nistk163' => '1.3.132.0.1', + // aka sect163k1 + 'nistp192' => '1.2.840.10045.3.1.1', + // aka secp192r1 + 'nistp224' => '1.3.132.0.33', + // aka secp224r1 + 'nistk233' => '1.3.132.0.26', + // aka sect233k1 + 'nistb233' => '1.3.132.0.27', + // aka sect233r1 + 'nistk283' => '1.3.132.0.16', + // aka sect283k1 + 'nistk409' => '1.3.132.0.36', + // aka sect409k1 + 'nistb409' => '1.3.132.0.37', + // aka sect409r1 + 'nistt571' => '1.3.132.0.38', + // aka sect571k1 + // from https://tools.ietf.org/html/rfc5915 + 'secp192r1' => '1.2.840.10045.3.1.1', + // aka prime192v1 + 'sect163k1' => '1.3.132.0.1', + 'sect163r2' => '1.3.132.0.15', + 'secp224r1' => '1.3.132.0.33', + 'sect233k1' => '1.3.132.0.26', + 'sect233r1' => '1.3.132.0.27', + 'secp256r1' => '1.2.840.10045.3.1.7', + // aka prime256v1 + 'sect283k1' => '1.3.132.0.16', + 'sect283r1' => '1.3.132.0.17', + 'secp384r1' => '1.3.132.0.34', + 'sect409k1' => '1.3.132.0.36', + 'sect409r1' => '1.3.132.0.37', + 'secp521r1' => '1.3.132.0.35', + 'sect571k1' => '1.3.132.0.38', + 'sect571r1' => '1.3.132.0.39', + // from http://www.secg.org/SEC2-Ver-1.0.pdf + 'secp112r1' => '1.3.132.0.6', + 'secp112r2' => '1.3.132.0.7', + 'secp128r1' => '1.3.132.0.28', + 'secp128r2' => '1.3.132.0.29', + 'secp160k1' => '1.3.132.0.9', + 'secp160r1' => '1.3.132.0.8', + 'secp160r2' => '1.3.132.0.30', + 'secp192k1' => '1.3.132.0.31', + 'secp224k1' => '1.3.132.0.32', + 'secp256k1' => '1.3.132.0.10', + 'sect113r1' => '1.3.132.0.4', + 'sect113r2' => '1.3.132.0.5', + 'sect131r1' => '1.3.132.0.22', + 'sect131r2' => '1.3.132.0.23', + 'sect163r1' => '1.3.132.0.2', + 'sect193r1' => '1.3.132.0.24', + 'sect193r2' => '1.3.132.0.25', + 'sect239k1' => '1.3.132.0.3', + // from http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.202.2977&rep=rep1&type=pdf#page=36 + /* + 'c2pnb163v1' => '1.2.840.10045.3.0.1', // J.4.1, example 1 + 'c2pnb163v2' => '1.2.840.10045.3.0.2', // J.4.1, example 2 + 'c2pnb163v3' => '1.2.840.10045.3.0.3', // J.4.1, example 3 + 'c2pnb172w1' => '1.2.840.10045.3.0.4', // J.4.2, example 1 + 'c2tnb191v1' => '1.2.840.10045.3.0.5', // J.4.3, example 1 + 'c2tnb191v2' => '1.2.840.10045.3.0.6', // J.4.3, example 2 + 'c2tnb191v3' => '1.2.840.10045.3.0.7', // J.4.3, example 3 + 'c2onb191v4' => '1.2.840.10045.3.0.8', // J.4.3, example 4 + 'c2onb191v5' => '1.2.840.10045.3.0.9', // J.4.3, example 5 + 'c2pnb208w1' => '1.2.840.10045.3.0.10', // J.4.4, example 1 + 'c2tnb239v1' => '1.2.840.10045.3.0.11', // J.4.5, example 1 + 'c2tnb239v2' => '1.2.840.10045.3.0.12', // J.4.5, example 2 + 'c2tnb239v3' => '1.2.840.10045.3.0.13', // J.4.5, example 3 + 'c2onb239v4' => '1.2.840.10045.3.0.14', // J.4.5, example 4 + 'c2onb239v5' => '1.2.840.10045.3.0.15', // J.4.5, example 5 + 'c2pnb272w1' => '1.2.840.10045.3.0.16', // J.4.6, example 1 + 'c2pnb304w1' => '1.2.840.10045.3.0.17', // J.4.7, example 1 + 'c2tnb359v1' => '1.2.840.10045.3.0.18', // J.4.8, example 1 + 'c2pnb368w1' => '1.2.840.10045.3.0.19', // J.4.9, example 1 + 'c2tnb431r1' => '1.2.840.10045.3.0.20', // J.4.10, example 1 + */ + // http://www.ecc-brainpool.org/download/Domain-parameters.pdf + // https://tools.ietf.org/html/rfc5639 + 'brainpoolP160r1' => '1.3.36.3.3.2.8.1.1.1', + 'brainpoolP160t1' => '1.3.36.3.3.2.8.1.1.2', + 'brainpoolP192r1' => '1.3.36.3.3.2.8.1.1.3', + 'brainpoolP192t1' => '1.3.36.3.3.2.8.1.1.4', + 'brainpoolP224r1' => '1.3.36.3.3.2.8.1.1.5', + 'brainpoolP224t1' => '1.3.36.3.3.2.8.1.1.6', + 'brainpoolP256r1' => '1.3.36.3.3.2.8.1.1.7', + 'brainpoolP256t1' => '1.3.36.3.3.2.8.1.1.8', + 'brainpoolP320r1' => '1.3.36.3.3.2.8.1.1.9', + 'brainpoolP320t1' => '1.3.36.3.3.2.8.1.1.10', + 'brainpoolP384r1' => '1.3.36.3.3.2.8.1.1.11', + 'brainpoolP384t1' => '1.3.36.3.3.2.8.1.1.12', + 'brainpoolP512r1' => '1.3.36.3.3.2.8.1.1.13', + 'brainpoolP512t1' => '1.3.36.3.3.2.8.1.1.14', + ]; + ASN1::loadOIDs([ + 'prime-field' => '1.2.840.10045.1.1', + 'characteristic-two-field' => '1.2.840.10045.1.2', + 'characteristic-two-basis' => '1.2.840.10045.1.2.3', + // per http://www.secg.org/SEC1-Ver-1.0.pdf#page=84, gnBasis "not used here" + 'gnBasis' => '1.2.840.10045.1.2.3.1', + // NULL + 'tpBasis' => '1.2.840.10045.1.2.3.2', + // Trinomial + 'ppBasis' => '1.2.840.10045.1.2.3.3', + ] + self::$curveOIDs); + } + } + /** + * Explicitly set the curve + * + * If the key contains an implicit curve phpseclib needs the curve + * to be explicitly provided + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + */ + public static function setImplicitCurve(BaseCurve $curve) + { + self::$implicitCurve = $curve; + } + /** + * Returns an instance of \phpseclib3\Crypt\EC\BaseCurves\Base based + * on the curve parameters + * + * @param array $params + * @return \phpseclib3\Crypt\EC\BaseCurves\Base|false + */ + protected static function loadCurveByParam(array $params) + { + if (count($params) > 1) { + throw new \RuntimeException('No parameters are present'); + } + if (isset($params['namedCurve'])) { + $curve = '\\phpseclib3\\Crypt\\EC\\Curves\\' . $params['namedCurve']; + if (!class_exists($curve)) { + throw new UnsupportedCurveException('Named Curve of ' . $params['namedCurve'] . ' is not supported'); + } + return new $curve(); + } + if (isset($params['implicitCurve'])) { + if (!isset(self::$implicitCurve)) { + throw new \RuntimeException('Implicit curves can be provided by calling setImplicitCurve'); + } + return self::$implicitCurve; + } + if (isset($params['specifiedCurve'])) { + $data = $params['specifiedCurve']; + switch ($data['fieldID']['fieldType']) { + case 'prime-field': + $curve = new PrimeCurve(); + $curve->setModulo($data['fieldID']['parameters']); + $curve->setCoefficients(new BigInteger($data['curve']['a'], 256), new BigInteger($data['curve']['b'], 256)); + $point = self::extractPoint("\x00" . $data['base'], $curve); + $curve->setBasePoint(...$point); + $curve->setOrder($data['order']); + return $curve; + case 'characteristic-two-field': + $curve = new BinaryCurve(); + $params = ASN1::decodeBER($data['fieldID']['parameters']); + $params = ASN1::asn1map($params[0], Maps\Characteristic_two::MAP); + $modulo = [(int) $params['m']->toString()]; + switch ($params['basis']) { + case 'tpBasis': + $modulo[] = (int) $params['parameters']->toString(); + break; + case 'ppBasis': + $temp = ASN1::decodeBER($params['parameters']); + $temp = ASN1::asn1map($temp[0], Maps\Pentanomial::MAP); + $modulo[] = (int) $temp['k3']->toString(); + $modulo[] = (int) $temp['k2']->toString(); + $modulo[] = (int) $temp['k1']->toString(); + } + $modulo[] = 0; + $curve->setModulo(...$modulo); + $len = ceil($modulo[0] / 8); + $curve->setCoefficients(Strings::bin2hex($data['curve']['a']), Strings::bin2hex($data['curve']['b'])); + $point = self::extractPoint("\x00" . $data['base'], $curve); + $curve->setBasePoint(...$point); + $curve->setOrder($data['order']); + return $curve; + default: + throw new UnsupportedCurveException('Field Type of ' . $data['fieldID']['fieldType'] . ' is not supported'); + } + } + throw new \RuntimeException('No valid parameters are present'); + } + /** + * Extract points from a string + * + * Supports both compressed and uncompressed points + * + * @param string $str + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @return object[] + */ + public static function extractPoint($str, BaseCurve $curve) + { + if ($curve instanceof TwistedEdwardsCurve) { + // first step of point deciding as discussed at the following URL's: + // https://tools.ietf.org/html/rfc8032#section-5.1.3 + // https://tools.ietf.org/html/rfc8032#section-5.2.3 + $y = $str; + $y = strrev($y); + $sign = (bool) (ord($y[0]) & 0x80); + $y[0] = $y[0] & chr(0x7f); + $y = new BigInteger($y, 256); + if ($y->compare($curve->getModulo()) >= 0) { + throw new \RuntimeException('The Y coordinate should not be >= the modulo'); + } + $point = $curve->recoverX($y, $sign); + if (!$curve->verifyPoint($point)) { + throw new \RuntimeException('Unable to verify that point exists on curve'); + } + return $point; + } + // the first byte of a bit string represents the number of bits in the last byte that are to be ignored but, + // currently, bit strings wanting a non-zero amount of bits trimmed are not supported + if (($val = Strings::shift($str)) != "\x00") { + throw new \UnexpectedValueException('extractPoint expects the first byte to be null - not ' . Strings::bin2hex($val)); + } + if ($str == "\x00") { + return []; + } + $keylen = strlen($str); + $order = $curve->getLengthInBytes(); + // point compression is being used + if ($keylen == $order + 1) { + return $curve->derivePoint($str); + } + // point compression is not being used + if ($keylen == 2 * $order + 1) { + preg_match("#(.)(.{{$order}})(.{{$order}})#s", $str, $matches); + list(, $w, $x, $y) = $matches; + if ($w != "\x04") { + throw new \UnexpectedValueException('The first byte of an uncompressed point should be 04 - not ' . Strings::bin2hex($val)); + } + $point = [$curve->convertInteger(new BigInteger($x, 256)), $curve->convertInteger(new BigInteger($y, 256))]; + if (!$curve->verifyPoint($point)) { + throw new \RuntimeException('Unable to verify that point exists on curve'); + } + return $point; + } + throw new \UnexpectedValueException('The string representation of the points is not of an appropriate length'); + } + /** + * Encode Parameters + * + * @todo Maybe at some point this could be moved to __toString() for each of the curves? + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param bool $returnArray optional + * @param array $options optional + * @return string|false + */ + private static function encodeParameters(BaseCurve $curve, $returnArray = \false, array $options = []) + { + $useNamedCurves = isset($options['namedCurve']) ? $options['namedCurve'] : self::$useNamedCurves; + $reflect = new \ReflectionClass($curve); + $name = $reflect->getShortName(); + if ($useNamedCurves) { + if (isset(self::$curveOIDs[$name])) { + if ($reflect->isFinal()) { + $reflect = $reflect->getParentClass(); + $name = $reflect->getShortName(); + } + return $returnArray ? ['namedCurve' => $name] : ASN1::encodeDER(['namedCurve' => $name], Maps\ECParameters::MAP); + } + foreach (new \DirectoryIterator(__DIR__ . '/../../Curves/') as $file) { + if ($file->getExtension() != 'php') { + continue; + } + $testName = $file->getBasename('.php'); + $class = 'phpseclib3\\Crypt\\EC\\Curves\\' . $testName; + $reflect = new \ReflectionClass($class); + if ($reflect->isFinal()) { + continue; + } + $candidate = new $class(); + switch ($name) { + case 'Prime': + if (!$candidate instanceof PrimeCurve) { + break; + } + if (!$candidate->getModulo()->equals($curve->getModulo())) { + break; + } + if ($candidate->getA()->toBytes() != $curve->getA()->toBytes()) { + break; + } + if ($candidate->getB()->toBytes() != $curve->getB()->toBytes()) { + break; + } + list($candidateX, $candidateY) = $candidate->getBasePoint(); + list($curveX, $curveY) = $curve->getBasePoint(); + if ($candidateX->toBytes() != $curveX->toBytes()) { + break; + } + if ($candidateY->toBytes() != $curveY->toBytes()) { + break; + } + return $returnArray ? ['namedCurve' => $testName] : ASN1::encodeDER(['namedCurve' => $testName], Maps\ECParameters::MAP); + case 'Binary': + if (!$candidate instanceof BinaryCurve) { + break; + } + if ($candidate->getModulo() != $curve->getModulo()) { + break; + } + if ($candidate->getA()->toBytes() != $curve->getA()->toBytes()) { + break; + } + if ($candidate->getB()->toBytes() != $curve->getB()->toBytes()) { + break; + } + list($candidateX, $candidateY) = $candidate->getBasePoint(); + list($curveX, $curveY) = $curve->getBasePoint(); + if ($candidateX->toBytes() != $curveX->toBytes()) { + break; + } + if ($candidateY->toBytes() != $curveY->toBytes()) { + break; + } + return $returnArray ? ['namedCurve' => $testName] : ASN1::encodeDER(['namedCurve' => $testName], Maps\ECParameters::MAP); + } + } + } + $order = $curve->getOrder(); + // we could try to calculate the order thusly: + // https://crypto.stackexchange.com/a/27914/4520 + // https://en.wikipedia.org/wiki/Schoof%E2%80%93Elkies%E2%80%93Atkin_algorithm + if (!$order) { + throw new \RuntimeException('Specified Curves need the order to be specified'); + } + $point = $curve->getBasePoint(); + $x = $point[0]->toBytes(); + $y = $point[1]->toBytes(); + if ($curve instanceof PrimeCurve) { + /* + * valid versions are: + * + * ecdpVer1: + * - neither the curve or the base point are generated verifiably randomly. + * ecdpVer2: + * - curve and base point are generated verifiably at random and curve.seed is present + * ecdpVer3: + * - base point is generated verifiably at random but curve is not. curve.seed is present + */ + // other (optional) parameters can be calculated using the methods discused at + // https://crypto.stackexchange.com/q/28947/4520 + $data = ['version' => 'ecdpVer1', 'fieldID' => ['fieldType' => 'prime-field', 'parameters' => $curve->getModulo()], 'curve' => ['a' => $curve->getA()->toBytes(), 'b' => $curve->getB()->toBytes()], 'base' => "\x04" . $x . $y, 'order' => $order]; + return $returnArray ? ['specifiedCurve' => $data] : ASN1::encodeDER(['specifiedCurve' => $data], Maps\ECParameters::MAP); + } + if ($curve instanceof BinaryCurve) { + $modulo = $curve->getModulo(); + $basis = count($modulo); + $m = array_shift($modulo); + array_pop($modulo); + // the last parameter should always be 0 + //rsort($modulo); + switch ($basis) { + case 3: + $basis = 'tpBasis'; + $modulo = new BigInteger($modulo[0]); + break; + case 5: + $basis = 'ppBasis'; + // these should be in strictly ascending order (hence the commented out rsort above) + $modulo = ['k1' => new BigInteger($modulo[2]), 'k2' => new BigInteger($modulo[1]), 'k3' => new BigInteger($modulo[0])]; + $modulo = ASN1::encodeDER($modulo, Maps\Pentanomial::MAP); + $modulo = new ASN1\Element($modulo); + } + $params = ASN1::encodeDER(['m' => new BigInteger($m), 'basis' => $basis, 'parameters' => $modulo], Maps\Characteristic_two::MAP); + $params = new ASN1\Element($params); + $a = ltrim($curve->getA()->toBytes(), "\x00"); + if (!strlen($a)) { + $a = "\x00"; + } + $b = ltrim($curve->getB()->toBytes(), "\x00"); + if (!strlen($b)) { + $b = "\x00"; + } + $data = ['version' => 'ecdpVer1', 'fieldID' => ['fieldType' => 'characteristic-two-field', 'parameters' => $params], 'curve' => ['a' => $a, 'b' => $b], 'base' => "\x04" . $x . $y, 'order' => $order]; + return $returnArray ? ['specifiedCurve' => $data] : ASN1::encodeDER(['specifiedCurve' => $data], Maps\ECParameters::MAP); + } + throw new UnsupportedCurveException('Curve cannot be serialized'); + } + /** + * Use Specified Curve + * + * A specified curve has all the coefficients, the base points, etc, explicitely included. + * A specified curve is a more verbose way of representing a curve + */ + public static function useSpecifiedCurve() + { + self::$useNamedCurves = \false; + } + /** + * Use Named Curve + * + * A named curve does not include any parameters. It is up to the EC parameters to + * know what the coefficients, the base points, etc, are from the name of the curve. + * A named curve is a more concise way of representing a curve + */ + public static function useNamedCurve() + { + self::$useNamedCurves = \true; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/JWK.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/JWK.php new file mode 100644 index 0000000..a52560c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/JWK.php @@ -0,0 +1,155 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\JWK as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\secp256k1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\secp256r1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\secp384r1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\secp521r1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * JWK Formatted EC Handler + * + * @author Jim Wigginton + */ +abstract class JWK extends Progenitor +{ + use Common; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + switch ($key->kty) { + case 'EC': + switch ($key->crv) { + case 'P-256': + case 'P-384': + case 'P-521': + case 'secp256k1': + break; + default: + throw new UnsupportedCurveException('Only P-256, P-384, P-521 and secp256k1 curves are accepted (' . $key->crv . ' provided)'); + } + break; + case 'OKP': + switch ($key->crv) { + case 'Ed25519': + case 'Ed448': + break; + default: + throw new UnsupportedCurveException('Only Ed25519 and Ed448 curves are accepted (' . $key->crv . ' provided)'); + } + break; + default: + throw new \Exception('Only EC and OKP JWK keys are supported'); + } + $curve = '\\phpseclib3\\Crypt\\EC\\Curves\\' . str_replace('P-', 'nistp', $key->crv); + $curve = new $curve(); + if ($curve instanceof TwistedEdwardsCurve) { + $QA = self::extractPoint(Strings::base64url_decode($key->x), $curve); + if (!isset($key->d)) { + return compact('curve', 'QA'); + } + $arr = $curve->extractSecret(Strings::base64url_decode($key->d)); + return compact('curve', 'QA') + $arr; + } + $QA = [$curve->convertInteger(new BigInteger(Strings::base64url_decode($key->x), 256)), $curve->convertInteger(new BigInteger(Strings::base64url_decode($key->y), 256))]; + if (!$curve->verifyPoint($QA)) { + throw new \RuntimeException('Unable to verify that point exists on curve'); + } + if (!isset($key->d)) { + return compact('curve', 'QA'); + } + $dA = new BigInteger(Strings::base64url_decode($key->d), 256); + $curve->rangeCheck($dA); + return compact('curve', 'dA', 'QA'); + } + /** + * Returns the alias that corresponds to a curve + * + * @return string + */ + private static function getAlias(BaseCurve $curve) + { + switch (\true) { + case $curve instanceof secp256r1: + return 'P-256'; + case $curve instanceof secp384r1: + return 'P-384'; + case $curve instanceof secp521r1: + return 'P-521'; + case $curve instanceof secp256k1: + return 'secp256k1'; + } + $reflect = new \ReflectionClass($curve); + $curveName = $reflect->isFinal() ? $reflect->getParentClass()->getShortName() : $reflect->getShortName(); + throw new UnsupportedCurveException("{$curveName} is not a supported curve"); + } + /** + * Return the array superstructure for an EC public key + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @return array + */ + private static function savePublicKeyHelper(BaseCurve $curve, array $publicKey) + { + if ($curve instanceof TwistedEdwardsCurve) { + return ['kty' => 'OKP', 'crv' => $curve instanceof Ed25519 ? 'Ed25519' : 'Ed448', 'x' => Strings::base64url_encode($curve->encodePoint($publicKey))]; + } + return ['kty' => 'EC', 'crv' => self::getAlias($curve), 'x' => Strings::base64url_encode($publicKey[0]->toBytes()), 'y' => Strings::base64url_encode($publicKey[1]->toBytes())]; + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param array $options optional + * @return string + */ + public static function savePublicKey(BaseCurve $curve, array $publicKey, array $options = []) + { + $key = self::savePublicKeyHelper($curve, $publicKey); + return self::wrapKey($key, $options); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\Curves\Ed25519 $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $secret = null, $password = '', array $options = []) + { + $key = self::savePublicKeyHelper($curve, $publicKey); + $key['d'] = $curve instanceof TwistedEdwardsCurve ? $secret : $privateKey->toBytes(); + $key['d'] = Strings::base64url_encode($key['d']); + return self::wrapKey($key, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPrivate.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPrivate.php new file mode 100644 index 0000000..d11c766 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPrivate.php @@ -0,0 +1,93 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve448; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Montgomery Curve Private Key Handler + * + * @author Jim Wigginton + */ +abstract class MontgomeryPrivate +{ + /** + * Is invisible flag + * + */ + const IS_INVISIBLE = \true; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + switch (strlen($key)) { + case 32: + $curve = new Curve25519(); + break; + case 56: + $curve = new Curve448(); + break; + default: + throw new \LengthException('The only supported lengths are 32 and 56'); + } + $components = ['curve' => $curve]; + $components['dA'] = new BigInteger($key, 256); + $curve->rangeCheck($components['dA']); + // note that EC::getEncodedCoordinates does some additional "magic" (it does strrev on the result) + $components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); + return $components; + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @return string + */ + public static function savePublicKey(MontgomeryCurve $curve, array $publicKey) + { + return strrev($publicKey[0]->toBytes()); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, MontgomeryCurve $curve, array $publicKey, $secret = null, $password = '') + { + if (!empty($password) && is_string($password)) { + throw new UnsupportedFormatException('MontgomeryPrivate private keys do not support encryption'); + } + return $privateKey->toBytes(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPublic.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPublic.php new file mode 100644 index 0000000..5d015cc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPublic.php @@ -0,0 +1,65 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve448; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Montgomery Public Key Handler + * + * @author Jim Wigginton + */ +abstract class MontgomeryPublic +{ + /** + * Is invisible flag + * + */ + const IS_INVISIBLE = \true; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + switch (strlen($key)) { + case 32: + $curve = new Curve25519(); + break; + case 56: + $curve = new Curve448(); + break; + default: + throw new \LengthException('The only supported lengths are 32 and 56'); + } + $components = ['curve' => $curve]; + $components['QA'] = [$components['curve']->convertInteger(new BigInteger(strrev($key), 256))]; + return $components; + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Montgomery $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @return string + */ + public static function savePublicKey(MontgomeryCurve $curve, array $publicKey) + { + return strrev($publicKey[0]->toBytes()); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/OpenSSH.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/OpenSSH.php new file mode 100644 index 0000000..edc0d63 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/OpenSSH.php @@ -0,0 +1,163 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\OpenSSH as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * OpenSSH Formatted EC Key Handler + * + * @author Jim Wigginton + */ +abstract class OpenSSH extends Progenitor +{ + use Common; + /** + * Supported Key Types + * + * @var array + */ + protected static $types = ['ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $parsed = parent::load($key, $password); + if (isset($parsed['paddedKey'])) { + $paddedKey = $parsed['paddedKey']; + list($type) = Strings::unpackSSH2('s', $paddedKey); + if ($type != $parsed['type']) { + throw new \RuntimeException("The public and private keys are not of the same type ({$type} vs {$parsed['type']})"); + } + if ($type == 'ssh-ed25519') { + list(, $key, $comment) = Strings::unpackSSH2('sss', $paddedKey); + $key = libsodium::load($key); + $key['comment'] = $comment; + return $key; + } + list($curveName, $publicKey, $privateKey, $comment) = Strings::unpackSSH2('ssis', $paddedKey); + $curve = self::loadCurveByParam(['namedCurve' => $curveName]); + $curve->rangeCheck($privateKey); + return ['curve' => $curve, 'dA' => $privateKey, 'QA' => self::extractPoint("\x00{$publicKey}", $curve), 'comment' => $comment]; + } + if ($parsed['type'] == 'ssh-ed25519') { + if (Strings::shift($parsed['publicKey'], 4) != "\x00\x00\x00 ") { + throw new \RuntimeException('Length of ssh-ed25519 key should be 32'); + } + $curve = new Ed25519(); + $qa = self::extractPoint($parsed['publicKey'], $curve); + } else { + list($curveName, $publicKey) = Strings::unpackSSH2('ss', $parsed['publicKey']); + $curveName = '\\phpseclib3\\Crypt\\EC\\Curves\\' . $curveName; + $curve = new $curveName(); + $qa = self::extractPoint("\x00" . $publicKey, $curve); + } + return ['curve' => $curve, 'QA' => $qa, 'comment' => $parsed['comment']]; + } + /** + * Returns the alias that corresponds to a curve + * + * @return string + */ + private static function getAlias(BaseCurve $curve) + { + self::initialize_static_variables(); + $reflect = new \ReflectionClass($curve); + $name = $reflect->getShortName(); + $oid = self::$curveOIDs[$name]; + $aliases = array_filter(self::$curveOIDs, function ($v) use($oid) { + return $v == $oid; + }); + $aliases = array_keys($aliases); + for ($i = 0; $i < count($aliases); $i++) { + if (in_array('ecdsa-sha2-' . $aliases[$i], self::$types)) { + $alias = $aliases[$i]; + break; + } + } + if (!isset($alias)) { + throw new UnsupportedCurveException($name . ' is not a curve that the OpenSSH plugin supports'); + } + return $alias; + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param array $options optional + * @return string + */ + public static function savePublicKey(BaseCurve $curve, array $publicKey, array $options = []) + { + $comment = isset($options['comment']) ? $options['comment'] : self::$comment; + if ($curve instanceof Ed25519) { + $key = Strings::packSSH2('ss', 'ssh-ed25519', $curve->encodePoint($publicKey)); + if (isset($options['binary']) ? $options['binary'] : self::$binary) { + return $key; + } + $key = 'ssh-ed25519 ' . base64_encode($key) . ' ' . $comment; + return $key; + } + $alias = self::getAlias($curve); + $points = "\x04" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes(); + $key = Strings::packSSH2('sss', 'ecdsa-sha2-' . $alias, $alias, $points); + if (isset($options['binary']) ? $options['binary'] : self::$binary) { + return $key; + } + $key = 'ecdsa-sha2-' . $alias . ' ' . base64_encode($key) . ' ' . $comment; + return $key; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\Curves\Ed25519 $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $secret = null, $password = '', array $options = []) + { + if ($curve instanceof Ed25519) { + if (!isset($secret)) { + throw new \RuntimeException('Private Key does not have a secret set'); + } + if (strlen($secret) != 32) { + throw new \RuntimeException('Private Key secret is not of the correct length'); + } + $pubKey = $curve->encodePoint($publicKey); + $publicKey = Strings::packSSH2('ss', 'ssh-ed25519', $pubKey); + $privateKey = Strings::packSSH2('sss', 'ssh-ed25519', $pubKey, $secret . $pubKey); + return self::wrapPrivateKey($publicKey, $privateKey, $password, $options); + } + $alias = self::getAlias($curve); + $points = "\x04" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes(); + $publicKey = self::savePublicKey($curve, $publicKey, ['binary' => \true]); + $privateKey = Strings::packSSH2('sssi', 'ecdsa-sha2-' . $alias, $alias, $points, $privateKey); + return self::wrapPrivateKey($publicKey, $privateKey, $password, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS1.php new file mode 100644 index 0000000..8b18ab3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS1.php @@ -0,0 +1,154 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS1 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * "PKCS1" (RFC5915) Formatted EC Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS1 extends Progenitor +{ + use Common; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + self::initialize_static_variables(); + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + if (strpos($key, 'BEGIN EC PARAMETERS') && strpos($key, 'BEGIN EC PRIVATE KEY')) { + $components = []; + preg_match('#-*BEGIN EC PRIVATE KEY-*[^-]*-*END EC PRIVATE KEY-*#s', $key, $matches); + $decoded = parent::load($matches[0], $password); + $decoded = ASN1::decodeBER($decoded); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $ecPrivate = ASN1::asn1map($decoded[0], Maps\ECPrivateKey::MAP); + if (!is_array($ecPrivate)) { + throw new \RuntimeException('Unable to perform ASN1 mapping'); + } + if (isset($ecPrivate['parameters'])) { + $components['curve'] = self::loadCurveByParam($ecPrivate['parameters']); + } + preg_match('#-*BEGIN EC PARAMETERS-*[^-]*-*END EC PARAMETERS-*#s', $key, $matches); + $decoded = parent::load($matches[0], ''); + $decoded = ASN1::decodeBER($decoded); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $ecParams = ASN1::asn1map($decoded[0], Maps\ECParameters::MAP); + if (!is_array($ecParams)) { + throw new \RuntimeException('Unable to perform ASN1 mapping'); + } + $ecParams = self::loadCurveByParam($ecParams); + // comparing $ecParams and $components['curve'] directly won't work because they'll have different Math\Common\FiniteField classes + // even if the modulo is the same + if (isset($components['curve']) && self::encodeParameters($ecParams, \false, []) != self::encodeParameters($components['curve'], \false, [])) { + throw new \RuntimeException('EC PARAMETERS does not correspond to EC PRIVATE KEY'); + } + if (!isset($components['curve'])) { + $components['curve'] = $ecParams; + } + $components['dA'] = new BigInteger($ecPrivate['privateKey'], 256); + $components['curve']->rangeCheck($components['dA']); + $components['QA'] = isset($ecPrivate['publicKey']) ? self::extractPoint($ecPrivate['publicKey'], $components['curve']) : $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); + return $components; + } + $key = parent::load($key, $password); + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $key = ASN1::asn1map($decoded[0], Maps\ECParameters::MAP); + if (is_array($key)) { + return ['curve' => self::loadCurveByParam($key)]; + } + $key = ASN1::asn1map($decoded[0], Maps\ECPrivateKey::MAP); + if (!is_array($key)) { + throw new \RuntimeException('Unable to perform ASN1 mapping'); + } + if (!isset($key['parameters'])) { + throw new \RuntimeException('Key cannot be loaded without parameters'); + } + $components = []; + $components['curve'] = self::loadCurveByParam($key['parameters']); + $components['dA'] = new BigInteger($key['privateKey'], 256); + $components['QA'] = isset($ecPrivate['publicKey']) ? self::extractPoint($ecPrivate['publicKey'], $components['curve']) : $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); + return $components; + } + /** + * Convert EC parameters to the appropriate format + * + * @return string + */ + public static function saveParameters(BaseCurve $curve, array $options = []) + { + self::initialize_static_variables(); + if ($curve instanceof TwistedEdwardsCurve || $curve instanceof MontgomeryCurve) { + throw new UnsupportedCurveException('TwistedEdwards and Montgomery Curves are not supported'); + } + $key = self::encodeParameters($curve, \false, $options); + return "-----BEGIN EC PARAMETERS-----\r\n" . chunk_split(Strings::base64_encode($key), 64) . "-----END EC PARAMETERS-----\r\n"; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $secret = null, $password = '', array $options = []) + { + self::initialize_static_variables(); + if ($curve instanceof TwistedEdwardsCurve || $curve instanceof MontgomeryCurve) { + throw new UnsupportedCurveException('TwistedEdwards Curves are not supported'); + } + $publicKey = "\x04" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes(); + $key = ['version' => 'ecPrivkeyVer1', 'privateKey' => $privateKey->toBytes(), 'parameters' => new ASN1\Element(self::encodeParameters($curve)), 'publicKey' => "\x00" . $publicKey]; + $key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP); + return self::wrapPrivateKey($key, 'EC', $password, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php new file mode 100644 index 0000000..07cb791 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php @@ -0,0 +1,186 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed448; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#8 Formatted EC Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS8 extends Progenitor +{ + use Common; + /** + * OID Name + * + * @var array + */ + const OID_NAME = ['id-ecPublicKey', 'id-Ed25519', 'id-Ed448']; + /** + * OID Value + * + * @var string + */ + const OID_VALUE = ['1.2.840.10045.2.1', '1.3.101.112', '1.3.101.113']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + // initialize_static_variables() is defined in both the trait and the parent class + // when it's defined in two places it's the traits one that's called + // the parent one is needed, as well, but the parent one is called by other methods + // in the parent class as needed and in the context of the parent it's the parent + // one that's called + self::initialize_static_variables(); + $key = parent::load($key, $password); + $type = isset($key['privateKey']) ? 'privateKey' : 'publicKey'; + switch ($key[$type . 'Algorithm']['algorithm']) { + case 'id-Ed25519': + case 'id-Ed448': + return self::loadEdDSA($key); + } + $decoded = ASN1::decodeBER($key[$type . 'Algorithm']['parameters']->element); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $params = ASN1::asn1map($decoded[0], Maps\ECParameters::MAP); + if (!$params) { + throw new \RuntimeException('Unable to decode the parameters using Maps\\ECParameters'); + } + $components = []; + $components['curve'] = self::loadCurveByParam($params); + if ($type == 'publicKey') { + $components['QA'] = self::extractPoint("\x00" . $key['publicKey'], $components['curve']); + return $components; + } + $decoded = ASN1::decodeBER($key['privateKey']); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $key = ASN1::asn1map($decoded[0], Maps\ECPrivateKey::MAP); + if (isset($key['parameters']) && $params != $key['parameters']) { + throw new \RuntimeException('The PKCS8 parameter field does not match the private key parameter field'); + } + $components['dA'] = new BigInteger($key['privateKey'], 256); + $components['curve']->rangeCheck($components['dA']); + $components['QA'] = isset($key['publicKey']) ? self::extractPoint($key['publicKey'], $components['curve']) : $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); + return $components; + } + /** + * Break a public or private EdDSA key down into its constituent components + * + * @return array + */ + private static function loadEdDSA(array $key) + { + $components = []; + if (isset($key['privateKey'])) { + $components['curve'] = $key['privateKeyAlgorithm']['algorithm'] == 'id-Ed25519' ? new Ed25519() : new Ed448(); + // 0x04 == octet string + // 0x20 == length (32 bytes) + if (substr($key['privateKey'], 0, 2) != "\x04 ") { + throw new \RuntimeException('The first two bytes of the private key field should be 0x0420'); + } + $arr = $components['curve']->extractSecret(substr($key['privateKey'], 2)); + $components['dA'] = $arr['dA']; + $components['secret'] = $arr['secret']; + } + if (isset($key['publicKey'])) { + if (!isset($components['curve'])) { + $components['curve'] = $key['publicKeyAlgorithm']['algorithm'] == 'id-Ed25519' ? new Ed25519() : new Ed448(); + } + $components['QA'] = self::extractPoint($key['publicKey'], $components['curve']); + } + if (isset($key['privateKey']) && !isset($components['QA'])) { + $components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']); + } + return $components; + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param array $options optional + * @return string + */ + public static function savePublicKey(BaseCurve $curve, array $publicKey, array $options = []) + { + self::initialize_static_variables(); + if ($curve instanceof MontgomeryCurve) { + throw new UnsupportedCurveException('Montgomery Curves are not supported'); + } + if ($curve instanceof TwistedEdwardsCurve) { + return self::wrapPublicKey($curve->encodePoint($publicKey), null, $curve instanceof Ed25519 ? 'id-Ed25519' : 'id-Ed448'); + } + $params = new ASN1\Element(self::encodeParameters($curve, \false, $options)); + $key = "\x04" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes(); + return self::wrapPublicKey($key, $params, 'id-ecPublicKey'); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $secret = null, $password = '', array $options = []) + { + self::initialize_static_variables(); + if ($curve instanceof MontgomeryCurve) { + throw new UnsupportedCurveException('Montgomery Curves are not supported'); + } + if ($curve instanceof TwistedEdwardsCurve) { + return self::wrapPrivateKey("\x04 " . $secret, [], null, $password, $curve instanceof Ed25519 ? 'id-Ed25519' : 'id-Ed448'); + } + $publicKey = "\x04" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes(); + $params = new ASN1\Element(self::encodeParameters($curve, \false, $options)); + $key = [ + 'version' => 'ecPrivkeyVer1', + 'privateKey' => $privateKey->toBytes(), + //'parameters' => $params, + 'publicKey' => "\x00" . $publicKey, + ]; + $key = ASN1::encodeDER($key, Maps\ECPrivateKey::MAP); + return self::wrapPrivateKey($key, [], $params, $password, 'id-ecPublicKey', '', $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PuTTY.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PuTTY.php new file mode 100644 index 0000000..a8a1af5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PuTTY.php @@ -0,0 +1,115 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PuTTY as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PuTTY Formatted EC Key Handler + * + * @author Jim Wigginton + */ +abstract class PuTTY extends Progenitor +{ + use Common; + /** + * Public Handler + * + * @var string + */ + const PUBLIC_HANDLER = 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\OpenSSH'; + /** + * Supported Key Types + * + * @var array + */ + protected static $types = ['ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $components = parent::load($key, $password); + if (!isset($components['private'])) { + return $components; + } + $private = $components['private']; + $temp = Strings::base64_encode(Strings::packSSH2('s', $components['type']) . $components['public']); + $components = OpenSSH::load($components['type'] . ' ' . $temp . ' ' . $components['comment']); + if ($components['curve'] instanceof TwistedEdwardsCurve) { + if (Strings::shift($private, 4) != "\x00\x00\x00 ") { + throw new \RuntimeException('Length of ssh-ed25519 key should be 32'); + } + $arr = $components['curve']->extractSecret($private); + $components['dA'] = $arr['dA']; + $components['secret'] = $arr['secret']; + } else { + list($components['dA']) = Strings::unpackSSH2('i', $private); + $components['curve']->rangeCheck($components['dA']); + } + return $components; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, BaseCurve $curve, array $publicKey, $secret = null, $password = \false, array $options = []) + { + self::initialize_static_variables(); + $public = explode(' ', OpenSSH::savePublicKey($curve, $publicKey)); + $name = $public[0]; + $public = Strings::base64_decode($public[1]); + list(, $length) = unpack('N', Strings::shift($public, 4)); + Strings::shift($public, $length); + // PuTTY pads private keys with a null byte per the following: + // https://github.com/github/putty/blob/a3d14d77f566a41fc61dfdc5c2e0e384c9e6ae8b/sshecc.c#L1926 + if (!$curve instanceof TwistedEdwardsCurve) { + $private = $privateKey->toBytes(); + if (!(strlen($privateKey->toBits()) & 7)) { + $private = "\x00{$private}"; + } + } + $private = $curve instanceof TwistedEdwardsCurve ? Strings::packSSH2('s', $secret) : Strings::packSSH2('s', $private); + return self::wrapPrivateKey($public, $private, $name, $password, $options); + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField[] $publicKey + * @return string + */ + public static function savePublicKey(BaseCurve $curve, array $publicKey) + { + $public = explode(' ', OpenSSH::savePublicKey($curve, $publicKey)); + $type = $public[0]; + $public = Strings::base64_decode($public[1]); + list(, $length) = unpack('N', Strings::shift($public, 4)); + Strings::shift($public, $length); + return self::wrapPublicKey($public, $type); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php new file mode 100644 index 0000000..490209e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php @@ -0,0 +1,373 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Base as BaseCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Prime as PrimeCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * XML Formatted EC Key Handler + * + * @author Jim Wigginton + */ +abstract class XML +{ + use Common; + /** + * Default namespace + * + * @var string + */ + private static $namespace; + /** + * Flag for using RFC4050 syntax + * + * @var bool + */ + private static $rfc4050 = \false; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + self::initialize_static_variables(); + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + if (!class_exists('DOMDocument')) { + throw new BadConfigurationException('The dom extension is not setup correctly on this system'); + } + $use_errors = libxml_use_internal_errors(\true); + $temp = self::isolateNamespace($key, 'http://www.w3.org/2009/xmldsig11#'); + if ($temp) { + $key = $temp; + } + $temp = self::isolateNamespace($key, 'http://www.w3.org/2001/04/xmldsig-more#'); + if ($temp) { + $key = $temp; + } + $dom = new \DOMDocument(); + if (substr($key, 0, 5) != '' . $key . ''; + } + if (!$dom->loadXML($key)) { + libxml_use_internal_errors($use_errors); + throw new \UnexpectedValueException('Key does not appear to contain XML'); + } + $xpath = new \DOMXPath($dom); + libxml_use_internal_errors($use_errors); + $curve = self::loadCurveByParam($xpath); + $pubkey = self::query($xpath, 'publickey', 'Public Key is not present'); + $QA = self::query($xpath, 'ecdsakeyvalue')->length ? self::extractPointRFC4050($xpath, $curve) : self::extractPoint("\x00" . $pubkey, $curve); + libxml_use_internal_errors($use_errors); + return compact('curve', 'QA'); + } + /** + * Case-insensitive xpath query + * + * @param \DOMXPath $xpath + * @param string $name + * @param string $error optional + * @param bool $decode optional + * @return \DOMNodeList + */ + private static function query(\DOMXPath $xpath, $name, $error = null, $decode = \true) + { + $query = '/'; + $names = explode('/', $name); + foreach ($names as $name) { + $query .= "/*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='{$name}']"; + } + $result = $xpath->query($query); + if (!isset($error)) { + return $result; + } + if (!$result->length) { + throw new \RuntimeException($error); + } + return $decode ? self::decodeValue($result->item(0)->textContent) : $result->item(0)->textContent; + } + /** + * Finds the first element in the relevant namespace, strips the namespacing and returns the XML for that element. + * + * @param string $xml + * @param string $ns + */ + private static function isolateNamespace($xml, $ns) + { + $dom = new \DOMDocument(); + if (!$dom->loadXML($xml)) { + return \false; + } + $xpath = new \DOMXPath($dom); + $nodes = $xpath->query("//*[namespace::*[.='{$ns}'] and not(../namespace::*[.='{$ns}'])]"); + if (!$nodes->length) { + return \false; + } + $node = $nodes->item(0); + $ns_name = $node->lookupPrefix($ns); + if ($ns_name) { + $node->removeAttributeNS($ns, $ns_name); + } + return $dom->saveXML($node); + } + /** + * Decodes the value + * + * @param string $value + */ + private static function decodeValue($value) + { + return Strings::base64_decode(str_replace(["\r", "\n", ' ', "\t"], '', $value)); + } + /** + * Extract points from an XML document + * + * @param \DOMXPath $xpath + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @return object[] + */ + private static function extractPointRFC4050(\DOMXPath $xpath, BaseCurve $curve) + { + $x = self::query($xpath, 'publickey/x'); + $y = self::query($xpath, 'publickey/y'); + if (!$x->length || !$x->item(0)->hasAttribute('Value')) { + throw new \RuntimeException('Public Key / X coordinate not found'); + } + if (!$y->length || !$y->item(0)->hasAttribute('Value')) { + throw new \RuntimeException('Public Key / Y coordinate not found'); + } + $point = [$curve->convertInteger(new BigInteger($x->item(0)->getAttribute('Value'))), $curve->convertInteger(new BigInteger($y->item(0)->getAttribute('Value')))]; + if (!$curve->verifyPoint($point)) { + throw new \RuntimeException('Unable to verify that point exists on curve'); + } + return $point; + } + /** + * Returns an instance of \phpseclib3\Crypt\EC\BaseCurves\Base based + * on the curve parameters + * + * @param \DomXPath $xpath + * @return \phpseclib3\Crypt\EC\BaseCurves\Base|false + */ + private static function loadCurveByParam(\DOMXPath $xpath) + { + $namedCurve = self::query($xpath, 'namedcurve'); + if ($namedCurve->length == 1) { + $oid = $namedCurve->item(0)->getAttribute('URN'); + $oid = preg_replace('#[^\\d.]#', '', $oid); + $name = array_search($oid, self::$curveOIDs); + if ($name === \false) { + throw new UnsupportedCurveException('Curve with OID of ' . $oid . ' is not supported'); + } + $curve = '\\phpseclib3\\Crypt\\EC\\Curves\\' . $name; + if (!class_exists($curve)) { + throw new UnsupportedCurveException('Named Curve of ' . $name . ' is not supported'); + } + return new $curve(); + } + $params = self::query($xpath, 'explicitparams'); + if ($params->length) { + return self::loadCurveByParamRFC4050($xpath); + } + $params = self::query($xpath, 'ecparameters'); + if (!$params->length) { + throw new \RuntimeException('No parameters are present'); + } + $fieldTypes = ['prime-field' => ['fieldid/prime/p'], 'gnb' => ['fieldid/gnb/m'], 'tnb' => ['fieldid/tnb/k'], 'pnb' => ['fieldid/pnb/k1', 'fieldid/pnb/k2', 'fieldid/pnb/k3'], 'unknown' => []]; + foreach ($fieldTypes as $type => $queries) { + foreach ($queries as $query) { + $result = self::query($xpath, $query); + if (!$result->length) { + continue 2; + } + $param = preg_replace('#.*/#', '', $query); + ${$param} = self::decodeValue($result->item(0)->textContent); + } + break; + } + $a = self::query($xpath, 'curve/a', 'A coefficient is not present'); + $b = self::query($xpath, 'curve/b', 'B coefficient is not present'); + $base = self::query($xpath, 'base', 'Base point is not present'); + $order = self::query($xpath, 'order', 'Order is not present'); + switch ($type) { + case 'prime-field': + $curve = new PrimeCurve(); + $curve->setModulo(new BigInteger($p, 256)); + $curve->setCoefficients(new BigInteger($a, 256), new BigInteger($b, 256)); + $point = self::extractPoint("\x00" . $base, $curve); + $curve->setBasePoint(...$point); + $curve->setOrder(new BigInteger($order, 256)); + return $curve; + case 'gnb': + case 'tnb': + case 'pnb': + default: + throw new UnsupportedCurveException('Field Type of ' . $type . ' is not supported'); + } + } + /** + * Returns an instance of \phpseclib3\Crypt\EC\BaseCurves\Base based + * on the curve parameters + * + * @param \DomXPath $xpath + * @return \phpseclib3\Crypt\EC\BaseCurves\Base|false + */ + private static function loadCurveByParamRFC4050(\DOMXPath $xpath) + { + $fieldTypes = ['prime-field' => ['primefieldparamstype/p'], 'unknown' => []]; + foreach ($fieldTypes as $type => $queries) { + foreach ($queries as $query) { + $result = self::query($xpath, $query); + if (!$result->length) { + continue 2; + } + $param = preg_replace('#.*/#', '', $query); + ${$param} = $result->item(0)->textContent; + } + break; + } + $a = self::query($xpath, 'curveparamstype/a', 'A coefficient is not present', \false); + $b = self::query($xpath, 'curveparamstype/b', 'B coefficient is not present', \false); + $x = self::query($xpath, 'basepointparams/basepoint/ecpointtype/x', 'Base Point X is not present', \false); + $y = self::query($xpath, 'basepointparams/basepoint/ecpointtype/y', 'Base Point Y is not present', \false); + $order = self::query($xpath, 'order', 'Order is not present', \false); + switch ($type) { + case 'prime-field': + $curve = new PrimeCurve(); + $p = str_replace(["\r", "\n", ' ', "\t"], '', $p); + $curve->setModulo(new BigInteger($p)); + $a = str_replace(["\r", "\n", ' ', "\t"], '', $a); + $b = str_replace(["\r", "\n", ' ', "\t"], '', $b); + $curve->setCoefficients(new BigInteger($a), new BigInteger($b)); + $x = str_replace(["\r", "\n", ' ', "\t"], '', $x); + $y = str_replace(["\r", "\n", ' ', "\t"], '', $y); + $curve->setBasePoint(new BigInteger($x), new BigInteger($y)); + $order = str_replace(["\r", "\n", ' ', "\t"], '', $order); + $curve->setOrder(new BigInteger($order)); + return $curve; + default: + throw new UnsupportedCurveException('Field Type of ' . $type . ' is not supported'); + } + } + /** + * Sets the namespace. dsig11 is the most common one. + * + * Set to null to unset. Used only for creating public keys. + * + * @param string $namespace + */ + public static function setNamespace($namespace) + { + self::$namespace = $namespace; + } + /** + * Uses the XML syntax specified in https://tools.ietf.org/html/rfc4050 + */ + public static function enableRFC4050Syntax() + { + self::$rfc4050 = \true; + } + /** + * Uses the XML syntax specified in https://www.w3.org/TR/xmldsig-core/#sec-ECParameters + */ + public static function disableRFC4050Syntax() + { + self::$rfc4050 = \false; + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param array $options optional + * @return string + */ + public static function savePublicKey(BaseCurve $curve, array $publicKey, array $options = []) + { + self::initialize_static_variables(); + if ($curve instanceof TwistedEdwardsCurve || $curve instanceof MontgomeryCurve) { + throw new UnsupportedCurveException('TwistedEdwards and Montgomery Curves are not supported'); + } + if (empty(static::$namespace)) { + $pre = $post = ''; + } else { + $pre = static::$namespace . ':'; + $post = ':' . static::$namespace; + } + if (self::$rfc4050) { + return '<' . $pre . 'ECDSAKeyValue xmlns' . $post . '="http://www.w3.org/2001/04/xmldsig-more#">' . "\r\n" . self::encodeXMLParameters($curve, $pre, $options) . "\r\n" . '<' . $pre . 'PublicKey>' . "\r\n" . '<' . $pre . 'X Value="' . $publicKey[0] . '" />' . "\r\n" . '<' . $pre . 'Y Value="' . $publicKey[1] . '" />' . "\r\n" . '' . "\r\n" . ''; + } + $publicKey = "\x04" . $publicKey[0]->toBytes() . $publicKey[1]->toBytes(); + return '<' . $pre . 'ECDSAKeyValue xmlns' . $post . '="http://www.w3.org/2009/xmldsig11#">' . "\r\n" . self::encodeXMLParameters($curve, $pre, $options) . "\r\n" . '<' . $pre . 'PublicKey>' . Strings::base64_encode($publicKey) . '' . "\r\n" . ''; + } + /** + * Encode Parameters + * + * @param \phpseclib3\Crypt\EC\BaseCurves\Base $curve + * @param string $pre + * @param array $options optional + * @return string|false + */ + private static function encodeXMLParameters(BaseCurve $curve, $pre, array $options = []) + { + $result = self::encodeParameters($curve, \true, $options); + if (isset($result['namedCurve'])) { + $namedCurve = '<' . $pre . 'NamedCurve URI="urn:oid:' . self::$curveOIDs[$result['namedCurve']] . '" />'; + return self::$rfc4050 ? '' . str_replace('URI', 'URN', $namedCurve) . '' : $namedCurve; + } + if (self::$rfc4050) { + $xml = '<' . $pre . 'ExplicitParams>' . "\r\n" . '<' . $pre . 'FieldParams>' . "\r\n"; + $temp = $result['specifiedCurve']; + switch ($temp['fieldID']['fieldType']) { + case 'prime-field': + $xml .= '<' . $pre . 'PrimeFieldParamsType>' . "\r\n" . '<' . $pre . 'P>' . $temp['fieldID']['parameters'] . '' . "\r\n" . '' . "\r\n"; + $a = $curve->getA(); + $b = $curve->getB(); + list($x, $y) = $curve->getBasePoint(); + break; + default: + throw new UnsupportedCurveException('Field Type of ' . $temp['fieldID']['fieldType'] . ' is not supported'); + } + $xml .= '' . "\r\n" . '<' . $pre . 'CurveParamsType>' . "\r\n" . '<' . $pre . 'A>' . $a . '' . "\r\n" . '<' . $pre . 'B>' . $b . '' . "\r\n" . '' . "\r\n" . '<' . $pre . 'BasePointParams>' . "\r\n" . '<' . $pre . 'BasePoint>' . "\r\n" . '<' . $pre . 'ECPointType>' . "\r\n" . '<' . $pre . 'X>' . $x . '' . "\r\n" . '<' . $pre . 'Y>' . $y . '' . "\r\n" . '' . "\r\n" . '' . "\r\n" . '<' . $pre . 'Order>' . $curve->getOrder() . '' . "\r\n" . '' . "\r\n" . '' . "\r\n"; + return $xml; + } + if (isset($result['specifiedCurve'])) { + $xml = '<' . $pre . 'ECParameters>' . "\r\n" . '<' . $pre . 'FieldID>' . "\r\n"; + $temp = $result['specifiedCurve']; + switch ($temp['fieldID']['fieldType']) { + case 'prime-field': + $xml .= '<' . $pre . 'Prime>' . "\r\n" . '<' . $pre . 'P>' . Strings::base64_encode($temp['fieldID']['parameters']->toBytes()) . '' . "\r\n" . '' . "\r\n"; + break; + default: + throw new UnsupportedCurveException('Field Type of ' . $temp['fieldID']['fieldType'] . ' is not supported'); + } + $xml .= '' . "\r\n" . '<' . $pre . 'Curve>' . "\r\n" . '<' . $pre . 'A>' . Strings::base64_encode($temp['curve']['a']) . '' . "\r\n" . '<' . $pre . 'B>' . Strings::base64_encode($temp['curve']['b']) . '' . "\r\n" . '' . "\r\n" . '<' . $pre . 'Base>' . Strings::base64_encode($temp['base']) . '' . "\r\n" . '<' . $pre . 'Order>' . Strings::base64_encode($temp['order']) . '' . "\r\n" . ''; + return $xml; + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/libsodium.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/libsodium.php new file mode 100644 index 0000000..b051bd9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/libsodium.php @@ -0,0 +1,106 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * libsodium Key Handler + * + * @author Jim Wigginton + */ +abstract class libsodium +{ + use Common; + /** + * Is invisible flag + * + */ + const IS_INVISIBLE = \true; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + switch (strlen($key)) { + case 32: + $public = $key; + break; + case 64: + $private = substr($key, 0, 32); + $public = substr($key, -32); + break; + case 96: + $public = substr($key, -32); + if (substr($key, 32, 32) != $public) { + throw new \RuntimeException('Keys with 96 bytes should have the 2nd and 3rd set of 32 bytes match'); + } + $private = substr($key, 0, 32); + break; + default: + throw new \RuntimeException('libsodium keys need to either be 32 bytes long, 64 bytes long or 96 bytes long'); + } + $curve = new Ed25519(); + $components = ['curve' => $curve]; + if (isset($private)) { + $arr = $curve->extractSecret($private); + $components['dA'] = $arr['dA']; + $components['secret'] = $arr['secret']; + } + $components['QA'] = isset($public) ? self::extractPoint($public, $curve) : $curve->multiplyPoint($curve->getBasePoint(), $components['dA']); + return $components; + } + /** + * Convert an EC public key to the appropriate format + * + * @param \phpseclib3\Crypt\EC\Curves\Ed25519 $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @return string + */ + public static function savePublicKey(Ed25519 $curve, array $publicKey) + { + return $curve->encodePoint($publicKey); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $privateKey + * @param \phpseclib3\Crypt\EC\Curves\Ed25519 $curve + * @param \phpseclib3\Math\Common\FiniteField\Integer[] $publicKey + * @param string $secret optional + * @param string $password optional + * @return string + */ + public static function savePrivateKey(BigInteger $privateKey, Ed25519 $curve, array $publicKey, $secret = null, $password = '') + { + if (!isset($secret)) { + throw new \RuntimeException('Private Key does not have a secret set'); + } + if (strlen($secret) != 32) { + throw new \RuntimeException('Private Key secret is not of the correct length'); + } + if (!empty($password) && is_string($password)) { + throw new UnsupportedFormatException('libsodium private keys do not support encryption'); + } + return $secret . $curve->encodePoint($publicKey); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/ASN1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/ASN1.php new file mode 100644 index 0000000..049aea3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/ASN1.php @@ -0,0 +1,57 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1 as Encoder; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps\EcdsaSigValue; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * ASN1 Signature Handler + * + * @author Jim Wigginton + */ +abstract class ASN1 +{ + /** + * Loads a signature + * + * @param string $sig + * @return array + */ + public static function load($sig) + { + if (!is_string($sig)) { + return \false; + } + $decoded = Encoder::decodeBER($sig); + if (empty($decoded)) { + return \false; + } + $components = Encoder::asn1map($decoded[0], EcdsaSigValue::MAP); + return $components; + } + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @return string + */ + public static function save(BigInteger $r, BigInteger $s) + { + return Encoder::encodeDER(compact('r', 's'), EcdsaSigValue::MAP); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php new file mode 100644 index 0000000..bf2e8fe --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php @@ -0,0 +1,60 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * ASN1 Signature Handler + * + * @author Jim Wigginton + */ +abstract class IEEE +{ + /** + * Loads a signature + * + * @param string $sig + * @return array + */ + public static function load($sig) + { + if (!is_string($sig)) { + return \false; + } + $len = strlen($sig); + if ($len & 1) { + return \false; + } + $r = new BigInteger(substr($sig, 0, $len >> 1), 256); + $s = new BigInteger(substr($sig, $len >> 1), 256); + return compact('r', 's'); + } + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @return string + */ + public static function save(BigInteger $r, BigInteger $s) + { + $r = $r->toBytes(); + $s = $s->toBytes(); + $len = max(strlen($r), strlen($s)); + return str_pad($r, $len, "\x00", \STR_PAD_LEFT) . str_pad($s, $len, "\x00", \STR_PAD_LEFT); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/Raw.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/Raw.php new file mode 100644 index 0000000..ed258a7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/Raw.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Signature\Raw as Progenitor; +/** + * Raw DSA Signature Handler + * + * @author Jim Wigginton + */ +abstract class Raw extends Progenitor +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/SSH2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/SSH2.php new file mode 100644 index 0000000..a3c1558 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/SSH2.php @@ -0,0 +1,83 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Signature; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * SSH2 Signature Handler + * + * @author Jim Wigginton + */ +abstract class SSH2 +{ + /** + * Loads a signature + * + * @param string $sig + * @return mixed + */ + public static function load($sig) + { + if (!is_string($sig)) { + return \false; + } + $result = Strings::unpackSSH2('ss', $sig); + if ($result === \false) { + return \false; + } + list($type, $blob) = $result; + switch ($type) { + // see https://tools.ietf.org/html/rfc5656#section-3.1.2 + case 'ecdsa-sha2-nistp256': + case 'ecdsa-sha2-nistp384': + case 'ecdsa-sha2-nistp521': + break; + default: + return \false; + } + $result = Strings::unpackSSH2('ii', $blob); + if ($result === \false) { + return \false; + } + return ['r' => $result[0], 's' => $result[1]]; + } + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @param string $curve + * @return string + */ + public static function save(BigInteger $r, BigInteger $s, $curve) + { + switch ($curve) { + case 'secp256r1': + $curve = 'nistp256'; + break; + case 'secp384r1': + $curve = 'nistp384'; + break; + case 'secp521r1': + $curve = 'nistp521'; + break; + default: + return \false; + } + $blob = Strings::packSSH2('ii', $r, $s); + return Strings::packSSH2('ss', 'ecdsa-sha2-' . $curve, $blob); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php new file mode 100644 index 0000000..52632f6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php @@ -0,0 +1,33 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; +/** + * EC Parameters + * + * @author Jim Wigginton + */ +final class Parameters extends EC +{ + /** + * Returns the parameters + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type = 'PKCS1', array $options = []) + { + $type = self::validatePlugin('Keys', 'PKCS1', 'saveParameters'); + return $type::saveParameters($this->curve, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php new file mode 100644 index 0000000..40be894 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php @@ -0,0 +1,226 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Curve25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys\PKCS1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Signature\ASN1 as ASN1Signature; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedOperationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * EC Private Key + * + * @author Jim Wigginton + */ +final class PrivateKey extends EC implements Common\PrivateKey +{ + use Common\Traits\PasswordProtected; + /** + * Private Key dA + * + * sign() converts this to a BigInteger so one might wonder why this is a FiniteFieldInteger instead of + * a BigInteger. That's because a FiniteFieldInteger, when converted to a byte string, is null padded by + * a certain amount whereas a BigInteger isn't. + * + * @var object + */ + protected $dA; + /** + * @var string + */ + protected $secret; + /** + * Multiplies an encoded point by the private key + * + * Used by ECDH + * + * @param string $coordinates + * @return string + */ + public function multiply($coordinates) + { + if ($this->curve instanceof MontgomeryCurve) { + if ($this->curve instanceof Curve25519 && self::$engines['libsodium']) { + return sodium_crypto_scalarmult($this->dA->toBytes(), $coordinates); + } + $point = [$this->curve->convertInteger(new BigInteger(strrev($coordinates), 256))]; + $point = $this->curve->multiplyPoint($point, $this->dA); + return strrev($point[0]->toBytes(\true)); + } + if (!$this->curve instanceof TwistedEdwardsCurve) { + $coordinates = "\x00{$coordinates}"; + } + $point = PKCS1::extractPoint($coordinates, $this->curve); + $point = $this->curve->multiplyPoint($point, $this->dA); + if ($this->curve instanceof TwistedEdwardsCurve) { + return $this->curve->encodePoint($point); + } + if (empty($point)) { + throw new \RuntimeException('The infinity point is invalid'); + } + return "\x04" . $point[0]->toBytes(\true) . $point[1]->toBytes(\true); + } + /** + * Create a signature + * + * @see self::verify() + * @param string $message + * @return mixed + */ + public function sign($message) + { + if ($this->curve instanceof MontgomeryCurve) { + throw new UnsupportedOperationException('Montgomery Curves cannot be used to create signatures'); + } + $dA = $this->dA; + $order = $this->curve->getOrder(); + $shortFormat = $this->shortFormat; + $format = $this->sigFormat; + if ($format === \false) { + return \false; + } + if ($this->curve instanceof TwistedEdwardsCurve) { + if ($this->curve instanceof Ed25519 && self::$engines['libsodium'] && !isset($this->context)) { + $result = sodium_crypto_sign_detached($message, $this->withPassword()->toString('libsodium')); + return $shortFormat == 'SSH2' ? Strings::packSSH2('ss', 'ssh-' . strtolower($this->getCurve()), $result) : $result; + } + // contexts (Ed25519ctx) are supported but prehashing (Ed25519ph) is not. + // quoting https://tools.ietf.org/html/rfc8032#section-8.5 , + // "The Ed25519ph and Ed448ph variants ... SHOULD NOT be used" + $A = $this->curve->encodePoint($this->QA); + $curve = $this->curve; + $hash = new Hash($curve::HASH); + $secret = substr($hash->hash($this->secret), $curve::SIZE); + if ($curve instanceof Ed25519) { + $dom = !isset($this->context) ? '' : 'SigEd25519 no Ed25519 collisions' . "\x00" . chr(strlen($this->context)) . $this->context; + } else { + $context = isset($this->context) ? $this->context : ''; + $dom = 'SigEd448' . "\x00" . chr(strlen($context)) . $context; + } + // SHA-512(dom2(F, C) || prefix || PH(M)) + $r = $hash->hash($dom . $secret . $message); + $r = strrev($r); + $r = new BigInteger($r, 256); + list(, $r) = $r->divide($order); + $R = $curve->multiplyPoint($curve->getBasePoint(), $r); + $R = $curve->encodePoint($R); + $k = $hash->hash($dom . $R . $A . $message); + $k = strrev($k); + $k = new BigInteger($k, 256); + list(, $k) = $k->divide($order); + $S = $k->multiply($dA)->add($r); + list(, $S) = $S->divide($order); + $S = str_pad(strrev($S->toBytes()), $curve::SIZE, "\x00"); + return $shortFormat == 'SSH2' ? Strings::packSSH2('ss', 'ssh-' . strtolower($this->getCurve()), $R . $S) : $R . $S; + } + if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { + $signature = ''; + // altho PHP's OpenSSL bindings only supported EC key creation in PHP 7.1 they've long + // supported signing / verification + // we use specified curves to avoid issues with OpenSSL possibly not supporting a given named curve; + // doing this may mean some curve-specific optimizations can't be used but idk if OpenSSL even + // has curve-specific optimizations + $result = openssl_sign($message, $signature, $this->withPassword()->toString('PKCS8', ['namedCurve' => \false]), $this->hash->getHash()); + if ($result) { + if ($shortFormat == 'ASN1') { + return $signature; + } + extract(ASN1Signature::load($signature)); + return $shortFormat == 'SSH2' ? $format::save($r, $s, $this->getCurve()) : $format::save($r, $s); + } + } + $e = $this->hash->hash($message); + $e = new BigInteger($e, 256); + $Ln = $this->hash->getLength() - $order->getLength(); + $z = $Ln > 0 ? $e->bitwise_rightShift($Ln) : $e; + while (\true) { + $k = BigInteger::randomRange(self::$one, $order->subtract(self::$one)); + list($x, $y) = $this->curve->multiplyPoint($this->curve->getBasePoint(), $k); + $x = $x->toBigInteger(); + list(, $r) = $x->divide($order); + if ($r->equals(self::$zero)) { + continue; + } + $kinv = $k->modInverse($order); + $temp = $z->add($dA->multiply($r)); + $temp = $kinv->multiply($temp); + list(, $s) = $temp->divide($order); + if (!$s->equals(self::$zero)) { + break; + } + } + // the following is an RFC6979 compliant implementation of deterministic ECDSA + // it's unused because it's mainly intended for use when a good CSPRNG isn't + // available. if phpseclib's CSPRNG isn't good then even key generation is + // suspect + /* + // if this were actually being used it'd probably be better if this lived in load() and createKey() + $this->q = $this->curve->getOrder(); + $dA = $this->dA->toBigInteger(); + $this->x = $dA; + + $h1 = $this->hash->hash($message); + $k = $this->computek($h1); + list($x, $y) = $this->curve->multiplyPoint($this->curve->getBasePoint(), $k); + $x = $x->toBigInteger(); + list(, $r) = $x->divide($this->q); + $kinv = $k->modInverse($this->q); + $h1 = $this->bits2int($h1); + $temp = $h1->add($dA->multiply($r)); + $temp = $kinv->multiply($temp); + list(, $s) = $temp->divide($this->q); + */ + return $shortFormat == 'SSH2' ? $format::save($r, $s, $this->getCurve()) : $format::save($r, $s); + } + /** + * Returns the private key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePrivateKey'); + return $type::savePrivateKey($this->dA, $this->curve, $this->QA, $this->secret, $this->password, $options); + } + /** + * Returns the public key + * + * @see self::getPrivateKey() + * @return mixed + */ + public function getPublicKey() + { + $format = 'PKCS8'; + if ($this->curve instanceof MontgomeryCurve) { + $format = 'MontgomeryPublic'; + } + $type = self::validatePlugin('Keys', $format, 'savePublicKey'); + $key = $type::savePublicKey($this->curve, $this->QA); + $key = EC::loadFormat($format, $key); + if ($this->curve instanceof MontgomeryCurve) { + return $key; + } + $key = $key->withHash($this->hash->getHash())->withSignatureFormat($this->shortFormat); + if ($this->curve instanceof TwistedEdwardsCurve) { + $key = $key->withContext($this->context); + } + return $key; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php new file mode 100644 index 0000000..098a3a5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php @@ -0,0 +1,136 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\Montgomery as MontgomeryCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\BaseCurves\TwistedEdwards as TwistedEdwardsCurve; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Curves\Ed25519; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Keys\PKCS1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC\Formats\Signature\ASN1 as ASN1Signature; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedOperationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * EC Public Key + * + * @author Jim Wigginton + */ +final class PublicKey extends EC implements Common\PublicKey +{ + use Common\Traits\Fingerprint; + /** + * Verify a signature + * + * @see self::verify() + * @param string $message + * @param string $signature + * @return mixed + */ + public function verify($message, $signature) + { + if ($this->curve instanceof MontgomeryCurve) { + throw new UnsupportedOperationException('Montgomery Curves cannot be used to create signatures'); + } + $shortFormat = $this->shortFormat; + $format = $this->sigFormat; + if ($format === \false) { + return \false; + } + $order = $this->curve->getOrder(); + if ($this->curve instanceof TwistedEdwardsCurve) { + if ($shortFormat == 'SSH2') { + list(, $signature) = Strings::unpackSSH2('ss', $signature); + } + if ($this->curve instanceof Ed25519 && self::$engines['libsodium'] && !isset($this->context)) { + return sodium_crypto_sign_verify_detached($signature, $message, $this->toString('libsodium')); + } + $curve = $this->curve; + if (strlen($signature) != 2 * $curve::SIZE) { + return \false; + } + $R = substr($signature, 0, $curve::SIZE); + $S = substr($signature, $curve::SIZE); + try { + $R = PKCS1::extractPoint($R, $curve); + $R = $this->curve->convertToInternal($R); + } catch (\Exception $e) { + return \false; + } + $S = strrev($S); + $S = new BigInteger($S, 256); + if ($S->compare($order) >= 0) { + return \false; + } + $A = $curve->encodePoint($this->QA); + if ($curve instanceof Ed25519) { + $dom2 = !isset($this->context) ? '' : 'SigEd25519 no Ed25519 collisions' . "\x00" . chr(strlen($this->context)) . $this->context; + } else { + $context = isset($this->context) ? $this->context : ''; + $dom2 = 'SigEd448' . "\x00" . chr(strlen($context)) . $context; + } + $hash = new Hash($curve::HASH); + $k = $hash->hash($dom2 . substr($signature, 0, $curve::SIZE) . $A . $message); + $k = strrev($k); + $k = new BigInteger($k, 256); + list(, $k) = $k->divide($order); + $qa = $curve->convertToInternal($this->QA); + $lhs = $curve->multiplyPoint($curve->getBasePoint(), $S); + $rhs = $curve->multiplyPoint($qa, $k); + $rhs = $curve->addPoint($rhs, $R); + $rhs = $curve->convertToAffine($rhs); + return $lhs[0]->equals($rhs[0]) && $lhs[1]->equals($rhs[1]); + } + $params = $format::load($signature); + if ($params === \false || count($params) != 2) { + return \false; + } + extract($params); + if (self::$engines['OpenSSL'] && in_array($this->hash->getHash(), openssl_get_md_methods())) { + $sig = $format != 'ASN1' ? ASN1Signature::save($r, $s) : $signature; + $result = openssl_verify($message, $sig, $this->toString('PKCS8', ['namedCurve' => \false]), $this->hash->getHash()); + if ($result != -1) { + return (bool) $result; + } + } + $n_1 = $order->subtract(self::$one); + if (!$r->between(self::$one, $n_1) || !$s->between(self::$one, $n_1)) { + return \false; + } + $e = $this->hash->hash($message); + $e = new BigInteger($e, 256); + $Ln = $this->hash->getLength() - $order->getLength(); + $z = $Ln > 0 ? $e->bitwise_rightShift($Ln) : $e; + $w = $s->modInverse($order); + list(, $u1) = $z->multiply($w)->divide($order); + list(, $u2) = $r->multiply($w)->divide($order); + $u1 = $this->curve->convertInteger($u1); + $u2 = $this->curve->convertInteger($u2); + list($x1, $y1) = $this->curve->multiplyAddPoints([$this->curve->getBasePoint(), $this->QA], [$u1, $u2]); + $x1 = $x1->toBigInteger(); + list(, $x1) = $x1->divide($order); + return $x1->equals($r); + } + /** + * Returns the public key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePublicKey'); + return $type::savePublicKey($this->curve, $this->QA, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Hash.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Hash.php new file mode 100644 index 0000000..c7a6325 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Hash.php @@ -0,0 +1,1134 @@ + + * setKey('abcdefg'); + * + * echo base64_encode($hash->hash('abcdefg')); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2015 Jim Wigginton + * @author Andreas Fischer + * @copyright 2015 Andreas Fischer + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; +/** + * @author Jim Wigginton + * @author Andreas Fischer + */ +class Hash +{ + /** + * Padding Types + * + */ + const PADDING_KECCAK = 1; + /** + * Padding Types + * + */ + const PADDING_SHA3 = 2; + /** + * Padding Types + * + */ + const PADDING_SHAKE = 3; + /** + * Padding Type + * + * Only used by SHA3 + * + * @var int + */ + private $paddingType = 0; + /** + * Hash Parameter + * + * @see self::setHash() + * @var int + */ + private $hashParam; + /** + * Byte-length of hash output (Internal HMAC) + * + * @see self::setHash() + * @var int + */ + private $length; + /** + * Hash Algorithm + * + * @see self::setHash() + * @var string + */ + private $algo; + /** + * Key + * + * @see self::setKey() + * @var string + */ + private $key = \false; + /** + * Nonce + * + * @see self::setNonce() + * @var string + */ + private $nonce = \false; + /** + * Hash Parameters + * + * @var array + */ + private $parameters = []; + /** + * Computed Key + * + * @see self::_computeKey() + * @var string + */ + private $computedKey = \false; + /** + * Outer XOR (Internal HMAC) + * + * Used only for sha512/* + * + * @see self::hash() + * @var string + */ + private $opad; + /** + * Inner XOR (Internal HMAC) + * + * Used only for sha512/* + * + * @see self::hash() + * @var string + */ + private $ipad; + /** + * Recompute AES Key + * + * Used only for umac + * + * @see self::hash() + * @var boolean + */ + private $recomputeAESKey; + /** + * umac cipher object + * + * @see self::hash() + * @var \phpseclib3\Crypt\AES + */ + private $c; + /** + * umac pad + * + * @see self::hash() + * @var string + */ + private $pad; + /** + * Block Size + * + * @var int + */ + private $blockSize; + /**#@+ + * UMAC variables + * + * @var PrimeField + */ + private static $factory36; + private static $factory64; + private static $factory128; + private static $offset64; + private static $offset128; + private static $marker64; + private static $marker128; + private static $maxwordrange64; + private static $maxwordrange128; + /**#@-*/ + /** + * Default Constructor. + * + * @param string $hash + */ + public function __construct($hash = 'sha256') + { + $this->setHash($hash); + } + /** + * Sets the key for HMACs + * + * Keys can be of any length. + * + * @param string $key + */ + public function setKey($key = \false) + { + $this->key = $key; + $this->computeKey(); + $this->recomputeAESKey = \true; + } + /** + * Sets the nonce for UMACs + * + * Keys can be of any length. + * + * @param string $nonce + */ + public function setNonce($nonce = \false) + { + switch (\true) { + case !is_string($nonce): + case strlen($nonce) > 0 && strlen($nonce) <= 16: + $this->recomputeAESKey = \true; + $this->nonce = $nonce; + return; + } + throw new \LengthException('The nonce length must be between 1 and 16 bytes, inclusive'); + } + /** + * Pre-compute the key used by the HMAC + * + * Quoting http://tools.ietf.org/html/rfc2104#section-2, "Applications that use keys longer than B bytes + * will first hash the key using H and then use the resultant L byte string as the actual key to HMAC." + * + * As documented in https://www.reddit.com/r/PHP/comments/9nct2l/symfonypolyfill_hash_pbkdf2_correct_fix_for/ + * when doing an HMAC multiple times it's faster to compute the hash once instead of computing it during + * every call + * + */ + private function computeKey() + { + if ($this->key === \false) { + $this->computedKey = \false; + return; + } + if (strlen($this->key) <= $this->getBlockLengthInBytes()) { + $this->computedKey = $this->key; + return; + } + $this->computedKey = is_array($this->algo) ? call_user_func($this->algo, $this->key) : hash($this->algo, $this->key, \true); + } + /** + * Gets the hash function. + * + * As set by the constructor or by the setHash() method. + * + * @return string + */ + public function getHash() + { + return $this->hashParam; + } + /** + * Sets the hash function. + * + * @param string $hash + */ + public function setHash($hash) + { + $this->hashParam = $hash = strtolower($hash); + switch ($hash) { + case 'umac-32': + case 'umac-64': + case 'umac-96': + case 'umac-128': + $this->blockSize = 128; + $this->length = abs(substr($hash, -3)) >> 3; + $this->algo = 'umac'; + return; + case 'md2-96': + case 'md5-96': + case 'sha1-96': + case 'sha224-96': + case 'sha256-96': + case 'sha384-96': + case 'sha512-96': + case 'sha512/224-96': + case 'sha512/256-96': + $hash = substr($hash, 0, -3); + $this->length = 12; + // 96 / 8 = 12 + break; + case 'md2': + case 'md5': + $this->length = 16; + break; + case 'sha1': + $this->length = 20; + break; + case 'sha224': + case 'sha512/224': + case 'sha3-224': + $this->length = 28; + break; + case 'keccak256': + $this->paddingType = self::PADDING_KECCAK; + // fall-through + case 'sha256': + case 'sha512/256': + case 'sha3-256': + $this->length = 32; + break; + case 'sha384': + case 'sha3-384': + $this->length = 48; + break; + case 'sha512': + case 'sha3-512': + $this->length = 64; + break; + default: + if (preg_match('#^(shake(?:128|256))-(\\d+)$#', $hash, $matches)) { + $this->paddingType = self::PADDING_SHAKE; + $hash = $matches[1]; + $this->length = $matches[2] >> 3; + } else { + throw new UnsupportedAlgorithmException("{$hash} is not a supported algorithm"); + } + } + switch ($hash) { + case 'md2': + case 'md2-96': + $this->blockSize = 128; + break; + case 'md5-96': + case 'sha1-96': + case 'sha224-96': + case 'sha256-96': + case 'md5': + case 'sha1': + case 'sha224': + case 'sha256': + $this->blockSize = 512; + break; + case 'sha3-224': + $this->blockSize = 1152; + // 1600 - 2*224 + break; + case 'sha3-256': + case 'shake256': + case 'keccak256': + $this->blockSize = 1088; + // 1600 - 2*256 + break; + case 'sha3-384': + $this->blockSize = 832; + // 1600 - 2*384 + break; + case 'sha3-512': + $this->blockSize = 576; + // 1600 - 2*512 + break; + case 'shake128': + $this->blockSize = 1344; + // 1600 - 2*128 + break; + default: + $this->blockSize = 1024; + } + if (in_array(substr($hash, 0, 5), ['sha3-', 'shake', 'kecca'])) { + // PHP 7.1.0 introduced support for "SHA3 fixed mode algorithms": + // http://php.net/ChangeLog-7.php#7.1.0 + if (version_compare(\PHP_VERSION, '7.1.0') < 0 || substr($hash, 0, 5) != 'sha3-') { + //preg_match('#(\d+)$#', $hash, $matches); + //$this->parameters['capacity'] = 2 * $matches[1]; // 1600 - $this->blockSize + //$this->parameters['rate'] = 1600 - $this->parameters['capacity']; // == $this->blockSize + if (!$this->paddingType) { + $this->paddingType = self::PADDING_SHA3; + } + $this->parameters = ['capacity' => 1600 - $this->blockSize, 'rate' => $this->blockSize, 'length' => $this->length, 'padding' => $this->paddingType]; + $hash = ['Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Hash', \PHP_INT_SIZE == 8 ? 'sha3_64' : 'sha3_32']; + } + } + if ($hash == 'sha512/224' || $hash == 'sha512/256') { + // PHP 7.1.0 introduced sha512/224 and sha512/256 support: + // http://php.net/ChangeLog-7.php#7.1.0 + if (version_compare(\PHP_VERSION, '7.1.0') < 0) { + // from http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf#page=24 + $initial = $hash == 'sha512/256' ? ['22312194FC2BF72C', '9F555FA3C84C64C2', '2393B86B6F53B151', '963877195940EABD', '96283EE2A88EFFE3', 'BE5E1E2553863992', '2B0199FC2C85B8AA', '0EB72DDC81C52CA2'] : ['8C3D37C819544DA2', '73E1996689DCD4D6', '1DFAB7AE32FF9C82', '679DD514582F9FCF', '0F6D2B697BD44DA8', '77E36F7304C48942', '3F9D85A86A1D36C8', '1112E6AD91D692A1']; + for ($i = 0; $i < 8; $i++) { + $initial[$i] = new BigInteger($initial[$i], 16); + $initial[$i]->setPrecision(64); + } + $this->parameters = compact('initial'); + $hash = ['Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Hash', 'sha512']; + } + } + if (is_array($hash)) { + $b = $this->blockSize >> 3; + $this->ipad = str_repeat(chr(0x36), $b); + $this->opad = str_repeat(chr(0x5c), $b); + } + $this->algo = $hash; + $this->computeKey(); + } + /** + * KDF: Key-Derivation Function + * + * The key-derivation function generates pseudorandom bits used to key the hash functions. + * + * @param int $index a non-negative integer less than 2^64 + * @param int $numbytes a non-negative integer less than 2^64 + * @return string string of length numbytes bytes + */ + private function kdf($index, $numbytes) + { + $this->c->setIV(pack('N4', 0, $index, 0, 1)); + return $this->c->encrypt(str_repeat("\x00", $numbytes)); + } + /** + * PDF Algorithm + * + * @return string string of length taglen bytes. + */ + private function pdf() + { + $k = $this->key; + $nonce = $this->nonce; + $taglen = $this->length; + // + // Extract and zero low bit(s) of Nonce if needed + // + if ($taglen <= 8) { + $last = strlen($nonce) - 1; + $mask = $taglen == 4 ? "\x03" : "\x01"; + $index = $nonce[$last] & $mask; + $nonce[$last] = $nonce[$last] ^ $index; + } + // + // Make Nonce BLOCKLEN bytes by appending zeroes if needed + // + $nonce = str_pad($nonce, 16, "\x00"); + // + // Generate subkey, encipher and extract indexed substring + // + $kp = $this->kdf(0, 16); + $c = new AES('ctr'); + $c->disablePadding(); + $c->setKey($kp); + $c->setIV($nonce); + $t = $c->encrypt("\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"); + // we could use ord() but per https://paragonie.com/blog/2016/06/constant-time-encoding-boring-cryptography-rfc-4648-and-you + // unpack() doesn't leak timing info + return $taglen <= 8 ? substr($t, unpack('C', $index)[1] * $taglen, $taglen) : substr($t, 0, $taglen); + } + /** + * UHASH Algorithm + * + * @param string $m string of length less than 2^67 bits. + * @param int $taglen the integer 4, 8, 12 or 16. + * @return string string of length taglen bytes. + */ + private function uhash($m, $taglen) + { + // + // One internal iteration per 4 bytes of output + // + $iters = $taglen >> 2; + // + // Define total key needed for all iterations using KDF. + // L1Key reuses most key material between iterations. + // + //$L1Key = $this->kdf(1, 1024 + ($iters - 1) * 16); + $L1Key = $this->kdf(1, (1024 + ($iters - 1)) * 16); + $L2Key = $this->kdf(2, $iters * 24); + $L3Key1 = $this->kdf(3, $iters * 64); + $L3Key2 = $this->kdf(4, $iters * 4); + // + // For each iteration, extract key and do three-layer hash. + // If bytelength(M) <= 1024, then skip L2-HASH. + // + $y = ''; + for ($i = 0; $i < $iters; $i++) { + $L1Key_i = substr($L1Key, $i * 16, 1024); + $L2Key_i = substr($L2Key, $i * 24, 24); + $L3Key1_i = substr($L3Key1, $i * 64, 64); + $L3Key2_i = substr($L3Key2, $i * 4, 4); + $a = self::L1Hash($L1Key_i, $m); + $b = strlen($m) <= 1024 ? "\x00\x00\x00\x00\x00\x00\x00\x00{$a}" : self::L2Hash($L2Key_i, $a); + $c = self::L3Hash($L3Key1_i, $L3Key2_i, $b); + $y .= $c; + } + return $y; + } + /** + * L1-HASH Algorithm + * + * The first-layer hash breaks the message into 1024-byte chunks and + * hashes each with a function called NH. Concatenating the results + * forms a string, which is up to 128 times shorter than the original. + * + * @param string $k string of length 1024 bytes. + * @param string $m string of length less than 2^67 bits. + * @return string string of length (8 * ceil(bitlength(M)/8192)) bytes. + */ + private static function L1Hash($k, $m) + { + // + // Break M into 1024 byte chunks (final chunk may be shorter) + // + $m = str_split($m, 1024); + // + // For each chunk, except the last: endian-adjust, NH hash + // and add bit-length. Use results to build Y. + // + $length = new BigInteger(1024 * 8); + $y = ''; + for ($i = 0; $i < count($m) - 1; $i++) { + $m[$i] = pack('N*', ...unpack('V*', $m[$i])); + // ENDIAN-SWAP + $y .= static::nh($k, $m[$i], $length); + } + // + // For the last chunk: pad to 32-byte boundary, endian-adjust, + // NH hash and add bit-length. Concatenate the result to Y. + // + $length = count($m) ? strlen($m[$i]) : 0; + $pad = 32 - $length % 32; + $pad = max(32, $length + $pad % 32); + $m[$i] = str_pad(isset($m[$i]) ? $m[$i] : '', $pad, "\x00"); + // zeropad + $m[$i] = pack('N*', ...unpack('V*', $m[$i])); + // ENDIAN-SWAP + $y .= static::nh($k, $m[$i], new BigInteger($length * 8)); + return $y; + } + /** + * NH Algorithm + * + * @param string $k string of length 1024 bytes. + * @param string $m string with length divisible by 32 bytes. + * @return string string of length 8 bytes. + */ + private static function nh($k, $m, $length) + { + $toUInt32 = function ($x) { + $x = new BigInteger($x, 256); + $x->setPrecision(32); + return $x; + }; + // + // Break M and K into 4-byte chunks + // + //$t = strlen($m) >> 2; + $m = str_split($m, 4); + $t = count($m); + $k = str_split($k, 4); + $k = array_pad(array_slice($k, 0, $t), $t, 0); + $m = array_map($toUInt32, $m); + $k = array_map($toUInt32, $k); + // + // Perform NH hash on the chunks, pairing words for multiplication + // which are 4 apart to accommodate vector-parallelism. + // + $y = new BigInteger(); + $y->setPrecision(64); + $i = 0; + while ($i < $t) { + $temp = $m[$i]->add($k[$i]); + $temp->setPrecision(64); + $temp = $temp->multiply($m[$i + 4]->add($k[$i + 4])); + $y = $y->add($temp); + $temp = $m[$i + 1]->add($k[$i + 1]); + $temp->setPrecision(64); + $temp = $temp->multiply($m[$i + 5]->add($k[$i + 5])); + $y = $y->add($temp); + $temp = $m[$i + 2]->add($k[$i + 2]); + $temp->setPrecision(64); + $temp = $temp->multiply($m[$i + 6]->add($k[$i + 6])); + $y = $y->add($temp); + $temp = $m[$i + 3]->add($k[$i + 3]); + $temp->setPrecision(64); + $temp = $temp->multiply($m[$i + 7]->add($k[$i + 7])); + $y = $y->add($temp); + $i += 8; + } + return $y->add($length)->toBytes(); + } + /** + * L2-HASH: Second-Layer Hash + * + * The second-layer rehashes the L1-HASH output using a polynomial hash + * called POLY. If the L1-HASH output is long, then POLY is called once + * on a prefix of the L1-HASH output and called using different settings + * on the remainder. (This two-step hashing of the L1-HASH output is + * needed only if the message length is greater than 16 megabytes.) + * Careful implementation of POLY is necessary to avoid a possible + * timing attack (see Section 6.6 for more information). + * + * @param string $k string of length 24 bytes. + * @param string $m string of length less than 2^64 bytes. + * @return string string of length 16 bytes. + */ + private static function L2Hash($k, $m) + { + // + // Extract keys and restrict to special key-sets + // + $k64 = $k & "\x01\xff\xff\xff\x01\xff\xff\xff"; + $k64 = new BigInteger($k64, 256); + $k128 = substr($k, 8) & "\x01\xff\xff\xff\x01\xff\xff\xff\x01\xff\xff\xff\x01\xff\xff\xff"; + $k128 = new BigInteger($k128, 256); + // + // If M is no more than 2^17 bytes, hash under 64-bit prime, + // otherwise, hash first 2^17 bytes under 64-bit prime and + // remainder under 128-bit prime. + // + if (strlen($m) <= 0x20000) { + // 2^14 64-bit words + $y = self::poly(64, self::$maxwordrange64, $k64, $m); + } else { + $m_1 = substr($m, 0, 0x20000); + // 1 << 17 + $m_2 = substr($m, 0x20000) . "\x80"; + $length = strlen($m_2); + $pad = 16 - $length % 16; + $pad %= 16; + $m_2 = str_pad($m_2, $length + $pad, "\x00"); + // zeropad + $y = self::poly(64, self::$maxwordrange64, $k64, $m_1); + $y = str_pad($y, 16, "\x00", \STR_PAD_LEFT); + $y = self::poly(128, self::$maxwordrange128, $k128, $y . $m_2); + } + return str_pad($y, 16, "\x00", \STR_PAD_LEFT); + } + /** + * POLY Algorithm + * + * @param int $wordbits the integer 64 or 128. + * @param BigInteger $maxwordrange positive integer less than 2^wordbits. + * @param BigInteger $k integer in the range 0 ... prime(wordbits) - 1. + * @param string $m string with length divisible by (wordbits / 8) bytes. + * @return integer in the range 0 ... prime(wordbits) - 1. + */ + private static function poly($wordbits, $maxwordrange, $k, $m) + { + // + // Define constants used for fixing out-of-range words + // + $wordbytes = $wordbits >> 3; + if ($wordbits == 128) { + $factory = self::$factory128; + $offset = self::$offset128; + $marker = self::$marker128; + } else { + $factory = self::$factory64; + $offset = self::$offset64; + $marker = self::$marker64; + } + $k = $factory->newInteger($k); + // + // Break M into chunks of length wordbytes bytes + // + $m_i = str_split($m, $wordbytes); + // + // Each input word m is compared with maxwordrange. If not smaller + // then 'marker' and (m - offset), both in range, are hashed. + // + $y = $factory->newInteger(new BigInteger(1)); + foreach ($m_i as $m) { + $m = $factory->newInteger(new BigInteger($m, 256)); + if ($m->compare($maxwordrange) >= 0) { + $y = $k->multiply($y)->add($marker); + $y = $k->multiply($y)->add($m->subtract($offset)); + } else { + $y = $k->multiply($y)->add($m); + } + } + return $y->toBytes(); + } + /** + * L3-HASH: Third-Layer Hash + * + * The output from L2-HASH is 16 bytes long. This final hash function + * hashes the 16-byte string to a fixed length of 4 bytes. + * + * @param string $k1 string of length 64 bytes. + * @param string $k2 string of length 4 bytes. + * @param string $m string of length 16 bytes. + * @return string string of length 4 bytes. + */ + private static function L3Hash($k1, $k2, $m) + { + $factory = self::$factory36; + $y = $factory->newInteger(new BigInteger()); + for ($i = 0; $i < 8; $i++) { + $m_i = $factory->newInteger(new BigInteger(substr($m, 2 * $i, 2), 256)); + $k_i = $factory->newInteger(new BigInteger(substr($k1, 8 * $i, 8), 256)); + $y = $y->add($m_i->multiply($k_i)); + } + $y = str_pad(substr($y->toBytes(), -4), 4, "\x00", \STR_PAD_LEFT); + $y = $y ^ $k2; + return $y; + } + /** + * Compute the Hash / HMAC / UMAC. + * + * @param string $text + * @return string + */ + public function hash($text) + { + $algo = $this->algo; + if ($algo == 'umac') { + if ($this->recomputeAESKey) { + if (!is_string($this->nonce)) { + throw new InsufficientSetupException('No nonce has been set'); + } + if (!is_string($this->key)) { + throw new InsufficientSetupException('No key has been set'); + } + if (strlen($this->key) != 16) { + throw new \LengthException('Key must be 16 bytes long'); + } + if (!isset(self::$maxwordrange64)) { + $one = new BigInteger(1); + $prime36 = new BigInteger("\x00\x00\x00\x0f\xff\xff\xff\xfb", 256); + self::$factory36 = new PrimeField($prime36); + $prime64 = new BigInteger("\xff\xff\xff\xff\xff\xff\xff\xc5", 256); + self::$factory64 = new PrimeField($prime64); + $prime128 = new BigInteger("\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffa", 256); + self::$factory128 = new PrimeField($prime128); + self::$offset64 = new BigInteger("\x01\x00\x00\x00\x00\x00\x00\x00\x00", 256); + self::$offset64 = self::$factory64->newInteger(self::$offset64->subtract($prime64)); + self::$offset128 = new BigInteger("\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 256); + self::$offset128 = self::$factory128->newInteger(self::$offset128->subtract($prime128)); + self::$marker64 = self::$factory64->newInteger($prime64->subtract($one)); + self::$marker128 = self::$factory128->newInteger($prime128->subtract($one)); + $maxwordrange64 = $one->bitwise_leftShift(64)->subtract($one->bitwise_leftShift(32)); + self::$maxwordrange64 = self::$factory64->newInteger($maxwordrange64); + $maxwordrange128 = $one->bitwise_leftShift(128)->subtract($one->bitwise_leftShift(96)); + self::$maxwordrange128 = self::$factory128->newInteger($maxwordrange128); + } + $this->c = new AES('ctr'); + $this->c->disablePadding(); + $this->c->setKey($this->key); + $this->pad = $this->pdf(); + $this->recomputeAESKey = \false; + } + $hashedmessage = $this->uhash($text, $this->length); + return $hashedmessage ^ $this->pad; + } + if (is_array($algo)) { + if (empty($this->key) || !is_string($this->key)) { + return substr($algo($text, ...array_values($this->parameters)), 0, $this->length); + } + // SHA3 HMACs are discussed at https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf#page=30 + $key = str_pad($this->computedKey, $b, chr(0)); + $temp = $this->ipad ^ $key; + $temp .= $text; + $temp = substr($algo($temp, ...array_values($this->parameters)), 0, $this->length); + $output = $this->opad ^ $key; + $output .= $temp; + $output = $algo($output, ...array_values($this->parameters)); + return substr($output, 0, $this->length); + } + $output = !empty($this->key) || is_string($this->key) ? hash_hmac($algo, $text, $this->computedKey, \true) : hash($algo, $text, \true); + return strlen($output) > $this->length ? substr($output, 0, $this->length) : $output; + } + /** + * Returns the hash length (in bits) + * + * @return int + */ + public function getLength() + { + return $this->length << 3; + } + /** + * Returns the hash length (in bytes) + * + * @return int + */ + public function getLengthInBytes() + { + return $this->length; + } + /** + * Returns the block length (in bits) + * + * @return int + */ + public function getBlockLength() + { + return $this->blockSize; + } + /** + * Returns the block length (in bytes) + * + * @return int + */ + public function getBlockLengthInBytes() + { + return $this->blockSize >> 3; + } + /** + * Pads SHA3 based on the mode + * + * @param int $padLength + * @param int $padType + * @return string + */ + private static function sha3_pad($padLength, $padType) + { + switch ($padType) { + case self::PADDING_KECCAK: + $temp = chr(0x1) . str_repeat("\x00", $padLength - 1); + $temp[$padLength - 1] = $temp[$padLength - 1] | chr(0x80); + return $temp; + case self::PADDING_SHAKE: + $temp = chr(0x1f) . str_repeat("\x00", $padLength - 1); + $temp[$padLength - 1] = $temp[$padLength - 1] | chr(0x80); + return $temp; + //case self::PADDING_SHA3: + default: + // from https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf#page=36 + return $padLength == 1 ? chr(0x86) : chr(0x6) . str_repeat("\x00", $padLength - 2) . chr(0x80); + } + } + /** + * Pure-PHP 32-bit implementation of SHA3 + * + * Whereas BigInteger.php's 32-bit engine works on PHP 64-bit this 32-bit implementation + * of SHA3 will *not* work on PHP 64-bit. This is because this implementation + * employees bitwise NOTs and bitwise left shifts. And the round constants only work + * on 32-bit PHP. eg. dechex(-2147483648) returns 80000000 on 32-bit PHP and + * FFFFFFFF80000000 on 64-bit PHP. Sure, we could do bitwise ANDs but that would slow + * things down. + * + * SHA512 requires BigInteger to simulate 64-bit unsigned integers because SHA2 employees + * addition whereas SHA3 just employees bitwise operators. PHP64 only supports signed + * 64-bit integers, which complicates addition, whereas that limitation isn't an issue + * for SHA3. + * + * In https://ws680.nist.gov/publication/get_pdf.cfm?pub_id=919061#page=16 KECCAK[C] is + * defined as "the KECCAK instance with KECCAK-f[1600] as the underlying permutation and + * capacity c". This is relevant because, altho the KECCAK standard defines a mode + * (KECCAK-f[800]) designed for 32-bit machines that mode is incompatible with SHA3 + * + * @param string $p + * @param int $c + * @param int $r + * @param int $d + * @param int $padType + */ + private static function sha3_32($p, $c, $r, $d, $padType) + { + $block_size = $r >> 3; + $padLength = $block_size - strlen($p) % $block_size; + $num_ints = $block_size >> 2; + $p .= static::sha3_pad($padLength, $padType); + $n = strlen($p) / $r; + // number of blocks + $s = [[[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]], [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]]; + $p = str_split($p, $block_size); + foreach ($p as $pi) { + $pi = unpack('V*', $pi); + $x = $y = 0; + for ($i = 1; $i <= $num_ints; $i += 2) { + $s[$x][$y][0] ^= $pi[$i + 1]; + $s[$x][$y][1] ^= $pi[$i]; + if (++$y == 5) { + $y = 0; + $x++; + } + } + static::processSHA3Block32($s); + } + $z = ''; + $i = $j = 0; + while (strlen($z) < $d) { + $z .= pack('V2', $s[$i][$j][1], $s[$i][$j++][0]); + if ($j == 5) { + $j = 0; + $i++; + if ($i == 5) { + $i = 0; + static::processSHA3Block32($s); + } + } + } + return $z; + } + /** + * 32-bit block processing method for SHA3 + * + * @param array $s + */ + private static function processSHA3Block32(&$s) + { + static $rotationOffsets = [[0, 1, 62, 28, 27], [36, 44, 6, 55, 20], [3, 10, 43, 25, 39], [41, 45, 15, 21, 8], [18, 2, 61, 56, 14]]; + // the standards give these constants in hexadecimal notation. it's tempting to want to use + // that same notation, here, however, we can't, because 0x80000000, on PHP32, is a positive + // float - not the negative int that we need to be in PHP32. so we use -2147483648 instead + static $roundConstants = [[0, 1], [0, 32898], [-2147483648, 32906], [-2147483648, -2147450880], [0, 32907], [0, -2147483647], [-2147483648, -2147450751], [-2147483648, 32777], [0, 138], [0, 136], [0, -2147450871], [0, -2147483638], [0, -2147450741], [-2147483648, 139], [-2147483648, 32905], [-2147483648, 32771], [-2147483648, 32770], [-2147483648, 128], [0, 32778], [-2147483648, -2147483638], [-2147483648, -2147450751], [-2147483648, 32896], [0, -2147483647], [-2147483648, -2147450872]]; + for ($round = 0; $round < 24; $round++) { + // theta step + $parity = $rotated = []; + for ($i = 0; $i < 5; $i++) { + $parity[] = [$s[0][$i][0] ^ $s[1][$i][0] ^ $s[2][$i][0] ^ $s[3][$i][0] ^ $s[4][$i][0], $s[0][$i][1] ^ $s[1][$i][1] ^ $s[2][$i][1] ^ $s[3][$i][1] ^ $s[4][$i][1]]; + $rotated[] = static::rotateLeft32($parity[$i], 1); + } + $temp = [[$parity[4][0] ^ $rotated[1][0], $parity[4][1] ^ $rotated[1][1]], [$parity[0][0] ^ $rotated[2][0], $parity[0][1] ^ $rotated[2][1]], [$parity[1][0] ^ $rotated[3][0], $parity[1][1] ^ $rotated[3][1]], [$parity[2][0] ^ $rotated[4][0], $parity[2][1] ^ $rotated[4][1]], [$parity[3][0] ^ $rotated[0][0], $parity[3][1] ^ $rotated[0][1]]]; + for ($i = 0; $i < 5; $i++) { + for ($j = 0; $j < 5; $j++) { + $s[$i][$j][0] ^= $temp[$j][0]; + $s[$i][$j][1] ^= $temp[$j][1]; + } + } + $st = $s; + // rho and pi steps + for ($i = 0; $i < 5; $i++) { + for ($j = 0; $j < 5; $j++) { + $st[(2 * $i + 3 * $j) % 5][$j] = static::rotateLeft32($s[$j][$i], $rotationOffsets[$j][$i]); + } + } + // chi step + for ($i = 0; $i < 5; $i++) { + $s[$i][0] = [$st[$i][0][0] ^ ~$st[$i][1][0] & $st[$i][2][0], $st[$i][0][1] ^ ~$st[$i][1][1] & $st[$i][2][1]]; + $s[$i][1] = [$st[$i][1][0] ^ ~$st[$i][2][0] & $st[$i][3][0], $st[$i][1][1] ^ ~$st[$i][2][1] & $st[$i][3][1]]; + $s[$i][2] = [$st[$i][2][0] ^ ~$st[$i][3][0] & $st[$i][4][0], $st[$i][2][1] ^ ~$st[$i][3][1] & $st[$i][4][1]]; + $s[$i][3] = [$st[$i][3][0] ^ ~$st[$i][4][0] & $st[$i][0][0], $st[$i][3][1] ^ ~$st[$i][4][1] & $st[$i][0][1]]; + $s[$i][4] = [$st[$i][4][0] ^ ~$st[$i][0][0] & $st[$i][1][0], $st[$i][4][1] ^ ~$st[$i][0][1] & $st[$i][1][1]]; + } + // iota step + $s[0][0][0] ^= $roundConstants[$round][0]; + $s[0][0][1] ^= $roundConstants[$round][1]; + } + } + /** + * Rotate 32-bit int + * + * @param array $x + * @param int $shift + */ + private static function rotateLeft32($x, $shift) + { + if ($shift < 32) { + list($hi, $lo) = $x; + } else { + $shift -= 32; + list($lo, $hi) = $x; + } + return [$hi << $shift | $lo >> 32 - $shift & (1 << $shift) - 1, $lo << $shift | $hi >> 32 - $shift & (1 << $shift) - 1]; + } + /** + * Pure-PHP 64-bit implementation of SHA3 + * + * @param string $p + * @param int $c + * @param int $r + * @param int $d + * @param int $padType + */ + private static function sha3_64($p, $c, $r, $d, $padType) + { + $block_size = $r >> 3; + $padLength = $block_size - strlen($p) % $block_size; + $num_ints = $block_size >> 2; + $p .= static::sha3_pad($padLength, $padType); + $n = strlen($p) / $r; + // number of blocks + $s = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]]; + $p = str_split($p, $block_size); + foreach ($p as $pi) { + $pi = unpack('P*', $pi); + $x = $y = 0; + foreach ($pi as $subpi) { + $s[$x][$y++] ^= $subpi; + if ($y == 5) { + $y = 0; + $x++; + } + } + static::processSHA3Block64($s); + } + $z = ''; + $i = $j = 0; + while (strlen($z) < $d) { + $z .= pack('P', $s[$i][$j++]); + if ($j == 5) { + $j = 0; + $i++; + if ($i == 5) { + $i = 0; + static::processSHA3Block64($s); + } + } + } + return $z; + } + /** + * 64-bit block processing method for SHA3 + * + * @param array $s + */ + private static function processSHA3Block64(&$s) + { + static $rotationOffsets = [[0, 1, 62, 28, 27], [36, 44, 6, 55, 20], [3, 10, 43, 25, 39], [41, 45, 15, 21, 8], [18, 2, 61, 56, 14]]; + static $roundConstants = [1, 32898, -9223372036854742902, -9223372034707259392, 32907, 2147483649, -9223372034707259263, -9223372036854743031, 138, 136, 2147516425, 2147483658, 2147516555, -9223372036854775669, -9223372036854742903, -9223372036854743037, -9223372036854743038, -9223372036854775680, 32778, -9223372034707292150, -9223372034707259263, -9223372036854742912, 2147483649, -9223372034707259384]; + for ($round = 0; $round < 24; $round++) { + // theta step + $parity = []; + for ($i = 0; $i < 5; $i++) { + $parity[] = $s[0][$i] ^ $s[1][$i] ^ $s[2][$i] ^ $s[3][$i] ^ $s[4][$i]; + } + $temp = [$parity[4] ^ static::rotateLeft64($parity[1], 1), $parity[0] ^ static::rotateLeft64($parity[2], 1), $parity[1] ^ static::rotateLeft64($parity[3], 1), $parity[2] ^ static::rotateLeft64($parity[4], 1), $parity[3] ^ static::rotateLeft64($parity[0], 1)]; + for ($i = 0; $i < 5; $i++) { + for ($j = 0; $j < 5; $j++) { + $s[$i][$j] ^= $temp[$j]; + } + } + $st = $s; + // rho and pi steps + for ($i = 0; $i < 5; $i++) { + for ($j = 0; $j < 5; $j++) { + $st[(2 * $i + 3 * $j) % 5][$j] = static::rotateLeft64($s[$j][$i], $rotationOffsets[$j][$i]); + } + } + // chi step + for ($i = 0; $i < 5; $i++) { + $s[$i] = [$st[$i][0] ^ ~$st[$i][1] & $st[$i][2], $st[$i][1] ^ ~$st[$i][2] & $st[$i][3], $st[$i][2] ^ ~$st[$i][3] & $st[$i][4], $st[$i][3] ^ ~$st[$i][4] & $st[$i][0], $st[$i][4] ^ ~$st[$i][0] & $st[$i][1]]; + } + // iota step + $s[0][0] ^= $roundConstants[$round]; + } + } + /** + * Rotate 64-bit int + * + * @param int $x + * @param int $shift + */ + private static function rotateLeft64($x, $shift) + { + return $x << $shift | $x >> 64 - $shift & (1 << $shift) - 1; + } + /** + * Pure-PHP implementation of SHA512 + * + * @param string $m + * @param array $hash + * @return string + */ + private static function sha512($m, $hash) + { + static $k; + if (!isset($k)) { + // Initialize table of round constants + // (first 64 bits of the fractional parts of the cube roots of the first 80 primes 2..409) + $k = ['428a2f98d728ae22', '7137449123ef65cd', 'b5c0fbcfec4d3b2f', 'e9b5dba58189dbbc', '3956c25bf348b538', '59f111f1b605d019', '923f82a4af194f9b', 'ab1c5ed5da6d8118', 'd807aa98a3030242', '12835b0145706fbe', '243185be4ee4b28c', '550c7dc3d5ffb4e2', '72be5d74f27b896f', '80deb1fe3b1696b1', '9bdc06a725c71235', 'c19bf174cf692694', 'e49b69c19ef14ad2', 'efbe4786384f25e3', '0fc19dc68b8cd5b5', '240ca1cc77ac9c65', '2de92c6f592b0275', '4a7484aa6ea6e483', '5cb0a9dcbd41fbd4', '76f988da831153b5', '983e5152ee66dfab', 'a831c66d2db43210', 'b00327c898fb213f', 'bf597fc7beef0ee4', 'c6e00bf33da88fc2', 'd5a79147930aa725', '06ca6351e003826f', '142929670a0e6e70', '27b70a8546d22ffc', '2e1b21385c26c926', '4d2c6dfc5ac42aed', '53380d139d95b3df', '650a73548baf63de', '766a0abb3c77b2a8', '81c2c92e47edaee6', '92722c851482353b', 'a2bfe8a14cf10364', 'a81a664bbc423001', 'c24b8b70d0f89791', 'c76c51a30654be30', 'd192e819d6ef5218', 'd69906245565a910', 'f40e35855771202a', '106aa07032bbd1b8', '19a4c116b8d2d0c8', '1e376c085141ab53', '2748774cdf8eeb99', '34b0bcb5e19b48a8', '391c0cb3c5c95a63', '4ed8aa4ae3418acb', '5b9cca4f7763e373', '682e6ff3d6b2b8a3', '748f82ee5defb2fc', '78a5636f43172f60', '84c87814a1f0ab72', '8cc702081a6439ec', '90befffa23631e28', 'a4506cebde82bde9', 'bef9a3f7b2c67915', 'c67178f2e372532b', 'ca273eceea26619c', 'd186b8c721c0c207', 'eada7dd6cde0eb1e', 'f57d4f7fee6ed178', '06f067aa72176fba', '0a637dc5a2c898a6', '113f9804bef90dae', '1b710b35131c471b', '28db77f523047d84', '32caab7b40c72493', '3c9ebe0a15c9bebc', '431d67c49c100d4c', '4cc5d4becb3e42b6', '597f299cfc657e2a', '5fcb6fab3ad6faec', '6c44198c4a475817']; + for ($i = 0; $i < 80; $i++) { + $k[$i] = new BigInteger($k[$i], 16); + } + } + // Pre-processing + $length = strlen($m); + // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128 + $m .= str_repeat(chr(0), 128 - ($length + 16 & 0x7f)); + $m[$length] = chr(0x80); + // we don't support hashing strings 512MB long + $m .= pack('N4', 0, 0, 0, $length << 3); + // Process the message in successive 1024-bit chunks + $chunks = str_split($m, 128); + foreach ($chunks as $chunk) { + $w = []; + for ($i = 0; $i < 16; $i++) { + $temp = new BigInteger(Strings::shift($chunk, 8), 256); + $temp->setPrecision(64); + $w[] = $temp; + } + // Extend the sixteen 32-bit words into eighty 32-bit words + for ($i = 16; $i < 80; $i++) { + $temp = [$w[$i - 15]->bitwise_rightRotate(1), $w[$i - 15]->bitwise_rightRotate(8), $w[$i - 15]->bitwise_rightShift(7)]; + $s0 = $temp[0]->bitwise_xor($temp[1]); + $s0 = $s0->bitwise_xor($temp[2]); + $temp = [$w[$i - 2]->bitwise_rightRotate(19), $w[$i - 2]->bitwise_rightRotate(61), $w[$i - 2]->bitwise_rightShift(6)]; + $s1 = $temp[0]->bitwise_xor($temp[1]); + $s1 = $s1->bitwise_xor($temp[2]); + $w[$i] = clone $w[$i - 16]; + $w[$i] = $w[$i]->add($s0); + $w[$i] = $w[$i]->add($w[$i - 7]); + $w[$i] = $w[$i]->add($s1); + } + // Initialize hash value for this chunk + $a = clone $hash[0]; + $b = clone $hash[1]; + $c = clone $hash[2]; + $d = clone $hash[3]; + $e = clone $hash[4]; + $f = clone $hash[5]; + $g = clone $hash[6]; + $h = clone $hash[7]; + // Main loop + for ($i = 0; $i < 80; $i++) { + $temp = [$a->bitwise_rightRotate(28), $a->bitwise_rightRotate(34), $a->bitwise_rightRotate(39)]; + $s0 = $temp[0]->bitwise_xor($temp[1]); + $s0 = $s0->bitwise_xor($temp[2]); + $temp = [$a->bitwise_and($b), $a->bitwise_and($c), $b->bitwise_and($c)]; + $maj = $temp[0]->bitwise_xor($temp[1]); + $maj = $maj->bitwise_xor($temp[2]); + $t2 = $s0->add($maj); + $temp = [$e->bitwise_rightRotate(14), $e->bitwise_rightRotate(18), $e->bitwise_rightRotate(41)]; + $s1 = $temp[0]->bitwise_xor($temp[1]); + $s1 = $s1->bitwise_xor($temp[2]); + $temp = [$e->bitwise_and($f), $g->bitwise_and($e->bitwise_not())]; + $ch = $temp[0]->bitwise_xor($temp[1]); + $t1 = $h->add($s1); + $t1 = $t1->add($ch); + $t1 = $t1->add($k[$i]); + $t1 = $t1->add($w[$i]); + $h = clone $g; + $g = clone $f; + $f = clone $e; + $e = $d->add($t1); + $d = clone $c; + $c = clone $b; + $b = clone $a; + $a = $t1->add($t2); + } + // Add this chunk's hash to result so far + $hash = [$hash[0]->add($a), $hash[1]->add($b), $hash[2]->add($c), $hash[3]->add($d), $hash[4]->add($e), $hash[5]->add($f), $hash[6]->add($g), $hash[7]->add($h)]; + } + // Produce the final hash value (big-endian) + // (\phpseclib3\Crypt\Hash::hash() trims the output for hashes but not for HMACs. as such, we trim the output here) + $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() . $hash[4]->toBytes() . $hash[5]->toBytes() . $hash[6]->toBytes() . $hash[7]->toBytes(); + return $temp; + } + /** + * __toString() magic method + */ + public function __toString() + { + return $this->getHash(); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php new file mode 100644 index 0000000..dfe2e3c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php @@ -0,0 +1,102 @@ + + * @copyright 2009 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\AsymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\NoKeyLoadedException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\X509; +/** + * PublicKeyLoader + * + * @author Jim Wigginton + */ +abstract class PublicKeyLoader +{ + /** + * Loads a public or private key + * + * @return AsymmetricKey + * @param string|array $key + * @param string $password optional + */ + public static function load($key, $password = \false) + { + try { + return EC::load($key, $password); + } catch (NoKeyLoadedException $e) { + } + try { + return RSA::load($key, $password); + } catch (NoKeyLoadedException $e) { + } + try { + return DSA::load($key, $password); + } catch (NoKeyLoadedException $e) { + } + try { + $x509 = new X509(); + $x509->loadX509($key); + $key = $x509->getPublicKey(); + if ($key) { + return $key; + } + } catch (\Exception $e) { + } + throw new NoKeyLoadedException('Unable to read key'); + } + /** + * Loads a private key + * + * @return PrivateKey + * @param string|array $key + * @param string $password optional + */ + public static function loadPrivateKey($key, $password = \false) + { + $key = self::load($key, $password); + if (!$key instanceof PrivateKey) { + throw new NoKeyLoadedException('The key that was loaded was not a private key'); + } + return $key; + } + /** + * Loads a public key + * + * @return PublicKey + * @param string|array $key + */ + public static function loadPublicKey($key) + { + $key = self::load($key); + if (!$key instanceof PublicKey) { + throw new NoKeyLoadedException('The key that was loaded was not a public key'); + } + return $key; + } + /** + * Loads parameters + * + * @return AsymmetricKey + * @param string|array $key + */ + public static function loadParameters($key) + { + $key = self::load($key); + if (!$key instanceof PrivateKey && !$key instanceof PublicKey) { + throw new NoKeyLoadedException('The key that was loaded was not a parameter'); + } + return $key; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RC2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RC2.php new file mode 100644 index 0000000..06aa9a3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RC2.php @@ -0,0 +1,478 @@ + + * setKey('abcdefgh'); + * + * $plaintext = str_repeat('a', 1024); + * + * echo $rc2->decrypt($rc2->encrypt($plaintext)); + * ?> + * + * + * @author Patrick Monnerat + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\BlockCipher; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadModeException; +/** + * Pure-PHP implementation of RC2. + * + */ +class RC2 extends BlockCipher +{ + /** + * Block Length of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::block_size + * @var int + */ + protected $block_size = 8; + /** + * The Key + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::key + * @see self::setKey() + * @var string + */ + protected $key; + /** + * The Original (unpadded) Key + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::key + * @see self::setKey() + * @see self::encrypt() + * @see self::decrypt() + * @var string + */ + private $orig_key; + /** + * Key Length (in bytes) + * + * @see \phpseclib3\Crypt\RC2::setKeyLength() + * @var int + */ + protected $key_length = 16; + // = 128 bits + /** + * The mcrypt specific name of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @var string + */ + protected $cipher_name_mcrypt = 'rc2'; + /** + * Optimizing value while CFB-encrypting + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @var int + */ + protected $cfb_init_len = 500; + /** + * The key length in bits. + * + * {@internal Should be in range [1..1024].} + * + * {@internal Changing this value after setting the key has no effect.} + * + * @see self::setKeyLength() + * @see self::setKey() + * @var int + */ + private $default_key_length = 1024; + /** + * The key length in bits. + * + * {@internal Should be in range [1..1024].} + * + * @see self::isValidEnine() + * @see self::setKey() + * @var int + */ + private $current_key_length; + /** + * The Key Schedule + * + * @see self::setupKey() + * @var array + */ + private $keys; + /** + * Key expansion randomization table. + * Twice the same 256-value sequence to save a modulus in key expansion. + * + * @see self::setKey() + * @var array + */ + private static $pitable = [0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2, 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x9, 0x81, 0x7d, 0x32, 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0xb, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82, 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc, 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26, 0x6f, 0xbf, 0xe, 0xda, 0x46, 0x69, 0x7, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x3, 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x6, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7, 0x8, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a, 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x4, 0x18, 0xa4, 0xec, 0xc2, 0xe0, 0x41, 0x6e, 0xf, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39, 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x2, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31, 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x5, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9, 0xd3, 0x0, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x1, 0x3f, 0x58, 0xe2, 0x89, 0xa9, 0xd, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0xc, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e, 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0xa, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad, 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2, 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x9, 0x81, 0x7d, 0x32, 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0xb, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82, 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc, 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26, 0x6f, 0xbf, 0xe, 0xda, 0x46, 0x69, 0x7, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x3, 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x6, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7, 0x8, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a, 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x4, 0x18, 0xa4, 0xec, 0xc2, 0xe0, 0x41, 0x6e, 0xf, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39, 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x2, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31, 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x5, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9, 0xd3, 0x0, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x1, 0x3f, 0x58, 0xe2, 0x89, 0xa9, 0xd, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0xc, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e, 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0xa, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad]; + /** + * Inverse key expansion randomization table. + * + * @see self::setKey() + * @var array + */ + private static $invpitable = [0xd1, 0xda, 0xb9, 0x6f, 0x9c, 0xc8, 0x78, 0x66, 0x80, 0x2c, 0xf8, 0x37, 0xea, 0xe0, 0x62, 0xa4, 0xcb, 0x71, 0x50, 0x27, 0x4b, 0x95, 0xd9, 0x20, 0x9d, 0x4, 0x91, 0xe3, 0x47, 0x6a, 0x7e, 0x53, 0xfa, 0x3a, 0x3b, 0xb4, 0xa8, 0xbc, 0x5f, 0x68, 0x8, 0xca, 0x8f, 0x14, 0xd7, 0xc0, 0xef, 0x7b, 0x5b, 0xbf, 0x2f, 0xe5, 0xe2, 0x8c, 0xba, 0x12, 0xe1, 0xaf, 0xb2, 0x54, 0x5d, 0x59, 0x76, 0xdb, 0x32, 0xa2, 0x58, 0x6e, 0x1c, 0x29, 0x64, 0xf3, 0xe9, 0x96, 0xc, 0x98, 0x19, 0x8d, 0x3e, 0x26, 0xab, 0xa5, 0x85, 0x16, 0x40, 0xbd, 0x49, 0x67, 0xdc, 0x22, 0x94, 0xbb, 0x3c, 0xc1, 0x9b, 0xeb, 0x45, 0x28, 0x18, 0xd8, 0x1a, 0x42, 0x7d, 0xcc, 0xfb, 0x65, 0x8e, 0x3d, 0xcd, 0x2a, 0xa3, 0x60, 0xae, 0x93, 0x8a, 0x48, 0x97, 0x51, 0x15, 0xf7, 0x1, 0xb, 0xb7, 0x36, 0xb1, 0x2e, 0x11, 0xfd, 0x84, 0x2d, 0x3f, 0x13, 0x88, 0xb3, 0x34, 0x24, 0x1b, 0xde, 0xc5, 0x1d, 0x4d, 0x2b, 0x17, 0x31, 0x74, 0xa9, 0xc6, 0x43, 0x6d, 0x39, 0x90, 0xbe, 0xc3, 0xb0, 0x21, 0x6b, 0xf6, 0xf, 0xd5, 0x99, 0xd, 0xac, 0x1f, 0x5c, 0x9e, 0xf5, 0xf9, 0x4c, 0xd6, 0xdf, 0x89, 0xe4, 0x8b, 0xff, 0xc7, 0xaa, 0xe7, 0xed, 0x46, 0x25, 0xb6, 0x6, 0x5e, 0x35, 0xb5, 0xec, 0xce, 0xe8, 0x6c, 0x30, 0x55, 0x61, 0x4a, 0xfe, 0xa0, 0x79, 0x3, 0xf0, 0x10, 0x72, 0x7c, 0xcf, 0x52, 0xa6, 0xa7, 0xee, 0x44, 0xd3, 0x9a, 0x57, 0x92, 0xd0, 0x5a, 0x7a, 0x41, 0x7f, 0xe, 0x0, 0x63, 0xf2, 0x4f, 0x5, 0x83, 0xc9, 0xa1, 0xd4, 0xdd, 0xc4, 0x56, 0xf4, 0xd2, 0x77, 0x81, 0x9, 0x82, 0x33, 0x9f, 0x7, 0x86, 0x75, 0x38, 0x4e, 0x69, 0xf1, 0xad, 0x23, 0x73, 0x87, 0x70, 0x2, 0xc2, 0x1e, 0xb8, 0xa, 0xfc, 0xe6]; + /** + * Default Constructor. + * + * @param string $mode + * @throws \InvalidArgumentException if an invalid / unsupported mode is provided + */ + public function __construct($mode) + { + parent::__construct($mode); + if ($this->mode == self::MODE_STREAM) { + throw new BadModeException('Block ciphers cannot be ran in stream mode'); + } + } + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + switch ($engine) { + case self::ENGINE_OPENSSL: + if ($this->current_key_length != 128 || strlen($this->orig_key) < 16) { + return \false; + } + // quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1 + // "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider" + // in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not + if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\\d+\\.\\d+\\.\\d+) .*#', '$1', \OPENSSL_VERSION_TEXT), '3.0.1', '>=')) { + return \false; + } + $this->cipher_name_openssl_ecb = 'rc2-ecb'; + $this->cipher_name_openssl = 'rc2-' . $this->openssl_translate_mode(); + } + return parent::isValidEngineHelper($engine); + } + /** + * Sets the key length. + * + * Valid key lengths are 8 to 1024. + * Calling this function after setting the key has no effect until the next + * \phpseclib3\Crypt\RC2::setKey() call. + * + * @param int $length in bits + * @throws \LengthException if the key length isn't supported + */ + public function setKeyLength($length) + { + if ($length < 8 || $length > 1024) { + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys between 1 and 1024 bits, inclusive, are supported'); + } + $this->default_key_length = $this->current_key_length = $length; + $this->explicit_key_length = $length >> 3; + } + /** + * Returns the current key length + * + * @return int + */ + public function getKeyLength() + { + return $this->current_key_length; + } + /** + * Sets the key. + * + * Keys can be of any length. RC2, itself, uses 8 to 1024 bit keys (eg. + * strlen($key) <= 128), however, we only use the first 128 bytes if $key + * has more then 128 bytes in it, and set $key to a single null byte if + * it is empty. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() + * @param string $key + * @param int|boolean $t1 optional Effective key length in bits. + * @throws \LengthException if the key length isn't supported + */ + public function setKey($key, $t1 = \false) + { + $this->orig_key = $key; + if ($t1 === \false) { + $t1 = $this->default_key_length; + } + if ($t1 < 1 || $t1 > 1024) { + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys between 1 and 1024 bits, inclusive, are supported'); + } + $this->current_key_length = $t1; + if (strlen($key) < 1 || strlen($key) > 128) { + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes between 8 and 1024 bits, inclusive, are supported'); + } + $t = strlen($key); + // The mcrypt RC2 implementation only supports effective key length + // of 1024 bits. It is however possible to handle effective key + // lengths in range 1..1024 by expanding the key and applying + // inverse pitable mapping to the first byte before submitting it + // to mcrypt. + // Key expansion. + $l = array_values(unpack('C*', $key)); + $t8 = $t1 + 7 >> 3; + $tm = 0xff >> 8 * $t8 - $t1; + // Expand key. + $pitable = self::$pitable; + for ($i = $t; $i < 128; $i++) { + $l[$i] = $pitable[$l[$i - 1] + $l[$i - $t]]; + } + $i = 128 - $t8; + $l[$i] = $pitable[$l[$i] & $tm]; + while ($i--) { + $l[$i] = $pitable[$l[$i + 1] ^ $l[$i + $t8]]; + } + // Prepare the key for mcrypt. + $l[0] = self::$invpitable[$l[0]]; + array_unshift($l, 'C*'); + $this->key = pack(...$l); + $this->key_length = strlen($this->key); + $this->changed = $this->nonIVChanged = \true; + $this->setEngine(); + } + /** + * Encrypts a message. + * + * Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::encrypt, with some additional OpenSSL handling code + * + * @see self::decrypt() + * @param string $plaintext + * @return string $ciphertext + */ + public function encrypt($plaintext) + { + if ($this->engine == self::ENGINE_OPENSSL) { + $temp = $this->key; + $this->key = $this->orig_key; + $result = parent::encrypt($plaintext); + $this->key = $temp; + return $result; + } + return parent::encrypt($plaintext); + } + /** + * Decrypts a message. + * + * Mostly a wrapper for \phpseclib3\Crypt\Common\SymmetricKey::decrypt, with some additional OpenSSL handling code + * + * @see self::encrypt() + * @param string $ciphertext + * @return string $plaintext + */ + public function decrypt($ciphertext) + { + if ($this->engine == self::ENGINE_OPENSSL) { + $temp = $this->key; + $this->key = $this->orig_key; + $result = parent::decrypt($ciphertext); + $this->key = $temp; + return $result; + } + return parent::decrypt($ciphertext); + } + /** + * Encrypts a block + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @param string $in + * @return string + */ + protected function encryptBlock($in) + { + list($r0, $r1, $r2, $r3) = array_values(unpack('v*', $in)); + $keys = $this->keys; + $limit = 20; + $actions = [$limit => 44, 44 => 64]; + $j = 0; + for (;;) { + // Mixing round. + $r0 = ($r0 + $keys[$j++] + (($r1 ^ $r2) & $r3 ^ $r1) & 0xffff) << 1; + $r0 |= $r0 >> 16; + $r1 = ($r1 + $keys[$j++] + (($r2 ^ $r3) & $r0 ^ $r2) & 0xffff) << 2; + $r1 |= $r1 >> 16; + $r2 = ($r2 + $keys[$j++] + (($r3 ^ $r0) & $r1 ^ $r3) & 0xffff) << 3; + $r2 |= $r2 >> 16; + $r3 = ($r3 + $keys[$j++] + (($r0 ^ $r1) & $r2 ^ $r0) & 0xffff) << 5; + $r3 |= $r3 >> 16; + if ($j === $limit) { + if ($limit === 64) { + break; + } + // Mashing round. + $r0 += $keys[$r3 & 0x3f]; + $r1 += $keys[$r0 & 0x3f]; + $r2 += $keys[$r1 & 0x3f]; + $r3 += $keys[$r2 & 0x3f]; + $limit = $actions[$limit]; + } + } + return pack('vvvv', $r0, $r1, $r2, $r3); + } + /** + * Decrypts a block + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::decryptBlock() + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @param string $in + * @return string + */ + protected function decryptBlock($in) + { + list($r0, $r1, $r2, $r3) = array_values(unpack('v*', $in)); + $keys = $this->keys; + $limit = 44; + $actions = [$limit => 20, 20 => 0]; + $j = 64; + for (;;) { + // R-mixing round. + $r3 = ($r3 | $r3 << 16) >> 5; + $r3 = $r3 - $keys[--$j] - (($r0 ^ $r1) & $r2 ^ $r0) & 0xffff; + $r2 = ($r2 | $r2 << 16) >> 3; + $r2 = $r2 - $keys[--$j] - (($r3 ^ $r0) & $r1 ^ $r3) & 0xffff; + $r1 = ($r1 | $r1 << 16) >> 2; + $r1 = $r1 - $keys[--$j] - (($r2 ^ $r3) & $r0 ^ $r2) & 0xffff; + $r0 = ($r0 | $r0 << 16) >> 1; + $r0 = $r0 - $keys[--$j] - (($r1 ^ $r2) & $r3 ^ $r1) & 0xffff; + if ($j === $limit) { + if ($limit === 0) { + break; + } + // R-mashing round. + $r3 = $r3 - $keys[$r2 & 0x3f] & 0xffff; + $r2 = $r2 - $keys[$r1 & 0x3f] & 0xffff; + $r1 = $r1 - $keys[$r0 & 0x3f] & 0xffff; + $r0 = $r0 - $keys[$r3 & 0x3f] & 0xffff; + $limit = $actions[$limit]; + } + } + return pack('vvvv', $r0, $r1, $r2, $r3); + } + /** + * Creates the key schedule + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + */ + protected function setupKey() + { + if (!isset($this->key)) { + $this->setKey(''); + } + // Key has already been expanded in \phpseclib3\Crypt\RC2::setKey(): + // Only the first value must be altered. + $l = unpack('Ca/Cb/v*', $this->key); + array_unshift($l, self::$pitable[$l['a']] | $l['b'] << 8); + unset($l['a']); + unset($l['b']); + $this->keys = $l; + } + /** + * Setup the performance-optimized function for de/encrypt() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() + */ + protected function setupInlineCrypt() + { + // Init code for both, encrypt and decrypt. + $init_crypt = '$keys = $this->keys;'; + $keys = $this->keys; + // $in is the current 8 bytes block which has to be en/decrypt + $encrypt_block = $decrypt_block = ' + $in = unpack("v4", $in); + $r0 = $in[1]; + $r1 = $in[2]; + $r2 = $in[3]; + $r3 = $in[4]; + '; + // Create code for encryption. + $limit = 20; + $actions = [$limit => 44, 44 => 64]; + $j = 0; + for (;;) { + // Mixing round. + $encrypt_block .= ' + $r0 = (($r0 + ' . $keys[$j++] . ' + + ((($r1 ^ $r2) & $r3) ^ $r1)) & 0xFFFF) << 1; + $r0 |= $r0 >> 16; + $r1 = (($r1 + ' . $keys[$j++] . ' + + ((($r2 ^ $r3) & $r0) ^ $r2)) & 0xFFFF) << 2; + $r1 |= $r1 >> 16; + $r2 = (($r2 + ' . $keys[$j++] . ' + + ((($r3 ^ $r0) & $r1) ^ $r3)) & 0xFFFF) << 3; + $r2 |= $r2 >> 16; + $r3 = (($r3 + ' . $keys[$j++] . ' + + ((($r0 ^ $r1) & $r2) ^ $r0)) & 0xFFFF) << 5; + $r3 |= $r3 >> 16;'; + if ($j === $limit) { + if ($limit === 64) { + break; + } + // Mashing round. + $encrypt_block .= ' + $r0 += $keys[$r3 & 0x3F]; + $r1 += $keys[$r0 & 0x3F]; + $r2 += $keys[$r1 & 0x3F]; + $r3 += $keys[$r2 & 0x3F];'; + $limit = $actions[$limit]; + } + } + $encrypt_block .= '$in = pack("v4", $r0, $r1, $r2, $r3);'; + // Create code for decryption. + $limit = 44; + $actions = [$limit => 20, 20 => 0]; + $j = 64; + for (;;) { + // R-mixing round. + $decrypt_block .= ' + $r3 = ($r3 | ($r3 << 16)) >> 5; + $r3 = ($r3 - ' . $keys[--$j] . ' - + ((($r0 ^ $r1) & $r2) ^ $r0)) & 0xFFFF; + $r2 = ($r2 | ($r2 << 16)) >> 3; + $r2 = ($r2 - ' . $keys[--$j] . ' - + ((($r3 ^ $r0) & $r1) ^ $r3)) & 0xFFFF; + $r1 = ($r1 | ($r1 << 16)) >> 2; + $r1 = ($r1 - ' . $keys[--$j] . ' - + ((($r2 ^ $r3) & $r0) ^ $r2)) & 0xFFFF; + $r0 = ($r0 | ($r0 << 16)) >> 1; + $r0 = ($r0 - ' . $keys[--$j] . ' - + ((($r1 ^ $r2) & $r3) ^ $r1)) & 0xFFFF;'; + if ($j === $limit) { + if ($limit === 0) { + break; + } + // R-mashing round. + $decrypt_block .= ' + $r3 = ($r3 - $keys[$r2 & 0x3F]) & 0xFFFF; + $r2 = ($r2 - $keys[$r1 & 0x3F]) & 0xFFFF; + $r1 = ($r1 - $keys[$r0 & 0x3F]) & 0xFFFF; + $r0 = ($r0 - $keys[$r3 & 0x3F]) & 0xFFFF;'; + $limit = $actions[$limit]; + } + } + $decrypt_block .= '$in = pack("v4", $r0, $r1, $r2, $r3);'; + // Creates the inline-crypt function + $this->inline_crypt = $this->createInlineCryptFunction(['init_crypt' => $init_crypt, 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RC4.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RC4.php new file mode 100644 index 0000000..b519996 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RC4.php @@ -0,0 +1,258 @@ + + * setKey('abcdefgh'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $rc4->decrypt($rc4->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\StreamCipher; +/** + * Pure-PHP implementation of RC4. + * + * @author Jim Wigginton + */ +class RC4 extends StreamCipher +{ + /** + * @see \phpseclib3\Crypt\RC4::_crypt() + */ + const ENCRYPT = 0; + /** + * @see \phpseclib3\Crypt\RC4::_crypt() + */ + const DECRYPT = 1; + /** + * Key Length (in bytes) + * + * @see \phpseclib3\Crypt\RC4::setKeyLength() + * @var int + */ + protected $key_length = 128; + // = 1024 bits + /** + * The mcrypt specific name of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @var string + */ + protected $cipher_name_mcrypt = 'arcfour'; + /** + * The Key + * + * @see self::setKey() + * @var string + */ + protected $key; + /** + * The Key Stream for decryption and encryption + * + * @see self::setKey() + * @var array + */ + private $stream; + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + if ($engine == self::ENGINE_OPENSSL) { + if ($this->continuousBuffer) { + return \false; + } + // quoting https://www.openssl.org/news/openssl-3.0-notes.html, OpenSSL 3.0.1 + // "Moved all variations of the EVP ciphers CAST5, BF, IDEA, SEED, RC2, RC4, RC5, and DES to the legacy provider" + // in theory openssl_get_cipher_methods() should catch this but, on GitHub Actions, at least, it does not + if (defined('OPENSSL_VERSION_TEXT') && version_compare(preg_replace('#OpenSSL (\\d+\\.\\d+\\.\\d+) .*#', '$1', \OPENSSL_VERSION_TEXT), '3.0.1', '>=')) { + return \false; + } + $this->cipher_name_openssl = 'rc4-40'; + } + return parent::isValidEngineHelper($engine); + } + /** + * Sets the key length + * + * Keys can be between 1 and 256 bytes long. + * + * @param int $length + * @throws \LengthException if the key length is invalid + */ + public function setKeyLength($length) + { + if ($length < 8 || $length > 2048) { + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys between 1 and 256 bytes are supported'); + } + $this->key_length = $length >> 3; + parent::setKeyLength($length); + } + /** + * Sets the key length + * + * Keys can be between 1 and 256 bytes long. + * + * @param string $key + */ + public function setKey($key) + { + $length = strlen($key); + if ($length < 1 || $length > 256) { + throw new \LengthException('Key size of ' . $length . ' bytes is not supported by RC4. Keys must be between 1 and 256 bytes long'); + } + parent::setKey($key); + } + /** + * Encrypts a message. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see self::crypt() + * @param string $plaintext + * @return string $ciphertext + */ + public function encrypt($plaintext) + { + if ($this->engine != self::ENGINE_INTERNAL) { + return parent::encrypt($plaintext); + } + return $this->crypt($plaintext, self::ENCRYPT); + } + /** + * Decrypts a message. + * + * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). + * At least if the continuous buffer is disabled. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see self::crypt() + * @param string $ciphertext + * @return string $plaintext + */ + public function decrypt($ciphertext) + { + if ($this->engine != self::ENGINE_INTERNAL) { + return parent::decrypt($ciphertext); + } + return $this->crypt($ciphertext, self::DECRYPT); + } + /** + * Encrypts a block + * + * @param string $in + */ + protected function encryptBlock($in) + { + // RC4 does not utilize this method + } + /** + * Decrypts a block + * + * @param string $in + */ + protected function decryptBlock($in) + { + // RC4 does not utilize this method + } + /** + * Setup the key (expansion) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() + */ + protected function setupKey() + { + $key = $this->key; + $keyLength = strlen($key); + $keyStream = range(0, 255); + $j = 0; + for ($i = 0; $i < 256; $i++) { + $j = $j + $keyStream[$i] + ord($key[$i % $keyLength]) & 255; + $temp = $keyStream[$i]; + $keyStream[$i] = $keyStream[$j]; + $keyStream[$j] = $temp; + } + $this->stream = []; + $this->stream[self::DECRYPT] = $this->stream[self::ENCRYPT] = [ + 0, + // index $i + 0, + // index $j + $keyStream, + ]; + } + /** + * Encrypts or decrypts a message. + * + * @see self::encrypt() + * @see self::decrypt() + * @param string $text + * @param int $mode + * @return string $text + */ + private function crypt($text, $mode) + { + if ($this->changed) { + $this->setup(); + } + $stream =& $this->stream[$mode]; + if ($this->continuousBuffer) { + $i =& $stream[0]; + $j =& $stream[1]; + $keyStream =& $stream[2]; + } else { + $i = $stream[0]; + $j = $stream[1]; + $keyStream = $stream[2]; + } + $len = strlen($text); + for ($k = 0; $k < $len; ++$k) { + $i = $i + 1 & 255; + $ksi = $keyStream[$i]; + $j = $j + $ksi & 255; + $ksj = $keyStream[$j]; + $keyStream[$i] = $ksj; + $keyStream[$j] = $ksi; + $text[$k] = $text[$k] ^ chr($keyStream[$ksj + $ksi & 255]); + } + return $text; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA.php new file mode 100644 index 0000000..41fc33a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA.php @@ -0,0 +1,824 @@ + + * getPublicKey(); + * + * $plaintext = 'terrafrost'; + * + * $ciphertext = $public->encrypt($plaintext); + * + * echo $private->decrypt($ciphertext); + * ?> + * + * + * Here's an example of how to create signatures and verify signatures with this library: + * + * getPublicKey(); + * + * $plaintext = 'terrafrost'; + * + * $signature = $private->sign($plaintext); + * + * echo $public->verify($plaintext, $signature) ? 'verified' : 'unverified'; + * ?> + * + * + * One thing to consider when using this: so phpseclib uses PSS mode by default. + * Technically, id-RSASSA-PSS has a different key format than rsaEncryption. So + * should phpseclib save to the id-RSASSA-PSS format by default or the + * rsaEncryption format? For stand-alone keys I figure rsaEncryption is better + * because SSH doesn't use PSS and idk how many SSH servers would be able to + * decode an id-RSASSA-PSS key. For X.509 certificates the id-RSASSA-PSS + * format is used by default (unless you change it up to use PKCS1 instead) + * + * @author Jim Wigginton + * @copyright 2009 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\AsymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys\PSS; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InconsistentSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Pure-PHP PKCS#1 compliant implementation of RSA. + * + * @author Jim Wigginton + */ +abstract class RSA extends AsymmetricKey +{ + /** + * Algorithm Name + * + * @var string + */ + const ALGORITHM = 'RSA'; + /** + * Use {@link http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding Optimal Asymmetric Encryption Padding} + * (OAEP) for encryption / decryption. + * + * Uses sha256 by default + * + * @see self::setHash() + * @see self::setMGFHash() + * @see self::encrypt() + * @see self::decrypt() + */ + const ENCRYPTION_OAEP = 1; + /** + * Use PKCS#1 padding. + * + * Although self::PADDING_OAEP / self::PADDING_PSS offers more security, including PKCS#1 padding is necessary for purposes of backwards + * compatibility with protocols (like SSH-1) written before OAEP's introduction. + * + * @see self::encrypt() + * @see self::decrypt() + */ + const ENCRYPTION_PKCS1 = 2; + /** + * Do not use any padding + * + * Although this method is not recommended it can none-the-less sometimes be useful if you're trying to decrypt some legacy + * stuff, if you're trying to diagnose why an encrypted message isn't decrypting, etc. + * + * @see self::encrypt() + * @see self::decrypt() + */ + const ENCRYPTION_NONE = 4; + /** + * Use the Probabilistic Signature Scheme for signing + * + * Uses sha256 and 0 as the salt length + * + * @see self::setSaltLength() + * @see self::setMGFHash() + * @see self::setHash() + * @see self::sign() + * @see self::verify() + * @see self::setHash() + */ + const SIGNATURE_PSS = 16; + /** + * Use a relaxed version of PKCS#1 padding for signature verification + * + * @see self::sign() + * @see self::verify() + * @see self::setHash() + */ + const SIGNATURE_RELAXED_PKCS1 = 32; + /** + * Use PKCS#1 padding for signature verification + * + * @see self::sign() + * @see self::verify() + * @see self::setHash() + */ + const SIGNATURE_PKCS1 = 64; + /** + * Encryption padding mode + * + * @var int + */ + protected $encryptionPadding = self::ENCRYPTION_OAEP; + /** + * Signature padding mode + * + * @var int + */ + protected $signaturePadding = self::SIGNATURE_PSS; + /** + * Length of hash function output + * + * @var int + */ + protected $hLen; + /** + * Length of salt + * + * @var int + */ + protected $sLen; + /** + * Label + * + * @var string + */ + protected $label = ''; + /** + * Hash function for the Mask Generation Function + * + * @var \phpseclib3\Crypt\Hash + */ + protected $mgfHash; + /** + * Length of MGF hash function output + * + * @var int + */ + protected $mgfHLen; + /** + * Modulus (ie. n) + * + * @var \phpseclib3\Math\BigInteger + */ + protected $modulus; + /** + * Modulus length + * + * @var \phpseclib3\Math\BigInteger + */ + protected $k; + /** + * Exponent (ie. e or d) + * + * @var \phpseclib3\Math\BigInteger + */ + protected $exponent; + /** + * Default public exponent + * + * @var int + * @link http://en.wikipedia.org/wiki/65537_%28number%29 + */ + private static $defaultExponent = 65537; + /** + * Enable Blinding? + * + * @var bool + */ + protected static $enableBlinding = \true; + /** + * OpenSSL configuration file name. + * + * @see self::createKey() + * @var ?string + */ + protected static $configFile; + /** + * Smallest Prime + * + * Per , this number ought not result in primes smaller + * than 256 bits. As a consequence if the key you're trying to create is 1024 bits and you've set smallestPrime + * to 384 bits then you're going to get a 384 bit prime and a 640 bit prime (384 + 1024 % 384). At least if + * engine is set to self::ENGINE_INTERNAL. If Engine is set to self::ENGINE_OPENSSL then smallest Prime is + * ignored (ie. multi-prime RSA support is more intended as a way to speed up RSA key generation when there's + * a chance neither gmp nor OpenSSL are installed) + * + * @var int + */ + private static $smallestPrime = 4096; + /** + * Public Exponent + * + * @var \phpseclib3\Math\BigInteger + */ + protected $publicExponent; + /** + * Sets the public exponent for key generation + * + * This will be 65537 unless changed. + * + * @param int $val + */ + public static function setExponent($val) + { + self::$defaultExponent = $val; + } + /** + * Sets the smallest prime number in bits. Used for key generation + * + * This will be 4096 unless changed. + * + * @param int $val + */ + public static function setSmallestPrime($val) + { + self::$smallestPrime = $val; + } + /** + * Sets the OpenSSL config file path + * + * Set to the empty string to use the default config file + * + * @param string $val + */ + public static function setOpenSSLConfigPath($val) + { + self::$configFile = $val; + } + /** + * Create a private key + * + * The public key can be extracted from the private key + * + * @return RSA\PrivateKey + * @param int $bits + */ + public static function createKey($bits = 2048) + { + self::initialize_static_variables(); + $class = new \ReflectionClass(static::class); + if ($class->isFinal()) { + throw new \RuntimeException('createKey() should not be called from final classes (' . static::class . ')'); + } + $regSize = $bits >> 1; + // divide by two to see how many bits P and Q would be + if ($regSize > self::$smallestPrime) { + $num_primes = floor($bits / self::$smallestPrime); + $regSize = self::$smallestPrime; + } else { + $num_primes = 2; + } + if ($num_primes == 2 && $bits >= 384 && self::$defaultExponent == 65537) { + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + // OpenSSL uses 65537 as the exponent and requires RSA keys be 384 bits minimum + if (self::$engines['OpenSSL']) { + $config = []; + if (self::$configFile) { + $config['config'] = self::$configFile; + } + $rsa = openssl_pkey_new(['private_key_bits' => $bits] + $config); + openssl_pkey_export($rsa, $privatekeystr, null, $config); + // clear the buffer of error strings stemming from a minimalistic openssl.cnf + // https://github.com/php/php-src/issues/11054 talks about other errors this'll pick up + while (openssl_error_string() !== \false) { + } + return RSA::load($privatekeystr); + } + } + static $e; + if (!isset($e)) { + $e = new BigInteger(self::$defaultExponent); + } + $n = clone self::$one; + $exponents = $coefficients = $primes = []; + $lcm = ['top' => clone self::$one, 'bottom' => \false]; + do { + for ($i = 1; $i <= $num_primes; $i++) { + if ($i != $num_primes) { + $primes[$i] = BigInteger::randomPrime($regSize); + } else { + extract(BigInteger::minMaxBits($bits)); + /** @var BigInteger $min + * @var BigInteger $max + */ + list($min) = $min->divide($n); + $min = $min->add(self::$one); + list($max) = $max->divide($n); + $primes[$i] = BigInteger::randomRangePrime($min, $max); + } + // the first coefficient is calculated differently from the rest + // ie. instead of being $primes[1]->modInverse($primes[2]), it's $primes[2]->modInverse($primes[1]) + if ($i > 2) { + $coefficients[$i] = $n->modInverse($primes[$i]); + } + $n = $n->multiply($primes[$i]); + $temp = $primes[$i]->subtract(self::$one); + // textbook RSA implementations use Euler's totient function instead of the least common multiple. + // see http://en.wikipedia.org/wiki/Euler%27s_totient_function + $lcm['top'] = $lcm['top']->multiply($temp); + $lcm['bottom'] = $lcm['bottom'] === \false ? $temp : $lcm['bottom']->gcd($temp); + } + list($temp) = $lcm['top']->divide($lcm['bottom']); + $gcd = $temp->gcd($e); + $i0 = 1; + } while (!$gcd->equals(self::$one)); + $coefficients[2] = $primes[2]->modInverse($primes[1]); + $d = $e->modInverse($temp); + foreach ($primes as $i => $prime) { + $temp = $prime->subtract(self::$one); + $exponents[$i] = $e->modInverse($temp); + } + // from : + // RSAPrivateKey ::= SEQUENCE { + // version Version, + // modulus INTEGER, -- n + // publicExponent INTEGER, -- e + // privateExponent INTEGER, -- d + // prime1 INTEGER, -- p + // prime2 INTEGER, -- q + // exponent1 INTEGER, -- d mod (p-1) + // exponent2 INTEGER, -- d mod (q-1) + // coefficient INTEGER, -- (inverse of q) mod p + // otherPrimeInfos OtherPrimeInfos OPTIONAL + // } + $privatekey = new PrivateKey(); + $privatekey->modulus = $n; + $privatekey->k = $bits >> 3; + $privatekey->publicExponent = $e; + $privatekey->exponent = $d; + $privatekey->primes = $primes; + $privatekey->exponents = $exponents; + $privatekey->coefficients = $coefficients; + /* + $publickey = new PublicKey; + $publickey->modulus = $n; + $publickey->k = $bits >> 3; + $publickey->exponent = $e; + $publickey->publicExponent = $e; + $publickey->isPublic = true; + */ + return $privatekey; + } + /** + * OnLoad Handler + * + * @return bool + */ + protected static function onLoad(array $components) + { + $key = $components['isPublicKey'] ? new PublicKey() : new PrivateKey(); + $key->modulus = $components['modulus']; + $key->publicExponent = $components['publicExponent']; + $key->k = $key->modulus->getLengthInBytes(); + if ($components['isPublicKey'] || !isset($components['privateExponent'])) { + $key->exponent = $key->publicExponent; + } else { + $key->privateExponent = $components['privateExponent']; + $key->exponent = $key->privateExponent; + $key->primes = $components['primes']; + $key->exponents = $components['exponents']; + $key->coefficients = $components['coefficients']; + } + if ($components['format'] == PSS::class) { + // in the X509 world RSA keys are assumed to use PKCS1 padding by default. only if the key is + // explicitly a PSS key is the use of PSS assumed. phpseclib does not work like this. phpseclib + // uses PSS padding by default. it assumes the more secure method by default and altho it provides + // for the less secure PKCS1 method you have to go out of your way to use it. this is consistent + // with the latest trends in crypto. libsodium (NaCl) is actually a little more extreme in that + // not only does it defaults to the most secure methods - it doesn't even let you choose less + // secure methods + //$key = $key->withPadding(self::SIGNATURE_PSS); + if (isset($components['hash'])) { + $key = $key->withHash($components['hash']); + } + if (isset($components['MGFHash'])) { + $key = $key->withMGFHash($components['MGFHash']); + } + if (isset($components['saltLength'])) { + $key = $key->withSaltLength($components['saltLength']); + } + } + return $key; + } + /** + * Initialize static variables + */ + protected static function initialize_static_variables() + { + if (!isset(self::$configFile)) { + self::$configFile = dirname(__FILE__) . '/../openssl.cnf'; + } + parent::initialize_static_variables(); + } + /** + * Constructor + * + * PublicKey and PrivateKey objects can only be created from abstract RSA class + */ + protected function __construct() + { + parent::__construct(); + $this->hLen = $this->hash->getLengthInBytes(); + $this->mgfHash = new Hash('sha256'); + $this->mgfHLen = $this->mgfHash->getLengthInBytes(); + } + /** + * Integer-to-Octet-String primitive + * + * See {@link http://tools.ietf.org/html/rfc3447#section-4.1 RFC3447#section-4.1}. + * + * @param bool|\phpseclib3\Math\BigInteger $x + * @param int $xLen + * @return bool|string + */ + protected function i2osp($x, $xLen) + { + if ($x === \false) { + return \false; + } + $x = $x->toBytes(); + if (strlen($x) > $xLen) { + throw new \OutOfRangeException('Resultant string length out of range'); + } + return str_pad($x, $xLen, chr(0), \STR_PAD_LEFT); + } + /** + * Octet-String-to-Integer primitive + * + * See {@link http://tools.ietf.org/html/rfc3447#section-4.2 RFC3447#section-4.2}. + * + * @param string $x + * @return \phpseclib3\Math\BigInteger + */ + protected function os2ip($x) + { + return new BigInteger($x, 256); + } + /** + * EMSA-PKCS1-V1_5-ENCODE + * + * See {@link http://tools.ietf.org/html/rfc3447#section-9.2 RFC3447#section-9.2}. + * + * @param string $m + * @param int $emLen + * @throws \LengthException if the intended encoded message length is too short + * @return string + */ + protected function emsa_pkcs1_v1_5_encode($m, $emLen) + { + $h = $this->hash->hash($m); + // see http://tools.ietf.org/html/rfc3447#page-43 + switch ($this->hash->getHash()) { + case 'md2': + $t = "0 0\f\x06\x08*\x86H\x86\xf7\r\x02\x02\x05\x00\x04\x10"; + break; + case 'md5': + $t = "0 0\f\x06\x08*\x86H\x86\xf7\r\x02\x05\x05\x00\x04\x10"; + break; + case 'sha1': + $t = "0!0\t\x06\x05+\x0e\x03\x02\x1a\x05\x00\x04\x14"; + break; + case 'sha256': + $t = "010\r\x06\t`\x86H\x01e\x03\x04\x02\x01\x05\x00\x04 "; + break; + case 'sha384': + $t = "0A0\r\x06\t`\x86H\x01e\x03\x04\x02\x02\x05\x00\x040"; + break; + case 'sha512': + $t = "0Q0\r\x06\t`\x86H\x01e\x03\x04\x02\x03\x05\x00\x04@"; + break; + // from https://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf#page=40 + case 'sha224': + $t = "0-0\r\x06\t`\x86H\x01e\x03\x04\x02\x04\x05\x00\x04\x1c"; + break; + case 'sha512/224': + $t = "0-0\r\x06\t`\x86H\x01e\x03\x04\x02\x05\x05\x00\x04\x1c"; + break; + case 'sha512/256': + $t = "010\r\x06\t`\x86H\x01e\x03\x04\x02\x06\x05\x00\x04 "; + } + $t .= $h; + $tLen = strlen($t); + if ($emLen < $tLen + 11) { + throw new \LengthException('Intended encoded message length too short'); + } + $ps = str_repeat(chr(0xff), $emLen - $tLen - 3); + $em = "\x00\x01{$ps}\x00{$t}"; + return $em; + } + /** + * EMSA-PKCS1-V1_5-ENCODE (without NULL) + * + * Quoting https://tools.ietf.org/html/rfc8017#page-65, + * + * "The parameters field associated with id-sha1, id-sha224, id-sha256, + * id-sha384, id-sha512, id-sha512/224, and id-sha512/256 should + * generally be omitted, but if present, it shall have a value of type + * NULL" + * + * @param string $m + * @param int $emLen + * @return string + */ + protected function emsa_pkcs1_v1_5_encode_without_null($m, $emLen) + { + $h = $this->hash->hash($m); + // see http://tools.ietf.org/html/rfc3447#page-43 + switch ($this->hash->getHash()) { + case 'sha1': + $t = "0\x1f0\x07\x06\x05+\x0e\x03\x02\x1a\x04\x14"; + break; + case 'sha256': + $t = "0/0\v\x06\t`\x86H\x01e\x03\x04\x02\x01\x04 "; + break; + case 'sha384': + $t = "0?0\v\x06\t`\x86H\x01e\x03\x04\x02\x02\x040"; + break; + case 'sha512': + $t = "0O0\v\x06\t`\x86H\x01e\x03\x04\x02\x03\x04@"; + break; + // from https://www.emc.com/collateral/white-papers/h11300-pkcs-1v2-2-rsa-cryptography-standard-wp.pdf#page=40 + case 'sha224': + $t = "0+0\v\x06\t`\x86H\x01e\x03\x04\x02\x04\x04\x1c"; + break; + case 'sha512/224': + $t = "0+0\v\x06\t`\x86H\x01e\x03\x04\x02\x05\x04\x1c"; + break; + case 'sha512/256': + $t = "0/0\v\x06\t`\x86H\x01e\x03\x04\x02\x06\x04 "; + break; + default: + throw new UnsupportedAlgorithmException('md2 and md5 require NULLs'); + } + $t .= $h; + $tLen = strlen($t); + if ($emLen < $tLen + 11) { + throw new \LengthException('Intended encoded message length too short'); + } + $ps = str_repeat(chr(0xff), $emLen - $tLen - 3); + $em = "\x00\x01{$ps}\x00{$t}"; + return $em; + } + /** + * MGF1 + * + * See {@link http://tools.ietf.org/html/rfc3447#appendix-B.2.1 RFC3447#appendix-B.2.1}. + * + * @param string $mgfSeed + * @param int $maskLen + * @return string + */ + protected function mgf1($mgfSeed, $maskLen) + { + // if $maskLen would yield strings larger than 4GB, PKCS#1 suggests a "Mask too long" error be output. + $t = ''; + $count = ceil($maskLen / $this->mgfHLen); + for ($i = 0; $i < $count; $i++) { + $c = pack('N', $i); + $t .= $this->mgfHash->hash($mgfSeed . $c); + } + return substr($t, 0, $maskLen); + } + /** + * Returns the key size + * + * More specifically, this returns the size of the modulo in bits. + * + * @return int + */ + public function getLength() + { + return !isset($this->modulus) ? 0 : $this->modulus->getLength(); + } + /** + * Determines which hashing function should be used + * + * Used with signature production / verification and (if the encryption mode is self::PADDING_OAEP) encryption and + * decryption. + * + * @param string $hash + */ + public function withHash($hash) + { + $new = clone $this; + // \phpseclib3\Crypt\Hash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. + switch (strtolower($hash)) { + case 'md2': + case 'md5': + case 'sha1': + case 'sha256': + case 'sha384': + case 'sha512': + case 'sha224': + case 'sha512/224': + case 'sha512/256': + $new->hash = new Hash($hash); + break; + default: + throw new UnsupportedAlgorithmException('The only supported hash algorithms are: md2, md5, sha1, sha256, sha384, sha512, sha224, sha512/224, sha512/256'); + } + $new->hLen = $new->hash->getLengthInBytes(); + return $new; + } + /** + * Determines which hashing function should be used for the mask generation function + * + * The mask generation function is used by self::PADDING_OAEP and self::PADDING_PSS and although it's + * best if Hash and MGFHash are set to the same thing this is not a requirement. + * + * @param string $hash + */ + public function withMGFHash($hash) + { + $new = clone $this; + // \phpseclib3\Crypt\Hash supports algorithms that PKCS#1 doesn't support. md5-96 and sha1-96, for example. + switch (strtolower($hash)) { + case 'md2': + case 'md5': + case 'sha1': + case 'sha256': + case 'sha384': + case 'sha512': + case 'sha224': + case 'sha512/224': + case 'sha512/256': + $new->mgfHash = new Hash($hash); + break; + default: + throw new UnsupportedAlgorithmException('The only supported hash algorithms are: md2, md5, sha1, sha256, sha384, sha512, sha224, sha512/224, sha512/256'); + } + $new->mgfHLen = $new->mgfHash->getLengthInBytes(); + return $new; + } + /** + * Returns the MGF hash algorithm currently being used + * + */ + public function getMGFHash() + { + return clone $this->mgfHash; + } + /** + * Determines the salt length + * + * Used by RSA::PADDING_PSS + * + * To quote from {@link http://tools.ietf.org/html/rfc3447#page-38 RFC3447#page-38}: + * + * Typical salt lengths in octets are hLen (the length of the output + * of the hash function Hash) and 0. + * + * @param int $sLen + */ + public function withSaltLength($sLen) + { + $new = clone $this; + $new->sLen = $sLen; + return $new; + } + /** + * Returns the salt length currently being used + * + */ + public function getSaltLength() + { + return $this->sLen !== null ? $this->sLen : $this->hLen; + } + /** + * Determines the label + * + * Used by RSA::PADDING_OAEP + * + * To quote from {@link http://tools.ietf.org/html/rfc3447#page-17 RFC3447#page-17}: + * + * Both the encryption and the decryption operations of RSAES-OAEP take + * the value of a label L as input. In this version of PKCS #1, L is + * the empty string; other uses of the label are outside the scope of + * this document. + * + * @param string $label + */ + public function withLabel($label) + { + $new = clone $this; + $new->label = $label; + return $new; + } + /** + * Returns the label currently being used + * + */ + public function getLabel() + { + return $this->label; + } + /** + * Determines the padding modes + * + * Example: $key->withPadding(RSA::ENCRYPTION_PKCS1 | RSA::SIGNATURE_PKCS1); + * + * @param int $padding + */ + public function withPadding($padding) + { + $masks = [self::ENCRYPTION_OAEP, self::ENCRYPTION_PKCS1, self::ENCRYPTION_NONE]; + $encryptedCount = 0; + $selected = 0; + foreach ($masks as $mask) { + if ($padding & $mask) { + $selected = $mask; + $encryptedCount++; + } + } + if ($encryptedCount > 1) { + throw new InconsistentSetupException('Multiple encryption padding modes have been selected; at most only one should be selected'); + } + $encryptionPadding = $selected; + $masks = [self::SIGNATURE_PSS, self::SIGNATURE_RELAXED_PKCS1, self::SIGNATURE_PKCS1]; + $signatureCount = 0; + $selected = 0; + foreach ($masks as $mask) { + if ($padding & $mask) { + $selected = $mask; + $signatureCount++; + } + } + if ($signatureCount > 1) { + throw new InconsistentSetupException('Multiple signature padding modes have been selected; at most only one should be selected'); + } + $signaturePadding = $selected; + $new = clone $this; + if ($encryptedCount) { + $new->encryptionPadding = $encryptionPadding; + } + if ($signatureCount) { + $new->signaturePadding = $signaturePadding; + } + return $new; + } + /** + * Returns the padding currently being used + * + */ + public function getPadding() + { + return $this->signaturePadding | $this->encryptionPadding; + } + /** + * Returns the current engine being used + * + * OpenSSL is only used in this class (and it's subclasses) for key generation + * Even then it depends on the parameters you're using. It's not used for + * multi-prime RSA nor is it used if the key length is outside of the range + * supported by OpenSSL + * + * @see self::useInternalEngine() + * @see self::useBestEngine() + * @return string + */ + public function getEngine() + { + if (!isset(self::$engines['PHP'])) { + self::useBestEngine(); + } + return self::$engines['OpenSSL'] && self::$defaultExponent == 65537 ? 'OpenSSL' : 'PHP'; + } + /** + * Enable RSA Blinding + * + */ + public static function enableBlinding() + { + static::$enableBlinding = \true; + } + /** + * Disable RSA Blinding + * + */ + public static function disableBlinding() + { + static::$enableBlinding = \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/JWK.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/JWK.php new file mode 100644 index 0000000..51a3969 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/JWK.php @@ -0,0 +1,116 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\JWK as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * JWK Formatted RSA Handler + * + * @author Jim Wigginton + */ +abstract class JWK extends Progenitor +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + if ($key->kty != 'RSA') { + throw new \RuntimeException('Only RSA JWK keys are supported'); + } + $count = $publicCount = 0; + $vars = ['n', 'e', 'd', 'p', 'q', 'dp', 'dq', 'qi']; + foreach ($vars as $var) { + if (!isset($key->{$var}) || !is_string($key->{$var})) { + continue; + } + $count++; + $value = new BigInteger(Strings::base64url_decode($key->{$var}), 256); + switch ($var) { + case 'n': + $publicCount++; + $components['modulus'] = $value; + break; + case 'e': + $publicCount++; + $components['publicExponent'] = $value; + break; + case 'd': + $components['privateExponent'] = $value; + break; + case 'p': + $components['primes'][1] = $value; + break; + case 'q': + $components['primes'][2] = $value; + break; + case 'dp': + $components['exponents'][1] = $value; + break; + case 'dq': + $components['exponents'][2] = $value; + break; + case 'qi': + $components['coefficients'][2] = $value; + } + } + if ($count == count($vars)) { + return $components + ['isPublicKey' => \false]; + } + if ($count == 2 && $publicCount == 2) { + return $components + ['isPublicKey' => \true]; + } + throw new \UnexpectedValueException('Key does not have an appropriate number of RSA parameters'); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + if (count($primes) != 2) { + throw new \InvalidArgumentException('JWK does not support multi-prime RSA keys'); + } + $key = ['kty' => 'RSA', 'n' => Strings::base64url_encode($n->toBytes()), 'e' => Strings::base64url_encode($e->toBytes()), 'd' => Strings::base64url_encode($d->toBytes()), 'p' => Strings::base64url_encode($primes[1]->toBytes()), 'q' => Strings::base64url_encode($primes[2]->toBytes()), 'dp' => Strings::base64url_encode($exponents[1]->toBytes()), 'dq' => Strings::base64url_encode($exponents[2]->toBytes()), 'qi' => Strings::base64url_encode($coefficients[2]->toBytes())]; + return self::wrapKey($key, $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) + { + $key = ['kty' => 'RSA', 'n' => Strings::base64url_encode($n->toBytes()), 'e' => Strings::base64url_encode($e->toBytes())]; + return self::wrapKey($key, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php new file mode 100644 index 0000000..230dd64 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php @@ -0,0 +1,207 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Microsoft BLOB Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class MSBLOB +{ + /** + * Public/Private Key Pair + * + */ + const PRIVATEKEYBLOB = 0x7; + /** + * Public Key + * + */ + const PUBLICKEYBLOB = 0x6; + /** + * Public Key + * + */ + const PUBLICKEYBLOBEX = 0xa; + /** + * RSA public key exchange algorithm + * + */ + const CALG_RSA_KEYX = 0xa400; + /** + * RSA public key exchange algorithm + * + */ + const CALG_RSA_SIGN = 0x2400; + /** + * Public Key + * + */ + const RSA1 = 0x31415352; + /** + * Private Key + * + */ + const RSA2 = 0x32415352; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + $key = Strings::base64_decode($key); + if (!is_string($key)) { + throw new \UnexpectedValueException('Base64 decoding produced an error'); + } + if (strlen($key) < 20) { + throw new \UnexpectedValueException('Key appears to be malformed'); + } + // PUBLICKEYSTRUC publickeystruc + // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387453(v=vs.85).aspx + extract(unpack('atype/aversion/vreserved/Valgo', Strings::shift($key, 8))); + /** + * @var string $type + * @var string $version + * @var integer $reserved + * @var integer $algo + */ + switch (ord($type)) { + case self::PUBLICKEYBLOB: + case self::PUBLICKEYBLOBEX: + $publickey = \true; + break; + case self::PRIVATEKEYBLOB: + $publickey = \false; + break; + default: + throw new \UnexpectedValueException('Key appears to be malformed'); + } + $components = ['isPublicKey' => $publickey]; + // https://msdn.microsoft.com/en-us/library/windows/desktop/aa375549(v=vs.85).aspx + switch ($algo) { + case self::CALG_RSA_KEYX: + case self::CALG_RSA_SIGN: + break; + default: + throw new \UnexpectedValueException('Key appears to be malformed'); + } + // RSAPUBKEY rsapubkey + // https://msdn.microsoft.com/en-us/library/windows/desktop/aa387685(v=vs.85).aspx + // could do V for pubexp but that's unsigned 32-bit whereas some PHP installs only do signed 32-bit + extract(unpack('Vmagic/Vbitlen/a4pubexp', Strings::shift($key, 12))); + /** + * @var integer $magic + * @var integer $bitlen + * @var string $pubexp + */ + switch ($magic) { + case self::RSA2: + $components['isPublicKey'] = \false; + // fall-through + case self::RSA1: + break; + default: + throw new \UnexpectedValueException('Key appears to be malformed'); + } + $baseLength = $bitlen / 16; + if (strlen($key) != 2 * $baseLength && strlen($key) != 9 * $baseLength) { + throw new \UnexpectedValueException('Key appears to be malformed'); + } + $components[$components['isPublicKey'] ? 'publicExponent' : 'privateExponent'] = new BigInteger(strrev($pubexp), 256); + // BYTE modulus[rsapubkey.bitlen/8] + $components['modulus'] = new BigInteger(strrev(Strings::shift($key, $bitlen / 8)), 256); + if ($publickey) { + return $components; + } + $components['isPublicKey'] = \false; + // BYTE prime1[rsapubkey.bitlen/16] + $components['primes'] = [1 => new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256)]; + // BYTE prime2[rsapubkey.bitlen/16] + $components['primes'][] = new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256); + // BYTE exponent1[rsapubkey.bitlen/16] + $components['exponents'] = [1 => new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256)]; + // BYTE exponent2[rsapubkey.bitlen/16] + $components['exponents'][] = new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256); + // BYTE coefficient[rsapubkey.bitlen/16] + $components['coefficients'] = [2 => new BigInteger(strrev(Strings::shift($key, $bitlen / 16)), 256)]; + if (isset($components['privateExponent'])) { + $components['publicExponent'] = $components['privateExponent']; + } + // BYTE privateExponent[rsapubkey.bitlen/8] + $components['privateExponent'] = new BigInteger(strrev(Strings::shift($key, $bitlen / 8)), 256); + return $components; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '') + { + if (count($primes) != 2) { + throw new \InvalidArgumentException('MSBLOB does not support multi-prime RSA keys'); + } + if (!empty($password) && is_string($password)) { + throw new UnsupportedFormatException('MSBLOB private keys do not support encryption'); + } + $n = strrev($n->toBytes()); + $e = str_pad(strrev($e->toBytes()), 4, "\x00"); + $key = pack('aavV', chr(self::PRIVATEKEYBLOB), chr(2), 0, self::CALG_RSA_KEYX); + $key .= pack('VVa*', self::RSA2, 8 * strlen($n), $e); + $key .= $n; + $key .= strrev($primes[1]->toBytes()); + $key .= strrev($primes[2]->toBytes()); + $key .= strrev($exponents[1]->toBytes()); + $key .= strrev($exponents[2]->toBytes()); + $key .= strrev($coefficients[2]->toBytes()); + $key .= strrev($d->toBytes()); + return Strings::base64_encode($key); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e) + { + $n = strrev($n->toBytes()); + $e = str_pad(strrev($e->toBytes()), 4, "\x00"); + $key = pack('aavV', chr(self::PUBLICKEYBLOB), chr(2), 0, self::CALG_RSA_KEYX); + $key .= pack('VVa*', self::RSA1, 8 * strlen($n), $e); + $key .= $n; + return Strings::base64_encode($key); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/OpenSSH.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/OpenSSH.php new file mode 100644 index 0000000..f992dfc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/OpenSSH.php @@ -0,0 +1,101 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\OpenSSH as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * OpenSSH Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class OpenSSH extends Progenitor +{ + /** + * Supported Key Types + * + * @var array + */ + protected static $types = ['ssh-rsa']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + static $one; + if (!isset($one)) { + $one = new BigInteger(1); + } + $parsed = parent::load($key, $password); + if (isset($parsed['paddedKey'])) { + list($type) = Strings::unpackSSH2('s', $parsed['paddedKey']); + if ($type != $parsed['type']) { + throw new \RuntimeException("The public and private keys are not of the same type ({$type} vs {$parsed['type']})"); + } + $primes = $coefficients = []; + list($modulus, $publicExponent, $privateExponent, $coefficients[2], $primes[1], $primes[2], $comment, ) = Strings::unpackSSH2('i6s', $parsed['paddedKey']); + $temp = $primes[1]->subtract($one); + $exponents = [1 => $publicExponent->modInverse($temp)]; + $temp = $primes[2]->subtract($one); + $exponents[] = $publicExponent->modInverse($temp); + $isPublicKey = \false; + return compact('publicExponent', 'modulus', 'privateExponent', 'primes', 'coefficients', 'exponents', 'comment', 'isPublicKey'); + } + list($publicExponent, $modulus) = Strings::unpackSSH2('ii', $parsed['publicKey']); + return ['isPublicKey' => \true, 'modulus' => $modulus, 'publicExponent' => $publicExponent, 'comment' => $parsed['comment']]; + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) + { + $RSAPublicKey = Strings::packSSH2('sii', 'ssh-rsa', $e, $n); + if (isset($options['binary']) ? $options['binary'] : self::$binary) { + return $RSAPublicKey; + } + $comment = isset($options['comment']) ? $options['comment'] : self::$comment; + $RSAPublicKey = 'ssh-rsa ' . base64_encode($RSAPublicKey) . ' ' . $comment; + return $RSAPublicKey; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + $publicKey = self::savePublicKey($n, $e, ['binary' => \true]); + $privateKey = Strings::packSSH2('si6', 'ssh-rsa', $n, $e, $d, $coefficients[2], $primes[1], $primes[2]); + return self::wrapPrivateKey($publicKey, $privateKey, $password, $options); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php new file mode 100644 index 0000000..2dd020d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php @@ -0,0 +1,120 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS1 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#1 Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS1 extends Progenitor +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + if (strpos($key, 'PUBLIC') !== \false) { + $components = ['isPublicKey' => \true]; + } elseif (strpos($key, 'PRIVATE') !== \false) { + $components = ['isPublicKey' => \false]; + } else { + $components = []; + } + $key = parent::load($key, $password); + $decoded = ASN1::decodeBER($key); + if (!$decoded) { + throw new \RuntimeException('Unable to decode BER'); + } + $key = ASN1::asn1map($decoded[0], Maps\RSAPrivateKey::MAP); + if (is_array($key)) { + $components += ['modulus' => $key['modulus'], 'publicExponent' => $key['publicExponent'], 'privateExponent' => $key['privateExponent'], 'primes' => [1 => $key['prime1'], $key['prime2']], 'exponents' => [1 => $key['exponent1'], $key['exponent2']], 'coefficients' => [2 => $key['coefficient']]]; + if ($key['version'] == 'multi') { + foreach ($key['otherPrimeInfos'] as $primeInfo) { + $components['primes'][] = $primeInfo['prime']; + $components['exponents'][] = $primeInfo['exponent']; + $components['coefficients'][] = $primeInfo['coefficient']; + } + } + if (!isset($components['isPublicKey'])) { + $components['isPublicKey'] = \false; + } + return $components; + } + $key = ASN1::asn1map($decoded[0], Maps\RSAPublicKey::MAP); + if (!is_array($key)) { + throw new \RuntimeException('Unable to perform ASN1 mapping'); + } + if (!isset($components['isPublicKey'])) { + $components['isPublicKey'] = \true; + } + return $components + $key; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + $num_primes = count($primes); + $key = ['version' => $num_primes == 2 ? 'two-prime' : 'multi', 'modulus' => $n, 'publicExponent' => $e, 'privateExponent' => $d, 'prime1' => $primes[1], 'prime2' => $primes[2], 'exponent1' => $exponents[1], 'exponent2' => $exponents[2], 'coefficient' => $coefficients[2]]; + for ($i = 3; $i <= $num_primes; $i++) { + $key['otherPrimeInfos'][] = ['prime' => $primes[$i], 'exponent' => $exponents[$i], 'coefficient' => $coefficients[$i]]; + } + $key = ASN1::encodeDER($key, Maps\RSAPrivateKey::MAP); + return self::wrapPrivateKey($key, 'RSA', $password, $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e) + { + $key = ['modulus' => $n, 'publicExponent' => $e]; + $key = ASN1::encodeDER($key, Maps\RSAPublicKey::MAP); + return self::wrapPublicKey($key, 'RSA'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php new file mode 100644 index 0000000..c7887d1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php @@ -0,0 +1,111 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#8 Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class PKCS8 extends Progenitor +{ + /** + * OID Name + * + * @var string + */ + const OID_NAME = 'rsaEncryption'; + /** + * OID Value + * + * @var string + */ + const OID_VALUE = '1.2.840.113549.1.1.1'; + /** + * Child OIDs loaded + * + * @var bool + */ + protected static $childOIDsLoaded = \false; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + $key = parent::load($key, $password); + if (isset($key['privateKey'])) { + $components['isPublicKey'] = \false; + $type = 'private'; + } else { + $components['isPublicKey'] = \true; + $type = 'public'; + } + $result = $components + PKCS1::load($key[$type . 'Key']); + if (isset($key['meta'])) { + $result['meta'] = $key['meta']; + } + return $result; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + $key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients); + $key = ASN1::extractBER($key); + return self::wrapPrivateKey($key, [], null, $password, null, '', $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) + { + $key = PKCS1::savePublicKey($n, $e); + $key = ASN1::extractBER($key); + return self::wrapPublicKey($key, null); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php new file mode 100644 index 0000000..e19ff06 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php @@ -0,0 +1,193 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PKCS8 as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PKCS#8 Formatted RSA-PSS Key Handler + * + * @author Jim Wigginton + */ +abstract class PSS extends Progenitor +{ + /** + * OID Name + * + * @var string + */ + const OID_NAME = 'id-RSASSA-PSS'; + /** + * OID Value + * + * @var string + */ + const OID_VALUE = '1.2.840.113549.1.1.10'; + /** + * OIDs loaded + * + * @var bool + */ + private static $oidsLoaded = \false; + /** + * Child OIDs loaded + * + * @var bool + */ + protected static $childOIDsLoaded = \false; + /** + * Initialize static variables + */ + private static function initialize_static_variables() + { + if (!self::$oidsLoaded) { + ASN1::loadOIDs(['md2' => '1.2.840.113549.2.2', 'md4' => '1.2.840.113549.2.4', 'md5' => '1.2.840.113549.2.5', 'id-sha1' => '1.3.14.3.2.26', 'id-sha256' => '2.16.840.1.101.3.4.2.1', 'id-sha384' => '2.16.840.1.101.3.4.2.2', 'id-sha512' => '2.16.840.1.101.3.4.2.3', 'id-sha224' => '2.16.840.1.101.3.4.2.4', 'id-sha512/224' => '2.16.840.1.101.3.4.2.5', 'id-sha512/256' => '2.16.840.1.101.3.4.2.6', 'id-mgf1' => '1.2.840.113549.1.1.8']); + self::$oidsLoaded = \true; + } + } + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + self::initialize_static_variables(); + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + $components = ['isPublicKey' => strpos($key, 'PUBLIC') !== \false]; + $key = parent::load($key, $password); + $type = isset($key['privateKey']) ? 'private' : 'public'; + $result = $components + PKCS1::load($key[$type . 'Key']); + if (isset($key[$type . 'KeyAlgorithm']['parameters'])) { + $decoded = ASN1::decodeBER($key[$type . 'KeyAlgorithm']['parameters']); + if ($decoded === \false) { + throw new \UnexpectedValueException('Unable to decode parameters'); + } + $params = ASN1::asn1map($decoded[0], Maps\RSASSA_PSS_params::MAP); + } else { + $params = []; + } + if (isset($params['maskGenAlgorithm']['parameters'])) { + $decoded = ASN1::decodeBER($params['maskGenAlgorithm']['parameters']); + if ($decoded === \false) { + throw new \UnexpectedValueException('Unable to decode parameters'); + } + $params['maskGenAlgorithm']['parameters'] = ASN1::asn1map($decoded[0], Maps\HashAlgorithm::MAP); + } else { + $params['maskGenAlgorithm'] = ['algorithm' => 'id-mgf1', 'parameters' => ['algorithm' => 'id-sha1']]; + } + if (!isset($params['hashAlgorithm']['algorithm'])) { + $params['hashAlgorithm']['algorithm'] = 'id-sha1'; + } + $result['hash'] = str_replace('id-', '', $params['hashAlgorithm']['algorithm']); + $result['MGFHash'] = str_replace('id-', '', $params['maskGenAlgorithm']['parameters']['algorithm']); + if (isset($params['saltLength'])) { + $result['saltLength'] = (int) $params['saltLength']->toString(); + } + if (isset($key['meta'])) { + $result['meta'] = $key['meta']; + } + return $result; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + self::initialize_static_variables(); + $key = PKCS1::savePrivateKey($n, $e, $d, $primes, $exponents, $coefficients); + $key = ASN1::extractBER($key); + $params = self::savePSSParams($options); + return self::wrapPrivateKey($key, [], $params, $password, null, '', $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param array $options optional + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e, array $options = []) + { + self::initialize_static_variables(); + $key = PKCS1::savePublicKey($n, $e); + $key = ASN1::extractBER($key); + $params = self::savePSSParams($options); + return self::wrapPublicKey($key, $params); + } + /** + * Encodes PSS parameters + * + * @param array $options + * @return string + */ + public static function savePSSParams(array $options) + { + /* + The trailerField field is an integer. It provides + compatibility with IEEE Std 1363a-2004 [P1363A]. The value + MUST be 1, which represents the trailer field with hexadecimal + value 0xBC. Other trailer fields, including the trailer field + composed of HashID concatenated with 0xCC that is specified in + IEEE Std 1363a, are not supported. Implementations that + perform signature generation MUST omit the trailerField field, + indicating that the default trailer field value was used. + Implementations that perform signature validation MUST + recognize both a present trailerField field with value 1 and an + absent trailerField field. + + source: https://tools.ietf.org/html/rfc4055#page-9 + */ + $params = ['trailerField' => new BigInteger(1)]; + if (isset($options['hash'])) { + $params['hashAlgorithm']['algorithm'] = 'id-' . $options['hash']; + } + if (isset($options['MGFHash'])) { + $temp = ['algorithm' => 'id-' . $options['MGFHash']]; + $temp = ASN1::encodeDER($temp, Maps\HashAlgorithm::MAP); + $params['maskGenAlgorithm'] = ['algorithm' => 'id-mgf1', 'parameters' => new ASN1\Element($temp)]; + } + if (isset($options['saltLength'])) { + $params['saltLength'] = new BigInteger($options['saltLength']); + } + return new ASN1\Element(ASN1::encodeDER($params, Maps\RSASSA_PSS_params::MAP)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php new file mode 100644 index 0000000..f6f3e2c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php @@ -0,0 +1,107 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\Formats\Keys\PuTTY as Progenitor; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * PuTTY Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class PuTTY extends Progenitor +{ + /** + * Public Handler + * + * @var string + */ + const PUBLIC_HANDLER = 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\OpenSSH'; + /** + * Algorithm Identifier + * + * @var array + */ + protected static $types = ['ssh-rsa']; + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + static $one; + if (!isset($one)) { + $one = new BigInteger(1); + } + $components = parent::load($key, $password); + if (!isset($components['private'])) { + return $components; + } + extract($components); + unset($components['public'], $components['private']); + $isPublicKey = \false; + $result = Strings::unpackSSH2('ii', $public); + if ($result === \false) { + throw new \UnexpectedValueException('Key appears to be malformed'); + } + list($publicExponent, $modulus) = $result; + $result = Strings::unpackSSH2('iiii', $private); + if ($result === \false) { + throw new \UnexpectedValueException('Key appears to be malformed'); + } + $primes = $coefficients = []; + list($privateExponent, $primes[1], $primes[2], $coefficients[2]) = $result; + $temp = $primes[1]->subtract($one); + $exponents = [1 => $publicExponent->modInverse($temp)]; + $temp = $primes[2]->subtract($one); + $exponents[] = $publicExponent->modInverse($temp); + return compact('publicExponent', 'modulus', 'privateExponent', 'primes', 'coefficients', 'exponents', 'comment', 'isPublicKey'); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + if (count($primes) != 2) { + throw new \InvalidArgumentException('PuTTY does not support multi-prime RSA keys'); + } + $public = Strings::packSSH2('ii', $e, $n); + $private = Strings::packSSH2('iiii', $d, $primes[1], $primes[2], $coefficients[2]); + return self::wrapPrivateKey($public, $private, 'ssh-rsa', $password, $options); + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e) + { + return self::wrapPublicKey(Strings::packSSH2('ii', $e, $n), 'ssh-rsa'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/Raw.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/Raw.php new file mode 100644 index 0000000..1aefd0d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/Raw.php @@ -0,0 +1,153 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Raw RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class Raw +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + if (!is_array($key)) { + throw new \UnexpectedValueException('Key should be a array - not a ' . gettype($key)); + } + $key = array_change_key_case($key, \CASE_LOWER); + $components = ['isPublicKey' => \false]; + foreach (['e', 'exponent', 'publicexponent', 0, 'privateexponent', 'd'] as $index) { + if (isset($key[$index])) { + $components['publicExponent'] = $key[$index]; + break; + } + } + foreach (['n', 'modulo', 'modulus', 1] as $index) { + if (isset($key[$index])) { + $components['modulus'] = $key[$index]; + break; + } + } + if (!isset($components['publicExponent']) || !isset($components['modulus'])) { + throw new \UnexpectedValueException('Modulus / exponent not present'); + } + if (isset($key['primes'])) { + $components['primes'] = $key['primes']; + } elseif (isset($key['p']) && isset($key['q'])) { + $indices = [['p', 'q'], ['prime1', 'prime2']]; + foreach ($indices as $index) { + list($i0, $i1) = $index; + if (isset($key[$i0]) && isset($key[$i1])) { + $components['primes'] = [1 => $key[$i0], $key[$i1]]; + } + } + } + if (isset($key['exponents'])) { + $components['exponents'] = $key['exponents']; + } else { + $indices = [['dp', 'dq'], ['exponent1', 'exponent2']]; + foreach ($indices as $index) { + list($i0, $i1) = $index; + if (isset($key[$i0]) && isset($key[$i1])) { + $components['exponents'] = [1 => $key[$i0], $key[$i1]]; + } + } + } + if (isset($key['coefficients'])) { + $components['coefficients'] = $key['coefficients']; + } else { + foreach (['inverseq', 'q\'', 'coefficient'] as $index) { + if (isset($key[$index])) { + $components['coefficients'] = [2 => $key[$index]]; + } + } + } + if (!isset($components['primes'])) { + $components['isPublicKey'] = \true; + return $components; + } + if (!isset($components['exponents'])) { + $one = new BigInteger(1); + $temp = $components['primes'][1]->subtract($one); + $exponents = [1 => $components['publicExponent']->modInverse($temp)]; + $temp = $components['primes'][2]->subtract($one); + $exponents[] = $components['publicExponent']->modInverse($temp); + $components['exponents'] = $exponents; + } + if (!isset($components['coefficients'])) { + $components['coefficients'] = [2 => $components['primes'][2]->modInverse($components['primes'][1])]; + } + foreach (['privateexponent', 'd'] as $index) { + if (isset($key[$index])) { + $components['privateExponent'] = $key[$index]; + break; + } + } + return $components; + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @param array $options optional + * @return array + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '', array $options = []) + { + if (!empty($password) && is_string($password)) { + throw new UnsupportedFormatException('Raw private keys do not support encryption'); + } + return ['e' => clone $e, 'n' => clone $n, 'd' => clone $d, 'primes' => array_map(function ($var) { + return clone $var; + }, $primes), 'exponents' => array_map(function ($var) { + return clone $var; + }, $exponents), 'coefficients' => array_map(function ($var) { + return clone $var; + }, $coefficients)]; + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @return array + */ + public static function savePublicKey(BigInteger $n, BigInteger $e) + { + return ['e' => clone $e, 'n' => clone $n]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/XML.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/XML.php new file mode 100644 index 0000000..d46c4a8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/XML.php @@ -0,0 +1,140 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * XML Formatted RSA Key Handler + * + * @author Jim Wigginton + */ +abstract class XML +{ + /** + * Break a public or private key down into its constituent components + * + * @param string $key + * @param string $password optional + * @return array + */ + public static function load($key, $password = '') + { + if (!Strings::is_stringable($key)) { + throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key)); + } + if (!class_exists('DOMDocument')) { + throw new BadConfigurationException('The dom extension is not setup correctly on this system'); + } + $components = ['isPublicKey' => \false, 'primes' => [], 'exponents' => [], 'coefficients' => []]; + $use_errors = libxml_use_internal_errors(\true); + $dom = new \DOMDocument(); + if (substr($key, 0, 5) != '' . $key . ''; + } + if (!$dom->loadXML($key)) { + libxml_use_internal_errors($use_errors); + throw new \UnexpectedValueException('Key does not appear to contain XML'); + } + $xpath = new \DOMXPath($dom); + $keys = ['modulus', 'exponent', 'p', 'q', 'dp', 'dq', 'inverseq', 'd']; + foreach ($keys as $key) { + // $dom->getElementsByTagName($key) is case-sensitive + $temp = $xpath->query("//*[translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')='{$key}']"); + if (!$temp->length) { + continue; + } + $value = new BigInteger(Strings::base64_decode($temp->item(0)->nodeValue), 256); + switch ($key) { + case 'modulus': + $components['modulus'] = $value; + break; + case 'exponent': + $components['publicExponent'] = $value; + break; + case 'p': + $components['primes'][1] = $value; + break; + case 'q': + $components['primes'][2] = $value; + break; + case 'dp': + $components['exponents'][1] = $value; + break; + case 'dq': + $components['exponents'][2] = $value; + break; + case 'inverseq': + $components['coefficients'][2] = $value; + break; + case 'd': + $components['privateExponent'] = $value; + } + } + libxml_use_internal_errors($use_errors); + foreach ($components as $key => $value) { + if (is_array($value) && !count($value)) { + unset($components[$key]); + } + } + if (isset($components['modulus']) && isset($components['publicExponent'])) { + if (count($components) == 3) { + $components['isPublicKey'] = \true; + } + return $components; + } + throw new \UnexpectedValueException('Modulus / exponent not present'); + } + /** + * Convert a private key to the appropriate format. + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @param \phpseclib3\Math\BigInteger $d + * @param array $primes + * @param array $exponents + * @param array $coefficients + * @param string $password optional + * @return string + */ + public static function savePrivateKey(BigInteger $n, BigInteger $e, BigInteger $d, array $primes, array $exponents, array $coefficients, $password = '') + { + if (count($primes) != 2) { + throw new \InvalidArgumentException('XML does not support multi-prime RSA keys'); + } + if (!empty($password) && is_string($password)) { + throw new UnsupportedFormatException('XML private keys do not support encryption'); + } + return "\r\n" . ' ' . Strings::base64_encode($n->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($e->toBytes()) . "\r\n" . '

' . Strings::base64_encode($primes[1]->toBytes()) . "

\r\n" . ' ' . Strings::base64_encode($primes[2]->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($exponents[1]->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($exponents[2]->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($coefficients[2]->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($d->toBytes()) . "\r\n" . '
'; + } + /** + * Convert a public key to the appropriate format + * + * @param \phpseclib3\Math\BigInteger $n + * @param \phpseclib3\Math\BigInteger $e + * @return string + */ + public static function savePublicKey(BigInteger $n, BigInteger $e) + { + return "\r\n" . ' ' . Strings::base64_encode($n->toBytes()) . "\r\n" . ' ' . Strings::base64_encode($e->toBytes()) . "\r\n" . ''; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php new file mode 100644 index 0000000..1250b46 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php @@ -0,0 +1,441 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys\PSS; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Raw RSA Key Handler + * + * @author Jim Wigginton + */ +final class PrivateKey extends RSA implements Common\PrivateKey +{ + use Common\Traits\PasswordProtected; + /** + * Primes for Chinese Remainder Theorem (ie. p and q) + * + * @var array + */ + protected $primes; + /** + * Exponents for Chinese Remainder Theorem (ie. dP and dQ) + * + * @var array + */ + protected $exponents; + /** + * Coefficients for Chinese Remainder Theorem (ie. qInv) + * + * @var array + */ + protected $coefficients; + /** + * Private Exponent + * + * @var \phpseclib3\Math\BigInteger + */ + protected $privateExponent; + /** + * RSADP + * + * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.2 RFC3447#section-5.1.2}. + * + * @return bool|\phpseclib3\Math\BigInteger + */ + private function rsadp(BigInteger $c) + { + if ($c->compare(self::$zero) < 0 || $c->compare($this->modulus) > 0) { + throw new \OutOfRangeException('Ciphertext representative out of range'); + } + return $this->exponentiate($c); + } + /** + * RSASP1 + * + * See {@link http://tools.ietf.org/html/rfc3447#section-5.2.1 RFC3447#section-5.2.1}. + * + * @return bool|\phpseclib3\Math\BigInteger + */ + private function rsasp1(BigInteger $m) + { + if ($m->compare(self::$zero) < 0 || $m->compare($this->modulus) > 0) { + throw new \OutOfRangeException('Signature representative out of range'); + } + return $this->exponentiate($m); + } + /** + * Exponentiate + * + * @param \phpseclib3\Math\BigInteger $x + * @return \phpseclib3\Math\BigInteger + */ + protected function exponentiate(BigInteger $x) + { + switch (\true) { + case empty($this->primes): + case $this->primes[1]->equals(self::$zero): + case empty($this->coefficients): + case $this->coefficients[2]->equals(self::$zero): + case empty($this->exponents): + case $this->exponents[1]->equals(self::$zero): + return $x->modPow($this->exponent, $this->modulus); + } + $num_primes = count($this->primes); + if (!static::$enableBlinding) { + $m_i = [1 => $x->modPow($this->exponents[1], $this->primes[1]), 2 => $x->modPow($this->exponents[2], $this->primes[2])]; + $h = $m_i[1]->subtract($m_i[2]); + $h = $h->multiply($this->coefficients[2]); + list(, $h) = $h->divide($this->primes[1]); + $m = $m_i[2]->add($h->multiply($this->primes[2])); + $r = $this->primes[1]; + for ($i = 3; $i <= $num_primes; $i++) { + $m_i = $x->modPow($this->exponents[$i], $this->primes[$i]); + $r = $r->multiply($this->primes[$i - 1]); + $h = $m_i->subtract($m); + $h = $h->multiply($this->coefficients[$i]); + list(, $h) = $h->divide($this->primes[$i]); + $m = $m->add($r->multiply($h)); + } + } else { + $smallest = $this->primes[1]; + for ($i = 2; $i <= $num_primes; $i++) { + if ($smallest->compare($this->primes[$i]) > 0) { + $smallest = $this->primes[$i]; + } + } + $r = BigInteger::randomRange(self::$one, $smallest->subtract(self::$one)); + $m_i = [1 => $this->blind($x, $r, 1), 2 => $this->blind($x, $r, 2)]; + $h = $m_i[1]->subtract($m_i[2]); + $h = $h->multiply($this->coefficients[2]); + list(, $h) = $h->divide($this->primes[1]); + $m = $m_i[2]->add($h->multiply($this->primes[2])); + $r = $this->primes[1]; + for ($i = 3; $i <= $num_primes; $i++) { + $m_i = $this->blind($x, $r, $i); + $r = $r->multiply($this->primes[$i - 1]); + $h = $m_i->subtract($m); + $h = $h->multiply($this->coefficients[$i]); + list(, $h) = $h->divide($this->primes[$i]); + $m = $m->add($r->multiply($h)); + } + } + return $m; + } + /** + * Performs RSA Blinding + * + * Protects against timing attacks by employing RSA Blinding. + * Returns $x->modPow($this->exponents[$i], $this->primes[$i]) + * + * @param \phpseclib3\Math\BigInteger $x + * @param \phpseclib3\Math\BigInteger $r + * @param int $i + * @return \phpseclib3\Math\BigInteger + */ + private function blind(BigInteger $x, BigInteger $r, $i) + { + $x = $x->multiply($r->modPow($this->publicExponent, $this->primes[$i])); + $x = $x->modPow($this->exponents[$i], $this->primes[$i]); + $r = $r->modInverse($this->primes[$i]); + $x = $x->multiply($r); + list(, $x) = $x->divide($this->primes[$i]); + return $x; + } + /** + * EMSA-PSS-ENCODE + * + * See {@link http://tools.ietf.org/html/rfc3447#section-9.1.1 RFC3447#section-9.1.1}. + * + * @return string + * @param string $m + * @throws \RuntimeException on encoding error + * @param int $emBits + */ + private function emsa_pss_encode($m, $emBits) + { + // if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error + // be output. + $emLen = $emBits + 1 >> 3; + // ie. ceil($emBits / 8) + $sLen = $this->sLen !== null ? $this->sLen : $this->hLen; + $mHash = $this->hash->hash($m); + if ($emLen < $this->hLen + $sLen + 2) { + throw new \LengthException('RSA modulus too short'); + } + $salt = Random::string($sLen); + $m2 = "\x00\x00\x00\x00\x00\x00\x00\x00" . $mHash . $salt; + $h = $this->hash->hash($m2); + $ps = str_repeat(chr(0), $emLen - $sLen - $this->hLen - 2); + $db = $ps . chr(1) . $salt; + $dbMask = $this->mgf1($h, $emLen - $this->hLen - 1); + // ie. stlren($db) + $maskedDB = $db ^ $dbMask; + $maskedDB[0] = ~chr(0xff << ($emBits & 7)) & $maskedDB[0]; + $em = $maskedDB . $h . chr(0xbc); + return $em; + } + /** + * RSASSA-PSS-SIGN + * + * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.1 RFC3447#section-8.1.1}. + * + * @param string $m + * @return bool|string + */ + private function rsassa_pss_sign($m) + { + // EMSA-PSS encoding + $em = $this->emsa_pss_encode($m, 8 * $this->k - 1); + // RSA signature + $m = $this->os2ip($em); + $s = $this->rsasp1($m); + $s = $this->i2osp($s, $this->k); + // Output the signature S + return $s; + } + /** + * RSASSA-PKCS1-V1_5-SIGN + * + * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.1 RFC3447#section-8.2.1}. + * + * @param string $m + * @throws \LengthException if the RSA modulus is too short + * @return bool|string + */ + private function rsassa_pkcs1_v1_5_sign($m) + { + // EMSA-PKCS1-v1_5 encoding + // If the encoding operation outputs "intended encoded message length too short," output "RSA modulus + // too short" and stop. + try { + $em = $this->emsa_pkcs1_v1_5_encode($m, $this->k); + } catch (\LengthException $e) { + throw new \LengthException('RSA modulus too short'); + } + // RSA signature + $m = $this->os2ip($em); + $s = $this->rsasp1($m); + $s = $this->i2osp($s, $this->k); + // Output the signature S + return $s; + } + /** + * Create a signature + * + * @see self::verify() + * @param string $message + * @return string + */ + public function sign($message) + { + switch ($this->signaturePadding) { + case self::SIGNATURE_PKCS1: + case self::SIGNATURE_RELAXED_PKCS1: + return $this->rsassa_pkcs1_v1_5_sign($message); + //case self::SIGNATURE_PSS: + default: + return $this->rsassa_pss_sign($message); + } + } + /** + * RSAES-PKCS1-V1_5-DECRYPT + * + * See {@link http://tools.ietf.org/html/rfc3447#section-7.2.2 RFC3447#section-7.2.2}. + * + * @param string $c + * @return bool|string + */ + private function rsaes_pkcs1_v1_5_decrypt($c) + { + // Length checking + if (strlen($c) != $this->k) { + // or if k < 11 + throw new \LengthException('Ciphertext representative too long'); + } + // RSA decryption + $c = $this->os2ip($c); + $m = $this->rsadp($c); + $em = $this->i2osp($m, $this->k); + // EME-PKCS1-v1_5 decoding + if (ord($em[0]) != 0 || ord($em[1]) > 2) { + throw new \RuntimeException('Decryption error'); + } + $ps = substr($em, 2, strpos($em, chr(0), 2) - 2); + $m = substr($em, strlen($ps) + 3); + if (strlen($ps) < 8) { + throw new \RuntimeException('Decryption error'); + } + // Output M + return $m; + } + /** + * RSAES-OAEP-DECRYPT + * + * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.2 RFC3447#section-7.1.2}. The fact that the error + * messages aren't distinguishable from one another hinders debugging, but, to quote from RFC3447#section-7.1.2: + * + * Note. Care must be taken to ensure that an opponent cannot + * distinguish the different error conditions in Step 3.g, whether by + * error message or timing, or, more generally, learn partial + * information about the encoded message EM. Otherwise an opponent may + * be able to obtain useful information about the decryption of the + * ciphertext C, leading to a chosen-ciphertext attack such as the one + * observed by Manger [36]. + * + * @param string $c + * @return bool|string + */ + private function rsaes_oaep_decrypt($c) + { + // Length checking + // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error + // be output. + if (strlen($c) != $this->k || $this->k < 2 * $this->hLen + 2) { + throw new \LengthException('Ciphertext representative too long'); + } + // RSA decryption + $c = $this->os2ip($c); + $m = $this->rsadp($c); + $em = $this->i2osp($m, $this->k); + // EME-OAEP decoding + $lHash = $this->hash->hash($this->label); + $y = ord($em[0]); + $maskedSeed = substr($em, 1, $this->hLen); + $maskedDB = substr($em, $this->hLen + 1); + $seedMask = $this->mgf1($maskedDB, $this->hLen); + $seed = $maskedSeed ^ $seedMask; + $dbMask = $this->mgf1($seed, $this->k - $this->hLen - 1); + $db = $maskedDB ^ $dbMask; + $lHash2 = substr($db, 0, $this->hLen); + $m = substr($db, $this->hLen); + $hashesMatch = hash_equals($lHash, $lHash2); + $leadingZeros = 1; + $patternMatch = 0; + $offset = 0; + for ($i = 0; $i < strlen($m); $i++) { + $patternMatch |= $leadingZeros & $m[$i] === "\x01"; + $leadingZeros &= $m[$i] === "\x00"; + $offset += $patternMatch ? 0 : 1; + } + // we do | instead of || to avoid https://en.wikipedia.org/wiki/Short-circuit_evaluation + // to protect against timing attacks + if (!$hashesMatch | !$patternMatch) { + throw new \RuntimeException('Decryption error'); + } + // Output the message M + return substr($m, $offset + 1); + } + /** + * Raw Encryption / Decryption + * + * Doesn't use padding and is not recommended. + * + * @param string $m + * @return bool|string + * @throws \LengthException if strlen($m) > $this->k + */ + private function raw_encrypt($m) + { + if (strlen($m) > $this->k) { + throw new \LengthException('Ciphertext representative too long'); + } + $temp = $this->os2ip($m); + $temp = $this->rsadp($temp); + return $this->i2osp($temp, $this->k); + } + /** + * Decryption + * + * @see self::encrypt() + * @param string $ciphertext + * @return bool|string + */ + public function decrypt($ciphertext) + { + switch ($this->encryptionPadding) { + case self::ENCRYPTION_NONE: + return $this->raw_encrypt($ciphertext); + case self::ENCRYPTION_PKCS1: + return $this->rsaes_pkcs1_v1_5_decrypt($ciphertext); + //case self::ENCRYPTION_OAEP: + default: + return $this->rsaes_oaep_decrypt($ciphertext); + } + } + /** + * Returns the public key + * + * @return mixed + */ + public function getPublicKey() + { + $type = self::validatePlugin('Keys', 'PKCS8', 'savePublicKey'); + if (empty($this->modulus) || empty($this->publicExponent)) { + throw new \RuntimeException('Public key components not found'); + } + $key = $type::savePublicKey($this->modulus, $this->publicExponent); + return RSA::loadFormat('PKCS8', $key)->withHash($this->hash->getHash())->withMGFHash($this->mgfHash->getHash())->withSaltLength($this->sLen)->withLabel($this->label)->withPadding($this->signaturePadding | $this->encryptionPadding); + } + /** + * Returns the private key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, empty($this->primes) ? 'savePublicKey' : 'savePrivateKey'); + if ($type == PSS::class) { + if ($this->signaturePadding == self::SIGNATURE_PSS) { + $options += ['hash' => $this->hash->getHash(), 'MGFHash' => $this->mgfHash->getHash(), 'saltLength' => $this->getSaltLength()]; + } else { + throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS'); + } + } + if (empty($this->primes)) { + return $type::savePublicKey($this->modulus, $this->exponent, $options); + } + return $type::savePrivateKey($this->modulus, $this->publicExponent, $this->exponent, $this->primes, $this->exponents, $this->coefficients, $this->password, $options); + /* + $key = $type::savePrivateKey($this->modulus, $this->publicExponent, $this->exponent, $this->primes, $this->exponents, $this->coefficients, $this->password, $options); + if ($key !== false || count($this->primes) == 2) { + return $key; + } + + $nSize = $this->getSize() >> 1; + + $primes = [1 => clone self::$one, clone self::$one]; + $i = 1; + foreach ($this->primes as $prime) { + $primes[$i] = $primes[$i]->multiply($prime); + if ($primes[$i]->getLength() >= $nSize) { + $i++; + } + } + + $exponents = []; + $coefficients = [2 => $primes[2]->modInverse($primes[1])]; + + foreach ($primes as $i => $prime) { + $temp = $prime->subtract(self::$one); + $exponents[$i] = $this->modulus->modInverse($temp); + } + + return $type::savePrivateKey($this->modulus, $this->publicExponent, $this->exponent, $primes, $exponents, $coefficients, $this->password, $options); + */ + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php new file mode 100644 index 0000000..aa8eca4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php @@ -0,0 +1,439 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys\PSS; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedFormatException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps\DigestInfo; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Raw RSA Key Handler + * + * @author Jim Wigginton + */ +final class PublicKey extends RSA implements Common\PublicKey +{ + use Common\Traits\Fingerprint; + /** + * Exponentiate + * + * @param \phpseclib3\Math\BigInteger $x + * @return \phpseclib3\Math\BigInteger + */ + private function exponentiate(BigInteger $x) + { + return $x->modPow($this->exponent, $this->modulus); + } + /** + * RSAVP1 + * + * See {@link http://tools.ietf.org/html/rfc3447#section-5.2.2 RFC3447#section-5.2.2}. + * + * @param \phpseclib3\Math\BigInteger $s + * @return bool|\phpseclib3\Math\BigInteger + */ + private function rsavp1($s) + { + if ($s->compare(self::$zero) < 0 || $s->compare($this->modulus) > 0) { + return \false; + } + return $this->exponentiate($s); + } + /** + * RSASSA-PKCS1-V1_5-VERIFY + * + * See {@link http://tools.ietf.org/html/rfc3447#section-8.2.2 RFC3447#section-8.2.2}. + * + * @param string $m + * @param string $s + * @throws \LengthException if the RSA modulus is too short + * @return bool + */ + private function rsassa_pkcs1_v1_5_verify($m, $s) + { + // Length checking + if (strlen($s) != $this->k) { + return \false; + } + // RSA verification + $s = $this->os2ip($s); + $m2 = $this->rsavp1($s); + if ($m2 === \false) { + return \false; + } + $em = $this->i2osp($m2, $this->k); + if ($em === \false) { + return \false; + } + // EMSA-PKCS1-v1_5 encoding + $exception = \false; + // If the encoding operation outputs "intended encoded message length too short," output "RSA modulus + // too short" and stop. + try { + $em2 = $this->emsa_pkcs1_v1_5_encode($m, $this->k); + $r1 = hash_equals($em, $em2); + } catch (\LengthException $e) { + $exception = \true; + } + try { + $em3 = $this->emsa_pkcs1_v1_5_encode_without_null($m, $this->k); + $r2 = hash_equals($em, $em3); + } catch (\LengthException $e) { + $exception = \true; + } catch (UnsupportedAlgorithmException $e) { + $r2 = \false; + } + if ($exception) { + throw new \LengthException('RSA modulus too short'); + } + // Compare + return $r1 || $r2; + } + /** + * RSASSA-PKCS1-V1_5-VERIFY (relaxed matching) + * + * Per {@link http://tools.ietf.org/html/rfc3447#page-43 RFC3447#page-43} PKCS1 v1.5 + * specified the use BER encoding rather than DER encoding that PKCS1 v2.0 specified. + * This means that under rare conditions you can have a perfectly valid v1.5 signature + * that fails to validate with _rsassa_pkcs1_v1_5_verify(). PKCS1 v2.1 also recommends + * that if you're going to validate these types of signatures you "should indicate + * whether the underlying BER encoding is a DER encoding and hence whether the signature + * is valid with respect to the specification given in [PKCS1 v2.0+]". so if you do + * $rsa->getLastPadding() and get RSA::PADDING_RELAXED_PKCS1 back instead of + * RSA::PADDING_PKCS1... that means BER encoding was used. + * + * @param string $m + * @param string $s + * @return bool + */ + private function rsassa_pkcs1_v1_5_relaxed_verify($m, $s) + { + // Length checking + if (strlen($s) != $this->k) { + return \false; + } + // RSA verification + $s = $this->os2ip($s); + $m2 = $this->rsavp1($s); + if ($m2 === \false) { + return \false; + } + $em = $this->i2osp($m2, $this->k); + if ($em === \false) { + return \false; + } + if (Strings::shift($em, 2) != "\x00\x01") { + return \false; + } + $em = ltrim($em, "\xff"); + if (Strings::shift($em) != "\x00") { + return \false; + } + $decoded = ASN1::decodeBER($em); + if (!is_array($decoded) || empty($decoded[0]) || strlen($em) > $decoded[0]['length']) { + return \false; + } + static $oids; + if (!isset($oids)) { + $oids = [ + 'md2' => '1.2.840.113549.2.2', + 'md4' => '1.2.840.113549.2.4', + // from PKCS1 v1.5 + 'md5' => '1.2.840.113549.2.5', + 'id-sha1' => '1.3.14.3.2.26', + 'id-sha256' => '2.16.840.1.101.3.4.2.1', + 'id-sha384' => '2.16.840.1.101.3.4.2.2', + 'id-sha512' => '2.16.840.1.101.3.4.2.3', + // from PKCS1 v2.2 + 'id-sha224' => '2.16.840.1.101.3.4.2.4', + 'id-sha512/224' => '2.16.840.1.101.3.4.2.5', + 'id-sha512/256' => '2.16.840.1.101.3.4.2.6', + ]; + ASN1::loadOIDs($oids); + } + $decoded = ASN1::asn1map($decoded[0], DigestInfo::MAP); + if (!isset($decoded) || $decoded === \false) { + return \false; + } + if (!isset($oids[$decoded['digestAlgorithm']['algorithm']])) { + return \false; + } + if (isset($decoded['digestAlgorithm']['parameters']) && $decoded['digestAlgorithm']['parameters'] !== ['null' => '']) { + return \false; + } + $hash = $decoded['digestAlgorithm']['algorithm']; + $hash = substr($hash, 0, 3) == 'id-' ? substr($hash, 3) : $hash; + $hash = new Hash($hash); + $em = $hash->hash($m); + $em2 = $decoded['digest']; + return hash_equals($em, $em2); + } + /** + * EMSA-PSS-VERIFY + * + * See {@link http://tools.ietf.org/html/rfc3447#section-9.1.2 RFC3447#section-9.1.2}. + * + * @param string $m + * @param string $em + * @param int $emBits + * @return string + */ + private function emsa_pss_verify($m, $em, $emBits) + { + // if $m is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error + // be output. + $emLen = $emBits + 7 >> 3; + // ie. ceil($emBits / 8); + $sLen = $this->sLen !== null ? $this->sLen : $this->hLen; + $mHash = $this->hash->hash($m); + if ($emLen < $this->hLen + $sLen + 2) { + return \false; + } + if ($em[strlen($em) - 1] != chr(0xbc)) { + return \false; + } + $maskedDB = substr($em, 0, -$this->hLen - 1); + $h = substr($em, -$this->hLen - 1, $this->hLen); + $temp = chr(0xff << ($emBits & 7)); + if ((~$maskedDB[0] & $temp) != $temp) { + return \false; + } + $dbMask = $this->mgf1($h, $emLen - $this->hLen - 1); + $db = $maskedDB ^ $dbMask; + $db[0] = ~chr(0xff << ($emBits & 7)) & $db[0]; + $temp = $emLen - $this->hLen - $sLen - 2; + if (substr($db, 0, $temp) != str_repeat(chr(0), $temp) || ord($db[$temp]) != 1) { + return \false; + } + $salt = substr($db, $temp + 1); + // should be $sLen long + $m2 = "\x00\x00\x00\x00\x00\x00\x00\x00" . $mHash . $salt; + $h2 = $this->hash->hash($m2); + return hash_equals($h, $h2); + } + /** + * RSASSA-PSS-VERIFY + * + * See {@link http://tools.ietf.org/html/rfc3447#section-8.1.2 RFC3447#section-8.1.2}. + * + * @param string $m + * @param string $s + * @return bool|string + */ + private function rsassa_pss_verify($m, $s) + { + // Length checking + if (strlen($s) != $this->k) { + return \false; + } + // RSA verification + $modBits = strlen($this->modulus->toBits()); + $s2 = $this->os2ip($s); + $m2 = $this->rsavp1($s2); + $em = $this->i2osp($m2, $this->k); + if ($em === \false) { + return \false; + } + // EMSA-PSS verification + return $this->emsa_pss_verify($m, $em, $modBits - 1); + } + /** + * Verifies a signature + * + * @see self::sign() + * @param string $message + * @param string $signature + * @return bool + */ + public function verify($message, $signature) + { + switch ($this->signaturePadding) { + case self::SIGNATURE_RELAXED_PKCS1: + return $this->rsassa_pkcs1_v1_5_relaxed_verify($message, $signature); + case self::SIGNATURE_PKCS1: + return $this->rsassa_pkcs1_v1_5_verify($message, $signature); + //case self::SIGNATURE_PSS: + default: + return $this->rsassa_pss_verify($message, $signature); + } + } + /** + * RSAES-PKCS1-V1_5-ENCRYPT + * + * See {@link http://tools.ietf.org/html/rfc3447#section-7.2.1 RFC3447#section-7.2.1}. + * + * @param string $m + * @param bool $pkcs15_compat optional + * @throws \LengthException if strlen($m) > $this->k - 11 + * @return bool|string + */ + private function rsaes_pkcs1_v1_5_encrypt($m, $pkcs15_compat = \false) + { + $mLen = strlen($m); + // Length checking + if ($mLen > $this->k - 11) { + throw new \LengthException('Message too long'); + } + // EME-PKCS1-v1_5 encoding + $psLen = $this->k - $mLen - 3; + $ps = ''; + while (strlen($ps) != $psLen) { + $temp = Random::string($psLen - strlen($ps)); + $temp = str_replace("\x00", '', $temp); + $ps .= $temp; + } + $type = 2; + $em = chr(0) . chr($type) . $ps . chr(0) . $m; + // RSA encryption + $m = $this->os2ip($em); + $c = $this->rsaep($m); + $c = $this->i2osp($c, $this->k); + // Output the ciphertext C + return $c; + } + /** + * RSAES-OAEP-ENCRYPT + * + * See {@link http://tools.ietf.org/html/rfc3447#section-7.1.1 RFC3447#section-7.1.1} and + * {http://en.wikipedia.org/wiki/Optimal_Asymmetric_Encryption_Padding OAES}. + * + * @param string $m + * @throws \LengthException if strlen($m) > $this->k - 2 * $this->hLen - 2 + * @return string + */ + private function rsaes_oaep_encrypt($m) + { + $mLen = strlen($m); + // Length checking + // if $l is larger than two million terrabytes and you're using sha1, PKCS#1 suggests a "Label too long" error + // be output. + if ($mLen > $this->k - 2 * $this->hLen - 2) { + throw new \LengthException('Message too long'); + } + // EME-OAEP encoding + $lHash = $this->hash->hash($this->label); + $ps = str_repeat(chr(0), $this->k - $mLen - 2 * $this->hLen - 2); + $db = $lHash . $ps . chr(1) . $m; + $seed = Random::string($this->hLen); + $dbMask = $this->mgf1($seed, $this->k - $this->hLen - 1); + $maskedDB = $db ^ $dbMask; + $seedMask = $this->mgf1($maskedDB, $this->hLen); + $maskedSeed = $seed ^ $seedMask; + $em = chr(0) . $maskedSeed . $maskedDB; + // RSA encryption + $m = $this->os2ip($em); + $c = $this->rsaep($m); + $c = $this->i2osp($c, $this->k); + // Output the ciphertext C + return $c; + } + /** + * RSAEP + * + * See {@link http://tools.ietf.org/html/rfc3447#section-5.1.1 RFC3447#section-5.1.1}. + * + * @param \phpseclib3\Math\BigInteger $m + * @return bool|\phpseclib3\Math\BigInteger + */ + private function rsaep($m) + { + if ($m->compare(self::$zero) < 0 || $m->compare($this->modulus) > 0) { + throw new \OutOfRangeException('Message representative out of range'); + } + return $this->exponentiate($m); + } + /** + * Raw Encryption / Decryption + * + * Doesn't use padding and is not recommended. + * + * @param string $m + * @return bool|string + * @throws \LengthException if strlen($m) > $this->k + */ + private function raw_encrypt($m) + { + if (strlen($m) > $this->k) { + throw new \LengthException('Message too long'); + } + $temp = $this->os2ip($m); + $temp = $this->rsaep($temp); + return $this->i2osp($temp, $this->k); + } + /** + * Encryption + * + * Both self::PADDING_OAEP and self::PADDING_PKCS1 both place limits on how long $plaintext can be. + * If $plaintext exceeds those limits it will be broken up so that it does and the resultant ciphertext's will + * be concatenated together. + * + * @see self::decrypt() + * @param string $plaintext + * @return bool|string + * @throws \LengthException if the RSA modulus is too short + */ + public function encrypt($plaintext) + { + switch ($this->encryptionPadding) { + case self::ENCRYPTION_NONE: + return $this->raw_encrypt($plaintext); + case self::ENCRYPTION_PKCS1: + return $this->rsaes_pkcs1_v1_5_encrypt($plaintext); + //case self::ENCRYPTION_OAEP: + default: + return $this->rsaes_oaep_encrypt($plaintext); + } + } + /** + * Returns the public key + * + * The public key is only returned under two circumstances - if the private key had the public key embedded within it + * or if the public key was set via setPublicKey(). If the currently loaded key is supposed to be the public key this + * function won't return it since this library, for the most part, doesn't distinguish between public and private keys. + * + * @param string $type + * @param array $options optional + * @return mixed + */ + public function toString($type, array $options = []) + { + $type = self::validatePlugin('Keys', $type, 'savePublicKey'); + if ($type == PSS::class) { + if ($this->signaturePadding == self::SIGNATURE_PSS) { + $options += ['hash' => $this->hash->getHash(), 'MGFHash' => $this->mgfHash->getHash(), 'saltLength' => $this->getSaltLength()]; + } else { + throw new UnsupportedFormatException('The PSS format can only be used when the signature method has been explicitly set to PSS'); + } + } + return $type::savePublicKey($this->modulus, $this->publicExponent, $options); + } + /** + * Converts a public key to a private key + * + * @return RSA + */ + public function asPrivateKey() + { + $new = new PrivateKey(); + $new->exponent = $this->exponent; + $new->modulus = $this->modulus; + $new->k = $this->k; + $new->format = $this->format; + return $new->withHash($this->hash->getHash())->withMGFHash($this->mgfHash->getHash())->withSaltLength($this->sLen)->withLabel($this->label)->withPadding($this->signaturePadding | $this->encryptionPadding); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Random.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Random.php new file mode 100644 index 0000000..796ac94 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Random.php @@ -0,0 +1,202 @@ + + * + * + * + * @author Jim Wigginton + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +/** + * Pure-PHP Random Number Generator + * + * @author Jim Wigginton + */ +abstract class Random +{ + /** + * Generate a random string. + * + * Although microoptimizations are generally discouraged as they impair readability this function is ripe with + * microoptimizations because this function has the potential of being called a huge number of times. + * eg. for RSA key generation. + * + * @param int $length + * @throws \RuntimeException if a symmetric cipher is needed but not loaded + * @return string + */ + public static function string($length) + { + if (!$length) { + return ''; + } + try { + return random_bytes($length); + } catch (\Exception $e) { + // random_compat will throw an Exception, which in PHP 5 does not implement Throwable + } catch (\Throwable $e) { + // If a sufficient source of randomness is unavailable, random_bytes() will throw an + // object that implements the Throwable interface (Exception, TypeError, Error). + // We don't actually need to do anything here. The string() method should just continue + // as normal. Note, however, that if we don't have a sufficient source of randomness for + // random_bytes(), most of the other calls here will fail too, so we'll end up using + // the PHP implementation. + } + // at this point we have no choice but to use a pure-PHP CSPRNG + // cascade entropy across multiple PHP instances by fixing the session and collecting all + // environmental variables, including the previous session data and the current session + // data. + // + // mt_rand seeds itself by looking at the PID and the time, both of which are (relatively) + // easy to guess at. linux uses mouse clicks, keyboard timings, etc, as entropy sources, but + // PHP isn't low level to be able to use those as sources and on a web server there's not likely + // going to be a ton of keyboard or mouse action. web servers do have one thing that we can use + // however, a ton of people visiting the website. obviously you don't want to base your seeding + // solely on parameters a potential attacker sends but (1) not everything in $_SERVER is controlled + // by the user and (2) this isn't just looking at the data sent by the current user - it's based + // on the data sent by all users. one user requests the page and a hash of their info is saved. + // another user visits the page and the serialization of their data is utilized along with the + // server environment stuff and a hash of the previous http request data (which itself utilizes + // a hash of the session data before that). certainly an attacker should be assumed to have + // full control over his own http requests. he, however, is not going to have control over + // everyone's http requests. + static $crypto = \false, $v; + if ($crypto === \false) { + // save old session data + $old_session_id = session_id(); + $old_use_cookies = ini_get('session.use_cookies'); + $old_session_cache_limiter = session_cache_limiter(); + $_OLD_SESSION = isset($_SESSION) ? $_SESSION : \false; + if ($old_session_id != '') { + session_write_close(); + } + session_id(1); + ini_set('session.use_cookies', 0); + session_cache_limiter(''); + session_start(); + $v = (isset($_SERVER) ? self::safe_serialize($_SERVER) : '') . (isset($_POST) ? self::safe_serialize($_POST) : '') . (isset($_GET) ? self::safe_serialize($_GET) : '') . (isset($_COOKIE) ? self::safe_serialize($_COOKIE) : '') . (version_compare(\PHP_VERSION, '8.1.0', '>=') ? serialize($GLOBALS) : self::safe_serialize($GLOBALS)) . self::safe_serialize($_SESSION) . self::safe_serialize($_OLD_SESSION); + $v = $seed = $_SESSION['seed'] = sha1($v, \true); + if (!isset($_SESSION['count'])) { + $_SESSION['count'] = 0; + } + $_SESSION['count']++; + session_write_close(); + // restore old session data + if ($old_session_id != '') { + session_id($old_session_id); + session_start(); + ini_set('session.use_cookies', $old_use_cookies); + session_cache_limiter($old_session_cache_limiter); + } else { + if ($_OLD_SESSION !== \false) { + $_SESSION = $_OLD_SESSION; + unset($_OLD_SESSION); + } else { + unset($_SESSION); + } + } + // in SSH2 a shared secret and an exchange hash are generated through the key exchange process. + // the IV client to server is the hash of that "nonce" with the letter A and for the encryption key it's the letter C. + // if the hash doesn't produce enough a key or an IV that's long enough concat successive hashes of the + // original hash and the current hash. we'll be emulating that. for more info see the following URL: + // + // http://tools.ietf.org/html/rfc4253#section-7.2 + // + // see the is_string($crypto) part for an example of how to expand the keys + $key = sha1($seed . 'A', \true); + $iv = sha1($seed . 'C', \true); + // ciphers are used as per the nist.gov link below. also, see this link: + // + // http://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Designs_based_on_cryptographic_primitives + switch (\true) { + case class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\AES'): + $crypto = new AES('ctr'); + break; + case class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Twofish'): + $crypto = new Twofish('ctr'); + break; + case class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Blowfish'): + $crypto = new Blowfish('ctr'); + break; + case class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\TripleDES'): + $crypto = new TripleDES('ctr'); + break; + case class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DES'): + $crypto = new DES('ctr'); + break; + case class_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RC4'): + $crypto = new RC4(); + break; + default: + throw new \RuntimeException(__CLASS__ . ' requires at least one symmetric cipher be loaded'); + } + $crypto->setKey(substr($key, 0, $crypto->getKeyLength() >> 3)); + $crypto->setIV(substr($iv, 0, $crypto->getBlockLength() >> 3)); + $crypto->enableContinuousBuffer(); + } + //return $crypto->encrypt(str_repeat("\0", $length)); + // the following is based off of ANSI X9.31: + // + // http://csrc.nist.gov/groups/STM/cavp/documents/rng/931rngext.pdf + // + // OpenSSL uses that same standard for it's random numbers: + // + // http://www.opensource.apple.com/source/OpenSSL/OpenSSL-38/openssl/fips-1.0/rand/fips_rand.c + // (do a search for "ANS X9.31 A.2.4") + $result = ''; + while (strlen($result) < $length) { + $i = $crypto->encrypt(microtime()); + // strlen(microtime()) == 21 + $r = $crypto->encrypt($i ^ $v); + // strlen($v) == 20 + $v = $crypto->encrypt($r ^ $i); + // strlen($r) == 20 + $result .= $r; + } + return substr($result, 0, $length); + } + /** + * Safely serialize variables + * + * If a class has a private __sleep() it'll emit a warning + * @return mixed + * @param mixed $arr + */ + private static function safe_serialize(&$arr) + { + if (is_object($arr)) { + return ''; + } + if (!is_array($arr)) { + return serialize($arr); + } + // prevent circular array recursion + if (isset($arr['__phpseclib_marker'])) { + return ''; + } + $safearr = []; + $arr['__phpseclib_marker'] = \true; + foreach (array_keys($arr) as $key) { + // do not recurse on the '__phpseclib_marker' key itself, for smaller memory usage + if ($key !== '__phpseclib_marker') { + $safearr[$key] = self::safe_serialize($arr[$key]); + } + } + unset($arr['__phpseclib_marker']); + return serialize($safearr); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php new file mode 100644 index 0000000..4f13619 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php @@ -0,0 +1,1048 @@ + + * setKey('abcdefghijklmnop'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $rijndael->decrypt($rijndael->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2008 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\BlockCipher; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadDecryptionException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadModeException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InconsistentSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +/** + * Pure-PHP implementation of Rijndael. + * + * @author Jim Wigginton + */ +class Rijndael extends BlockCipher +{ + /** + * The mcrypt specific name of the cipher + * + * Mcrypt is useable for 128/192/256-bit $block_size/$key_length. For 160/224 not. + * \phpseclib3\Crypt\Rijndael determines automatically whether mcrypt is useable + * or not for the current $block_size/$key_length. + * In case of, $cipher_name_mcrypt will be set dynamically at run time accordingly. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::engine + * @see self::isValidEngine() + * @var string + */ + protected $cipher_name_mcrypt = 'rijndael-128'; + /** + * The Key Schedule + * + * @see self::setup() + * @var array + */ + private $w; + /** + * The Inverse Key Schedule + * + * @see self::setup() + * @var array + */ + private $dw; + /** + * The Block Length divided by 32 + * + * {@internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4. Exists in conjunction with $block_size + * because the encryption / decryption / key schedule creation requires this number and not $block_size. We could + * derive this from $block_size or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu + * of that, we'll just precompute it once.} + * + * @see self::setBlockLength() + * @var int + */ + private $Nb = 4; + /** + * The Key Length (in bytes) + * + * {@internal The max value is 256 / 8 = 32, the min value is 128 / 8 = 16. Exists in conjunction with $Nk + * because the encryption / decryption / key schedule creation requires this number and not $key_length. We could + * derive this from $key_length or vice versa, but that'd mean we'd have to do multiple shift operations, so in lieu + * of that, we'll just precompute it once.} + * + * @see self::setKeyLength() + * @var int + */ + protected $key_length = 16; + /** + * The Key Length divided by 32 + * + * @see self::setKeyLength() + * @var int + * @internal The max value is 256 / 32 = 8, the min value is 128 / 32 = 4 + */ + private $Nk = 4; + /** + * The Number of Rounds + * + * {@internal The max value is 14, the min value is 10.} + * + * @var int + */ + private $Nr; + /** + * Shift offsets + * + * @var array + */ + private $c; + /** + * Holds the last used key- and block_size information + * + * @var array + */ + private $kl; + /** + * Default Constructor. + * + * @param string $mode + * @throws \InvalidArgumentException if an invalid / unsupported mode is provided + */ + public function __construct($mode) + { + parent::__construct($mode); + if ($this->mode == self::MODE_STREAM) { + throw new BadModeException('Block ciphers cannot be ran in stream mode'); + } + } + /** + * Sets the key length. + * + * Valid key lengths are 128, 160, 192, 224, and 256. + * + * Note: phpseclib extends Rijndael (and AES) for using 160- and 224-bit keys but they are officially not defined + * and the most (if not all) implementations are not able using 160/224-bit keys but round/pad them up to + * 192/256 bits as, for example, mcrypt will do. + * + * That said, if you want be compatible with other Rijndael and AES implementations, + * you should not setKeyLength(160) or setKeyLength(224). + * + * Additional: In case of 160- and 224-bit keys, phpseclib will/can, for that reason, not use + * the mcrypt php extension, even if available. + * This results then in slower encryption. + * + * @throws \LengthException if the key length is invalid + * @param int $length + */ + public function setKeyLength($length) + { + switch ($length) { + case 128: + case 160: + case 192: + case 224: + case 256: + $this->key_length = $length >> 3; + break; + default: + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128, 160, 192, 224 or 256 bits are supported'); + } + parent::setKeyLength($length); + } + /** + * Sets the key. + * + * Rijndael supports five different key lengths + * + * @see setKeyLength() + * @param string $key + * @throws \LengthException if the key length isn't supported + */ + public function setKey($key) + { + switch (strlen($key)) { + case 16: + case 20: + case 24: + case 28: + case 32: + break; + default: + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 20, 24, 28 or 32 are supported'); + } + parent::setKey($key); + } + /** + * Sets the block length + * + * Valid block lengths are 128, 160, 192, 224, and 256. + * + * @param int $length + */ + public function setBlockLength($length) + { + switch ($length) { + case 128: + case 160: + case 192: + case 224: + case 256: + break; + default: + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128, 160, 192, 224 or 256 bits are supported'); + } + $this->Nb = $length >> 5; + $this->block_size = $length >> 3; + $this->changed = $this->nonIVChanged = \true; + $this->setEngine(); + } + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + switch ($engine) { + case self::ENGINE_LIBSODIUM: + return function_exists('sodium_crypto_aead_aes256gcm_is_available') && sodium_crypto_aead_aes256gcm_is_available() && $this->mode == self::MODE_GCM && $this->key_length == 32 && $this->nonce && strlen($this->nonce) == 12 && $this->block_size == 16; + case self::ENGINE_OPENSSL_GCM: + if (!extension_loaded('openssl')) { + return \false; + } + $methods = openssl_get_cipher_methods(); + return $this->mode == self::MODE_GCM && version_compare(\PHP_VERSION, '7.1.0', '>=') && in_array('aes-' . $this->getKeyLength() . '-gcm', $methods) && $this->block_size == 16; + case self::ENGINE_OPENSSL: + if ($this->block_size != 16) { + return \false; + } + $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb'; + $this->cipher_name_openssl = 'aes-' . ($this->key_length << 3) . '-' . $this->openssl_translate_mode(); + break; + case self::ENGINE_MCRYPT: + $this->cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3); + if ($this->key_length % 8) { + // is it a 160/224-bit key? + // mcrypt is not usable for them, only for 128/192/256-bit keys + return \false; + } + } + return parent::isValidEngineHelper($engine); + } + /** + * Encrypts a block + * + * @param string $in + * @return string + */ + protected function encryptBlock($in) + { + static $tables; + if (empty($tables)) { + $tables =& $this->getTables(); + } + $t0 = $tables[0]; + $t1 = $tables[1]; + $t2 = $tables[2]; + $t3 = $tables[3]; + $sbox = $tables[4]; + $state = []; + $words = unpack('N*', $in); + $c = $this->c; + $w = $this->w; + $Nb = $this->Nb; + $Nr = $this->Nr; + // addRoundKey + $wc = $Nb - 1; + foreach ($words as $word) { + $state[] = $word ^ $w[++$wc]; + } + // fips-197.pdf#page=19, "Figure 5. Pseudo Code for the Cipher", states that this loop has four components - + // subBytes, shiftRows, mixColumns, and addRoundKey. fips-197.pdf#page=30, "Implementation Suggestions Regarding + // Various Platforms" suggests that performs enhanced implementations are described in Rijndael-ammended.pdf. + // Rijndael-ammended.pdf#page=20, "Implementation aspects / 32-bit processor", discusses such an optimization. + // Unfortunately, the description given there is not quite correct. Per aes.spec.v316.pdf#page=19 [1], + // equation (7.4.7) is supposed to use addition instead of subtraction, so we'll do that here, as well. + // [1] http://fp.gladman.plus.com/cryptography_technology/rijndael/aes.spec.v316.pdf + $temp = []; + for ($round = 1; $round < $Nr; ++$round) { + $i = 0; + // $c[0] == 0 + $j = $c[1]; + $k = $c[2]; + $l = $c[3]; + while ($i < $Nb) { + $temp[$i] = $t0[$state[$i] >> 24 & 0xff] ^ $t1[$state[$j] >> 16 & 0xff] ^ $t2[$state[$k] >> 8 & 0xff] ^ $t3[$state[$l] & 0xff] ^ $w[++$wc]; + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + $state = $temp; + } + // subWord + for ($i = 0; $i < $Nb; ++$i) { + $state[$i] = $sbox[$state[$i] & 0xff] | $sbox[$state[$i] >> 8 & 0xff] << 8 | $sbox[$state[$i] >> 16 & 0xff] << 16 | $sbox[$state[$i] >> 24 & 0xff] << 24; + } + // shiftRows + addRoundKey + $i = 0; + // $c[0] == 0 + $j = $c[1]; + $k = $c[2]; + $l = $c[3]; + while ($i < $Nb) { + $temp[$i] = $state[$i] & intval(0xff000000) ^ $state[$j] & 0xff0000 ^ $state[$k] & 0xff00 ^ $state[$l] & 0xff ^ $w[$i]; + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + return pack('N*', ...$temp); + } + /** + * Decrypts a block + * + * @param string $in + * @return string + */ + protected function decryptBlock($in) + { + static $invtables; + if (empty($invtables)) { + $invtables =& $this->getInvTables(); + } + $dt0 = $invtables[0]; + $dt1 = $invtables[1]; + $dt2 = $invtables[2]; + $dt3 = $invtables[3]; + $isbox = $invtables[4]; + $state = []; + $words = unpack('N*', $in); + $c = $this->c; + $dw = $this->dw; + $Nb = $this->Nb; + $Nr = $this->Nr; + // addRoundKey + $wc = $Nb - 1; + foreach ($words as $word) { + $state[] = $word ^ $dw[++$wc]; + } + $temp = []; + for ($round = $Nr - 1; $round > 0; --$round) { + $i = 0; + // $c[0] == 0 + $j = $Nb - $c[1]; + $k = $Nb - $c[2]; + $l = $Nb - $c[3]; + while ($i < $Nb) { + $temp[$i] = $dt0[$state[$i] >> 24 & 0xff] ^ $dt1[$state[$j] >> 16 & 0xff] ^ $dt2[$state[$k] >> 8 & 0xff] ^ $dt3[$state[$l] & 0xff] ^ $dw[++$wc]; + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + $state = $temp; + } + // invShiftRows + invSubWord + addRoundKey + $i = 0; + // $c[0] == 0 + $j = $Nb - $c[1]; + $k = $Nb - $c[2]; + $l = $Nb - $c[3]; + while ($i < $Nb) { + $word = $state[$i] & intval(0xff000000) | $state[$j] & 0xff0000 | $state[$k] & 0xff00 | $state[$l] & 0xff; + $temp[$i] = $dw[$i] ^ ($isbox[$word & 0xff] | $isbox[$word >> 8 & 0xff] << 8 | $isbox[$word >> 16 & 0xff] << 16 | $isbox[$word >> 24 & 0xff] << 24); + ++$i; + $j = ($j + 1) % $Nb; + $k = ($k + 1) % $Nb; + $l = ($l + 1) % $Nb; + } + return pack('N*', ...$temp); + } + /** + * Setup the self::ENGINE_INTERNAL $engine + * + * (re)init, if necessary, the internal cipher $engine and flush all $buffers + * Used (only) if $engine == self::ENGINE_INTERNAL + * + * _setup() will be called each time if $changed === true + * typically this happens when using one or more of following public methods: + * + * - setKey() + * + * - setIV() + * + * - disableContinuousBuffer() + * + * - First run of encrypt() / decrypt() with no init-settings + * + * {@internal setup() is always called before en/decryption.} + * + * {@internal Could, but not must, extend by the child Crypt_* class} + * + * @see self::setKey() + * @see self::setIV() + * @see self::disableContinuousBuffer() + */ + protected function setup() + { + if (!$this->changed) { + return; + } + parent::setup(); + if (is_string($this->iv) && strlen($this->iv) != $this->block_size) { + throw new InconsistentSetupException('The IV length (' . strlen($this->iv) . ') does not match the block size (' . $this->block_size . ')'); + } + } + /** + * Setup the key (expansion) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + */ + protected function setupKey() + { + // Each number in $rcon is equal to the previous number multiplied by two in Rijndael's finite field. + // See http://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplicative_inverse + static $rcon; + if (!isset($rcon)) { + $rcon = [0, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000, 0x1b000000, 0x36000000, 0x6c000000, 0xd8000000, 0xab000000, 0x4d000000, 0x9a000000, 0x2f000000, 0x5e000000, 0xbc000000, 0x63000000, 0xc6000000, 0x97000000, 0x35000000, 0x6a000000, 0xd4000000, 0xb3000000, 0x7d000000, 0xfa000000, 0xef000000, 0xc5000000, 0x91000000]; + $rcon = array_map('intval', $rcon); + } + if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->key_length === $this->kl['key_length'] && $this->block_size === $this->kl['block_size']) { + // already expanded + return; + } + $this->kl = ['key' => $this->key, 'key_length' => $this->key_length, 'block_size' => $this->block_size]; + $this->Nk = $this->key_length >> 2; + // see Rijndael-ammended.pdf#page=44 + $this->Nr = max($this->Nk, $this->Nb) + 6; + // shift offsets for Nb = 5, 7 are defined in Rijndael-ammended.pdf#page=44, + // "Table 8: Shift offsets in Shiftrow for the alternative block lengths" + // shift offsets for Nb = 4, 6, 8 are defined in Rijndael-ammended.pdf#page=14, + // "Table 2: Shift offsets for different block lengths" + switch ($this->Nb) { + case 4: + case 5: + case 6: + $this->c = [0, 1, 2, 3]; + break; + case 7: + $this->c = [0, 1, 2, 4]; + break; + case 8: + $this->c = [0, 1, 3, 4]; + } + $w = array_values(unpack('N*words', $this->key)); + $length = $this->Nb * ($this->Nr + 1); + for ($i = $this->Nk; $i < $length; $i++) { + $temp = $w[$i - 1]; + if ($i % $this->Nk == 0) { + // according to , "the size of an integer is platform-dependent". + // on a 32-bit machine, it's 32-bits, and on a 64-bit machine, it's 64-bits. on a 32-bit machine, + // 0xFFFFFFFF << 8 == 0xFFFFFF00, but on a 64-bit machine, it equals 0xFFFFFFFF00. as such, doing 'and' + // with 0xFFFFFFFF (or 0xFFFFFF00) on a 32-bit machine is unnecessary, but on a 64-bit machine, it is. + $temp = $temp << 8 & intval(0xffffff00) | $temp >> 24 & 0xff; + // rotWord + $temp = $this->subWord($temp) ^ $rcon[$i / $this->Nk]; + } elseif ($this->Nk > 6 && $i % $this->Nk == 4) { + $temp = $this->subWord($temp); + } + $w[$i] = $w[$i - $this->Nk] ^ $temp; + } + // convert the key schedule from a vector of $Nb * ($Nr + 1) length to a matrix with $Nr + 1 rows and $Nb columns + // and generate the inverse key schedule. more specifically, + // according to (section 5.3.3), + // "The key expansion for the Inverse Cipher is defined as follows: + // 1. Apply the Key Expansion. + // 2. Apply InvMixColumn to all Round Keys except the first and the last one." + // also, see fips-197.pdf#page=27, "5.3.5 Equivalent Inverse Cipher" + list($dt0, $dt1, $dt2, $dt3) = $this->getInvTables(); + $temp = $this->w = $this->dw = []; + for ($i = $row = $col = 0; $i < $length; $i++, $col++) { + if ($col == $this->Nb) { + if ($row == 0) { + $this->dw[0] = $this->w[0]; + } else { + // subWord + invMixColumn + invSubWord = invMixColumn + $j = 0; + while ($j < $this->Nb) { + $dw = $this->subWord($this->w[$row][$j]); + $temp[$j] = $dt0[$dw >> 24 & 0xff] ^ $dt1[$dw >> 16 & 0xff] ^ $dt2[$dw >> 8 & 0xff] ^ $dt3[$dw & 0xff]; + $j++; + } + $this->dw[$row] = $temp; + } + $col = 0; + $row++; + } + $this->w[$row][$col] = $w[$i]; + } + $this->dw[$row] = $this->w[$row]; + // Converting to 1-dim key arrays (both ascending) + $this->dw = array_reverse($this->dw); + $w = array_pop($this->w); + $dw = array_pop($this->dw); + foreach ($this->w as $r => $wr) { + foreach ($wr as $c => $wc) { + $w[] = $wc; + $dw[] = $this->dw[$r][$c]; + } + } + $this->w = $w; + $this->dw = $dw; + } + /** + * Performs S-Box substitutions + * + * @return array + * @param int $word + */ + private function subWord($word) + { + static $sbox; + if (empty($sbox)) { + list(, , , , $sbox) = self::getTables(); + } + return $sbox[$word & 0xff] | $sbox[$word >> 8 & 0xff] << 8 | $sbox[$word >> 16 & 0xff] << 16 | $sbox[$word >> 24 & 0xff] << 24; + } + /** + * Provides the mixColumns and sboxes tables + * + * @see self::encryptBlock() + * @see self::setupInlineCrypt() + * @see self::subWord() + * @return array &$tables + */ + protected function &getTables() + { + static $tables; + if (empty($tables)) { + // according to (section 5.2.1), + // precomputed tables can be used in the mixColumns phase. in that example, they're assigned t0...t3, so + // those are the names we'll use. + $t3 = array_map('intval', [ + // with array_map('intval', ...) we ensure we have only int's and not + // some slower floats converted by php automatically on high values + 0x6363a5c6, + 0x7c7c84f8, + 0x777799ee, + 0x7b7b8df6, + 0xf2f20dff, + 0x6b6bbdd6, + 0x6f6fb1de, + 0xc5c55491, + 0x30305060, + 0x1010302, + 0x6767a9ce, + 0x2b2b7d56, + 0xfefe19e7, + 0xd7d762b5, + 0xababe64d, + 0x76769aec, + 0xcaca458f, + 0x82829d1f, + 0xc9c94089, + 0x7d7d87fa, + 0xfafa15ef, + 0x5959ebb2, + 0x4747c98e, + 0xf0f00bfb, + 0xadadec41, + 0xd4d467b3, + 0xa2a2fd5f, + 0xafafea45, + 0x9c9cbf23, + 0xa4a4f753, + 0x727296e4, + 0xc0c05b9b, + 0xb7b7c275, + 0xfdfd1ce1, + 0x9393ae3d, + 0x26266a4c, + 0x36365a6c, + 0x3f3f417e, + 0xf7f702f5, + 0xcccc4f83, + 0x34345c68, + 0xa5a5f451, + 0xe5e534d1, + 0xf1f108f9, + 0x717193e2, + 0xd8d873ab, + 0x31315362, + 0x15153f2a, + 0x4040c08, + 0xc7c75295, + 0x23236546, + 0xc3c35e9d, + 0x18182830, + 0x9696a137, + 0x5050f0a, + 0x9a9ab52f, + 0x707090e, + 0x12123624, + 0x80809b1b, + 0xe2e23ddf, + 0xebeb26cd, + 0x2727694e, + 0xb2b2cd7f, + 0x75759fea, + 0x9091b12, + 0x83839e1d, + 0x2c2c7458, + 0x1a1a2e34, + 0x1b1b2d36, + 0x6e6eb2dc, + 0x5a5aeeb4, + 0xa0a0fb5b, + 0x5252f6a4, + 0x3b3b4d76, + 0xd6d661b7, + 0xb3b3ce7d, + 0x29297b52, + 0xe3e33edd, + 0x2f2f715e, + 0x84849713, + 0x5353f5a6, + 0xd1d168b9, + 0x0, + 0xeded2cc1, + 0x20206040, + 0xfcfc1fe3, + 0xb1b1c879, + 0x5b5bedb6, + 0x6a6abed4, + 0xcbcb468d, + 0xbebed967, + 0x39394b72, + 0x4a4ade94, + 0x4c4cd498, + 0x5858e8b0, + 0xcfcf4a85, + 0xd0d06bbb, + 0xefef2ac5, + 0xaaaae54f, + 0xfbfb16ed, + 0x4343c586, + 0x4d4dd79a, + 0x33335566, + 0x85859411, + 0x4545cf8a, + 0xf9f910e9, + 0x2020604, + 0x7f7f81fe, + 0x5050f0a0, + 0x3c3c4478, + 0x9f9fba25, + 0xa8a8e34b, + 0x5151f3a2, + 0xa3a3fe5d, + 0x4040c080, + 0x8f8f8a05, + 0x9292ad3f, + 0x9d9dbc21, + 0x38384870, + 0xf5f504f1, + 0xbcbcdf63, + 0xb6b6c177, + 0xdada75af, + 0x21216342, + 0x10103020, + 0xffff1ae5, + 0xf3f30efd, + 0xd2d26dbf, + 0xcdcd4c81, + 0xc0c1418, + 0x13133526, + 0xecec2fc3, + 0x5f5fe1be, + 0x9797a235, + 0x4444cc88, + 0x1717392e, + 0xc4c45793, + 0xa7a7f255, + 0x7e7e82fc, + 0x3d3d477a, + 0x6464acc8, + 0x5d5de7ba, + 0x19192b32, + 0x737395e6, + 0x6060a0c0, + 0x81819819, + 0x4f4fd19e, + 0xdcdc7fa3, + 0x22226644, + 0x2a2a7e54, + 0x9090ab3b, + 0x8888830b, + 0x4646ca8c, + 0xeeee29c7, + 0xb8b8d36b, + 0x14143c28, + 0xdede79a7, + 0x5e5ee2bc, + 0xb0b1d16, + 0xdbdb76ad, + 0xe0e03bdb, + 0x32325664, + 0x3a3a4e74, + 0xa0a1e14, + 0x4949db92, + 0x6060a0c, + 0x24246c48, + 0x5c5ce4b8, + 0xc2c25d9f, + 0xd3d36ebd, + 0xacacef43, + 0x6262a6c4, + 0x9191a839, + 0x9595a431, + 0xe4e437d3, + 0x79798bf2, + 0xe7e732d5, + 0xc8c8438b, + 0x3737596e, + 0x6d6db7da, + 0x8d8d8c01, + 0xd5d564b1, + 0x4e4ed29c, + 0xa9a9e049, + 0x6c6cb4d8, + 0x5656faac, + 0xf4f407f3, + 0xeaea25cf, + 0x6565afca, + 0x7a7a8ef4, + 0xaeaee947, + 0x8081810, + 0xbabad56f, + 0x787888f0, + 0x25256f4a, + 0x2e2e725c, + 0x1c1c2438, + 0xa6a6f157, + 0xb4b4c773, + 0xc6c65197, + 0xe8e823cb, + 0xdddd7ca1, + 0x74749ce8, + 0x1f1f213e, + 0x4b4bdd96, + 0xbdbddc61, + 0x8b8b860d, + 0x8a8a850f, + 0x707090e0, + 0x3e3e427c, + 0xb5b5c471, + 0x6666aacc, + 0x4848d890, + 0x3030506, + 0xf6f601f7, + 0xe0e121c, + 0x6161a3c2, + 0x35355f6a, + 0x5757f9ae, + 0xb9b9d069, + 0x86869117, + 0xc1c15899, + 0x1d1d273a, + 0x9e9eb927, + 0xe1e138d9, + 0xf8f813eb, + 0x9898b32b, + 0x11113322, + 0x6969bbd2, + 0xd9d970a9, + 0x8e8e8907, + 0x9494a733, + 0x9b9bb62d, + 0x1e1e223c, + 0x87879215, + 0xe9e920c9, + 0xcece4987, + 0x5555ffaa, + 0x28287850, + 0xdfdf7aa5, + 0x8c8c8f03, + 0xa1a1f859, + 0x89898009, + 0xd0d171a, + 0xbfbfda65, + 0xe6e631d7, + 0x4242c684, + 0x6868b8d0, + 0x4141c382, + 0x9999b029, + 0x2d2d775a, + 0xf0f111e, + 0xb0b0cb7b, + 0x5454fca8, + 0xbbbbd66d, + 0x16163a2c, + ]); + foreach ($t3 as $t3i) { + $t0[] = $t3i << 24 & intval(0xff000000) | $t3i >> 8 & 0xffffff; + $t1[] = $t3i << 16 & intval(0xffff0000) | $t3i >> 16 & 0xffff; + $t2[] = $t3i << 8 & intval(0xffffff00) | $t3i >> 24 & 0xff; + } + $tables = [ + // The Precomputed mixColumns tables t0 - t3 + $t0, + $t1, + $t2, + $t3, + // The SubByte S-Box + [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x1, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x4, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x5, 0x9a, 0x7, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x9, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x0, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x2, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0xc, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0xb, 0xdb, 0xe0, 0x32, 0x3a, 0xa, 0x49, 0x6, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x8, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x3, 0xf6, 0xe, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0xd, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0xf, 0xb0, 0x54, 0xbb, 0x16], + ]; + } + return $tables; + } + /** + * Provides the inverse mixColumns and inverse sboxes tables + * + * @see self::decryptBlock() + * @see self::setupInlineCrypt() + * @see self::setupKey() + * @return array &$tables + */ + protected function &getInvTables() + { + static $tables; + if (empty($tables)) { + $dt3 = array_map('intval', [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x24c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x82b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x36aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x7f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x5bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x6d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x0, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0xefffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0xfd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0xa67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x90d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x1269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x4984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0xb412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0xd9541ff, 0xa8017139, 0xcb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]); + foreach ($dt3 as $dt3i) { + $dt0[] = $dt3i << 24 & intval(0xff000000) | $dt3i >> 8 & 0xffffff; + $dt1[] = $dt3i << 16 & intval(0xffff0000) | $dt3i >> 16 & 0xffff; + $dt2[] = $dt3i << 8 & intval(0xffffff00) | $dt3i >> 24 & 0xff; + } + $tables = [ + // The Precomputed inverse mixColumns tables dt0 - dt3 + $dt0, + $dt1, + $dt2, + $dt3, + // The inverse SubByte S-Box + [0x52, 0x9, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0xb, 0x42, 0xfa, 0xc3, 0x4e, 0x8, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x0, 0x8c, 0xbc, 0xd3, 0xa, 0xf7, 0xe4, 0x58, 0x5, 0xb8, 0xb3, 0x45, 0x6, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0xf, 0x2, 0xc1, 0xaf, 0xbd, 0x3, 0x1, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0xe, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x7, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0xd, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x4, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0xc, 0x7d], + ]; + } + return $tables; + } + /** + * Setup the performance-optimized function for de/encrypt() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupInlineCrypt() + */ + protected function setupInlineCrypt() + { + $w = $this->w; + $dw = $this->dw; + $init_encrypt = ''; + $init_decrypt = ''; + $Nr = $this->Nr; + $Nb = $this->Nb; + $c = $this->c; + // Generating encrypt code: + $init_encrypt .= ' + if (empty($tables)) { + $tables = &$this->getTables(); + } + $t0 = $tables[0]; + $t1 = $tables[1]; + $t2 = $tables[2]; + $t3 = $tables[3]; + $sbox = $tables[4]; + '; + $s = 'e'; + $e = 's'; + $wc = $Nb - 1; + // Preround: addRoundKey + $encrypt_block = '$in = unpack("N*", $in);' . "\n"; + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block .= '$s' . $i . ' = $in[' . ($i + 1) . '] ^ ' . $w[++$wc] . ";\n"; + } + // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey + for ($round = 1; $round < $Nr; ++$round) { + list($s, $e) = [$e, $s]; + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block .= '$' . $e . $i . ' = + $t0[($' . $s . $i . ' >> 24) & 0xff] ^ + $t1[($' . $s . ($i + $c[1]) % $Nb . ' >> 16) & 0xff] ^ + $t2[($' . $s . ($i + $c[2]) % $Nb . ' >> 8) & 0xff] ^ + $t3[ $' . $s . ($i + $c[3]) % $Nb . ' & 0xff] ^ + ' . $w[++$wc] . ";\n"; + } + } + // Finalround: subWord + shiftRows + addRoundKey + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block .= '$' . $e . $i . ' = + $sbox[ $' . $e . $i . ' & 0xff] | + ($sbox[($' . $e . $i . ' >> 8) & 0xff] << 8) | + ($sbox[($' . $e . $i . ' >> 16) & 0xff] << 16) | + ($sbox[($' . $e . $i . ' >> 24) & 0xff] << 24);' . "\n"; + } + $encrypt_block .= '$in = pack("N*"' . "\n"; + for ($i = 0; $i < $Nb; ++$i) { + $encrypt_block .= ', + ($' . $e . $i . ' & ' . (int) 0xff000000 . ') ^ + ($' . $e . ($i + $c[1]) % $Nb . ' & 0x00FF0000 ) ^ + ($' . $e . ($i + $c[2]) % $Nb . ' & 0x0000FF00 ) ^ + ($' . $e . ($i + $c[3]) % $Nb . ' & 0x000000FF ) ^ + ' . $w[$i] . "\n"; + } + $encrypt_block .= ');'; + // Generating decrypt code: + $init_decrypt .= ' + if (empty($invtables)) { + $invtables = &$this->getInvTables(); + } + $dt0 = $invtables[0]; + $dt1 = $invtables[1]; + $dt2 = $invtables[2]; + $dt3 = $invtables[3]; + $isbox = $invtables[4]; + '; + $s = 'e'; + $e = 's'; + $wc = $Nb - 1; + // Preround: addRoundKey + $decrypt_block = '$in = unpack("N*", $in);' . "\n"; + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block .= '$s' . $i . ' = $in[' . ($i + 1) . '] ^ ' . $dw[++$wc] . ';' . "\n"; + } + // Mainrounds: shiftRows + subWord + mixColumns + addRoundKey + for ($round = 1; $round < $Nr; ++$round) { + list($s, $e) = [$e, $s]; + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block .= '$' . $e . $i . ' = + $dt0[($' . $s . $i . ' >> 24) & 0xff] ^ + $dt1[($' . $s . ($Nb + $i - $c[1]) % $Nb . ' >> 16) & 0xff] ^ + $dt2[($' . $s . ($Nb + $i - $c[2]) % $Nb . ' >> 8) & 0xff] ^ + $dt3[ $' . $s . ($Nb + $i - $c[3]) % $Nb . ' & 0xff] ^ + ' . $dw[++$wc] . ";\n"; + } + } + // Finalround: subWord + shiftRows + addRoundKey + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block .= '$' . $e . $i . ' = + $isbox[ $' . $e . $i . ' & 0xff] | + ($isbox[($' . $e . $i . ' >> 8) & 0xff] << 8) | + ($isbox[($' . $e . $i . ' >> 16) & 0xff] << 16) | + ($isbox[($' . $e . $i . ' >> 24) & 0xff] << 24);' . "\n"; + } + $decrypt_block .= '$in = pack("N*"' . "\n"; + for ($i = 0; $i < $Nb; ++$i) { + $decrypt_block .= ', + ($' . $e . $i . ' & ' . (int) 0xff000000 . ') ^ + ($' . $e . ($Nb + $i - $c[1]) % $Nb . ' & 0x00FF0000 ) ^ + ($' . $e . ($Nb + $i - $c[2]) % $Nb . ' & 0x0000FF00 ) ^ + ($' . $e . ($Nb + $i - $c[3]) % $Nb . ' & 0x000000FF ) ^ + ' . $dw[$i] . "\n"; + } + $decrypt_block .= ');'; + $this->inline_crypt = $this->createInlineCryptFunction(['init_crypt' => 'static $tables; static $invtables;', 'init_encrypt' => $init_encrypt, 'init_decrypt' => $init_decrypt, 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block]); + } + /** + * Encrypts a message. + * + * @see self::decrypt() + * @see parent::encrypt() + * @param string $plaintext + * @return string + */ + public function encrypt($plaintext) + { + $this->setup(); + switch ($this->engine) { + case self::ENGINE_LIBSODIUM: + $this->newtag = sodium_crypto_aead_aes256gcm_encrypt($plaintext, $this->aad, $this->nonce, $this->key); + return Strings::shift($this->newtag, strlen($plaintext)); + case self::ENGINE_OPENSSL_GCM: + return openssl_encrypt($plaintext, 'aes-' . $this->getKeyLength() . '-gcm', $this->key, \OPENSSL_RAW_DATA, $this->nonce, $this->newtag, $this->aad); + } + return parent::encrypt($plaintext); + } + /** + * Decrypts a message. + * + * @see self::encrypt() + * @see parent::decrypt() + * @param string $ciphertext + * @return string + */ + public function decrypt($ciphertext) + { + $this->setup(); + switch ($this->engine) { + case self::ENGINE_LIBSODIUM: + if ($this->oldtag === \false) { + throw new InsufficientSetupException('Authentication Tag has not been set'); + } + if (strlen($this->oldtag) != 16) { + break; + } + $plaintext = sodium_crypto_aead_aes256gcm_decrypt($ciphertext . $this->oldtag, $this->aad, $this->nonce, $this->key); + if ($plaintext === \false) { + $this->oldtag = \false; + throw new BadDecryptionException('Error decrypting ciphertext with libsodium'); + } + return $plaintext; + case self::ENGINE_OPENSSL_GCM: + if ($this->oldtag === \false) { + throw new InsufficientSetupException('Authentication Tag has not been set'); + } + $plaintext = openssl_decrypt($ciphertext, 'aes-' . $this->getKeyLength() . '-gcm', $this->key, \OPENSSL_RAW_DATA, $this->nonce, $this->oldtag, $this->aad); + if ($plaintext === \false) { + $this->oldtag = \false; + throw new BadDecryptionException('Error decrypting ciphertext with OpenSSL'); + } + return $plaintext; + } + return parent::decrypt($ciphertext); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Salsa20.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Salsa20.php new file mode 100644 index 0000000..be358ef --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Salsa20.php @@ -0,0 +1,454 @@ + + * @copyright 2019 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\StreamCipher; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadDecryptionException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +/** + * Pure-PHP implementation of Salsa20. + * + * @author Jim Wigginton + */ +class Salsa20 extends StreamCipher +{ + /** + * Part 1 of the state + * + * @var string|false + */ + protected $p1 = \false; + /** + * Part 2 of the state + * + * @var string|false + */ + protected $p2 = \false; + /** + * Key Length (in bytes) + * + * @var int + */ + protected $key_length = 32; + // = 256 bits + /** + * @see \phpseclib3\Crypt\Salsa20::crypt() + */ + const ENCRYPT = 0; + /** + * @see \phpseclib3\Crypt\Salsa20::crypt() + */ + const DECRYPT = 1; + /** + * Encryption buffer for continuous mode + * + * @var array + */ + protected $enbuffer; + /** + * Decryption buffer for continuous mode + * + * @var array + */ + protected $debuffer; + /** + * Counter + * + * @var int + */ + protected $counter = 0; + /** + * Using Generated Poly1305 Key + * + * @var boolean + */ + protected $usingGeneratedPoly1305Key = \false; + /** + * Salsa20 uses a nonce + * + * @return bool + */ + public function usesNonce() + { + return \true; + } + /** + * Sets the key. + * + * @param string $key + * @throws \LengthException if the key length isn't supported + */ + public function setKey($key) + { + switch (strlen($key)) { + case 16: + case 32: + break; + default: + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16 or 32 are supported'); + } + parent::setKey($key); + } + /** + * Sets the nonce. + * + * @param string $nonce + */ + public function setNonce($nonce) + { + if (strlen($nonce) != 8) { + throw new \LengthException('Nonce of size ' . strlen($key) . ' not supported by this algorithm. Only an 64-bit nonce is supported'); + } + $this->nonce = $nonce; + $this->changed = \true; + $this->setEngine(); + } + /** + * Sets the counter. + * + * @param int $counter + */ + public function setCounter($counter) + { + $this->counter = $counter; + $this->setEngine(); + } + /** + * Creates a Poly1305 key using the method discussed in RFC8439 + * + * See https://tools.ietf.org/html/rfc8439#section-2.6.1 + */ + protected function createPoly1305Key() + { + if ($this->nonce === \false) { + throw new InsufficientSetupException('No nonce has been defined'); + } + if ($this->key === \false) { + throw new InsufficientSetupException('No key has been defined'); + } + $c = clone $this; + $c->setCounter(0); + $c->usePoly1305 = \false; + $block = $c->encrypt(str_repeat("\x00", 256)); + $this->setPoly1305Key(substr($block, 0, 32)); + if ($this->counter == 0) { + $this->counter++; + } + } + /** + * Setup the self::ENGINE_INTERNAL $engine + * + * (re)init, if necessary, the internal cipher $engine + * + * _setup() will be called each time if $changed === true + * typically this happens when using one or more of following public methods: + * + * - setKey() + * + * - setNonce() + * + * - First run of encrypt() / decrypt() with no init-settings + * + * @see self::setKey() + * @see self::setNonce() + * @see self::disableContinuousBuffer() + */ + protected function setup() + { + if (!$this->changed) { + return; + } + $this->enbuffer = $this->debuffer = ['ciphertext' => '', 'counter' => $this->counter]; + $this->changed = $this->nonIVChanged = \false; + if ($this->nonce === \false) { + throw new InsufficientSetupException('No nonce has been defined'); + } + if ($this->key === \false) { + throw new InsufficientSetupException('No key has been defined'); + } + if ($this->usePoly1305 && !isset($this->poly1305Key)) { + $this->usingGeneratedPoly1305Key = \true; + $this->createPoly1305Key(); + } + $key = $this->key; + if (strlen($key) == 16) { + $constant = 'expand 16-byte k'; + $key .= $key; + } else { + $constant = 'expand 32-byte k'; + } + $this->p1 = substr($constant, 0, 4) . substr($key, 0, 16) . substr($constant, 4, 4) . $this->nonce . "\x00\x00\x00\x00"; + $this->p2 = substr($constant, 8, 4) . substr($key, 16, 16) . substr($constant, 12, 4); + } + /** + * Setup the key (expansion) + */ + protected function setupKey() + { + // Salsa20 does not utilize this method + } + /** + * Encrypts a message. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @see self::crypt() + * @param string $plaintext + * @return string $ciphertext + */ + public function encrypt($plaintext) + { + $ciphertext = $this->crypt($plaintext, self::ENCRYPT); + if (isset($this->poly1305Key)) { + $this->newtag = $this->poly1305($ciphertext); + } + return $ciphertext; + } + /** + * Decrypts a message. + * + * $this->decrypt($this->encrypt($plaintext)) == $this->encrypt($this->encrypt($plaintext)). + * At least if the continuous buffer is disabled. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @see self::crypt() + * @param string $ciphertext + * @return string $plaintext + */ + public function decrypt($ciphertext) + { + if (isset($this->poly1305Key)) { + if ($this->oldtag === \false) { + throw new InsufficientSetupException('Authentication Tag has not been set'); + } + $newtag = $this->poly1305($ciphertext); + if ($this->oldtag != substr($newtag, 0, strlen($this->oldtag))) { + $this->oldtag = \false; + throw new BadDecryptionException('Derived authentication tag and supplied authentication tag do not match'); + } + $this->oldtag = \false; + } + return $this->crypt($ciphertext, self::DECRYPT); + } + /** + * Encrypts a block + * + * @param string $in + */ + protected function encryptBlock($in) + { + // Salsa20 does not utilize this method + } + /** + * Decrypts a block + * + * @param string $in + */ + protected function decryptBlock($in) + { + // Salsa20 does not utilize this method + } + /** + * Encrypts or decrypts a message. + * + * @see self::encrypt() + * @see self::decrypt() + * @param string $text + * @param int $mode + * @return string $text + */ + private function crypt($text, $mode) + { + $this->setup(); + if (!$this->continuousBuffer) { + if ($this->engine == self::ENGINE_OPENSSL) { + $iv = pack('V', $this->counter) . $this->p2; + return openssl_encrypt($text, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA, $iv); + } + $i = $this->counter; + $blocks = str_split($text, 64); + foreach ($blocks as &$block) { + $block ^= static::salsa20($this->p1 . pack('V', $i++) . $this->p2); + } + return implode('', $blocks); + } + if ($mode == self::ENCRYPT) { + $buffer =& $this->enbuffer; + } else { + $buffer =& $this->debuffer; + } + if (!strlen($buffer['ciphertext'])) { + $ciphertext = ''; + } else { + $ciphertext = $text ^ Strings::shift($buffer['ciphertext'], strlen($text)); + $text = substr($text, strlen($ciphertext)); + if (!strlen($text)) { + return $ciphertext; + } + } + $overflow = strlen($text) % 64; + // & 0x3F + if ($overflow) { + $text2 = Strings::pop($text, $overflow); + if ($this->engine == self::ENGINE_OPENSSL) { + $iv = pack('V', $buffer['counter']) . $this->p2; + // at this point $text should be a multiple of 64 + $buffer['counter'] += (strlen($text) >> 6) + 1; + // ie. divide by 64 + $encrypted = openssl_encrypt($text . str_repeat("\x00", 64), $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA, $iv); + $temp = Strings::pop($encrypted, 64); + } else { + $blocks = str_split($text, 64); + if (strlen($text)) { + foreach ($blocks as &$block) { + $block ^= static::salsa20($this->p1 . pack('V', $buffer['counter']++) . $this->p2); + } + } + $encrypted = implode('', $blocks); + $temp = static::salsa20($this->p1 . pack('V', $buffer['counter']++) . $this->p2); + } + $ciphertext .= $encrypted . ($text2 ^ $temp); + $buffer['ciphertext'] = substr($temp, $overflow); + } elseif (!strlen($buffer['ciphertext'])) { + if ($this->engine == self::ENGINE_OPENSSL) { + $iv = pack('V', $buffer['counter']) . $this->p2; + $buffer['counter'] += strlen($text) >> 6; + $ciphertext .= openssl_encrypt($text, $this->cipher_name_openssl, $this->key, \OPENSSL_RAW_DATA, $iv); + } else { + $blocks = str_split($text, 64); + foreach ($blocks as &$block) { + $block ^= static::salsa20($this->p1 . pack('V', $buffer['counter']++) . $this->p2); + } + $ciphertext .= implode('', $blocks); + } + } + return $ciphertext; + } + /** + * Left Rotate + * + * @param int $x + * @param int $n + * @return int + */ + protected static function leftRotate($x, $n) + { + if (\PHP_INT_SIZE == 8) { + $r1 = $x << $n; + $r1 &= 0xffffffff; + $r2 = ($x & 0xffffffff) >> 32 - $n; + } else { + $x = (int) $x; + $r1 = $x << $n; + $r2 = $x >> 32 - $n; + $r2 &= (1 << $n) - 1; + } + return $r1 | $r2; + } + /** + * The quarterround function + * + * @param int $a + * @param int $b + * @param int $c + * @param int $d + */ + protected static function quarterRound(&$a, &$b, &$c, &$d) + { + $b ^= self::leftRotate($a + $d, 7); + $c ^= self::leftRotate($b + $a, 9); + $d ^= self::leftRotate($c + $b, 13); + $a ^= self::leftRotate($d + $c, 18); + } + /** + * The doubleround function + * + * @param int $x0 (by reference) + * @param int $x1 (by reference) + * @param int $x2 (by reference) + * @param int $x3 (by reference) + * @param int $x4 (by reference) + * @param int $x5 (by reference) + * @param int $x6 (by reference) + * @param int $x7 (by reference) + * @param int $x8 (by reference) + * @param int $x9 (by reference) + * @param int $x10 (by reference) + * @param int $x11 (by reference) + * @param int $x12 (by reference) + * @param int $x13 (by reference) + * @param int $x14 (by reference) + * @param int $x15 (by reference) + */ + protected static function doubleRound(&$x0, &$x1, &$x2, &$x3, &$x4, &$x5, &$x6, &$x7, &$x8, &$x9, &$x10, &$x11, &$x12, &$x13, &$x14, &$x15) + { + // columnRound + static::quarterRound($x0, $x4, $x8, $x12); + static::quarterRound($x5, $x9, $x13, $x1); + static::quarterRound($x10, $x14, $x2, $x6); + static::quarterRound($x15, $x3, $x7, $x11); + // rowRound + static::quarterRound($x0, $x1, $x2, $x3); + static::quarterRound($x5, $x6, $x7, $x4); + static::quarterRound($x10, $x11, $x8, $x9); + static::quarterRound($x15, $x12, $x13, $x14); + } + /** + * The Salsa20 hash function function + * + * @param string $x + */ + protected static function salsa20($x) + { + $z = $x = unpack('V*', $x); + for ($i = 0; $i < 10; $i++) { + static::doubleRound($z[1], $z[2], $z[3], $z[4], $z[5], $z[6], $z[7], $z[8], $z[9], $z[10], $z[11], $z[12], $z[13], $z[14], $z[15], $z[16]); + } + for ($i = 1; $i <= 16; $i++) { + $x[$i] += $z[$i]; + } + return pack('V*', ...$x); + } + /** + * Calculates Poly1305 MAC + * + * @see self::decrypt() + * @see self::encrypt() + * @param string $ciphertext + * @return string + */ + protected function poly1305($ciphertext) + { + if (!$this->usingGeneratedPoly1305Key) { + return parent::poly1305($this->aad . $ciphertext); + } else { + /* + sodium_crypto_aead_chacha20poly1305_encrypt does not calculate the poly1305 tag + the same way sodium_crypto_aead_chacha20poly1305_ietf_encrypt does. you can see + how the latter encrypts it in Salsa20::encrypt(). here's how the former encrypts + it: + + $this->newtag = $this->poly1305( + $this->aad . + pack('V', strlen($this->aad)) . "\0\0\0\0" . + $ciphertext . + pack('V', strlen($ciphertext)) . "\0\0\0\0" + ); + + phpseclib opts to use the IETF construction, even when the nonce is 64-bits + instead of 96-bits + */ + return parent::poly1305(self::nullPad128($this->aad) . self::nullPad128($ciphertext) . pack('V', strlen($this->aad)) . "\x00\x00\x00\x00" . pack('V', strlen($ciphertext)) . "\x00\x00\x00\x00"); + } + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php new file mode 100644 index 0000000..093b6c0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php @@ -0,0 +1,384 @@ + + * setKey('abcdefghijklmnopqrstuvwx'); + * + * $size = 10 * 1024; + * $plaintext = ''; + * for ($i = 0; $i < $size; $i++) { + * $plaintext.= 'a'; + * } + * + * echo $des->decrypt($des->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +/** + * Pure-PHP implementation of Triple DES. + * + * @author Jim Wigginton + */ +class TripleDES extends DES +{ + /** + * Encrypt / decrypt using inner chaining + * + * Inner chaining is used by SSH-1 and is generally considered to be less secure then outer chaining (self::MODE_CBC3). + */ + const MODE_3CBC = -2; + /** + * Encrypt / decrypt using outer chaining + * + * Outer chaining is used by SSH-2 and when the mode is set to \phpseclib3\Crypt\Common\BlockCipher::MODE_CBC. + */ + const MODE_CBC3 = self::MODE_CBC; + /** + * Key Length (in bytes) + * + * @see \phpseclib3\Crypt\TripleDES::setKeyLength() + * @var int + */ + protected $key_length = 24; + /** + * The mcrypt specific name of the cipher + * + * @see \phpseclib3\Crypt\DES::cipher_name_mcrypt + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @var string + */ + protected $cipher_name_mcrypt = 'tripledes'; + /** + * Optimizing value while CFB-encrypting + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @var int + */ + protected $cfb_init_len = 750; + /** + * max possible size of $key + * + * @see self::setKey() + * @see \phpseclib3\Crypt\DES::setKey() + * @var string + */ + protected $key_length_max = 24; + /** + * Internal flag whether using self::MODE_3CBC or not + * + * @var bool + */ + private $mode_3cbc; + /** + * The \phpseclib3\Crypt\DES objects + * + * Used only if $mode_3cbc === true + * + * @var array + */ + private $des; + /** + * Default Constructor. + * + * Determines whether or not the mcrypt or OpenSSL extensions should be used. + * + * $mode could be: + * + * - ecb + * + * - cbc + * + * - ctr + * + * - cfb + * + * - ofb + * + * - 3cbc + * + * - cbc3 (same as cbc) + * + * @see \phpseclib3\Crypt\DES::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @param string $mode + */ + public function __construct($mode) + { + switch (strtolower($mode)) { + // In case of self::MODE_3CBC, we init as CRYPT_DES_MODE_CBC + // and additional flag us internally as 3CBC + case '3cbc': + parent::__construct('cbc'); + $this->mode_3cbc = \true; + // This three $des'es will do the 3CBC work (if $key > 64bits) + $this->des = [new DES('cbc'), new DES('cbc'), new DES('cbc')]; + // we're going to be doing the padding, ourselves, so disable it in the \phpseclib3\Crypt\DES objects + $this->des[0]->disablePadding(); + $this->des[1]->disablePadding(); + $this->des[2]->disablePadding(); + break; + case 'cbc3': + $mode = 'cbc'; + // fall-through + // If not 3CBC, we init as usual + default: + parent::__construct($mode); + if ($this->mode == self::MODE_STREAM) { + throw new BadModeException('Block ciphers cannot be ran in stream mode'); + } + } + } + /** + * Test for engine validity + * + * This is mainly just a wrapper to set things up for \phpseclib3\Crypt\Common\SymmetricKey::isValidEngine() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @param int $engine + * @return bool + */ + protected function isValidEngineHelper($engine) + { + if ($engine == self::ENGINE_OPENSSL) { + $this->cipher_name_openssl_ecb = 'des-ede3'; + $mode = $this->openssl_translate_mode(); + $this->cipher_name_openssl = $mode == 'ecb' ? 'des-ede3' : 'des-ede3-' . $mode; + } + return parent::isValidEngineHelper($engine); + } + /** + * Sets the initialization vector. + * + * SetIV is not required when \phpseclib3\Crypt\Common\SymmetricKey::MODE_ECB is being used. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::setIV() + * @param string $iv + */ + public function setIV($iv) + { + parent::setIV($iv); + if ($this->mode_3cbc) { + $this->des[0]->setIV($iv); + $this->des[1]->setIV($iv); + $this->des[2]->setIV($iv); + } + } + /** + * Sets the key length. + * + * Valid key lengths are 128 and 192 bits. + * + * If you want to use a 64-bit key use DES.php + * + * @see \phpseclib3\Crypt\Common\SymmetricKey:setKeyLength() + * @throws \LengthException if the key length is invalid + * @param int $length + */ + public function setKeyLength($length) + { + switch ($length) { + case 128: + case 192: + break; + default: + throw new \LengthException('Key size of ' . $length . ' bits is not supported by this algorithm. Only keys of sizes 128 or 192 bits are supported'); + } + parent::setKeyLength($length); + } + /** + * Sets the key. + * + * Triple DES can use 128-bit (eg. strlen($key) == 16) or 192-bit (eg. strlen($key) == 24) keys. + * + * DES also requires that every eighth bit be a parity bit, however, we'll ignore that. + * + * @see \phpseclib3\Crypt\DES::setKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setKey() + * @throws \LengthException if the key length is invalid + * @param string $key + */ + public function setKey($key) + { + if ($this->explicit_key_length !== \false && strlen($key) != $this->explicit_key_length) { + throw new \LengthException('Key length has already been set to ' . $this->explicit_key_length . ' bytes and this key is ' . strlen($key) . ' bytes'); + } + switch (strlen($key)) { + case 16: + $key .= substr($key, 0, 8); + break; + case 24: + break; + default: + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16 or 24 are supported'); + } + // copied from self::setKey() + $this->key = $key; + $this->key_length = strlen($key); + $this->changed = $this->nonIVChanged = \true; + $this->setEngine(); + if ($this->mode_3cbc) { + $this->des[0]->setKey(substr($key, 0, 8)); + $this->des[1]->setKey(substr($key, 8, 8)); + $this->des[2]->setKey(substr($key, 16, 8)); + } + } + /** + * Encrypts a message. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::encrypt() + * @param string $plaintext + * @return string $cipertext + */ + public function encrypt($plaintext) + { + // parent::en/decrypt() is able to do all the work for all modes and keylengths, + // except for: self::MODE_3CBC (inner chaining CBC) with a key > 64bits + // if the key is smaller then 8, do what we'd normally do + if ($this->mode_3cbc && strlen($this->key) > 8) { + return $this->des[2]->encrypt($this->des[1]->decrypt($this->des[0]->encrypt($this->pad($plaintext)))); + } + return parent::encrypt($plaintext); + } + /** + * Decrypts a message. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::decrypt() + * @param string $ciphertext + * @return string $plaintext + */ + public function decrypt($ciphertext) + { + if ($this->mode_3cbc && strlen($this->key) > 8) { + return $this->unpad($this->des[0]->decrypt($this->des[1]->encrypt($this->des[2]->decrypt(str_pad($ciphertext, strlen($ciphertext) + 7 & 0xfffffff8, "\x00"))))); + } + return parent::decrypt($ciphertext); + } + /** + * Treat consecutive "packets" as if they are a continuous buffer. + * + * Say you have a 16-byte plaintext $plaintext. Using the default behavior, the two following code snippets + * will yield different outputs: + * + * + * echo $des->encrypt(substr($plaintext, 0, 8)); + * echo $des->encrypt(substr($plaintext, 8, 8)); + * + * + * echo $des->encrypt($plaintext); + * + * + * The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates + * another, as demonstrated with the following: + * + * + * $des->encrypt(substr($plaintext, 0, 8)); + * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); + * + * + * echo $des->decrypt($des->encrypt(substr($plaintext, 8, 8))); + * + * + * With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different + * outputs. The reason is due to the fact that the initialization vector's change after every encryption / + * decryption round when the continuous buffer is enabled. When it's disabled, they remain constant. + * + * Put another way, when the continuous buffer is enabled, the state of the \phpseclib3\Crypt\DES() object changes after each + * encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that + * continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), + * however, they are also less intuitive and more likely to cause you problems. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::enableContinuousBuffer() + * @see self::disableContinuousBuffer() + */ + public function enableContinuousBuffer() + { + parent::enableContinuousBuffer(); + if ($this->mode_3cbc) { + $this->des[0]->enableContinuousBuffer(); + $this->des[1]->enableContinuousBuffer(); + $this->des[2]->enableContinuousBuffer(); + } + } + /** + * Treat consecutive packets as if they are a discontinuous buffer. + * + * The default behavior. + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::disableContinuousBuffer() + * @see self::enableContinuousBuffer() + */ + public function disableContinuousBuffer() + { + parent::disableContinuousBuffer(); + if ($this->mode_3cbc) { + $this->des[0]->disableContinuousBuffer(); + $this->des[1]->disableContinuousBuffer(); + $this->des[2]->disableContinuousBuffer(); + } + } + /** + * Creates the key schedule + * + * @see \phpseclib3\Crypt\DES::setupKey() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setupKey() + */ + protected function setupKey() + { + switch (\true) { + // if $key <= 64bits we configure our internal pure-php cipher engine + // to act as regular [1]DES, not as 3DES. mcrypt.so::tripledes does the same. + case strlen($this->key) <= 8: + $this->des_rounds = 1; + break; + // otherwise, if $key > 64bits, we configure our engine to work as 3DES. + default: + $this->des_rounds = 3; + // (only) if 3CBC is used we have, of course, to setup the $des[0-2] keys also separately. + if ($this->mode_3cbc) { + $this->des[0]->setupKey(); + $this->des[1]->setupKey(); + $this->des[2]->setupKey(); + // because $des[0-2] will, now, do all the work we can return here + // not need unnecessary stress parent::setupKey() with our, now unused, $key. + return; + } + } + // setup our key + parent::setupKey(); + } + /** + * Sets the internal crypt engine + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::__construct() + * @see \phpseclib3\Crypt\Common\SymmetricKey::setPreferredEngine() + * @param int $engine + */ + public function setPreferredEngine($engine) + { + if ($this->mode_3cbc) { + $this->des[0]->setPreferredEngine($engine); + $this->des[1]->setPreferredEngine($engine); + $this->des[2]->setPreferredEngine($engine); + } + parent::setPreferredEngine($engine); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php new file mode 100644 index 0000000..fd58f8e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php @@ -0,0 +1,506 @@ + + * setKey('12345678901234567890123456789012'); + * + * $plaintext = str_repeat('a', 1024); + * + * echo $twofish->decrypt($twofish->encrypt($plaintext)); + * ?> + * + * + * @author Jim Wigginton + * @author Hans-Juergen Petrich + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\BlockCipher; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadModeException; +/** + * Pure-PHP implementation of Twofish. + * + * @author Jim Wigginton + * @author Hans-Juergen Petrich + */ +class Twofish extends BlockCipher +{ + /** + * The mcrypt specific name of the cipher + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cipher_name_mcrypt + * @var string + */ + protected $cipher_name_mcrypt = 'twofish'; + /** + * Optimizing value while CFB-encrypting + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::cfb_init_len + * @var int + */ + protected $cfb_init_len = 800; + /** + * Q-Table + * + * @var array + */ + private static $q0 = [0xa9, 0x67, 0xb3, 0xe8, 0x4, 0xfd, 0xa3, 0x76, 0x9a, 0x92, 0x80, 0x78, 0xe4, 0xdd, 0xd1, 0x38, 0xd, 0xc6, 0x35, 0x98, 0x18, 0xf7, 0xec, 0x6c, 0x43, 0x75, 0x37, 0x26, 0xfa, 0x13, 0x94, 0x48, 0xf2, 0xd0, 0x8b, 0x30, 0x84, 0x54, 0xdf, 0x23, 0x19, 0x5b, 0x3d, 0x59, 0xf3, 0xae, 0xa2, 0x82, 0x63, 0x1, 0x83, 0x2e, 0xd9, 0x51, 0x9b, 0x7c, 0xa6, 0xeb, 0xa5, 0xbe, 0x16, 0xc, 0xe3, 0x61, 0xc0, 0x8c, 0x3a, 0xf5, 0x73, 0x2c, 0x25, 0xb, 0xbb, 0x4e, 0x89, 0x6b, 0x53, 0x6a, 0xb4, 0xf1, 0xe1, 0xe6, 0xbd, 0x45, 0xe2, 0xf4, 0xb6, 0x66, 0xcc, 0x95, 0x3, 0x56, 0xd4, 0x1c, 0x1e, 0xd7, 0xfb, 0xc3, 0x8e, 0xb5, 0xe9, 0xcf, 0xbf, 0xba, 0xea, 0x77, 0x39, 0xaf, 0x33, 0xc9, 0x62, 0x71, 0x81, 0x79, 0x9, 0xad, 0x24, 0xcd, 0xf9, 0xd8, 0xe5, 0xc5, 0xb9, 0x4d, 0x44, 0x8, 0x86, 0xe7, 0xa1, 0x1d, 0xaa, 0xed, 0x6, 0x70, 0xb2, 0xd2, 0x41, 0x7b, 0xa0, 0x11, 0x31, 0xc2, 0x27, 0x90, 0x20, 0xf6, 0x60, 0xff, 0x96, 0x5c, 0xb1, 0xab, 0x9e, 0x9c, 0x52, 0x1b, 0x5f, 0x93, 0xa, 0xef, 0x91, 0x85, 0x49, 0xee, 0x2d, 0x4f, 0x8f, 0x3b, 0x47, 0x87, 0x6d, 0x46, 0xd6, 0x3e, 0x69, 0x64, 0x2a, 0xce, 0xcb, 0x2f, 0xfc, 0x97, 0x5, 0x7a, 0xac, 0x7f, 0xd5, 0x1a, 0x4b, 0xe, 0xa7, 0x5a, 0x28, 0x14, 0x3f, 0x29, 0x88, 0x3c, 0x4c, 0x2, 0xb8, 0xda, 0xb0, 0x17, 0x55, 0x1f, 0x8a, 0x7d, 0x57, 0xc7, 0x8d, 0x74, 0xb7, 0xc4, 0x9f, 0x72, 0x7e, 0x15, 0x22, 0x12, 0x58, 0x7, 0x99, 0x34, 0x6e, 0x50, 0xde, 0x68, 0x65, 0xbc, 0xdb, 0xf8, 0xc8, 0xa8, 0x2b, 0x40, 0xdc, 0xfe, 0x32, 0xa4, 0xca, 0x10, 0x21, 0xf0, 0xd3, 0x5d, 0xf, 0x0, 0x6f, 0x9d, 0x36, 0x42, 0x4a, 0x5e, 0xc1, 0xe0]; + /** + * Q-Table + * + * @var array + */ + private static $q1 = [0x75, 0xf3, 0xc6, 0xf4, 0xdb, 0x7b, 0xfb, 0xc8, 0x4a, 0xd3, 0xe6, 0x6b, 0x45, 0x7d, 0xe8, 0x4b, 0xd6, 0x32, 0xd8, 0xfd, 0x37, 0x71, 0xf1, 0xe1, 0x30, 0xf, 0xf8, 0x1b, 0x87, 0xfa, 0x6, 0x3f, 0x5e, 0xba, 0xae, 0x5b, 0x8a, 0x0, 0xbc, 0x9d, 0x6d, 0xc1, 0xb1, 0xe, 0x80, 0x5d, 0xd2, 0xd5, 0xa0, 0x84, 0x7, 0x14, 0xb5, 0x90, 0x2c, 0xa3, 0xb2, 0x73, 0x4c, 0x54, 0x92, 0x74, 0x36, 0x51, 0x38, 0xb0, 0xbd, 0x5a, 0xfc, 0x60, 0x62, 0x96, 0x6c, 0x42, 0xf7, 0x10, 0x7c, 0x28, 0x27, 0x8c, 0x13, 0x95, 0x9c, 0xc7, 0x24, 0x46, 0x3b, 0x70, 0xca, 0xe3, 0x85, 0xcb, 0x11, 0xd0, 0x93, 0xb8, 0xa6, 0x83, 0x20, 0xff, 0x9f, 0x77, 0xc3, 0xcc, 0x3, 0x6f, 0x8, 0xbf, 0x40, 0xe7, 0x2b, 0xe2, 0x79, 0xc, 0xaa, 0x82, 0x41, 0x3a, 0xea, 0xb9, 0xe4, 0x9a, 0xa4, 0x97, 0x7e, 0xda, 0x7a, 0x17, 0x66, 0x94, 0xa1, 0x1d, 0x3d, 0xf0, 0xde, 0xb3, 0xb, 0x72, 0xa7, 0x1c, 0xef, 0xd1, 0x53, 0x3e, 0x8f, 0x33, 0x26, 0x5f, 0xec, 0x76, 0x2a, 0x49, 0x81, 0x88, 0xee, 0x21, 0xc4, 0x1a, 0xeb, 0xd9, 0xc5, 0x39, 0x99, 0xcd, 0xad, 0x31, 0x8b, 0x1, 0x18, 0x23, 0xdd, 0x1f, 0x4e, 0x2d, 0xf9, 0x48, 0x4f, 0xf2, 0x65, 0x8e, 0x78, 0x5c, 0x58, 0x19, 0x8d, 0xe5, 0x98, 0x57, 0x67, 0x7f, 0x5, 0x64, 0xaf, 0x63, 0xb6, 0xfe, 0xf5, 0xb7, 0x3c, 0xa5, 0xce, 0xe9, 0x68, 0x44, 0xe0, 0x4d, 0x43, 0x69, 0x29, 0x2e, 0xac, 0x15, 0x59, 0xa8, 0xa, 0x9e, 0x6e, 0x47, 0xdf, 0x34, 0x35, 0x6a, 0xcf, 0xdc, 0x22, 0xc9, 0xc0, 0x9b, 0x89, 0xd4, 0xed, 0xab, 0x12, 0xa2, 0xd, 0x52, 0xbb, 0x2, 0x2f, 0xa9, 0xd7, 0x61, 0x1e, 0xb4, 0x50, 0x4, 0xf6, 0xc2, 0x16, 0x25, 0x86, 0x56, 0x55, 0x9, 0xbe, 0x91]; + /** + * M-Table + * + * @var array + */ + private static $m0 = [0xbcbc3275, 0xecec21f3, 0x202043c6, 0xb3b3c9f4, 0xdada03db, 0x2028b7b, 0xe2e22bfb, 0x9e9efac8, 0xc9c9ec4a, 0xd4d409d3, 0x18186be6, 0x1e1e9f6b, 0x98980e45, 0xb2b2387d, 0xa6a6d2e8, 0x2626b74b, 0x3c3c57d6, 0x93938a32, 0x8282eed8, 0x525298fd, 0x7b7bd437, 0xbbbb3771, 0x5b5b97f1, 0x474783e1, 0x24243c30, 0x5151e20f, 0xbabac6f8, 0x4a4af31b, 0xbfbf4887, 0xd0d70fa, 0xb0b0b306, 0x7575de3f, 0xd2d2fd5e, 0x7d7d20ba, 0x666631ae, 0x3a3aa35b, 0x59591c8a, 0x0, 0xcdcd93bc, 0x1a1ae09d, 0xaeae2c6d, 0x7f7fabc1, 0x2b2bc7b1, 0xbebeb90e, 0xe0e0a080, 0x8a8a105d, 0x3b3b52d2, 0x6464bad5, 0xd8d888a0, 0xe7e7a584, 0x5f5fe807, 0x1b1b1114, 0x2c2cc2b5, 0xfcfcb490, 0x3131272c, 0x808065a3, 0x73732ab2, 0xc0c8173, 0x79795f4c, 0x6b6b4154, 0x4b4b0292, 0x53536974, 0x94948f36, 0x83831f51, 0x2a2a3638, 0xc4c49cb0, 0x2222c8bd, 0xd5d5f85a, 0xbdbdc3fc, 0x48487860, 0xffffce62, 0x4c4c0796, 0x4141776c, 0xc7c7e642, 0xebeb24f7, 0x1c1c1410, 0x5d5d637c, 0x36362228, 0x6767c027, 0xe9e9af8c, 0x4444f913, 0x1414ea95, 0xf5f5bb9c, 0xcfcf18c7, 0x3f3f2d24, 0xc0c0e346, 0x7272db3b, 0x54546c70, 0x29294cca, 0xf0f035e3, 0x808fe85, 0xc6c617cb, 0xf3f34f11, 0x8c8ce4d0, 0xa4a45993, 0xcaca96b8, 0x68683ba6, 0xb8b84d83, 0x38382820, 0xe5e52eff, 0xadad569f, 0xb0b8477, 0xc8c81dc3, 0x9999ffcc, 0x5858ed03, 0x19199a6f, 0xe0e0a08, 0x95957ebf, 0x70705040, 0xf7f730e7, 0x6e6ecf2b, 0x1f1f6ee2, 0xb5b53d79, 0x9090f0c, 0x616134aa, 0x57571682, 0x9f9f0b41, 0x9d9d803a, 0x111164ea, 0x2525cdb9, 0xafafdde4, 0x4545089a, 0xdfdf8da4, 0xa3a35c97, 0xeaead57e, 0x353558da, 0xededd07a, 0x4343fc17, 0xf8f8cb66, 0xfbfbb194, 0x3737d3a1, 0xfafa401d, 0xc2c2683d, 0xb4b4ccf0, 0x32325dde, 0x9c9c71b3, 0x5656e70b, 0xe3e3da72, 0x878760a7, 0x15151b1c, 0xf9f93aef, 0x6363bfd1, 0x3434a953, 0x9a9a853e, 0xb1b1428f, 0x7c7cd133, 0x88889b26, 0x3d3da65f, 0xa1a1d7ec, 0xe4e4df76, 0x8181942a, 0x91910149, 0xf0ffb81, 0xeeeeaa88, 0x161661ee, 0xd7d77321, 0x9797f5c4, 0xa5a5a81a, 0xfefe3feb, 0x6d6db5d9, 0x7878aec5, 0xc5c56d39, 0x1d1de599, 0x7676a4cd, 0x3e3edcad, 0xcbcb6731, 0xb6b6478b, 0xefef5b01, 0x12121e18, 0x6060c523, 0x6a6ab0dd, 0x4d4df61f, 0xcecee94e, 0xdede7c2d, 0x55559df9, 0x7e7e5a48, 0x2121b24f, 0x3037af2, 0xa0a02665, 0x5e5e198e, 0x5a5a6678, 0x65654b5c, 0x62624e58, 0xfdfd4519, 0x606f48d, 0x404086e5, 0xf2f2be98, 0x3333ac57, 0x17179067, 0x5058e7f, 0xe8e85e05, 0x4f4f7d64, 0x89896aaf, 0x10109563, 0x74742fb6, 0xa0a75fe, 0x5c5c92f5, 0x9b9b74b7, 0x2d2d333c, 0x3030d6a5, 0x2e2e49ce, 0x494989e9, 0x46467268, 0x77775544, 0xa8a8d8e0, 0x9696044d, 0x2828bd43, 0xa9a92969, 0xd9d97929, 0x8686912e, 0xd1d187ac, 0xf4f44a15, 0x8d8d1559, 0xd6d682a8, 0xb9b9bc0a, 0x42420d9e, 0xf6f6c16e, 0x2f2fb847, 0xdddd06df, 0x23233934, 0xcccc6235, 0xf1f1c46a, 0xc1c112cf, 0x8585ebdc, 0x8f8f9e22, 0x7171a1c9, 0x9090f0c0, 0xaaaa539b, 0x101f189, 0x8b8be1d4, 0x4e4e8ced, 0x8e8e6fab, 0xababa212, 0x6f6f3ea2, 0xe6e6540d, 0xdbdbf252, 0x92927bbb, 0xb7b7b602, 0x6969ca2f, 0x3939d9a9, 0xd3d30cd7, 0xa7a72361, 0xa2a2ad1e, 0xc3c399b4, 0x6c6c4450, 0x7070504, 0x4047ff6, 0x272746c2, 0xacaca716, 0xd0d07625, 0x50501386, 0xdcdcf756, 0x84841a55, 0xe1e15109, 0x7a7a25be, 0x1313ef91]; + /** + * M-Table + * + * @var array + */ + private static $m1 = [0xa9d93939, 0x67901717, 0xb3719c9c, 0xe8d2a6a6, 0x4050707, 0xfd985252, 0xa3658080, 0x76dfe4e4, 0x9a084545, 0x92024b4b, 0x80a0e0e0, 0x78665a5a, 0xe4ddafaf, 0xddb06a6a, 0xd1bf6363, 0x38362a2a, 0xd54e6e6, 0xc6432020, 0x3562cccc, 0x98bef2f2, 0x181e1212, 0xf724ebeb, 0xecd7a1a1, 0x6c774141, 0x43bd2828, 0x7532bcbc, 0x37d47b7b, 0x269b8888, 0xfa700d0d, 0x13f94444, 0x94b1fbfb, 0x485a7e7e, 0xf27a0303, 0xd0e48c8c, 0x8b47b6b6, 0x303c2424, 0x84a5e7e7, 0x54416b6b, 0xdf06dddd, 0x23c56060, 0x1945fdfd, 0x5ba33a3a, 0x3d68c2c2, 0x59158d8d, 0xf321ecec, 0xae316666, 0xa23e6f6f, 0x82165757, 0x63951010, 0x15befef, 0x834db8b8, 0x2e918686, 0xd9b56d6d, 0x511f8383, 0x9b53aaaa, 0x7c635d5d, 0xa63b6868, 0xeb3ffefe, 0xa5d63030, 0xbe257a7a, 0x16a7acac, 0xc0f0909, 0xe335f0f0, 0x6123a7a7, 0xc0f09090, 0x8cafe9e9, 0x3a809d9d, 0xf5925c5c, 0x73810c0c, 0x2c273131, 0x2576d0d0, 0xbe75656, 0xbb7b9292, 0x4ee9cece, 0x89f10101, 0x6b9f1e1e, 0x53a93434, 0x6ac4f1f1, 0xb499c3c3, 0xf1975b5b, 0xe1834747, 0xe66b1818, 0xbdc82222, 0x450e9898, 0xe26e1f1f, 0xf4c9b3b3, 0xb62f7474, 0x66cbf8f8, 0xccff9999, 0x95ea1414, 0x3ed5858, 0x56f7dcdc, 0xd4e18b8b, 0x1c1b1515, 0x1eada2a2, 0xd70cd3d3, 0xfb2be2e2, 0xc31dc8c8, 0x8e195e5e, 0xb5c22c2c, 0xe9894949, 0xcf12c1c1, 0xbf7e9595, 0xba207d7d, 0xea641111, 0x77840b0b, 0x396dc5c5, 0xaf6a8989, 0x33d17c7c, 0xc9a17171, 0x62ceffff, 0x7137bbbb, 0x81fb0f0f, 0x793db5b5, 0x951e1e1, 0xaddc3e3e, 0x242d3f3f, 0xcda47676, 0xf99d5555, 0xd8ee8282, 0xe5864040, 0xc5ae7878, 0xb9cd2525, 0x4d049696, 0x44557777, 0x80a0e0e, 0x86135050, 0xe730f7f7, 0xa1d33737, 0x1d40fafa, 0xaa346161, 0xed8c4e4e, 0x6b3b0b0, 0x706c5454, 0xb22a7373, 0xd2523b3b, 0x410b9f9f, 0x7b8b0202, 0xa088d8d8, 0x114ff3f3, 0x3167cbcb, 0xc2462727, 0x27c06767, 0x90b4fcfc, 0x20283838, 0xf67f0404, 0x60784848, 0xff2ee5e5, 0x96074c4c, 0x5c4b6565, 0xb1c72b2b, 0xab6f8e8e, 0x9e0d4242, 0x9cbbf5f5, 0x52f2dbdb, 0x1bf34a4a, 0x5fa63d3d, 0x9359a4a4, 0xabcb9b9, 0xef3af9f9, 0x91ef1313, 0x85fe0808, 0x49019191, 0xee611616, 0x2d7cdede, 0x4fb22121, 0x8f42b1b1, 0x3bdb7272, 0x47b82f2f, 0x8748bfbf, 0x6d2caeae, 0x46e3c0c0, 0xd6573c3c, 0x3e859a9a, 0x6929a9a9, 0x647d4f4f, 0x2a948181, 0xce492e2e, 0xcb17c6c6, 0x2fca6969, 0xfcc3bdbd, 0x975ca3a3, 0x55ee8e8, 0x7ad0eded, 0xac87d1d1, 0x7f8e0505, 0xd5ba6464, 0x1aa8a5a5, 0x4bb72626, 0xeb9bebe, 0xa7608787, 0x5af8d5d5, 0x28223636, 0x14111b1b, 0x3fde7575, 0x2979d9d9, 0x88aaeeee, 0x3c332d2d, 0x4c5f7979, 0x2b6b7b7, 0xb896caca, 0xda583535, 0xb09cc4c4, 0x17fc4343, 0x551a8484, 0x1ff64d4d, 0x8a1c5959, 0x7d38b2b2, 0x57ac3333, 0xc718cfcf, 0x8df40606, 0x74695353, 0xb7749b9b, 0xc4f59797, 0x9f56adad, 0x72dae3e3, 0x7ed5eaea, 0x154af4f4, 0x229e8f8f, 0x12a2abab, 0x584e6262, 0x7e85f5f, 0x99e51d1d, 0x34392323, 0x6ec1f6f6, 0x50446c6c, 0xde5d3232, 0x68724646, 0x6526a0a0, 0xbc93cdcd, 0xdb03dada, 0xf8c6baba, 0xc8fa9e9e, 0xa882d6d6, 0x2bcf6e6e, 0x40507070, 0xdceb8585, 0xfe750a0a, 0x328a9393, 0xa48ddfdf, 0xca4c2929, 0x10141c1c, 0x2173d7d7, 0xf0ccb4b4, 0xd309d4d4, 0x5d108a8a, 0xfe25151, 0x0, 0x6f9a1919, 0x9de01a1a, 0x368f9494, 0x42e6c7c7, 0x4aecc9c9, 0x5efdd2d2, 0xc1ab7f7f, 0xe0d8a8a8]; + /** + * M-Table + * + * @var array + */ + private static $m2 = [0xbc75bc32, 0xecf3ec21, 0x20c62043, 0xb3f4b3c9, 0xdadbda03, 0x27b028b, 0xe2fbe22b, 0x9ec89efa, 0xc94ac9ec, 0xd4d3d409, 0x18e6186b, 0x1e6b1e9f, 0x9845980e, 0xb27db238, 0xa6e8a6d2, 0x264b26b7, 0x3cd63c57, 0x9332938a, 0x82d882ee, 0x52fd5298, 0x7b377bd4, 0xbb71bb37, 0x5bf15b97, 0x47e14783, 0x2430243c, 0x510f51e2, 0xbaf8bac6, 0x4a1b4af3, 0xbf87bf48, 0xdfa0d70, 0xb006b0b3, 0x753f75de, 0xd25ed2fd, 0x7dba7d20, 0x66ae6631, 0x3a5b3aa3, 0x598a591c, 0x0, 0xcdbccd93, 0x1a9d1ae0, 0xae6dae2c, 0x7fc17fab, 0x2bb12bc7, 0xbe0ebeb9, 0xe080e0a0, 0x8a5d8a10, 0x3bd23b52, 0x64d564ba, 0xd8a0d888, 0xe784e7a5, 0x5f075fe8, 0x1b141b11, 0x2cb52cc2, 0xfc90fcb4, 0x312c3127, 0x80a38065, 0x73b2732a, 0xc730c81, 0x794c795f, 0x6b546b41, 0x4b924b02, 0x53745369, 0x9436948f, 0x8351831f, 0x2a382a36, 0xc4b0c49c, 0x22bd22c8, 0xd55ad5f8, 0xbdfcbdc3, 0x48604878, 0xff62ffce, 0x4c964c07, 0x416c4177, 0xc742c7e6, 0xebf7eb24, 0x1c101c14, 0x5d7c5d63, 0x36283622, 0x672767c0, 0xe98ce9af, 0x441344f9, 0x149514ea, 0xf59cf5bb, 0xcfc7cf18, 0x3f243f2d, 0xc046c0e3, 0x723b72db, 0x5470546c, 0x29ca294c, 0xf0e3f035, 0x88508fe, 0xc6cbc617, 0xf311f34f, 0x8cd08ce4, 0xa493a459, 0xcab8ca96, 0x68a6683b, 0xb883b84d, 0x38203828, 0xe5ffe52e, 0xad9fad56, 0xb770b84, 0xc8c3c81d, 0x99cc99ff, 0x580358ed, 0x196f199a, 0xe080e0a, 0x95bf957e, 0x70407050, 0xf7e7f730, 0x6e2b6ecf, 0x1fe21f6e, 0xb579b53d, 0x90c090f, 0x61aa6134, 0x57825716, 0x9f419f0b, 0x9d3a9d80, 0x11ea1164, 0x25b925cd, 0xafe4afdd, 0x459a4508, 0xdfa4df8d, 0xa397a35c, 0xea7eead5, 0x35da3558, 0xed7aedd0, 0x431743fc, 0xf866f8cb, 0xfb94fbb1, 0x37a137d3, 0xfa1dfa40, 0xc23dc268, 0xb4f0b4cc, 0x32de325d, 0x9cb39c71, 0x560b56e7, 0xe372e3da, 0x87a78760, 0x151c151b, 0xf9eff93a, 0x63d163bf, 0x345334a9, 0x9a3e9a85, 0xb18fb142, 0x7c337cd1, 0x8826889b, 0x3d5f3da6, 0xa1eca1d7, 0xe476e4df, 0x812a8194, 0x91499101, 0xf810ffb, 0xee88eeaa, 0x16ee1661, 0xd721d773, 0x97c497f5, 0xa51aa5a8, 0xfeebfe3f, 0x6dd96db5, 0x78c578ae, 0xc539c56d, 0x1d991de5, 0x76cd76a4, 0x3ead3edc, 0xcb31cb67, 0xb68bb647, 0xef01ef5b, 0x1218121e, 0x602360c5, 0x6add6ab0, 0x4d1f4df6, 0xce4ecee9, 0xde2dde7c, 0x55f9559d, 0x7e487e5a, 0x214f21b2, 0x3f2037a, 0xa065a026, 0x5e8e5e19, 0x5a785a66, 0x655c654b, 0x6258624e, 0xfd19fd45, 0x68d06f4, 0x40e54086, 0xf298f2be, 0x335733ac, 0x17671790, 0x57f058e, 0xe805e85e, 0x4f644f7d, 0x89af896a, 0x10631095, 0x74b6742f, 0xafe0a75, 0x5cf55c92, 0x9bb79b74, 0x2d3c2d33, 0x30a530d6, 0x2ece2e49, 0x49e94989, 0x46684672, 0x77447755, 0xa8e0a8d8, 0x964d9604, 0x284328bd, 0xa969a929, 0xd929d979, 0x862e8691, 0xd1acd187, 0xf415f44a, 0x8d598d15, 0xd6a8d682, 0xb90ab9bc, 0x429e420d, 0xf66ef6c1, 0x2f472fb8, 0xdddfdd06, 0x23342339, 0xcc35cc62, 0xf16af1c4, 0xc1cfc112, 0x85dc85eb, 0x8f228f9e, 0x71c971a1, 0x90c090f0, 0xaa9baa53, 0x18901f1, 0x8bd48be1, 0x4eed4e8c, 0x8eab8e6f, 0xab12aba2, 0x6fa26f3e, 0xe60de654, 0xdb52dbf2, 0x92bb927b, 0xb702b7b6, 0x692f69ca, 0x39a939d9, 0xd3d7d30c, 0xa761a723, 0xa21ea2ad, 0xc3b4c399, 0x6c506c44, 0x7040705, 0x4f6047f, 0x27c22746, 0xac16aca7, 0xd025d076, 0x50865013, 0xdc56dcf7, 0x8455841a, 0xe109e151, 0x7abe7a25, 0x139113ef]; + /** + * M-Table + * + * @var array + */ + private static $m3 = [0xd939a9d9, 0x90176790, 0x719cb371, 0xd2a6e8d2, 0x5070405, 0x9852fd98, 0x6580a365, 0xdfe476df, 0x8459a08, 0x24b9202, 0xa0e080a0, 0x665a7866, 0xddafe4dd, 0xb06addb0, 0xbf63d1bf, 0x362a3836, 0x54e60d54, 0x4320c643, 0x62cc3562, 0xbef298be, 0x1e12181e, 0x24ebf724, 0xd7a1ecd7, 0x77416c77, 0xbd2843bd, 0x32bc7532, 0xd47b37d4, 0x9b88269b, 0x700dfa70, 0xf94413f9, 0xb1fb94b1, 0x5a7e485a, 0x7a03f27a, 0xe48cd0e4, 0x47b68b47, 0x3c24303c, 0xa5e784a5, 0x416b5441, 0x6dddf06, 0xc56023c5, 0x45fd1945, 0xa33a5ba3, 0x68c23d68, 0x158d5915, 0x21ecf321, 0x3166ae31, 0x3e6fa23e, 0x16578216, 0x95106395, 0x5bef015b, 0x4db8834d, 0x91862e91, 0xb56dd9b5, 0x1f83511f, 0x53aa9b53, 0x635d7c63, 0x3b68a63b, 0x3ffeeb3f, 0xd630a5d6, 0x257abe25, 0xa7ac16a7, 0xf090c0f, 0x35f0e335, 0x23a76123, 0xf090c0f0, 0xafe98caf, 0x809d3a80, 0x925cf592, 0x810c7381, 0x27312c27, 0x76d02576, 0xe7560be7, 0x7b92bb7b, 0xe9ce4ee9, 0xf10189f1, 0x9f1e6b9f, 0xa93453a9, 0xc4f16ac4, 0x99c3b499, 0x975bf197, 0x8347e183, 0x6b18e66b, 0xc822bdc8, 0xe98450e, 0x6e1fe26e, 0xc9b3f4c9, 0x2f74b62f, 0xcbf866cb, 0xff99ccff, 0xea1495ea, 0xed5803ed, 0xf7dc56f7, 0xe18bd4e1, 0x1b151c1b, 0xada21ead, 0xcd3d70c, 0x2be2fb2b, 0x1dc8c31d, 0x195e8e19, 0xc22cb5c2, 0x8949e989, 0x12c1cf12, 0x7e95bf7e, 0x207dba20, 0x6411ea64, 0x840b7784, 0x6dc5396d, 0x6a89af6a, 0xd17c33d1, 0xa171c9a1, 0xceff62ce, 0x37bb7137, 0xfb0f81fb, 0x3db5793d, 0x51e10951, 0xdc3eaddc, 0x2d3f242d, 0xa476cda4, 0x9d55f99d, 0xee82d8ee, 0x8640e586, 0xae78c5ae, 0xcd25b9cd, 0x4964d04, 0x55774455, 0xa0e080a, 0x13508613, 0x30f7e730, 0xd337a1d3, 0x40fa1d40, 0x3461aa34, 0x8c4eed8c, 0xb3b006b3, 0x6c54706c, 0x2a73b22a, 0x523bd252, 0xb9f410b, 0x8b027b8b, 0x88d8a088, 0x4ff3114f, 0x67cb3167, 0x4627c246, 0xc06727c0, 0xb4fc90b4, 0x28382028, 0x7f04f67f, 0x78486078, 0x2ee5ff2e, 0x74c9607, 0x4b655c4b, 0xc72bb1c7, 0x6f8eab6f, 0xd429e0d, 0xbbf59cbb, 0xf2db52f2, 0xf34a1bf3, 0xa63d5fa6, 0x59a49359, 0xbcb90abc, 0x3af9ef3a, 0xef1391ef, 0xfe0885fe, 0x1914901, 0x6116ee61, 0x7cde2d7c, 0xb2214fb2, 0x42b18f42, 0xdb723bdb, 0xb82f47b8, 0x48bf8748, 0x2cae6d2c, 0xe3c046e3, 0x573cd657, 0x859a3e85, 0x29a96929, 0x7d4f647d, 0x94812a94, 0x492ece49, 0x17c6cb17, 0xca692fca, 0xc3bdfcc3, 0x5ca3975c, 0x5ee8055e, 0xd0ed7ad0, 0x87d1ac87, 0x8e057f8e, 0xba64d5ba, 0xa8a51aa8, 0xb7264bb7, 0xb9be0eb9, 0x6087a760, 0xf8d55af8, 0x22362822, 0x111b1411, 0xde753fde, 0x79d92979, 0xaaee88aa, 0x332d3c33, 0x5f794c5f, 0xb6b702b6, 0x96cab896, 0x5835da58, 0x9cc4b09c, 0xfc4317fc, 0x1a84551a, 0xf64d1ff6, 0x1c598a1c, 0x38b27d38, 0xac3357ac, 0x18cfc718, 0xf4068df4, 0x69537469, 0x749bb774, 0xf597c4f5, 0x56ad9f56, 0xdae372da, 0xd5ea7ed5, 0x4af4154a, 0x9e8f229e, 0xa2ab12a2, 0x4e62584e, 0xe85f07e8, 0xe51d99e5, 0x39233439, 0xc1f66ec1, 0x446c5044, 0x5d32de5d, 0x72466872, 0x26a06526, 0x93cdbc93, 0x3dadb03, 0xc6baf8c6, 0xfa9ec8fa, 0x82d6a882, 0xcf6e2bcf, 0x50704050, 0xeb85dceb, 0x750afe75, 0x8a93328a, 0x8ddfa48d, 0x4c29ca4c, 0x141c1014, 0x73d72173, 0xccb4f0cc, 0x9d4d309, 0x108a5d10, 0xe2510fe2, 0x0, 0x9a196f9a, 0xe01a9de0, 0x8f94368f, 0xe6c742e6, 0xecc94aec, 0xfdd25efd, 0xab7fc1ab, 0xd8a8e0d8]; + /** + * The Key Schedule Array + * + * @var array + */ + private $K = []; + /** + * The Key depended S-Table 0 + * + * @var array + */ + private $S0 = []; + /** + * The Key depended S-Table 1 + * + * @var array + */ + private $S1 = []; + /** + * The Key depended S-Table 2 + * + * @var array + */ + private $S2 = []; + /** + * The Key depended S-Table 3 + * + * @var array + */ + private $S3 = []; + /** + * Holds the last used key + * + * @var array + */ + private $kl; + /** + * The Key Length (in bytes) + * + * @see Crypt_Twofish::setKeyLength() + * @var int + */ + protected $key_length = 16; + /** + * Default Constructor. + * + * @param string $mode + * @throws BadModeException if an invalid / unsupported mode is provided + */ + public function __construct($mode) + { + parent::__construct($mode); + if ($this->mode == self::MODE_STREAM) { + throw new BadModeException('Block ciphers cannot be ran in stream mode'); + } + } + /** + * Initialize Static Variables + */ + protected static function initialize_static_variables() + { + if (is_float(self::$m3[0])) { + self::$m0 = array_map('intval', self::$m0); + self::$m1 = array_map('intval', self::$m1); + self::$m2 = array_map('intval', self::$m2); + self::$m3 = array_map('intval', self::$m3); + self::$q0 = array_map('intval', self::$q0); + self::$q1 = array_map('intval', self::$q1); + } + parent::initialize_static_variables(); + } + /** + * Sets the key length. + * + * Valid key lengths are 128, 192 or 256 bits + * + * @param int $length + */ + public function setKeyLength($length) + { + switch ($length) { + case 128: + case 192: + case 256: + break; + default: + throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); + } + parent::setKeyLength($length); + } + /** + * Sets the key. + * + * Rijndael supports five different key lengths + * + * @see setKeyLength() + * @param string $key + * @throws \LengthException if the key length isn't supported + */ + public function setKey($key) + { + switch (strlen($key)) { + case 16: + case 24: + case 32: + break; + default: + throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); + } + parent::setKey($key); + } + /** + * Setup the key (expansion) + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupKey() + */ + protected function setupKey() + { + if (isset($this->kl['key']) && $this->key === $this->kl['key']) { + // already expanded + return; + } + $this->kl = ['key' => $this->key]; + /* Key expanding and generating the key-depended s-boxes */ + $le_longs = unpack('V*', $this->key); + $key = unpack('C*', $this->key); + $m0 = self::$m0; + $m1 = self::$m1; + $m2 = self::$m2; + $m3 = self::$m3; + $q0 = self::$q0; + $q1 = self::$q1; + $K = $S0 = $S1 = $S2 = $S3 = []; + switch (strlen($this->key)) { + case 16: + list($s7, $s6, $s5, $s4) = $this->mdsrem($le_longs[1], $le_longs[2]); + list($s3, $s2, $s1, $s0) = $this->mdsrem($le_longs[3], $le_longs[4]); + for ($i = 0, $j = 1; $i < 40; $i += 2, $j += 2) { + $A = $m0[$q0[$q0[$i] ^ $key[9]] ^ $key[1]] ^ $m1[$q0[$q1[$i] ^ $key[10]] ^ $key[2]] ^ $m2[$q1[$q0[$i] ^ $key[11]] ^ $key[3]] ^ $m3[$q1[$q1[$i] ^ $key[12]] ^ $key[4]]; + $B = $m0[$q0[$q0[$j] ^ $key[13]] ^ $key[5]] ^ $m1[$q0[$q1[$j] ^ $key[14]] ^ $key[6]] ^ $m2[$q1[$q0[$j] ^ $key[15]] ^ $key[7]] ^ $m3[$q1[$q1[$j] ^ $key[16]] ^ $key[8]]; + $B = $B << 8 | $B >> 24 & 0xff; + $A = self::safe_intval($A + $B); + $K[] = $A; + $A = self::safe_intval($A + $B); + $K[] = $A << 9 | $A >> 23 & 0x1ff; + } + for ($i = 0; $i < 256; ++$i) { + $S0[$i] = $m0[$q0[$q0[$i] ^ $s4] ^ $s0]; + $S1[$i] = $m1[$q0[$q1[$i] ^ $s5] ^ $s1]; + $S2[$i] = $m2[$q1[$q0[$i] ^ $s6] ^ $s2]; + $S3[$i] = $m3[$q1[$q1[$i] ^ $s7] ^ $s3]; + } + break; + case 24: + list($sb, $sa, $s9, $s8) = $this->mdsrem($le_longs[1], $le_longs[2]); + list($s7, $s6, $s5, $s4) = $this->mdsrem($le_longs[3], $le_longs[4]); + list($s3, $s2, $s1, $s0) = $this->mdsrem($le_longs[5], $le_longs[6]); + for ($i = 0, $j = 1; $i < 40; $i += 2, $j += 2) { + $A = $m0[$q0[$q0[$q1[$i] ^ $key[17]] ^ $key[9]] ^ $key[1]] ^ $m1[$q0[$q1[$q1[$i] ^ $key[18]] ^ $key[10]] ^ $key[2]] ^ $m2[$q1[$q0[$q0[$i] ^ $key[19]] ^ $key[11]] ^ $key[3]] ^ $m3[$q1[$q1[$q0[$i] ^ $key[20]] ^ $key[12]] ^ $key[4]]; + $B = $m0[$q0[$q0[$q1[$j] ^ $key[21]] ^ $key[13]] ^ $key[5]] ^ $m1[$q0[$q1[$q1[$j] ^ $key[22]] ^ $key[14]] ^ $key[6]] ^ $m2[$q1[$q0[$q0[$j] ^ $key[23]] ^ $key[15]] ^ $key[7]] ^ $m3[$q1[$q1[$q0[$j] ^ $key[24]] ^ $key[16]] ^ $key[8]]; + $B = $B << 8 | $B >> 24 & 0xff; + $A = self::safe_intval($A + $B); + $K[] = $A; + $A = self::safe_intval($A + $B); + $K[] = $A << 9 | $A >> 23 & 0x1ff; + } + for ($i = 0; $i < 256; ++$i) { + $S0[$i] = $m0[$q0[$q0[$q1[$i] ^ $s8] ^ $s4] ^ $s0]; + $S1[$i] = $m1[$q0[$q1[$q1[$i] ^ $s9] ^ $s5] ^ $s1]; + $S2[$i] = $m2[$q1[$q0[$q0[$i] ^ $sa] ^ $s6] ^ $s2]; + $S3[$i] = $m3[$q1[$q1[$q0[$i] ^ $sb] ^ $s7] ^ $s3]; + } + break; + default: + // 32 + list($sf, $se, $sd, $sc) = $this->mdsrem($le_longs[1], $le_longs[2]); + list($sb, $sa, $s9, $s8) = $this->mdsrem($le_longs[3], $le_longs[4]); + list($s7, $s6, $s5, $s4) = $this->mdsrem($le_longs[5], $le_longs[6]); + list($s3, $s2, $s1, $s0) = $this->mdsrem($le_longs[7], $le_longs[8]); + for ($i = 0, $j = 1; $i < 40; $i += 2, $j += 2) { + $A = $m0[$q0[$q0[$q1[$q1[$i] ^ $key[25]] ^ $key[17]] ^ $key[9]] ^ $key[1]] ^ $m1[$q0[$q1[$q1[$q0[$i] ^ $key[26]] ^ $key[18]] ^ $key[10]] ^ $key[2]] ^ $m2[$q1[$q0[$q0[$q0[$i] ^ $key[27]] ^ $key[19]] ^ $key[11]] ^ $key[3]] ^ $m3[$q1[$q1[$q0[$q1[$i] ^ $key[28]] ^ $key[20]] ^ $key[12]] ^ $key[4]]; + $B = $m0[$q0[$q0[$q1[$q1[$j] ^ $key[29]] ^ $key[21]] ^ $key[13]] ^ $key[5]] ^ $m1[$q0[$q1[$q1[$q0[$j] ^ $key[30]] ^ $key[22]] ^ $key[14]] ^ $key[6]] ^ $m2[$q1[$q0[$q0[$q0[$j] ^ $key[31]] ^ $key[23]] ^ $key[15]] ^ $key[7]] ^ $m3[$q1[$q1[$q0[$q1[$j] ^ $key[32]] ^ $key[24]] ^ $key[16]] ^ $key[8]]; + $B = $B << 8 | $B >> 24 & 0xff; + $A = self::safe_intval($A + $B); + $K[] = $A; + $A = self::safe_intval($A + $B); + $K[] = $A << 9 | $A >> 23 & 0x1ff; + } + for ($i = 0; $i < 256; ++$i) { + $S0[$i] = $m0[$q0[$q0[$q1[$q1[$i] ^ $sc] ^ $s8] ^ $s4] ^ $s0]; + $S1[$i] = $m1[$q0[$q1[$q1[$q0[$i] ^ $sd] ^ $s9] ^ $s5] ^ $s1]; + $S2[$i] = $m2[$q1[$q0[$q0[$q0[$i] ^ $se] ^ $sa] ^ $s6] ^ $s2]; + $S3[$i] = $m3[$q1[$q1[$q0[$q1[$i] ^ $sf] ^ $sb] ^ $s7] ^ $s3]; + } + } + $this->K = $K; + $this->S0 = $S0; + $this->S1 = $S1; + $this->S2 = $S2; + $this->S3 = $S3; + } + /** + * _mdsrem function using by the twofish cipher algorithm + * + * @param string $A + * @param string $B + * @return array + */ + private function mdsrem($A, $B) + { + // No gain by unrolling this loop. + for ($i = 0; $i < 8; ++$i) { + // Get most significant coefficient. + $t = 0xff & $B >> 24; + // Shift the others up. + $B = $B << 8 | 0xff & $A >> 24; + $A <<= 8; + $u = $t << 1; + // Subtract the modular polynomial on overflow. + if ($t & 0x80) { + $u ^= 0x14d; + } + // Remove t * (a * x^2 + 1). + $B ^= $t ^ $u << 16; + // Form u = a*t + t/a = t*(a + 1/a). + $u ^= 0x7fffffff & $t >> 1; + // Add the modular polynomial on underflow. + if ($t & 0x1) { + $u ^= 0xa6; + } + // Remove t * (a + 1/a) * (x^3 + x). + $B ^= $u << 24 | $u << 8; + } + return [0xff & $B >> 24, 0xff & $B >> 16, 0xff & $B >> 8, 0xff & $B]; + } + /** + * Encrypts a block + * + * @param string $in + * @return string + */ + protected function encryptBlock($in) + { + $S0 = $this->S0; + $S1 = $this->S1; + $S2 = $this->S2; + $S3 = $this->S3; + $K = $this->K; + $in = unpack("V4", $in); + $R0 = $K[0] ^ $in[1]; + $R1 = $K[1] ^ $in[2]; + $R2 = $K[2] ^ $in[3]; + $R3 = $K[3] ^ $in[4]; + $ki = 7; + while ($ki < 39) { + $t0 = $S0[$R0 & 0xff] ^ $S1[$R0 >> 8 & 0xff] ^ $S2[$R0 >> 16 & 0xff] ^ $S3[$R0 >> 24 & 0xff]; + $t1 = $S0[$R1 >> 24 & 0xff] ^ $S1[$R1 & 0xff] ^ $S2[$R1 >> 8 & 0xff] ^ $S3[$R1 >> 16 & 0xff]; + $R2 ^= self::safe_intval($t0 + $t1 + $K[++$ki]); + $R2 = $R2 >> 1 & 0x7fffffff | $R2 << 31; + $R3 = ($R3 >> 31 & 1 | $R3 << 1) ^ self::safe_intval($t0 + ($t1 << 1) + $K[++$ki]); + $t0 = $S0[$R2 & 0xff] ^ $S1[$R2 >> 8 & 0xff] ^ $S2[$R2 >> 16 & 0xff] ^ $S3[$R2 >> 24 & 0xff]; + $t1 = $S0[$R3 >> 24 & 0xff] ^ $S1[$R3 & 0xff] ^ $S2[$R3 >> 8 & 0xff] ^ $S3[$R3 >> 16 & 0xff]; + $R0 ^= self::safe_intval($t0 + $t1 + $K[++$ki]); + $R0 = $R0 >> 1 & 0x7fffffff | $R0 << 31; + $R1 = ($R1 >> 31 & 1 | $R1 << 1) ^ self::safe_intval($t0 + ($t1 << 1) + $K[++$ki]); + } + // @codingStandardsIgnoreStart + return pack("V4", $K[4] ^ $R2, $K[5] ^ $R3, $K[6] ^ $R0, $K[7] ^ $R1); + // @codingStandardsIgnoreEnd + } + /** + * Decrypts a block + * + * @param string $in + * @return string + */ + protected function decryptBlock($in) + { + $S0 = $this->S0; + $S1 = $this->S1; + $S2 = $this->S2; + $S3 = $this->S3; + $K = $this->K; + $in = unpack("V4", $in); + $R0 = $K[4] ^ $in[1]; + $R1 = $K[5] ^ $in[2]; + $R2 = $K[6] ^ $in[3]; + $R3 = $K[7] ^ $in[4]; + $ki = 40; + while ($ki > 8) { + $t0 = $S0[$R0 & 0xff] ^ $S1[$R0 >> 8 & 0xff] ^ $S2[$R0 >> 16 & 0xff] ^ $S3[$R0 >> 24 & 0xff]; + $t1 = $S0[$R1 >> 24 & 0xff] ^ $S1[$R1 & 0xff] ^ $S2[$R1 >> 8 & 0xff] ^ $S3[$R1 >> 16 & 0xff]; + $R3 ^= self::safe_intval($t0 + ($t1 << 1) + $K[--$ki]); + $R3 = $R3 >> 1 & 0x7fffffff | $R3 << 31; + $R2 = ($R2 >> 31 & 0x1 | $R2 << 1) ^ self::safe_intval($t0 + $t1 + $K[--$ki]); + $t0 = $S0[$R2 & 0xff] ^ $S1[$R2 >> 8 & 0xff] ^ $S2[$R2 >> 16 & 0xff] ^ $S3[$R2 >> 24 & 0xff]; + $t1 = $S0[$R3 >> 24 & 0xff] ^ $S1[$R3 & 0xff] ^ $S2[$R3 >> 8 & 0xff] ^ $S3[$R3 >> 16 & 0xff]; + $R1 ^= self::safe_intval($t0 + ($t1 << 1) + $K[--$ki]); + $R1 = $R1 >> 1 & 0x7fffffff | $R1 << 31; + $R0 = ($R0 >> 31 & 0x1 | $R0 << 1) ^ self::safe_intval($t0 + $t1 + $K[--$ki]); + } + // @codingStandardsIgnoreStart + return pack("V4", $K[0] ^ $R2, $K[1] ^ $R3, $K[2] ^ $R0, $K[3] ^ $R1); + // @codingStandardsIgnoreEnd + } + /** + * Setup the performance-optimized function for de/encrypt() + * + * @see \phpseclib3\Crypt\Common\SymmetricKey::_setupInlineCrypt() + */ + protected function setupInlineCrypt() + { + $K = $this->K; + $init_crypt = ' + static $S0, $S1, $S2, $S3; + if (!$S0) { + for ($i = 0; $i < 256; ++$i) { + $S0[] = (int)$this->S0[$i]; + $S1[] = (int)$this->S1[$i]; + $S2[] = (int)$this->S2[$i]; + $S3[] = (int)$this->S3[$i]; + } + } + '; + $safeint = self::safe_intval_inline(); + // Generating encrypt code: + $encrypt_block = ' + $in = unpack("V4", $in); + $R0 = ' . $K[0] . ' ^ $in[1]; + $R1 = ' . $K[1] . ' ^ $in[2]; + $R2 = ' . $K[2] . ' ^ $in[3]; + $R3 = ' . $K[3] . ' ^ $in[4]; + '; + for ($ki = 7, $i = 0; $i < 8; ++$i) { + $encrypt_block .= ' + $t0 = $S0[ $R0 & 0xff] ^ + $S1[($R0 >> 8) & 0xff] ^ + $S2[($R0 >> 16) & 0xff] ^ + $S3[($R0 >> 24) & 0xff]; + $t1 = $S0[($R1 >> 24) & 0xff] ^ + $S1[ $R1 & 0xff] ^ + $S2[($R1 >> 8) & 0xff] ^ + $S3[($R1 >> 16) & 0xff]; + $R2^= ' . sprintf($safeint, '$t0 + $t1 + ' . $K[++$ki]) . '; + $R2 = ($R2 >> 1 & 0x7fffffff) | ($R2 << 31); + $R3 = ((($R3 >> 31) & 1) | ($R3 << 1)) ^ ' . sprintf($safeint, '($t0 + ($t1 << 1) + ' . $K[++$ki] . ')') . '; + + $t0 = $S0[ $R2 & 0xff] ^ + $S1[($R2 >> 8) & 0xff] ^ + $S2[($R2 >> 16) & 0xff] ^ + $S3[($R2 >> 24) & 0xff]; + $t1 = $S0[($R3 >> 24) & 0xff] ^ + $S1[ $R3 & 0xff] ^ + $S2[($R3 >> 8) & 0xff] ^ + $S3[($R3 >> 16) & 0xff]; + $R0^= ' . sprintf($safeint, '($t0 + $t1 + ' . $K[++$ki] . ')') . '; + $R0 = ($R0 >> 1 & 0x7fffffff) | ($R0 << 31); + $R1 = ((($R1 >> 31) & 1) | ($R1 << 1)) ^ ' . sprintf($safeint, '($t0 + ($t1 << 1) + ' . $K[++$ki] . ')') . '; + '; + } + $encrypt_block .= ' + $in = pack("V4", ' . $K[4] . ' ^ $R2, + ' . $K[5] . ' ^ $R3, + ' . $K[6] . ' ^ $R0, + ' . $K[7] . ' ^ $R1); + '; + // Generating decrypt code: + $decrypt_block = ' + $in = unpack("V4", $in); + $R0 = ' . $K[4] . ' ^ $in[1]; + $R1 = ' . $K[5] . ' ^ $in[2]; + $R2 = ' . $K[6] . ' ^ $in[3]; + $R3 = ' . $K[7] . ' ^ $in[4]; + '; + for ($ki = 40, $i = 0; $i < 8; ++$i) { + $decrypt_block .= ' + $t0 = $S0[$R0 & 0xff] ^ + $S1[$R0 >> 8 & 0xff] ^ + $S2[$R0 >> 16 & 0xff] ^ + $S3[$R0 >> 24 & 0xff]; + $t1 = $S0[$R1 >> 24 & 0xff] ^ + $S1[$R1 & 0xff] ^ + $S2[$R1 >> 8 & 0xff] ^ + $S3[$R1 >> 16 & 0xff]; + $R3^= ' . sprintf($safeint, '$t0 + ($t1 << 1) + ' . $K[--$ki]) . '; + $R3 = $R3 >> 1 & 0x7fffffff | $R3 << 31; + $R2 = ($R2 >> 31 & 0x1 | $R2 << 1) ^ ' . sprintf($safeint, '($t0 + $t1 + ' . $K[--$ki] . ')') . '; + + $t0 = $S0[$R2 & 0xff] ^ + $S1[$R2 >> 8 & 0xff] ^ + $S2[$R2 >> 16 & 0xff] ^ + $S3[$R2 >> 24 & 0xff]; + $t1 = $S0[$R3 >> 24 & 0xff] ^ + $S1[$R3 & 0xff] ^ + $S2[$R3 >> 8 & 0xff] ^ + $S3[$R3 >> 16 & 0xff]; + $R1^= ' . sprintf($safeint, '$t0 + ($t1 << 1) + ' . $K[--$ki]) . '; + $R1 = $R1 >> 1 & 0x7fffffff | $R1 << 31; + $R0 = ($R0 >> 31 & 0x1 | $R0 << 1) ^ ' . sprintf($safeint, '($t0 + $t1 + ' . $K[--$ki] . ')') . '; + '; + } + $decrypt_block .= ' + $in = pack("V4", ' . $K[0] . ' ^ $R2, + ' . $K[1] . ' ^ $R3, + ' . $K[2] . ' ^ $R0, + ' . $K[3] . ' ^ $R1); + '; + $this->inline_crypt = $this->createInlineCryptFunction(['init_crypt' => $init_crypt, 'init_encrypt' => '', 'init_decrypt' => '', 'encrypt_block' => $encrypt_block, 'decrypt_block' => $decrypt_block]); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadConfigurationException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadConfigurationException.php new file mode 100644 index 0000000..988c80a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadConfigurationException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * BadConfigurationException + * + * @author Jim Wigginton + */ +class BadConfigurationException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadDecryptionException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadDecryptionException.php new file mode 100644 index 0000000..8a52176 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadDecryptionException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * BadDecryptionException + * + * @author Jim Wigginton + */ +class BadDecryptionException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadModeException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadModeException.php new file mode 100644 index 0000000..a084e0c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/BadModeException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * BadModeException + * + * @author Jim Wigginton + */ +class BadModeException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/ConnectionClosedException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/ConnectionClosedException.php new file mode 100644 index 0000000..fcc1c8e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/ConnectionClosedException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * ConnectionClosedException + * + * @author Jim Wigginton + */ +class ConnectionClosedException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/FileNotFoundException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/FileNotFoundException.php new file mode 100644 index 0000000..31ac087 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/FileNotFoundException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * FileNotFoundException + * + * @author Jim Wigginton + */ +class FileNotFoundException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/InconsistentSetupException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/InconsistentSetupException.php new file mode 100644 index 0000000..d2f17ce --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/InconsistentSetupException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * InconsistentSetupException + * + * @author Jim Wigginton + */ +class InconsistentSetupException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/InsufficientSetupException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/InsufficientSetupException.php new file mode 100644 index 0000000..30d9f1d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/InsufficientSetupException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * InsufficientSetupException + * + * @author Jim Wigginton + */ +class InsufficientSetupException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/NoKeyLoadedException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/NoKeyLoadedException.php new file mode 100644 index 0000000..2179c48 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/NoKeyLoadedException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * NoKeyLoadedException + * + * @author Jim Wigginton + */ +class NoKeyLoadedException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/NoSupportedAlgorithmsException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/NoSupportedAlgorithmsException.php new file mode 100644 index 0000000..4da37d2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/NoSupportedAlgorithmsException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * NoSupportedAlgorithmsException + * + * @author Jim Wigginton + */ +class NoSupportedAlgorithmsException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnableToConnectException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnableToConnectException.php new file mode 100644 index 0000000..d1ff02e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnableToConnectException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * UnableToConnectException + * + * @author Jim Wigginton + */ +class UnableToConnectException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedAlgorithmException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedAlgorithmException.php new file mode 100644 index 0000000..3804071 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedAlgorithmException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * UnsupportedAlgorithmException + * + * @author Jim Wigginton + */ +class UnsupportedAlgorithmException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedCurveException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedCurveException.php new file mode 100644 index 0000000..5afa9b8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedCurveException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * UnsupportedCurveException + * + * @author Jim Wigginton + */ +class UnsupportedCurveException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedFormatException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedFormatException.php new file mode 100644 index 0000000..e5a5f7e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedFormatException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * UnsupportedFormatException + * + * @author Jim Wigginton + */ +class UnsupportedFormatException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedOperationException.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedOperationException.php new file mode 100644 index 0000000..fe18721 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Exception/UnsupportedOperationException.php @@ -0,0 +1,22 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception; + +/** + * UnsupportedOperationException + * + * @author Jim Wigginton + */ +class UnsupportedOperationException extends \RuntimeException +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ANSI.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ANSI.php new file mode 100644 index 0000000..c0d1214 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ANSI.php @@ -0,0 +1,553 @@ + + * @copyright 2012 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File; + +/** + * Pure-PHP ANSI Decoder + * + * @author Jim Wigginton + */ +class ANSI +{ + /** + * Max Width + * + * @var int + */ + private $max_x; + /** + * Max Height + * + * @var int + */ + private $max_y; + /** + * Max History + * + * @var int + */ + private $max_history; + /** + * History + * + * @var array + */ + private $history; + /** + * History Attributes + * + * @var array + */ + private $history_attrs; + /** + * Current Column + * + * @var int + */ + private $x; + /** + * Current Row + * + * @var int + */ + private $y; + /** + * Old Column + * + * @var int + */ + private $old_x; + /** + * Old Row + * + * @var int + */ + private $old_y; + /** + * An empty attribute cell + * + * @var object + */ + private $base_attr_cell; + /** + * The current attribute cell + * + * @var object + */ + private $attr_cell; + /** + * An empty attribute row + * + * @var array + */ + private $attr_row; + /** + * The current screen text + * + * @var list + */ + private $screen; + /** + * The current screen attributes + * + * @var array + */ + private $attrs; + /** + * Current ANSI code + * + * @var string + */ + private $ansi; + /** + * Tokenization + * + * @var array + */ + private $tokenization; + /** + * Default Constructor. + * + * @return \phpseclib3\File\ANSI + */ + public function __construct() + { + $attr_cell = new \stdClass(); + $attr_cell->bold = \false; + $attr_cell->underline = \false; + $attr_cell->blink = \false; + $attr_cell->background = 'black'; + $attr_cell->foreground = 'white'; + $attr_cell->reverse = \false; + $this->base_attr_cell = clone $attr_cell; + $this->attr_cell = clone $attr_cell; + $this->setHistory(200); + $this->setDimensions(80, 24); + } + /** + * Set terminal width and height + * + * Resets the screen as well + * + * @param int $x + * @param int $y + */ + public function setDimensions($x, $y) + { + $this->max_x = $x - 1; + $this->max_y = $y - 1; + $this->x = $this->y = 0; + $this->history = $this->history_attrs = []; + $this->attr_row = array_fill(0, $this->max_x + 2, $this->base_attr_cell); + $this->screen = array_fill(0, $this->max_y + 1, ''); + $this->attrs = array_fill(0, $this->max_y + 1, $this->attr_row); + $this->ansi = ''; + } + /** + * Set the number of lines that should be logged past the terminal height + * + * @param int $history + */ + public function setHistory($history) + { + $this->max_history = $history; + } + /** + * Load a string + * + * @param string $source + */ + public function loadString($source) + { + $this->setDimensions($this->max_x + 1, $this->max_y + 1); + $this->appendString($source); + } + /** + * Appdend a string + * + * @param string $source + */ + public function appendString($source) + { + $this->tokenization = ['']; + for ($i = 0; $i < strlen($source); $i++) { + if (strlen($this->ansi)) { + $this->ansi .= $source[$i]; + $chr = ord($source[$i]); + // http://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements + // single character CSI's not currently supported + switch (\true) { + case $this->ansi == "\x1b=": + $this->ansi = ''; + continue 2; + case strlen($this->ansi) == 2 && $chr >= 64 && $chr <= 95 && $chr != ord('['): + case strlen($this->ansi) > 2 && $chr >= 64 && $chr <= 126: + break; + default: + continue 2; + } + $this->tokenization[] = $this->ansi; + $this->tokenization[] = ''; + // http://ascii-table.com/ansi-escape-sequences-vt-100.php + switch ($this->ansi) { + case "\x1b[H": + // Move cursor to upper left corner + $this->old_x = $this->x; + $this->old_y = $this->y; + $this->x = $this->y = 0; + break; + case "\x1b[J": + // Clear screen from cursor down + $this->history = array_merge($this->history, array_slice(array_splice($this->screen, $this->y + 1), 0, $this->old_y)); + $this->screen = array_merge($this->screen, array_fill($this->y, $this->max_y, '')); + $this->history_attrs = array_merge($this->history_attrs, array_slice(array_splice($this->attrs, $this->y + 1), 0, $this->old_y)); + $this->attrs = array_merge($this->attrs, array_fill($this->y, $this->max_y, $this->attr_row)); + if (count($this->history) == $this->max_history) { + array_shift($this->history); + array_shift($this->history_attrs); + } + // fall-through + case "\x1b[K": + // Clear screen from cursor right + $this->screen[$this->y] = substr($this->screen[$this->y], 0, $this->x); + array_splice($this->attrs[$this->y], $this->x + 1, $this->max_x - $this->x, array_fill($this->x, $this->max_x - ($this->x - 1), $this->base_attr_cell)); + break; + case "\x1b[2K": + // Clear entire line + $this->screen[$this->y] = str_repeat(' ', $this->x); + $this->attrs[$this->y] = $this->attr_row; + break; + case "\x1b[?1h": + // set cursor key to application + case "\x1b[?25h": + // show the cursor + case "\x1b(B": + // set united states g0 character set + break; + case "\x1bE": + // Move to next line + $this->newLine(); + $this->x = 0; + break; + default: + switch (\true) { + case preg_match('#\\x1B\\[(\\d+)B#', $this->ansi, $match): + // Move cursor down n lines + $this->old_y = $this->y; + $this->y += (int) $match[1]; + break; + case preg_match('#\\x1B\\[(\\d+);(\\d+)H#', $this->ansi, $match): + // Move cursor to screen location v,h + $this->old_x = $this->x; + $this->old_y = $this->y; + $this->x = $match[2] - 1; + $this->y = (int) $match[1] - 1; + break; + case preg_match('#\\x1B\\[(\\d+)C#', $this->ansi, $match): + // Move cursor right n lines + $this->old_x = $this->x; + $this->x += $match[1]; + break; + case preg_match('#\\x1B\\[(\\d+)D#', $this->ansi, $match): + // Move cursor left n lines + $this->old_x = $this->x; + $this->x -= $match[1]; + if ($this->x < 0) { + $this->x = 0; + } + break; + case preg_match('#\\x1B\\[(\\d+);(\\d+)r#', $this->ansi, $match): + // Set top and bottom lines of a window + break; + case preg_match('#\\x1B\\[(\\d*(?:;\\d*)*)m#', $this->ansi, $match): + // character attributes + $attr_cell =& $this->attr_cell; + $mods = explode(';', $match[1]); + foreach ($mods as $mod) { + switch ($mod) { + case '': + case '0': + // Turn off character attributes + $attr_cell = clone $this->base_attr_cell; + break; + case '1': + // Turn bold mode on + $attr_cell->bold = \true; + break; + case '4': + // Turn underline mode on + $attr_cell->underline = \true; + break; + case '5': + // Turn blinking mode on + $attr_cell->blink = \true; + break; + case '7': + // Turn reverse video on + $attr_cell->reverse = !$attr_cell->reverse; + $temp = $attr_cell->background; + $attr_cell->background = $attr_cell->foreground; + $attr_cell->foreground = $temp; + break; + default: + // set colors + //$front = $attr_cell->reverse ? &$attr_cell->background : &$attr_cell->foreground; + $front =& $attr_cell->{$attr_cell->reverse ? 'background' : 'foreground'}; + //$back = $attr_cell->reverse ? &$attr_cell->foreground : &$attr_cell->background; + $back =& $attr_cell->{$attr_cell->reverse ? 'foreground' : 'background'}; + switch ($mod) { + // @codingStandardsIgnoreStart + case '30': + $front = 'black'; + break; + case '31': + $front = 'red'; + break; + case '32': + $front = 'green'; + break; + case '33': + $front = 'yellow'; + break; + case '34': + $front = 'blue'; + break; + case '35': + $front = 'magenta'; + break; + case '36': + $front = 'cyan'; + break; + case '37': + $front = 'white'; + break; + case '40': + $back = 'black'; + break; + case '41': + $back = 'red'; + break; + case '42': + $back = 'green'; + break; + case '43': + $back = 'yellow'; + break; + case '44': + $back = 'blue'; + break; + case '45': + $back = 'magenta'; + break; + case '46': + $back = 'cyan'; + break; + case '47': + $back = 'white'; + break; + // @codingStandardsIgnoreEnd + default: + //user_error('Unsupported attribute: ' . $mod); + $this->ansi = ''; + break 2; + } + } + } + break; + default: + } + } + $this->ansi = ''; + continue; + } + $this->tokenization[count($this->tokenization) - 1] .= $source[$i]; + switch ($source[$i]) { + case "\r": + $this->x = 0; + break; + case "\n": + $this->newLine(); + break; + case "\x08": + // backspace + if ($this->x) { + $this->x--; + $this->attrs[$this->y][$this->x] = clone $this->base_attr_cell; + $this->screen[$this->y] = substr_replace($this->screen[$this->y], $source[$i], $this->x, 1); + } + break; + case "\x0f": + // shift + break; + case "\x1b": + // start ANSI escape code + $this->tokenization[count($this->tokenization) - 1] = substr($this->tokenization[count($this->tokenization) - 1], 0, -1); + //if (!strlen($this->tokenization[count($this->tokenization) - 1])) { + // array_pop($this->tokenization); + //} + $this->ansi .= "\x1b"; + break; + default: + $this->attrs[$this->y][$this->x] = clone $this->attr_cell; + if ($this->x > strlen($this->screen[$this->y])) { + $this->screen[$this->y] = str_repeat(' ', $this->x); + } + $this->screen[$this->y] = substr_replace($this->screen[$this->y], $source[$i], $this->x, 1); + if ($this->x > $this->max_x) { + $this->x = 0; + $this->newLine(); + } else { + $this->x++; + } + } + } + } + /** + * Add a new line + * + * Also update the $this->screen and $this->history buffers + * + */ + private function newLine() + { + //if ($this->y < $this->max_y) { + // $this->y++; + //} + while ($this->y >= $this->max_y) { + $this->history = array_merge($this->history, [array_shift($this->screen)]); + $this->screen[] = ''; + $this->history_attrs = array_merge($this->history_attrs, [array_shift($this->attrs)]); + $this->attrs[] = $this->attr_row; + if (count($this->history) >= $this->max_history) { + array_shift($this->history); + array_shift($this->history_attrs); + } + $this->y--; + } + $this->y++; + } + /** + * Returns the current coordinate without preformating + * + * @param \stdClass $last_attr + * @param \stdClass $cur_attr + * @param string $char + * @return string + */ + private function processCoordinate(\stdClass $last_attr, \stdClass $cur_attr, $char) + { + $output = ''; + if ($last_attr != $cur_attr) { + $close = $open = ''; + if ($last_attr->foreground != $cur_attr->foreground) { + if ($cur_attr->foreground != 'white') { + $open .= ''; + } + if ($last_attr->foreground != 'white') { + $close = '' . $close; + } + } + if ($last_attr->background != $cur_attr->background) { + if ($cur_attr->background != 'black') { + $open .= ''; + } + if ($last_attr->background != 'black') { + $close = '' . $close; + } + } + if ($last_attr->bold != $cur_attr->bold) { + if ($cur_attr->bold) { + $open .= ''; + } else { + $close = '' . $close; + } + } + if ($last_attr->underline != $cur_attr->underline) { + if ($cur_attr->underline) { + $open .= ''; + } else { + $close = '' . $close; + } + } + if ($last_attr->blink != $cur_attr->blink) { + if ($cur_attr->blink) { + $open .= ''; + } else { + $close = '' . $close; + } + } + $output .= $close . $open; + } + $output .= htmlspecialchars($char); + return $output; + } + /** + * Returns the current screen without preformating + * + * @return string + */ + private function getScreenHelper() + { + $output = ''; + $last_attr = $this->base_attr_cell; + for ($i = 0; $i <= $this->max_y; $i++) { + for ($j = 0; $j <= $this->max_x; $j++) { + $cur_attr = $this->attrs[$i][$j]; + $output .= $this->processCoordinate($last_attr, $cur_attr, isset($this->screen[$i][$j]) ? $this->screen[$i][$j] : ''); + $last_attr = $this->attrs[$i][$j]; + } + $output .= "\r\n"; + } + $output = substr($output, 0, -2); + // close any remaining open tags + $output .= $this->processCoordinate($last_attr, $this->base_attr_cell, ''); + return rtrim($output); + } + /** + * Returns the current screen + * + * @return string + */ + public function getScreen() + { + return '
' . $this->getScreenHelper() . '
'; + } + /** + * Returns the current screen and the x previous lines + * + * @return string + */ + public function getHistory() + { + $scrollback = ''; + $last_attr = $this->base_attr_cell; + for ($i = 0; $i < count($this->history); $i++) { + for ($j = 0; $j <= $this->max_x + 1; $j++) { + $cur_attr = $this->history_attrs[$i][$j]; + $scrollback .= $this->processCoordinate($last_attr, $cur_attr, isset($this->history[$i][$j]) ? $this->history[$i][$j] : ''); + $last_attr = $this->history_attrs[$i][$j]; + } + $scrollback .= "\r\n"; + } + $base_attr_cell = $this->base_attr_cell; + $this->base_attr_cell = $last_attr; + $scrollback .= $this->getScreen(); + $this->base_attr_cell = $base_attr_cell; + return '
' . $scrollback . '
'; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1.php new file mode 100644 index 0000000..a12ddd8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1.php @@ -0,0 +1,1398 @@ + + * @copyright 2012 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Element; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Pure-PHP ASN.1 Parser + * + * @author Jim Wigginton + */ +abstract class ASN1 +{ + // Tag Classes + // http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12 + const CLASS_UNIVERSAL = 0; + const CLASS_APPLICATION = 1; + const CLASS_CONTEXT_SPECIFIC = 2; + const CLASS_PRIVATE = 3; + // Tag Classes + // http://www.obj-sys.com/asn1tutorial/node124.html + const TYPE_BOOLEAN = 1; + const TYPE_INTEGER = 2; + const TYPE_BIT_STRING = 3; + const TYPE_OCTET_STRING = 4; + const TYPE_NULL = 5; + const TYPE_OBJECT_IDENTIFIER = 6; + //const TYPE_OBJECT_DESCRIPTOR = 7; + //const TYPE_INSTANCE_OF = 8; // EXTERNAL + const TYPE_REAL = 9; + const TYPE_ENUMERATED = 10; + //const TYPE_EMBEDDED = 11; + const TYPE_UTF8_STRING = 12; + //const TYPE_RELATIVE_OID = 13; + const TYPE_SEQUENCE = 16; + // SEQUENCE OF + const TYPE_SET = 17; + // SET OF + // More Tag Classes + // http://www.obj-sys.com/asn1tutorial/node10.html + const TYPE_NUMERIC_STRING = 18; + const TYPE_PRINTABLE_STRING = 19; + const TYPE_TELETEX_STRING = 20; + // T61String + const TYPE_VIDEOTEX_STRING = 21; + const TYPE_IA5_STRING = 22; + const TYPE_UTC_TIME = 23; + const TYPE_GENERALIZED_TIME = 24; + const TYPE_GRAPHIC_STRING = 25; + const TYPE_VISIBLE_STRING = 26; + // ISO646String + const TYPE_GENERAL_STRING = 27; + const TYPE_UNIVERSAL_STRING = 28; + //const TYPE_CHARACTER_STRING = 29; + const TYPE_BMP_STRING = 30; + // Tag Aliases + // These tags are kinda place holders for other tags. + const TYPE_CHOICE = -1; + const TYPE_ANY = -2; + /** + * ASN.1 object identifiers + * + * @var array + * @link http://en.wikipedia.org/wiki/Object_identifier + */ + private static $oids = []; + /** + * ASN.1 object identifier reverse mapping + * + * @var array + */ + private static $reverseOIDs = []; + /** + * Default date format + * + * @var string + * @link http://php.net/class.datetime + */ + private static $format = 'D, d M Y H:i:s O'; + /** + * Filters + * + * If the mapping type is self::TYPE_ANY what do we actually encode it as? + * + * @var array + * @see self::encode_der() + */ + private static $filters; + /** + * Current Location of most recent ASN.1 encode process + * + * Useful for debug purposes + * + * @var array + * @see self::encode_der() + */ + private static $location; + /** + * DER Encoded String + * + * In case we need to create ASN1\Element object's.. + * + * @var string + * @see self::decodeDER() + */ + private static $encoded; + /** + * Type mapping table for the ANY type. + * + * Structured or unknown types are mapped to a \phpseclib3\File\ASN1\Element. + * Unambiguous types get the direct mapping (int/real/bool). + * Others are mapped as a choice, with an extra indexing level. + * + * @var array + */ + const ANY_MAP = [ + self::TYPE_BOOLEAN => \true, + self::TYPE_INTEGER => \true, + self::TYPE_BIT_STRING => 'bitString', + self::TYPE_OCTET_STRING => 'octetString', + self::TYPE_NULL => 'null', + self::TYPE_OBJECT_IDENTIFIER => 'objectIdentifier', + self::TYPE_REAL => \true, + self::TYPE_ENUMERATED => 'enumerated', + self::TYPE_UTF8_STRING => 'utf8String', + self::TYPE_NUMERIC_STRING => 'numericString', + self::TYPE_PRINTABLE_STRING => 'printableString', + self::TYPE_TELETEX_STRING => 'teletexString', + self::TYPE_VIDEOTEX_STRING => 'videotexString', + self::TYPE_IA5_STRING => 'ia5String', + self::TYPE_UTC_TIME => 'utcTime', + self::TYPE_GENERALIZED_TIME => 'generalTime', + self::TYPE_GRAPHIC_STRING => 'graphicString', + self::TYPE_VISIBLE_STRING => 'visibleString', + self::TYPE_GENERAL_STRING => 'generalString', + self::TYPE_UNIVERSAL_STRING => 'universalString', + //self::TYPE_CHARACTER_STRING => 'characterString', + self::TYPE_BMP_STRING => 'bmpString', + ]; + /** + * String type to character size mapping table. + * + * Non-convertable types are absent from this table. + * size == 0 indicates variable length encoding. + * + * @var array + */ + const STRING_TYPE_SIZE = [self::TYPE_UTF8_STRING => 0, self::TYPE_BMP_STRING => 2, self::TYPE_UNIVERSAL_STRING => 4, self::TYPE_PRINTABLE_STRING => 1, self::TYPE_TELETEX_STRING => 1, self::TYPE_IA5_STRING => 1, self::TYPE_VISIBLE_STRING => 1]; + /** + * Parse BER-encoding + * + * Serves a similar purpose to openssl's asn1parse + * + * @param Element|string $encoded + * @return ?array + */ + public static function decodeBER($encoded) + { + if ($encoded instanceof Element) { + $encoded = $encoded->element; + } + self::$encoded = $encoded; + $decoded = self::decode_ber($encoded); + if ($decoded === \false) { + return null; + } + return [$decoded]; + } + /** + * Parse BER-encoding (Helper function) + * + * Sometimes we want to get the BER encoding of a particular tag. $start lets us do that without having to reencode. + * $encoded is passed by reference for the recursive calls done for self::TYPE_BIT_STRING and + * self::TYPE_OCTET_STRING. In those cases, the indefinite length is used. + * + * @param string $encoded + * @param int $start + * @param int $encoded_pos + * @return array|bool + */ + private static function decode_ber($encoded, $start = 0, $encoded_pos = 0) + { + $current = ['start' => $start]; + if (!isset($encoded[$encoded_pos])) { + return \false; + } + $type = ord($encoded[$encoded_pos++]); + $startOffset = 1; + $constructed = $type >> 5 & 1; + $tag = $type & 0x1f; + if ($tag == 0x1f) { + $tag = 0; + // process septets (since the eighth bit is ignored, it's not an octet) + do { + if (!isset($encoded[$encoded_pos])) { + return \false; + } + $temp = ord($encoded[$encoded_pos++]); + $startOffset++; + $loop = $temp >> 7; + $tag <<= 7; + $temp &= 0x7f; + // "bits 7 to 1 of the first subsequent octet shall not all be zero" + if ($startOffset == 2 && $temp == 0) { + return \false; + } + $tag |= $temp; + } while ($loop); + } + $start += $startOffset; + // Length, as discussed in paragraph 8.1.3 of X.690-0207.pdf#page=13 + if (!isset($encoded[$encoded_pos])) { + return \false; + } + $length = ord($encoded[$encoded_pos++]); + $start++; + if ($length == 0x80) { + // indefinite length + // "[A sender shall] use the indefinite form (see 8.1.3.6) if the encoding is constructed and is not all + // immediately available." -- paragraph 8.1.3.2.c + $length = strlen($encoded) - $encoded_pos; + } elseif ($length & 0x80) { + // definite length, long form + // technically, the long form of the length can be represented by up to 126 octets (bytes), but we'll only + // support it up to four. + $length &= 0x7f; + $temp = substr($encoded, $encoded_pos, $length); + $encoded_pos += $length; + // tags of indefinte length don't really have a header length; this length includes the tag + $current += ['headerlength' => $length + 2]; + $start += $length; + extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), \STR_PAD_LEFT), -4))); + /** @var integer $length */ + } else { + $current += ['headerlength' => 2]; + } + if ($length > strlen($encoded) - $encoded_pos) { + return \false; + } + $content = substr($encoded, $encoded_pos, $length); + $content_pos = 0; + // at this point $length can be overwritten. it's only accurate for definite length things as is + /* Class is UNIVERSAL, APPLICATION, PRIVATE, or CONTEXT-SPECIFIC. The UNIVERSAL class is restricted to the ASN.1 + built-in types. It defines an application-independent data type that must be distinguishable from all other + data types. The other three classes are user defined. The APPLICATION class distinguishes data types that + have a wide, scattered use within a particular presentation context. PRIVATE distinguishes data types within + a particular organization or country. CONTEXT-SPECIFIC distinguishes members of a sequence or set, the + alternatives of a CHOICE, or universally tagged set members. Only the class number appears in braces for this + data type; the term CONTEXT-SPECIFIC does not appear. + + -- http://www.obj-sys.com/asn1tutorial/node12.html */ + $class = $type >> 6 & 3; + switch ($class) { + case self::CLASS_APPLICATION: + case self::CLASS_PRIVATE: + case self::CLASS_CONTEXT_SPECIFIC: + if (!$constructed) { + return ['type' => $class, 'constant' => $tag, 'content' => $content, 'length' => $length + $start - $current['start']] + $current; + } + $newcontent = []; + $remainingLength = $length; + while ($remainingLength > 0) { + $temp = self::decode_ber($content, $start, $content_pos); + if ($temp === \false) { + break; + } + $length = $temp['length']; + // end-of-content octets - see paragraph 8.1.5 + if (substr($content, $content_pos + $length, 2) == "\x00\x00") { + $length += 2; + $start += $length; + $newcontent[] = $temp; + break; + } + $start += $length; + $remainingLength -= $length; + $newcontent[] = $temp; + $content_pos += $length; + } + return [ + 'type' => $class, + 'constant' => $tag, + // the array encapsulation is for BC with the old format + 'content' => $newcontent, + // the only time when $content['headerlength'] isn't defined is when the length is indefinite. + // the absence of $content['headerlength'] is how we know if something is indefinite or not. + // technically, it could be defined to be 2 and then another indicator could be used but whatever. + 'length' => $start - $current['start'], + ] + $current; + } + $current += ['type' => $tag]; + // decode UNIVERSAL tags + switch ($tag) { + case self::TYPE_BOOLEAN: + // "The contents octets shall consist of a single octet." -- paragraph 8.2.1 + if ($constructed || strlen($content) != 1) { + return \false; + } + $current['content'] = (bool) ord($content[$content_pos]); + break; + case self::TYPE_INTEGER: + case self::TYPE_ENUMERATED: + if ($constructed) { + return \false; + } + $current['content'] = new BigInteger(substr($content, $content_pos), -256); + break; + case self::TYPE_REAL: + // not currently supported + return \false; + case self::TYPE_BIT_STRING: + // The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit, + // the number of unused bits in the final subsequent octet. The number shall be in the range zero to + // seven. + if (!$constructed) { + $current['content'] = substr($content, $content_pos); + } else { + $temp = self::decode_ber($content, $start, $content_pos); + if ($temp === \false) { + return \false; + } + $length -= strlen($content) - $content_pos; + $last = count($temp) - 1; + for ($i = 0; $i < $last; $i++) { + // all subtags should be bit strings + if ($temp[$i]['type'] != self::TYPE_BIT_STRING) { + return \false; + } + $current['content'] .= substr($temp[$i]['content'], 1); + } + // all subtags should be bit strings + if ($temp[$last]['type'] != self::TYPE_BIT_STRING) { + return \false; + } + $current['content'] = $temp[$last]['content'][0] . $current['content'] . substr($temp[$i]['content'], 1); + } + break; + case self::TYPE_OCTET_STRING: + if (!$constructed) { + $current['content'] = substr($content, $content_pos); + } else { + $current['content'] = ''; + $length = 0; + while (substr($content, $content_pos, 2) != "\x00\x00") { + $temp = self::decode_ber($content, $length + $start, $content_pos); + if ($temp === \false) { + return \false; + } + $content_pos += $temp['length']; + // all subtags should be octet strings + if ($temp['type'] != self::TYPE_OCTET_STRING) { + return \false; + } + $current['content'] .= $temp['content']; + $length += $temp['length']; + } + if (substr($content, $content_pos, 2) == "\x00\x00") { + $length += 2; + // +2 for the EOC + } + } + break; + case self::TYPE_NULL: + // "The contents octets shall not contain any octets." -- paragraph 8.8.2 + if ($constructed || strlen($content)) { + return \false; + } + break; + case self::TYPE_SEQUENCE: + case self::TYPE_SET: + if (!$constructed) { + return \false; + } + $offset = 0; + $current['content'] = []; + $content_len = strlen($content); + while ($content_pos < $content_len) { + // if indefinite length construction was used and we have an end-of-content string next + // see paragraphs 8.1.1.3, 8.1.3.2, 8.1.3.6, 8.1.5, and (for an example) 8.6.4.2 + if (!isset($current['headerlength']) && substr($content, $content_pos, 2) == "\x00\x00") { + $length = $offset + 2; + // +2 for the EOC + break 2; + } + $temp = self::decode_ber($content, $start + $offset, $content_pos); + if ($temp === \false) { + return \false; + } + $content_pos += $temp['length']; + $current['content'][] = $temp; + $offset += $temp['length']; + } + break; + case self::TYPE_OBJECT_IDENTIFIER: + if ($constructed) { + return \false; + } + $current['content'] = self::decodeOID(substr($content, $content_pos)); + if ($current['content'] === \false) { + return \false; + } + break; + /* Each character string type shall be encoded as if it had been declared: + [UNIVERSAL x] IMPLICIT OCTET STRING + + -- X.690-0207.pdf#page=23 (paragraph 8.21.3) + + Per that, we're not going to do any validation. If there are any illegal characters in the string, + we don't really care */ + case self::TYPE_NUMERIC_STRING: + // 0,1,2,3,4,5,6,7,8,9, and space + case self::TYPE_PRINTABLE_STRING: + // Upper and lower case letters, digits, space, apostrophe, left/right parenthesis, plus sign, comma, + // hyphen, full stop, solidus, colon, equal sign, question mark + case self::TYPE_TELETEX_STRING: + // The Teletex character set in CCITT's T61, space, and delete + // see http://en.wikipedia.org/wiki/Teletex#Character_sets + case self::TYPE_VIDEOTEX_STRING: + // The Videotex character set in CCITT's T.100 and T.101, space, and delete + case self::TYPE_VISIBLE_STRING: + // Printing character sets of international ASCII, and space + case self::TYPE_IA5_STRING: + // International Alphabet 5 (International ASCII) + case self::TYPE_GRAPHIC_STRING: + // All registered G sets, and space + case self::TYPE_GENERAL_STRING: + // All registered C and G sets, space and delete + case self::TYPE_UTF8_STRING: + // ???? + case self::TYPE_BMP_STRING: + if ($constructed) { + return \false; + } + $current['content'] = substr($content, $content_pos); + break; + case self::TYPE_UTC_TIME: + case self::TYPE_GENERALIZED_TIME: + if ($constructed) { + return \false; + } + $current['content'] = self::decodeTime(substr($content, $content_pos), $tag); + break; + default: + return \false; + } + $start += $length; + // ie. length is the length of the full TLV encoding - it's not just the length of the value + return $current + ['length' => $start - $current['start']]; + } + /** + * ASN.1 Map + * + * Provides an ASN.1 semantic mapping ($mapping) from a parsed BER-encoding to a human readable format. + * + * "Special" mappings may be applied on a per tag-name basis via $special. + * + * @param array $decoded + * @param array $mapping + * @param array $special + * @return array|bool|Element|string|null + */ + public static function asn1map(array $decoded, $mapping, $special = []) + { + if (isset($mapping['explicit']) && is_array($decoded['content'])) { + $decoded = $decoded['content'][0]; + } + switch (\true) { + case $mapping['type'] == self::TYPE_ANY: + $intype = $decoded['type']; + // !isset(self::ANY_MAP[$intype]) produces a fatal error on PHP 5.6 + if (isset($decoded['constant']) || !array_key_exists($intype, self::ANY_MAP) || ord(self::$encoded[$decoded['start']]) & 0x20) { + return new Element(substr(self::$encoded, $decoded['start'], $decoded['length'])); + } + $inmap = self::ANY_MAP[$intype]; + if (is_string($inmap)) { + return [$inmap => self::asn1map($decoded, ['type' => $intype] + $mapping, $special)]; + } + break; + case $mapping['type'] == self::TYPE_CHOICE: + foreach ($mapping['children'] as $key => $option) { + switch (\true) { + case isset($option['constant']) && $option['constant'] == $decoded['constant']: + case !isset($option['constant']) && $option['type'] == $decoded['type']: + $value = self::asn1map($decoded, $option, $special); + break; + case !isset($option['constant']) && $option['type'] == self::TYPE_CHOICE: + $v = self::asn1map($decoded, $option, $special); + if (isset($v)) { + $value = $v; + } + } + if (isset($value)) { + if (isset($special[$key])) { + $value = $special[$key]($value); + } + return [$key => $value]; + } + } + return null; + case isset($mapping['implicit']): + case isset($mapping['explicit']): + case $decoded['type'] == $mapping['type']: + break; + default: + // if $decoded['type'] and $mapping['type'] are both strings, but different types of strings, + // let it through + switch (\true) { + case $decoded['type'] < 18: + // self::TYPE_NUMERIC_STRING == 18 + case $decoded['type'] > 30: + // self::TYPE_BMP_STRING == 30 + case $mapping['type'] < 18: + case $mapping['type'] > 30: + return null; + } + } + if (isset($mapping['implicit'])) { + $decoded['type'] = $mapping['type']; + } + switch ($decoded['type']) { + case self::TYPE_SEQUENCE: + $map = []; + // ignore the min and max + if (isset($mapping['min']) && isset($mapping['max'])) { + $child = $mapping['children']; + foreach ($decoded['content'] as $content) { + if (($map[] = self::asn1map($content, $child, $special)) === null) { + return null; + } + } + return $map; + } + $n = count($decoded['content']); + $i = 0; + foreach ($mapping['children'] as $key => $child) { + $maymatch = $i < $n; + // Match only existing input. + if ($maymatch) { + $temp = $decoded['content'][$i]; + if ($child['type'] != self::TYPE_CHOICE) { + // Get the mapping and input class & constant. + $childClass = $tempClass = self::CLASS_UNIVERSAL; + $constant = null; + if (isset($temp['constant'])) { + $tempClass = $temp['type']; + } + if (isset($child['class'])) { + $childClass = $child['class']; + $constant = $child['cast']; + } elseif (isset($child['constant'])) { + $childClass = self::CLASS_CONTEXT_SPECIFIC; + $constant = $child['constant']; + } + if (isset($constant) && isset($temp['constant'])) { + // Can only match if constants and class match. + $maymatch = $constant == $temp['constant'] && $childClass == $tempClass; + } else { + // Can only match if no constant expected and type matches or is generic. + $maymatch = !isset($child['constant']) && array_search($child['type'], [$temp['type'], self::TYPE_ANY, self::TYPE_CHOICE]) !== \false; + } + } + } + if ($maymatch) { + // Attempt submapping. + $candidate = self::asn1map($temp, $child, $special); + $maymatch = $candidate !== null; + } + if ($maymatch) { + // Got the match: use it. + if (isset($special[$key])) { + $candidate = $special[$key]($candidate); + } + $map[$key] = $candidate; + $i++; + } elseif (isset($child['default'])) { + $map[$key] = $child['default']; + } elseif (!isset($child['optional'])) { + return null; + // Syntax error. + } + } + // Fail mapping if all input items have not been consumed. + return $i < $n ? null : $map; + // the main diff between sets and sequences is the encapsulation of the foreach in another for loop + case self::TYPE_SET: + $map = []; + // ignore the min and max + if (isset($mapping['min']) && isset($mapping['max'])) { + $child = $mapping['children']; + foreach ($decoded['content'] as $content) { + if (($map[] = self::asn1map($content, $child, $special)) === null) { + return null; + } + } + return $map; + } + for ($i = 0; $i < count($decoded['content']); $i++) { + $temp = $decoded['content'][$i]; + $tempClass = self::CLASS_UNIVERSAL; + if (isset($temp['constant'])) { + $tempClass = $temp['type']; + } + foreach ($mapping['children'] as $key => $child) { + if (isset($map[$key])) { + continue; + } + $maymatch = \true; + if ($child['type'] != self::TYPE_CHOICE) { + $childClass = self::CLASS_UNIVERSAL; + $constant = null; + if (isset($child['class'])) { + $childClass = $child['class']; + $constant = $child['cast']; + } elseif (isset($child['constant'])) { + $childClass = self::CLASS_CONTEXT_SPECIFIC; + $constant = $child['constant']; + } + if (isset($constant) && isset($temp['constant'])) { + // Can only match if constants and class match. + $maymatch = $constant == $temp['constant'] && $childClass == $tempClass; + } else { + // Can only match if no constant expected and type matches or is generic. + $maymatch = !isset($child['constant']) && array_search($child['type'], [$temp['type'], self::TYPE_ANY, self::TYPE_CHOICE]) !== \false; + } + } + if ($maymatch) { + // Attempt submapping. + $candidate = self::asn1map($temp, $child, $special); + $maymatch = $candidate !== null; + } + if (!$maymatch) { + break; + } + // Got the match: use it. + if (isset($special[$key])) { + $candidate = $special[$key]($candidate); + } + $map[$key] = $candidate; + break; + } + } + foreach ($mapping['children'] as $key => $child) { + if (!isset($map[$key])) { + if (isset($child['default'])) { + $map[$key] = $child['default']; + } elseif (!isset($child['optional'])) { + return null; + } + } + } + return $map; + case self::TYPE_OBJECT_IDENTIFIER: + return isset(self::$oids[$decoded['content']]) ? self::$oids[$decoded['content']] : $decoded['content']; + case self::TYPE_UTC_TIME: + case self::TYPE_GENERALIZED_TIME: + // for explicitly tagged optional stuff + if (is_array($decoded['content'])) { + $decoded['content'] = $decoded['content'][0]['content']; + } + // for implicitly tagged optional stuff + // in theory, doing isset($mapping['implicit']) would work but malformed certs do exist + // in the wild that OpenSSL decodes without issue so we'll support them as well + if (!is_object($decoded['content'])) { + $decoded['content'] = self::decodeTime($decoded['content'], $decoded['type']); + } + return $decoded['content'] ? $decoded['content']->format(self::$format) : \false; + case self::TYPE_BIT_STRING: + if (isset($mapping['mapping'])) { + $offset = ord($decoded['content'][0]); + $size = (strlen($decoded['content']) - 1) * 8 - $offset; + /* + From X.680-0207.pdf#page=46 (21.7): + + "When a "NamedBitList" is used in defining a bitstring type ASN.1 encoding rules are free to add (or remove) + arbitrarily any trailing 0 bits to (or from) values that are being encoded or decoded. Application designers should + therefore ensure that different semantics are not associated with such values which differ only in the number of trailing + 0 bits." + */ + $bits = count($mapping['mapping']) == $size ? [] : array_fill(0, count($mapping['mapping']) - $size, \false); + for ($i = strlen($decoded['content']) - 1; $i > 0; $i--) { + $current = ord($decoded['content'][$i]); + for ($j = $offset; $j < 8; $j++) { + $bits[] = (bool) ($current & 1 << $j); + } + $offset = 0; + } + $values = []; + $map = array_reverse($mapping['mapping']); + foreach ($map as $i => $value) { + if ($bits[$i]) { + $values[] = $value; + } + } + return $values; + } + // fall-through + case self::TYPE_OCTET_STRING: + return $decoded['content']; + case self::TYPE_NULL: + return ''; + case self::TYPE_BOOLEAN: + case self::TYPE_NUMERIC_STRING: + case self::TYPE_PRINTABLE_STRING: + case self::TYPE_TELETEX_STRING: + case self::TYPE_VIDEOTEX_STRING: + case self::TYPE_IA5_STRING: + case self::TYPE_GRAPHIC_STRING: + case self::TYPE_VISIBLE_STRING: + case self::TYPE_GENERAL_STRING: + case self::TYPE_UNIVERSAL_STRING: + case self::TYPE_UTF8_STRING: + case self::TYPE_BMP_STRING: + return $decoded['content']; + case self::TYPE_INTEGER: + case self::TYPE_ENUMERATED: + $temp = $decoded['content']; + if (isset($mapping['implicit'])) { + $temp = new BigInteger($decoded['content'], -256); + } + if (isset($mapping['mapping'])) { + $temp = (int) $temp->toString(); + return isset($mapping['mapping'][$temp]) ? $mapping['mapping'][$temp] : \false; + } + return $temp; + } + } + /** + * DER-decode the length + * + * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See + * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information. + * + * @param string $string + * @return int + */ + public static function decodeLength(&$string) + { + $length = ord(Strings::shift($string)); + if ($length & 0x80) { + // definite length, long form + $length &= 0x7f; + $temp = Strings::shift($string, $length); + list(, $length) = unpack('N', substr(str_pad($temp, 4, chr(0), \STR_PAD_LEFT), -4)); + } + return $length; + } + /** + * ASN.1 Encode + * + * DER-encodes an ASN.1 semantic mapping ($mapping). Some libraries would probably call this function + * an ASN.1 compiler. + * + * "Special" mappings can be applied via $special. + * + * @param Element|string|array $source + * @param array $mapping + * @param array $special + * @return string + */ + public static function encodeDER($source, $mapping, $special = []) + { + self::$location = []; + return self::encode_der($source, $mapping, null, $special); + } + /** + * ASN.1 Encode (Helper function) + * + * @param Element|string|array|null $source + * @param array $mapping + * @param int $idx + * @param array $special + * @return string + */ + private static function encode_der($source, array $mapping, $idx = null, array $special = []) + { + if ($source instanceof Element) { + return $source->element; + } + // do not encode (implicitly optional) fields with value set to default + if (isset($mapping['default']) && $source === $mapping['default']) { + return ''; + } + if (isset($idx)) { + if (isset($special[$idx])) { + $source = $special[$idx]($source); + } + self::$location[] = $idx; + } + $tag = $mapping['type']; + switch ($tag) { + case self::TYPE_SET: + // Children order is not important, thus process in sequence. + case self::TYPE_SEQUENCE: + $tag |= 0x20; + // set the constructed bit + // ignore the min and max + if (isset($mapping['min']) && isset($mapping['max'])) { + $value = []; + $child = $mapping['children']; + foreach ($source as $content) { + $temp = self::encode_der($content, $child, null, $special); + if ($temp === \false) { + return \false; + } + $value[] = $temp; + } + /* "The encodings of the component values of a set-of value shall appear in ascending order, the encodings being compared + as octet strings with the shorter components being padded at their trailing end with 0-octets. + NOTE - The padding octets are for comparison purposes only and do not appear in the encodings." + + -- sec 11.6 of http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */ + if ($mapping['type'] == self::TYPE_SET) { + sort($value); + } + $value = implode('', $value); + break; + } + $value = ''; + foreach ($mapping['children'] as $key => $child) { + if (!array_key_exists($key, $source)) { + if (!isset($child['optional'])) { + return \false; + } + continue; + } + $temp = self::encode_der($source[$key], $child, $key, $special); + if ($temp === \false) { + return \false; + } + // An empty child encoding means it has been optimized out. + // Else we should have at least one tag byte. + if ($temp === '') { + continue; + } + // if isset($child['constant']) is true then isset($child['optional']) should be true as well + if (isset($child['constant'])) { + /* + From X.680-0207.pdf#page=58 (30.6): + + "The tagging construction specifies explicit tagging if any of the following holds: + ... + c) the "Tag Type" alternative is used and the value of "TagDefault" for the module is IMPLICIT TAGS or + AUTOMATIC TAGS, but the type defined by "Type" is an untagged choice type, an untagged open type, or + an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3)." + */ + if (isset($child['explicit']) || $child['type'] == self::TYPE_CHOICE) { + $subtag = chr(self::CLASS_CONTEXT_SPECIFIC << 6 | 0x20 | $child['constant']); + $temp = $subtag . self::encodeLength(strlen($temp)) . $temp; + } else { + $subtag = chr(self::CLASS_CONTEXT_SPECIFIC << 6 | ord($temp[0]) & 0x20 | $child['constant']); + $temp = $subtag . substr($temp, 1); + } + } + $value .= $temp; + } + break; + case self::TYPE_CHOICE: + $temp = \false; + foreach ($mapping['children'] as $key => $child) { + if (!isset($source[$key])) { + continue; + } + $temp = self::encode_der($source[$key], $child, $key, $special); + if ($temp === \false) { + return \false; + } + // An empty child encoding means it has been optimized out. + // Else we should have at least one tag byte. + if ($temp === '') { + continue; + } + $tag = ord($temp[0]); + // if isset($child['constant']) is true then isset($child['optional']) should be true as well + if (isset($child['constant'])) { + if (isset($child['explicit']) || $child['type'] == self::TYPE_CHOICE) { + $subtag = chr(self::CLASS_CONTEXT_SPECIFIC << 6 | 0x20 | $child['constant']); + $temp = $subtag . self::encodeLength(strlen($temp)) . $temp; + } else { + $subtag = chr(self::CLASS_CONTEXT_SPECIFIC << 6 | ord($temp[0]) & 0x20 | $child['constant']); + $temp = $subtag . substr($temp, 1); + } + } + } + if (isset($idx)) { + array_pop(self::$location); + } + if ($temp && isset($mapping['cast'])) { + $temp[0] = chr($mapping['class'] << 6 | $tag & 0x20 | $mapping['cast']); + } + return $temp; + case self::TYPE_INTEGER: + case self::TYPE_ENUMERATED: + if (!isset($mapping['mapping'])) { + if (is_numeric($source)) { + $source = new BigInteger($source); + } + $value = $source->toBytes(\true); + } else { + $value = array_search($source, $mapping['mapping']); + if ($value === \false) { + return \false; + } + $value = new BigInteger($value); + $value = $value->toBytes(\true); + } + if (!strlen($value)) { + $value = chr(0); + } + break; + case self::TYPE_UTC_TIME: + case self::TYPE_GENERALIZED_TIME: + $format = $mapping['type'] == self::TYPE_UTC_TIME ? 'y' : 'Y'; + $format .= 'mdHis'; + // if $source does _not_ include timezone information within it then assume that the timezone is GMT + $date = new \DateTime($source, new \DateTimeZone('GMT')); + // if $source _does_ include timezone information within it then convert the time to GMT + $date->setTimezone(new \DateTimeZone('GMT')); + $value = $date->format($format) . 'Z'; + break; + case self::TYPE_BIT_STRING: + if (isset($mapping['mapping'])) { + $bits = array_fill(0, count($mapping['mapping']), 0); + $size = 0; + for ($i = 0; $i < count($mapping['mapping']); $i++) { + if (in_array($mapping['mapping'][$i], $source)) { + $bits[$i] = 1; + $size = $i; + } + } + if (isset($mapping['min']) && $mapping['min'] >= 1 && $size < $mapping['min']) { + $size = $mapping['min'] - 1; + } + $offset = 8 - ($size + 1 & 7); + $offset = $offset !== 8 ? $offset : 0; + $value = chr($offset); + for ($i = $size + 1; $i < count($mapping['mapping']); $i++) { + unset($bits[$i]); + } + $bits = implode('', array_pad($bits, $size + $offset + 1, 0)); + $bytes = explode(' ', rtrim(chunk_split($bits, 8, ' '))); + foreach ($bytes as $byte) { + $value .= chr(bindec($byte)); + } + break; + } + // fall-through + case self::TYPE_OCTET_STRING: + /* The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit, + the number of unused bits in the final subsequent octet. The number shall be in the range zero to seven. + + -- http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=16 */ + $value = $source; + break; + case self::TYPE_OBJECT_IDENTIFIER: + $value = self::encodeOID($source); + break; + case self::TYPE_ANY: + $loc = self::$location; + if (isset($idx)) { + array_pop(self::$location); + } + switch (\true) { + case !isset($source): + return self::encode_der(null, ['type' => self::TYPE_NULL] + $mapping, null, $special); + case is_int($source): + case $source instanceof BigInteger: + return self::encode_der($source, ['type' => self::TYPE_INTEGER] + $mapping, null, $special); + case is_float($source): + return self::encode_der($source, ['type' => self::TYPE_REAL] + $mapping, null, $special); + case is_bool($source): + return self::encode_der($source, ['type' => self::TYPE_BOOLEAN] + $mapping, null, $special); + case is_array($source) && count($source) == 1: + $typename = implode('', array_keys($source)); + $outtype = array_search($typename, self::ANY_MAP, \true); + if ($outtype !== \false) { + return self::encode_der($source[$typename], ['type' => $outtype] + $mapping, null, $special); + } + } + $filters = self::$filters; + foreach ($loc as $part) { + if (!isset($filters[$part])) { + $filters = \false; + break; + } + $filters = $filters[$part]; + } + if ($filters === \false) { + throw new \RuntimeException('No filters defined for ' . implode('/', $loc)); + } + return self::encode_der($source, $filters + $mapping, null, $special); + case self::TYPE_NULL: + $value = ''; + break; + case self::TYPE_NUMERIC_STRING: + case self::TYPE_TELETEX_STRING: + case self::TYPE_PRINTABLE_STRING: + case self::TYPE_UNIVERSAL_STRING: + case self::TYPE_UTF8_STRING: + case self::TYPE_BMP_STRING: + case self::TYPE_IA5_STRING: + case self::TYPE_VISIBLE_STRING: + case self::TYPE_VIDEOTEX_STRING: + case self::TYPE_GRAPHIC_STRING: + case self::TYPE_GENERAL_STRING: + $value = $source; + break; + case self::TYPE_BOOLEAN: + $value = $source ? "\xff" : "\x00"; + break; + default: + throw new \RuntimeException('Mapping provides no type definition for ' . implode('/', self::$location)); + } + if (isset($idx)) { + array_pop(self::$location); + } + if (isset($mapping['cast'])) { + if (isset($mapping['explicit']) || $mapping['type'] == self::TYPE_CHOICE) { + $value = chr($tag) . self::encodeLength(strlen($value)) . $value; + $tag = $mapping['class'] << 6 | 0x20 | $mapping['cast']; + } else { + $tag = $mapping['class'] << 6 | ord($temp[0]) & 0x20 | $mapping['cast']; + } + } + return chr($tag) . self::encodeLength(strlen($value)) . $value; + } + /** + * BER-decode the OID + * + * Called by _decode_ber() + * + * @param string $content + * @return string + */ + public static function decodeOID($content) + { + static $eighty; + if (!$eighty) { + $eighty = new BigInteger(80); + } + $oid = []; + $pos = 0; + $len = strlen($content); + // see https://github.com/openjdk/jdk/blob/2deb318c9f047ec5a4b160d66a4b52f93688ec42/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java#L55 + if ($len > 4096) { + //throw new \RuntimeException("Object identifier size is limited to 4096 bytes ($len bytes present)"); + return \false; + } + if (ord($content[$len - 1]) & 0x80) { + return \false; + } + $n = new BigInteger(); + while ($pos < $len) { + $temp = ord($content[$pos++]); + $n = $n->bitwise_leftShift(7); + $n = $n->bitwise_or(new BigInteger($temp & 0x7f)); + if (~$temp & 0x80) { + $oid[] = $n; + $n = new BigInteger(); + } + } + $part1 = array_shift($oid); + $first = floor(ord($content[0]) / 40); + /* + "This packing of the first two object identifier components recognizes that only three values are allocated from the root + node, and at most 39 subsequent values from nodes reached by X = 0 and X = 1." + + -- https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=22 + */ + if ($first <= 2) { + // ie. 0 <= ord($content[0]) < 120 (0x78) + array_unshift($oid, ord($content[0]) % 40); + array_unshift($oid, $first); + } else { + array_unshift($oid, $part1->subtract($eighty)); + array_unshift($oid, 2); + } + return implode('.', $oid); + } + /** + * DER-encode the OID + * + * Called by _encode_der() + * + * @param string $source + * @return string + */ + public static function encodeOID($source) + { + static $mask, $zero, $forty; + if (!$mask) { + $mask = new BigInteger(0x7f); + $zero = new BigInteger(); + $forty = new BigInteger(40); + } + if (!preg_match('#(?:\\d+\\.)+#', $source)) { + $oid = isset(self::$reverseOIDs[$source]) ? self::$reverseOIDs[$source] : \false; + } else { + $oid = $source; + } + if ($oid === \false) { + throw new \RuntimeException('Invalid OID'); + } + $parts = explode('.', $oid); + $part1 = array_shift($parts); + $part2 = array_shift($parts); + $first = new BigInteger($part1); + $first = $first->multiply($forty); + $first = $first->add(new BigInteger($part2)); + array_unshift($parts, $first->toString()); + $value = ''; + foreach ($parts as $part) { + if (!$part) { + $temp = "\x00"; + } else { + $temp = ''; + $part = new BigInteger($part); + while (!$part->equals($zero)) { + $submask = $part->bitwise_and($mask); + $submask->setPrecision(8); + $temp = (chr(0x80) | $submask->toBytes()) . $temp; + $part = $part->bitwise_rightShift(7); + } + $temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7f); + } + $value .= $temp; + } + return $value; + } + /** + * BER-decode the time + * + * Called by _decode_ber() and in the case of implicit tags asn1map(). + * + * @param string $content + * @param int $tag + * @return \DateTime|false + */ + private static function decodeTime($content, $tag) + { + /* UTCTime: + http://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 + http://www.obj-sys.com/asn1tutorial/node15.html + + GeneralizedTime: + http://tools.ietf.org/html/rfc5280#section-4.1.2.5.2 + http://www.obj-sys.com/asn1tutorial/node14.html */ + $format = 'YmdHis'; + if ($tag == self::TYPE_UTC_TIME) { + // https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=28 says "the seconds + // element shall always be present" but none-the-less I've seen X509 certs where it isn't and if the + // browsers parse it phpseclib ought to too + if (preg_match('#^(\\d{10})(Z|[+-]\\d{4})$#', $content, $matches)) { + $content = $matches[1] . '00' . $matches[2]; + } + $prefix = substr($content, 0, 2) >= 50 ? '19' : '20'; + $content = $prefix . $content; + } elseif (strpos($content, '.') !== \false) { + $format .= '.u'; + } + if ($content[strlen($content) - 1] == 'Z') { + $content = substr($content, 0, -1) . '+0000'; + } + if (strpos($content, '-') !== \false || strpos($content, '+') !== \false) { + $format .= 'O'; + } + // error supression isn't necessary as of PHP 7.0: + // http://php.net/manual/en/migration70.other-changes.php + return @\DateTime::createFromFormat($format, $content); + } + /** + * Set the time format + * + * Sets the time / date format for asn1map(). + * + * @param string $format + */ + public static function setTimeFormat($format) + { + self::$format = $format; + } + /** + * Load OIDs + * + * Load the relevant OIDs for a particular ASN.1 semantic mapping. + * Previously loaded OIDs are retained. + * + * @param array $oids + */ + public static function loadOIDs(array $oids) + { + self::$reverseOIDs += $oids; + self::$oids = array_flip(self::$reverseOIDs); + } + /** + * Set filters + * + * See \phpseclib3\File\X509, etc, for an example. + * Previously loaded filters are not retained. + * + * @param array $filters + */ + public static function setFilters(array $filters) + { + self::$filters = $filters; + } + /** + * String type conversion + * + * This is a lazy conversion, dealing only with character size. + * No real conversion table is used. + * + * @param string $in + * @param int $from + * @param int $to + * @return string + */ + public static function convert($in, $from = self::TYPE_UTF8_STRING, $to = self::TYPE_UTF8_STRING) + { + // isset(self::STRING_TYPE_SIZE[$from] returns a fatal error on PHP 5.6 + if (!array_key_exists($from, self::STRING_TYPE_SIZE) || !array_key_exists($to, self::STRING_TYPE_SIZE)) { + return \false; + } + $insize = self::STRING_TYPE_SIZE[$from]; + $outsize = self::STRING_TYPE_SIZE[$to]; + $inlength = strlen($in); + $out = ''; + for ($i = 0; $i < $inlength;) { + if ($inlength - $i < $insize) { + return \false; + } + // Get an input character as a 32-bit value. + $c = ord($in[$i++]); + switch (\true) { + case $insize == 4: + $c = $c << 8 | ord($in[$i++]); + $c = $c << 8 | ord($in[$i++]); + // fall-through + case $insize == 2: + $c = $c << 8 | ord($in[$i++]); + // fall-through + case $insize == 1: + break; + case ($c & 0x80) == 0x0: + break; + case ($c & 0x40) == 0x0: + return \false; + default: + $bit = 6; + do { + if ($bit > 25 || $i >= $inlength || (ord($in[$i]) & 0xc0) != 0x80) { + return \false; + } + $c = $c << 6 | ord($in[$i++]) & 0x3f; + $bit += 5; + $mask = 1 << $bit; + } while ($c & $bit); + $c &= $mask - 1; + break; + } + // Convert and append the character to output string. + $v = ''; + switch (\true) { + case $outsize == 4: + $v .= chr($c & 0xff); + $c >>= 8; + $v .= chr($c & 0xff); + $c >>= 8; + // fall-through + case $outsize == 2: + $v .= chr($c & 0xff); + $c >>= 8; + // fall-through + case $outsize == 1: + $v .= chr($c & 0xff); + $c >>= 8; + if ($c) { + return \false; + } + break; + case ($c & (\PHP_INT_SIZE == 8 ? 0x80000000 : 1 << 31)) != 0: + return \false; + case $c >= 0x4000000: + $v .= chr(0x80 | $c & 0x3f); + $c = $c >> 6 | 0x4000000; + // fall-through + case $c >= 0x200000: + $v .= chr(0x80 | $c & 0x3f); + $c = $c >> 6 | 0x200000; + // fall-through + case $c >= 0x10000: + $v .= chr(0x80 | $c & 0x3f); + $c = $c >> 6 | 0x10000; + // fall-through + case $c >= 0x800: + $v .= chr(0x80 | $c & 0x3f); + $c = $c >> 6 | 0x800; + // fall-through + case $c >= 0x80: + $v .= chr(0x80 | $c & 0x3f); + $c = $c >> 6 | 0xc0; + // fall-through + default: + $v .= chr($c); + break; + } + $out .= strrev($v); + } + return $out; + } + /** + * Extract raw BER from Base64 encoding + * + * @param string $str + * @return string + */ + public static function extractBER($str) + { + /* X.509 certs are assumed to be base64 encoded but sometimes they'll have additional things in them + * above and beyond the ceritificate. + * ie. some may have the following preceding the -----BEGIN CERTIFICATE----- line: + * + * Bag Attributes + * localKeyID: 01 00 00 00 + * subject=/O=organization/OU=org unit/CN=common name + * issuer=/O=organization/CN=common name + */ + if (strlen($str) > ini_get('pcre.backtrack_limit')) { + $temp = $str; + } else { + $temp = preg_replace('#.*?^-+[^-]+-+[\\r\\n ]*$#ms', '', $str, 1); + $temp = preg_replace('#-+END.*[\\r\\n ]*.*#ms', '', $temp, 1); + } + // remove new lines + $temp = str_replace(["\r", "\n", ' '], '', $temp); + // remove the -----BEGIN CERTIFICATE----- and -----END CERTIFICATE----- stuff + $temp = preg_replace('#^-+[^-]+-+|-+[^-]+-+$#', '', $temp); + $temp = preg_match('#^[a-zA-Z\\d/+]*={0,2}$#', $temp) ? Strings::base64_decode($temp) : \false; + return $temp != \false ? $temp : $str; + } + /** + * DER-encode the length + * + * DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See + * {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information. + * + * @param int $length + * @return string + */ + public static function encodeLength($length) + { + if ($length <= 0x7f) { + return chr($length); + } + $temp = ltrim(pack('N', $length), chr(0)); + return pack('Ca*', 0x80 | strlen($temp), $temp); + } + /** + * Returns the OID corresponding to a name + * + * What's returned in the associative array returned by loadX509() (or load*()) is either a name or an OID if + * no OID to name mapping is available. The problem with this is that what may be an unmapped OID in one version + * of phpseclib may not be unmapped in the next version, so apps that are looking at this OID may not be able + * to work from version to version. + * + * This method will return the OID if a name is passed to it and if no mapping is avialable it'll assume that + * what's being passed to it already is an OID and return that instead. A few examples. + * + * getOID('2.16.840.1.101.3.4.2.1') == '2.16.840.1.101.3.4.2.1' + * getOID('id-sha256') == '2.16.840.1.101.3.4.2.1' + * getOID('zzz') == 'zzz' + * + * @param string $name + * @return string + */ + public static function getOID($name) + { + return isset(self::$reverseOIDs[$name]) ? self::$reverseOIDs[$name] : $name; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php new file mode 100644 index 0000000..a0d83da --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php @@ -0,0 +1,41 @@ + + * @copyright 2012 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; + +/** + * ASN.1 Raw Element + * + * An ASN.1 ANY mapping will return an ASN1\Element object. Use of this object + * will also bypass the normal encoding rules in ASN1::encodeDER() + * + * @author Jim Wigginton + */ +class Element +{ + /** + * Raw element value + * + * @var string + */ + public $element; + /** + * Constructor + * + * @param string $encoded + * @return \phpseclib3\File\ASN1\Element + */ + public function __construct($encoded) + { + $this->element = $encoded; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AccessDescription.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AccessDescription.php new file mode 100644 index 0000000..f4f1b1d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AccessDescription.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AccessDescription + * + * @author Jim Wigginton + */ +abstract class AccessDescription +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['accessMethod' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'accessLocation' => GeneralName::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AdministrationDomainName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AdministrationDomainName.php new file mode 100644 index 0000000..0659e7b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AdministrationDomainName.php @@ -0,0 +1,31 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AdministrationDomainName + * + * @author Jim Wigginton + */ +abstract class AdministrationDomainName +{ + const MAP = [ + 'type' => ASN1::TYPE_CHOICE, + // if class isn't present it's assumed to be \phpseclib3\File\ASN1::CLASS_UNIVERSAL or + // (if constant is present) \phpseclib3\File\ASN1::CLASS_CONTEXT_SPECIFIC + 'class' => ASN1::CLASS_APPLICATION, + 'cast' => 2, + 'children' => ['numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING]], + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php new file mode 100644 index 0000000..68c45f5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AlgorithmIdentifier + * + * @author Jim Wigginton + */ +abstract class AlgorithmIdentifier +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['algorithm' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'parameters' => ['type' => ASN1::TYPE_ANY, 'optional' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AnotherName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AnotherName.php new file mode 100644 index 0000000..271176c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AnotherName.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AnotherName + * + * @author Jim Wigginton + */ +abstract class AnotherName +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['type-id' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'value' => ['type' => ASN1::TYPE_ANY, 'constant' => 0, 'optional' => \true, 'explicit' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attribute.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attribute.php new file mode 100644 index 0000000..8ac6b45 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attribute.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Attribute + * + * @author Jim Wigginton + */ +abstract class Attribute +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['type' => AttributeType::MAP, 'value' => ['type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, 'children' => AttributeValue::MAP]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeType.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeType.php new file mode 100644 index 0000000..c64f7d0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeType.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AttributeType + * + * @author Jim Wigginton + */ +abstract class AttributeType +{ + const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php new file mode 100644 index 0000000..6cfa6b6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AttributeTypeAndValue + * + * @author Jim Wigginton + */ +abstract class AttributeTypeAndValue +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['type' => AttributeType::MAP, 'value' => AttributeValue::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeValue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeValue.php new file mode 100644 index 0000000..e7cd59e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeValue.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AttributeValue + * + * @author Jim Wigginton + */ +abstract class AttributeValue +{ + const MAP = ['type' => ASN1::TYPE_ANY]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attributes.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attributes.php new file mode 100644 index 0000000..9941e9b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attributes.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Attributes + * + * @author Jim Wigginton + */ +abstract class Attributes +{ + const MAP = ['type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, 'children' => Attribute::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php new file mode 100644 index 0000000..64c4005 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AuthorityInfoAccessSyntax + * + * @author Jim Wigginton + */ +abstract class AuthorityInfoAccessSyntax +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => AccessDescription::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php new file mode 100644 index 0000000..d96df26 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * AuthorityKeyIdentifier + * + * @author Jim Wigginton + */ +abstract class AuthorityKeyIdentifier +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['keyIdentifier' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + KeyIdentifier::MAP, 'authorityCertIssuer' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + GeneralNames::MAP, 'authorityCertSerialNumber' => ['constant' => 2, 'optional' => \true, 'implicit' => \true] + CertificateSerialNumber::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BaseDistance.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BaseDistance.php new file mode 100644 index 0000000..2697735 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BaseDistance.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * BaseDistance + * + * @author Jim Wigginton + */ +abstract class BaseDistance +{ + const MAP = ['type' => ASN1::TYPE_INTEGER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BasicConstraints.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BasicConstraints.php new file mode 100644 index 0000000..8177520 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BasicConstraints.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * BasicConstraints + * + * @author Jim Wigginton + */ +abstract class BasicConstraints +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['cA' => ['type' => ASN1::TYPE_BOOLEAN, 'optional' => \true, 'default' => \false], 'pathLenConstraint' => ['type' => ASN1::TYPE_INTEGER, 'optional' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php new file mode 100644 index 0000000..9ef72a9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * BuiltInDomainDefinedAttribute + * + * @author Jim Wigginton + */ +abstract class BuiltInDomainDefinedAttribute +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['type' => ['type' => ASN1::TYPE_PRINTABLE_STRING], 'value' => ['type' => ASN1::TYPE_PRINTABLE_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php new file mode 100644 index 0000000..2cf8913 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php @@ -0,0 +1,30 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * BuiltInDomainDefinedAttributes + * + * @author Jim Wigginton + */ +abstract class BuiltInDomainDefinedAttributes +{ + const MAP = [ + 'type' => ASN1::TYPE_SEQUENCE, + 'min' => 1, + 'max' => 4, + // ub-domain-defined-attributes + 'children' => BuiltInDomainDefinedAttribute::MAP, + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php new file mode 100644 index 0000000..d939c25 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * BuiltInStandardAttributes + * + * @author Jim Wigginton + */ +abstract class BuiltInStandardAttributes +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['country-name' => ['optional' => \true] + CountryName::MAP, 'administration-domain-name' => ['optional' => \true] + AdministrationDomainName::MAP, 'network-address' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + NetworkAddress::MAP, 'terminal-identifier' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + TerminalIdentifier::MAP, 'private-domain-name' => ['constant' => 2, 'optional' => \true, 'explicit' => \true] + PrivateDomainName::MAP, 'organization-name' => ['constant' => 3, 'optional' => \true, 'implicit' => \true] + OrganizationName::MAP, 'numeric-user-identifier' => ['constant' => 4, 'optional' => \true, 'implicit' => \true] + NumericUserIdentifier::MAP, 'personal-name' => ['constant' => 5, 'optional' => \true, 'implicit' => \true] + PersonalName::MAP, 'organizational-unit-names' => ['constant' => 6, 'optional' => \true, 'implicit' => \true] + OrganizationalUnitNames::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CPSuri.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CPSuri.php new file mode 100644 index 0000000..2e77335 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CPSuri.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CPSuri + * + * @author Jim Wigginton + */ +abstract class CPSuri +{ + const MAP = ['type' => ASN1::TYPE_IA5_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php new file mode 100644 index 0000000..665dd76 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CRLDistributionPoints + * + * @author Jim Wigginton + */ +abstract class CRLDistributionPoints +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => DistributionPoint::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLNumber.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLNumber.php new file mode 100644 index 0000000..dfa4c17 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLNumber.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CRLNumber + * + * @author Jim Wigginton + */ +abstract class CRLNumber +{ + const MAP = ['type' => ASN1::TYPE_INTEGER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLReason.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLReason.php new file mode 100644 index 0000000..816fa4a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLReason.php @@ -0,0 +1,36 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CRLReason + * + * @author Jim Wigginton + */ +abstract class CRLReason +{ + const MAP = ['type' => ASN1::TYPE_ENUMERATED, 'mapping' => [ + 'unspecified', + 'keyCompromise', + 'cACompromise', + 'affiliationChanged', + 'superseded', + 'cessationOfOperation', + 'certificateHold', + // Value 7 is not used. + 8 => 'removeFromCRL', + 'privilegeWithdrawn', + 'aACompromise', + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertPolicyId.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertPolicyId.php new file mode 100644 index 0000000..6f675c6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertPolicyId.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CertPolicyId + * + * @author Jim Wigginton + */ +abstract class CertPolicyId +{ + const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Certificate.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Certificate.php new file mode 100644 index 0000000..d56c38e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Certificate.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Certificate + * + * @author Jim Wigginton + */ +abstract class Certificate +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['tbsCertificate' => TBSCertificate::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateIssuer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateIssuer.php new file mode 100644 index 0000000..da443f8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateIssuer.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +/** + * CertificateIssuer + * + * @author Jim Wigginton + */ +abstract class CertificateIssuer +{ + const MAP = GeneralNames::MAP; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateList.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateList.php new file mode 100644 index 0000000..2c5d74a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateList.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CertificateList + * + * @author Jim Wigginton + */ +abstract class CertificateList +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['tbsCertList' => TBSCertList::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificatePolicies.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificatePolicies.php new file mode 100644 index 0000000..80547aa --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificatePolicies.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CertificatePolicies + * + * @author Jim Wigginton + */ +abstract class CertificatePolicies +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => PolicyInformation::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php new file mode 100644 index 0000000..948e772 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CertificateSerialNumber + * + * @author Jim Wigginton + */ +abstract class CertificateSerialNumber +{ + const MAP = ['type' => ASN1::TYPE_INTEGER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequest.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequest.php new file mode 100644 index 0000000..50e0f5f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequest.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CertificationRequest + * + * @author Jim Wigginton + */ +abstract class CertificationRequest +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['certificationRequestInfo' => CertificationRequestInfo::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php new file mode 100644 index 0000000..d0b0cc0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CertificationRequestInfo + * + * @author Jim Wigginton + */ +abstract class CertificationRequestInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1']], 'subject' => Name::MAP, 'subjectPKInfo' => SubjectPublicKeyInfo::MAP, 'attributes' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + Attributes::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Characteristic_two.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Characteristic_two.php new file mode 100644 index 0000000..b285043 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Characteristic_two.php @@ -0,0 +1,29 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Characteristic_two + * + * @author Jim Wigginton + */ +abstract class Characteristic_two +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + 'm' => ['type' => ASN1::TYPE_INTEGER], + // field size 2**m + 'basis' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], + 'parameters' => ['type' => ASN1::TYPE_ANY, 'optional' => \true], + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CountryName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CountryName.php new file mode 100644 index 0000000..cd8e329 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CountryName.php @@ -0,0 +1,31 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * CountryName + * + * @author Jim Wigginton + */ +abstract class CountryName +{ + const MAP = [ + 'type' => ASN1::TYPE_CHOICE, + // if class isn't present it's assumed to be \phpseclib3\File\ASN1::CLASS_UNIVERSAL or + // (if constant is present) \phpseclib3\File\ASN1::CLASS_CONTEXT_SPECIFIC + 'class' => ASN1::CLASS_APPLICATION, + 'cast' => 1, + 'children' => ['x121-dcc-code' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'iso-3166-alpha2-code' => ['type' => ASN1::TYPE_PRINTABLE_STRING]], + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Curve.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Curve.php new file mode 100644 index 0000000..2beae2f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Curve.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Curve + * + * @author Jim Wigginton + */ +abstract class Curve +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['a' => FieldElement::MAP, 'b' => FieldElement::MAP, 'seed' => ['type' => ASN1::TYPE_BIT_STRING, 'optional' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DHParameter.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DHParameter.php new file mode 100644 index 0000000..90433be --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DHParameter.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DHParameter + * + * @author Jim Wigginton + */ +abstract class DHParameter +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['prime' => ['type' => ASN1::TYPE_INTEGER], 'base' => ['type' => ASN1::TYPE_INTEGER], 'privateValueLength' => ['type' => ASN1::TYPE_INTEGER, 'optional' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAParams.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAParams.php new file mode 100644 index 0000000..fcb77a9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAParams.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DSAParams + * + * @author Jim Wigginton + */ +abstract class DSAParams +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['p' => ['type' => ASN1::TYPE_INTEGER], 'q' => ['type' => ASN1::TYPE_INTEGER], 'g' => ['type' => ASN1::TYPE_INTEGER]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPrivateKey.php new file mode 100644 index 0000000..db3d71d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPrivateKey.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DSAPrivateKey + * + * @author Jim Wigginton + */ +abstract class DSAPrivateKey +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER], 'p' => ['type' => ASN1::TYPE_INTEGER], 'q' => ['type' => ASN1::TYPE_INTEGER], 'g' => ['type' => ASN1::TYPE_INTEGER], 'y' => ['type' => ASN1::TYPE_INTEGER], 'x' => ['type' => ASN1::TYPE_INTEGER]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPublicKey.php new file mode 100644 index 0000000..4be9e90 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPublicKey.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DSAPublicKey + * + * @author Jim Wigginton + */ +abstract class DSAPublicKey +{ + const MAP = ['type' => ASN1::TYPE_INTEGER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DigestInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DigestInfo.php new file mode 100644 index 0000000..6948c56 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DigestInfo.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DigestInfo + * + * from https://tools.ietf.org/html/rfc2898#appendix-A.3 + * + * @author Jim Wigginton + */ +abstract class DigestInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['digestAlgorithm' => AlgorithmIdentifier::MAP, 'digest' => ['type' => ASN1::TYPE_OCTET_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DirectoryString.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DirectoryString.php new file mode 100644 index 0000000..40e94ce --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DirectoryString.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DirectoryString + * + * @author Jim Wigginton + */ +abstract class DirectoryString +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['teletexString' => ['type' => ASN1::TYPE_TELETEX_STRING], 'printableString' => ['type' => ASN1::TYPE_PRINTABLE_STRING], 'universalString' => ['type' => ASN1::TYPE_UNIVERSAL_STRING], 'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING], 'bmpString' => ['type' => ASN1::TYPE_BMP_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DisplayText.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DisplayText.php new file mode 100644 index 0000000..f1068d9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DisplayText.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DisplayText + * + * @author Jim Wigginton + */ +abstract class DisplayText +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['ia5String' => ['type' => ASN1::TYPE_IA5_STRING], 'visibleString' => ['type' => ASN1::TYPE_VISIBLE_STRING], 'bmpString' => ['type' => ASN1::TYPE_BMP_STRING], 'utf8String' => ['type' => ASN1::TYPE_UTF8_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPoint.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPoint.php new file mode 100644 index 0000000..afdac2a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPoint.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DistributionPoint + * + * @author Jim Wigginton + */ +abstract class DistributionPoint +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['distributionPoint' => ['constant' => 0, 'optional' => \true, 'explicit' => \true] + DistributionPointName::MAP, 'reasons' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + ReasonFlags::MAP, 'cRLIssuer' => ['constant' => 2, 'optional' => \true, 'implicit' => \true] + GeneralNames::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPointName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPointName.php new file mode 100644 index 0000000..bea4b89 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPointName.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DistributionPointName + * + * @author Jim Wigginton + */ +abstract class DistributionPointName +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['fullName' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + GeneralNames::MAP, 'nameRelativeToCRLIssuer' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + RelativeDistinguishedName::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DssSigValue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DssSigValue.php new file mode 100644 index 0000000..4fe4574 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DssSigValue.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * DssSigValue + * + * @author Jim Wigginton + */ +abstract class DssSigValue +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['r' => ['type' => ASN1::TYPE_INTEGER], 's' => ['type' => ASN1::TYPE_INTEGER]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECParameters.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECParameters.php new file mode 100644 index 0000000..6d28f49 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECParameters.php @@ -0,0 +1,36 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ECParameters + * + * ECParameters ::= CHOICE { + * namedCurve OBJECT IDENTIFIER + * -- implicitCurve NULL + * -- specifiedCurve SpecifiedECDomain + * } + * -- implicitCurve and specifiedCurve MUST NOT be used in PKIX. + * -- Details for SpecifiedECDomain can be found in [X9.62]. + * -- Any future additions to this CHOICE should be coordinated + * -- with ANSI X9. + * + * @author Jim Wigginton + */ +abstract class ECParameters +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['namedCurve' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'implicitCurve' => ['type' => ASN1::TYPE_NULL], 'specifiedCurve' => SpecifiedECDomain::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPoint.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPoint.php new file mode 100644 index 0000000..0cb7d0a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPoint.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ECPoint + * + * @author Jim Wigginton + */ +abstract class ECPoint +{ + const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPrivateKey.php new file mode 100644 index 0000000..f68535a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPrivateKey.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ECPrivateKey + * + * @author Jim Wigginton + */ +abstract class ECPrivateKey +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => [1 => 'ecPrivkeyVer1']], 'privateKey' => ['type' => ASN1::TYPE_OCTET_STRING], 'parameters' => ['constant' => 0, 'optional' => \true, 'explicit' => \true] + ECParameters::MAP, 'publicKey' => ['type' => ASN1::TYPE_BIT_STRING, 'constant' => 1, 'optional' => \true, 'explicit' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EDIPartyName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EDIPartyName.php new file mode 100644 index 0000000..49e88d8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EDIPartyName.php @@ -0,0 +1,29 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * EDIPartyName + * + * @author Jim Wigginton + */ +abstract class EDIPartyName +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + 'nameAssigner' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + DirectoryString::MAP, + // partyName is technically required but \phpseclib3\File\ASN1 doesn't currently support non-optional constants and + // setting it to optional gets the job done in any event. + 'partyName' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + DirectoryString::MAP, + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EcdsaSigValue.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EcdsaSigValue.php new file mode 100644 index 0000000..f86d03c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EcdsaSigValue.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * EcdsaSigValue + * + * @author Jim Wigginton + */ +abstract class EcdsaSigValue +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['r' => ['type' => ASN1::TYPE_INTEGER], 's' => ['type' => ASN1::TYPE_INTEGER]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedData.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedData.php new file mode 100644 index 0000000..59967f7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedData.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * EncryptedData + * + * @author Jim Wigginton + */ +abstract class EncryptedData +{ + const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php new file mode 100644 index 0000000..576e564 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * EncryptedPrivateKeyInfo + * + * @author Jim Wigginton + */ +abstract class EncryptedPrivateKeyInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['encryptionAlgorithm' => AlgorithmIdentifier::MAP, 'encryptedData' => EncryptedData::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php new file mode 100644 index 0000000..deebd43 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ExtKeyUsageSyntax + * + * @author Jim Wigginton + */ +abstract class ExtKeyUsageSyntax +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => KeyPurposeId::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extension.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extension.php new file mode 100644 index 0000000..32e3629 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extension.php @@ -0,0 +1,30 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Extension + * + * A certificate using system MUST reject the certificate if it encounters + * a critical extension it does not recognize; however, a non-critical + * extension may be ignored if it is not recognized. + * + * http://tools.ietf.org/html/rfc5280#section-4.2 + * + * @author Jim Wigginton + */ +abstract class Extension +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['extnId' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'critical' => ['type' => ASN1::TYPE_BOOLEAN, 'optional' => \true, 'default' => \false], 'extnValue' => ['type' => ASN1::TYPE_OCTET_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttribute.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttribute.php new file mode 100644 index 0000000..ef87aa9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttribute.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ExtensionAttribute + * + * @author Jim Wigginton + */ +abstract class ExtensionAttribute +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['extension-attribute-type' => ['type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 0, 'optional' => \true, 'implicit' => \true], 'extension-attribute-value' => ['type' => ASN1::TYPE_ANY, 'constant' => 1, 'optional' => \true, 'explicit' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttributes.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttributes.php new file mode 100644 index 0000000..eb51b74 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttributes.php @@ -0,0 +1,30 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ExtensionAttributes + * + * @author Jim Wigginton + */ +abstract class ExtensionAttributes +{ + const MAP = [ + 'type' => ASN1::TYPE_SET, + 'min' => 1, + 'max' => 256, + // ub-extension-attributes + 'children' => ExtensionAttribute::MAP, + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extensions.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extensions.php new file mode 100644 index 0000000..9d55f37 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extensions.php @@ -0,0 +1,31 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Extensions + * + * @author Jim Wigginton + */ +abstract class Extensions +{ + const MAP = [ + 'type' => ASN1::TYPE_SEQUENCE, + 'min' => 1, + // technically, it's MAX, but we'll assume anything < 0 is MAX + 'max' => -1, + // if 'children' isn't an array then 'min' and 'max' must be defined + 'children' => Extension::MAP, + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldElement.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldElement.php new file mode 100644 index 0000000..6feaa9f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldElement.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * FieldElement + * + * @author Jim Wigginton + */ +abstract class FieldElement +{ + const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldID.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldID.php new file mode 100644 index 0000000..17d601c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldID.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * FieldID + * + * @author Jim Wigginton + */ +abstract class FieldID +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['fieldType' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER], 'parameters' => ['type' => ASN1::TYPE_ANY, 'optional' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralName.php new file mode 100644 index 0000000..8a94205 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralName.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * GeneralName + * + * @author Jim Wigginton + */ +abstract class GeneralName +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['otherName' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + AnotherName::MAP, 'rfc822Name' => ['type' => ASN1::TYPE_IA5_STRING, 'constant' => 1, 'optional' => \true, 'implicit' => \true], 'dNSName' => ['type' => ASN1::TYPE_IA5_STRING, 'constant' => 2, 'optional' => \true, 'implicit' => \true], 'x400Address' => ['constant' => 3, 'optional' => \true, 'implicit' => \true] + ORAddress::MAP, 'directoryName' => ['constant' => 4, 'optional' => \true, 'explicit' => \true] + Name::MAP, 'ediPartyName' => ['constant' => 5, 'optional' => \true, 'implicit' => \true] + EDIPartyName::MAP, 'uniformResourceIdentifier' => ['type' => ASN1::TYPE_IA5_STRING, 'constant' => 6, 'optional' => \true, 'implicit' => \true], 'iPAddress' => ['type' => ASN1::TYPE_OCTET_STRING, 'constant' => 7, 'optional' => \true, 'implicit' => \true], 'registeredID' => ['type' => ASN1::TYPE_OBJECT_IDENTIFIER, 'constant' => 8, 'optional' => \true, 'implicit' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralNames.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralNames.php new file mode 100644 index 0000000..4bd3522 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralNames.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * GeneralNames + * + * @author Jim Wigginton + */ +abstract class GeneralNames +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => GeneralName::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtree.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtree.php new file mode 100644 index 0000000..a0bfe21 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtree.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * GeneralSubtree + * + * @author Jim Wigginton + */ +abstract class GeneralSubtree +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['base' => GeneralName::MAP, 'minimum' => ['constant' => 0, 'optional' => \true, 'implicit' => \true, 'default' => '0'] + BaseDistance::MAP, 'maximum' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + BaseDistance::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtrees.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtrees.php new file mode 100644 index 0000000..bef52e3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtrees.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * GeneralSubtrees + * + * @author Jim Wigginton + */ +abstract class GeneralSubtrees +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => GeneralSubtree::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HashAlgorithm.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HashAlgorithm.php new file mode 100644 index 0000000..2b22b37 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HashAlgorithm.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +/** + * HashAglorithm + * + * @author Jim Wigginton + */ +abstract class HashAlgorithm +{ + const MAP = AlgorithmIdentifier::MAP; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HoldInstructionCode.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HoldInstructionCode.php new file mode 100644 index 0000000..704deb3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HoldInstructionCode.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * HoldInstructionCode + * + * @author Jim Wigginton + */ +abstract class HoldInstructionCode +{ + const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/InvalidityDate.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/InvalidityDate.php new file mode 100644 index 0000000..cf2ce0f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/InvalidityDate.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * InvalidityDate + * + * @author Jim Wigginton + */ +abstract class InvalidityDate +{ + const MAP = ['type' => ASN1::TYPE_GENERALIZED_TIME]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuerAltName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuerAltName.php new file mode 100644 index 0000000..745ebde --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuerAltName.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +/** + * IssuerAltName + * + * @author Jim Wigginton + */ +abstract class IssuerAltName +{ + const MAP = GeneralNames::MAP; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php new file mode 100644 index 0000000..48a676b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * IssuingDistributionPoint + * + * @author Jim Wigginton + */ +abstract class IssuingDistributionPoint +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['distributionPoint' => ['constant' => 0, 'optional' => \true, 'explicit' => \true] + DistributionPointName::MAP, 'onlyContainsUserCerts' => ['type' => ASN1::TYPE_BOOLEAN, 'constant' => 1, 'optional' => \true, 'default' => \false, 'implicit' => \true], 'onlyContainsCACerts' => ['type' => ASN1::TYPE_BOOLEAN, 'constant' => 2, 'optional' => \true, 'default' => \false, 'implicit' => \true], 'onlySomeReasons' => ['constant' => 3, 'optional' => \true, 'implicit' => \true] + ReasonFlags::MAP, 'indirectCRL' => ['type' => ASN1::TYPE_BOOLEAN, 'constant' => 4, 'optional' => \true, 'default' => \false, 'implicit' => \true], 'onlyContainsAttributeCerts' => ['type' => ASN1::TYPE_BOOLEAN, 'constant' => 5, 'optional' => \true, 'default' => \false, 'implicit' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyIdentifier.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyIdentifier.php new file mode 100644 index 0000000..99d560c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyIdentifier.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * KeyIdentifier + * + * @author Jim Wigginton + */ +abstract class KeyIdentifier +{ + const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyPurposeId.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyPurposeId.php new file mode 100644 index 0000000..e39f61c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyPurposeId.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * KeyPurposeId + * + * @author Jim Wigginton + */ +abstract class KeyPurposeId +{ + const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyUsage.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyUsage.php new file mode 100644 index 0000000..39b6ffb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyUsage.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * KeyUsage + * + * @author Jim Wigginton + */ +abstract class KeyUsage +{ + const MAP = ['type' => ASN1::TYPE_BIT_STRING, 'mapping' => ['digitalSignature', 'nonRepudiation', 'keyEncipherment', 'dataEncipherment', 'keyAgreement', 'keyCertSign', 'cRLSign', 'encipherOnly', 'decipherOnly']]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php new file mode 100644 index 0000000..89120e9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +/** + * MaskGenAglorithm + * + * @author Jim Wigginton + */ +abstract class MaskGenAlgorithm +{ + const MAP = AlgorithmIdentifier::MAP; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Name.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Name.php new file mode 100644 index 0000000..d799fab --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Name.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Name + * + * @author Jim Wigginton + */ +abstract class Name +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['rdnSequence' => RDNSequence::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NameConstraints.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NameConstraints.php new file mode 100644 index 0000000..0fa9514 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NameConstraints.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * NameConstraints + * + * @author Jim Wigginton + */ +abstract class NameConstraints +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['permittedSubtrees' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + GeneralSubtrees::MAP, 'excludedSubtrees' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + GeneralSubtrees::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NetworkAddress.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NetworkAddress.php new file mode 100644 index 0000000..2f2522b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NetworkAddress.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * NetworkAddress + * + * @author Jim Wigginton + */ +abstract class NetworkAddress +{ + const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NoticeReference.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NoticeReference.php new file mode 100644 index 0000000..9b6ffe9 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NoticeReference.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * NoticeReference + * + * @author Jim Wigginton + */ +abstract class NoticeReference +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['organization' => DisplayText::MAP, 'noticeNumbers' => ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => 200, 'children' => ['type' => ASN1::TYPE_INTEGER]]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php new file mode 100644 index 0000000..060d4e4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * NumericUserIdentifier + * + * @author Jim Wigginton + */ +abstract class NumericUserIdentifier +{ + const MAP = ['type' => ASN1::TYPE_NUMERIC_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ORAddress.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ORAddress.php new file mode 100644 index 0000000..e05f02b --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ORAddress.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ORAddress + * + * @author Jim Wigginton + */ +abstract class ORAddress +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['built-in-standard-attributes' => BuiltInStandardAttributes::MAP, 'built-in-domain-defined-attributes' => ['optional' => \true] + BuiltInDomainDefinedAttributes::MAP, 'extension-attributes' => ['optional' => \true] + ExtensionAttributes::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php new file mode 100644 index 0000000..00347a3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * OneAsymmetricKey + * + * @author Jim Wigginton + */ +abstract class OneAsymmetricKey +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1', 'v2']], 'privateKeyAlgorithm' => AlgorithmIdentifier::MAP, 'privateKey' => PrivateKey::MAP, 'attributes' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + Attributes::MAP, 'publicKey' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + PublicKey::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationName.php new file mode 100644 index 0000000..353b47e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationName.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * OrganizationName + * + * @author Jim Wigginton + */ +abstract class OrganizationName +{ + const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php new file mode 100644 index 0000000..ce0bd6d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php @@ -0,0 +1,30 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * OrganizationalUnitNames + * + * @author Jim Wigginton + */ +abstract class OrganizationalUnitNames +{ + const MAP = [ + 'type' => ASN1::TYPE_SEQUENCE, + 'min' => 1, + 'max' => 4, + // ub-organizational-units + 'children' => ['type' => ASN1::TYPE_PRINTABLE_STRING], + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php new file mode 100644 index 0000000..87ee8c7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php @@ -0,0 +1,31 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * OtherPrimeInfo + * + * @author Jim Wigginton + */ +abstract class OtherPrimeInfo +{ + // version must be multi if otherPrimeInfos present + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + 'prime' => ['type' => ASN1::TYPE_INTEGER], + // ri + 'exponent' => ['type' => ASN1::TYPE_INTEGER], + // di + 'coefficient' => ['type' => ASN1::TYPE_INTEGER], + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php new file mode 100644 index 0000000..dde938c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php @@ -0,0 +1,25 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * OtherPrimeInfos + * + * @author Jim Wigginton + */ +abstract class OtherPrimeInfos +{ + // version must be multi if otherPrimeInfos present + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => OtherPrimeInfo::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBEParameter.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBEParameter.php new file mode 100644 index 0000000..c2795e0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBEParameter.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PBEParameter + * + * from https://tools.ietf.org/html/rfc2898#appendix-A.3 + * + * @author Jim Wigginton + */ +abstract class PBEParameter +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['salt' => ['type' => ASN1::TYPE_OCTET_STRING], 'iterationCount' => ['type' => ASN1::TYPE_INTEGER]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBES2params.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBES2params.php new file mode 100644 index 0000000..da40856 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBES2params.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PBES2params + * + * from https://tools.ietf.org/html/rfc2898#appendix-A.3 + * + * @author Jim Wigginton + */ +abstract class PBES2params +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['keyDerivationFunc' => AlgorithmIdentifier::MAP, 'encryptionScheme' => AlgorithmIdentifier::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBKDF2params.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBKDF2params.php new file mode 100644 index 0000000..6554e46 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBKDF2params.php @@ -0,0 +1,33 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PBKDF2params + * + * from https://tools.ietf.org/html/rfc2898#appendix-A.3 + * + * @author Jim Wigginton + */ +abstract class PBKDF2params +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + // technically, this is a CHOICE in RFC2898 but the other "choice" is, currently, more of a placeholder + // in the RFC + 'salt' => ['type' => ASN1::TYPE_OCTET_STRING], + 'iterationCount' => ['type' => ASN1::TYPE_INTEGER], + 'keyLength' => ['type' => ASN1::TYPE_INTEGER, 'optional' => \true], + 'prf' => AlgorithmIdentifier::MAP + ['optional' => \true], + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBMAC1params.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBMAC1params.php new file mode 100644 index 0000000..cfc4a35 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBMAC1params.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PBMAC1params + * + * from https://tools.ietf.org/html/rfc2898#appendix-A.3 + * + * @author Jim Wigginton + */ +abstract class PBMAC1params +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['keyDerivationFunc' => AlgorithmIdentifier::MAP, 'messageAuthScheme' => AlgorithmIdentifier::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PKCS9String.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PKCS9String.php new file mode 100644 index 0000000..390d152 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PKCS9String.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PKCS9String + * + * @author Jim Wigginton + */ +abstract class PKCS9String +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['ia5String' => ['type' => ASN1::TYPE_IA5_STRING], 'directoryString' => DirectoryString::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Pentanomial.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Pentanomial.php new file mode 100644 index 0000000..0bd3145 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Pentanomial.php @@ -0,0 +1,30 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Pentanomial + * + * @author Jim Wigginton + */ +abstract class Pentanomial +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + 'k1' => ['type' => ASN1::TYPE_INTEGER], + // k1 > 0 + 'k2' => ['type' => ASN1::TYPE_INTEGER], + // k2 > k1 + 'k3' => ['type' => ASN1::TYPE_INTEGER], + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PersonalName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PersonalName.php new file mode 100644 index 0000000..20cd95f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PersonalName.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PersonalName + * + * @author Jim Wigginton + */ +abstract class PersonalName +{ + const MAP = ['type' => ASN1::TYPE_SET, 'children' => ['surname' => ['type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 0, 'optional' => \true, 'implicit' => \true], 'given-name' => ['type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 1, 'optional' => \true, 'implicit' => \true], 'initials' => ['type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 2, 'optional' => \true, 'implicit' => \true], 'generation-qualifier' => ['type' => ASN1::TYPE_PRINTABLE_STRING, 'constant' => 3, 'optional' => \true, 'implicit' => \true]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyInformation.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyInformation.php new file mode 100644 index 0000000..d16bc37 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyInformation.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PolicyInformation + * + * @author Jim Wigginton + */ +abstract class PolicyInformation +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['policyIdentifier' => CertPolicyId::MAP, 'policyQualifiers' => ['type' => ASN1::TYPE_SEQUENCE, 'min' => 0, 'max' => -1, 'optional' => \true, 'children' => PolicyQualifierInfo::MAP]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyMappings.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyMappings.php new file mode 100644 index 0000000..f9bda94 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyMappings.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PolicyMappings + * + * @author Jim Wigginton + */ +abstract class PolicyMappings +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['issuerDomainPolicy' => CertPolicyId::MAP, 'subjectDomainPolicy' => CertPolicyId::MAP]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierId.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierId.php new file mode 100644 index 0000000..b519b3f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierId.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PolicyQualifierId + * + * @author Jim Wigginton + */ +abstract class PolicyQualifierId +{ + const MAP = ['type' => ASN1::TYPE_OBJECT_IDENTIFIER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php new file mode 100644 index 0000000..4271548 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PolicyQualifierInfo + * + * @author Jim Wigginton + */ +abstract class PolicyQualifierInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['policyQualifierId' => PolicyQualifierId::MAP, 'qualifier' => ['type' => ASN1::TYPE_ANY]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PostalAddress.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PostalAddress.php new file mode 100644 index 0000000..04178e3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PostalAddress.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PostalAddress + * + * @author Jim Wigginton + */ +abstract class PostalAddress +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'optional' => \true, 'min' => 1, 'max' => -1, 'children' => DirectoryString::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Prime_p.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Prime_p.php new file mode 100644 index 0000000..d0a76ab --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Prime_p.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Prime_p + * + * @author Jim Wigginton + */ +abstract class Prime_p +{ + const MAP = ['type' => ASN1::TYPE_INTEGER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateDomainName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateDomainName.php new file mode 100644 index 0000000..c5ed6ab --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateDomainName.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PrivateDomainName + * + * @author Jim Wigginton + */ +abstract class PrivateDomainName +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['numeric' => ['type' => ASN1::TYPE_NUMERIC_STRING], 'printable' => ['type' => ASN1::TYPE_PRINTABLE_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKey.php new file mode 100644 index 0000000..fa17a74 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKey.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PrivateKey + * + * @author Jim Wigginton + */ +abstract class PrivateKey +{ + const MAP = ['type' => ASN1::TYPE_OCTET_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php new file mode 100644 index 0000000..28e9bed --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PrivateKeyInfo + * + * @author Jim Wigginton + */ +abstract class PrivateKeyInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1']], 'privateKeyAlgorithm' => AlgorithmIdentifier::MAP, 'privateKey' => PrivateKey::MAP, 'attributes' => ['constant' => 0, 'optional' => \true, 'implicit' => \true] + Attributes::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php new file mode 100644 index 0000000..04d3b57 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PrivateKeyUsagePeriod + * + * @author Jim Wigginton + */ +abstract class PrivateKeyUsagePeriod +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['notBefore' => ['constant' => 0, 'optional' => \true, 'implicit' => \true, 'type' => ASN1::TYPE_GENERALIZED_TIME], 'notAfter' => ['constant' => 1, 'optional' => \true, 'implicit' => \true, 'type' => ASN1::TYPE_GENERALIZED_TIME]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKey.php new file mode 100644 index 0000000..b858fad --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKey.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PublicKey + * + * @author Jim Wigginton + */ +abstract class PublicKey +{ + const MAP = ['type' => ASN1::TYPE_BIT_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php new file mode 100644 index 0000000..734b8ff --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PublicKeyAndChallenge + * + * @author Jim Wigginton + */ +abstract class PublicKeyAndChallenge +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['spki' => SubjectPublicKeyInfo::MAP, 'challenge' => ['type' => ASN1::TYPE_IA5_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyInfo.php new file mode 100644 index 0000000..6758067 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyInfo.php @@ -0,0 +1,27 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * PublicKeyInfo + * + * this format is not formally defined anywhere but is none-the-less the form you + * get when you do "openssl rsa -in private.pem -outform PEM -pubout" + * + * @author Jim Wigginton + */ +abstract class PublicKeyInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['publicKeyAlgorithm' => AlgorithmIdentifier::MAP, 'publicKey' => ['type' => ASN1::TYPE_BIT_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RC2CBCParameter.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RC2CBCParameter.php new file mode 100644 index 0000000..b22330d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RC2CBCParameter.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RC2CBCParameter + * + * from https://tools.ietf.org/html/rfc2898#appendix-A.3 + * + * @author Jim Wigginton + */ +abstract class RC2CBCParameter +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['rc2ParametersVersion' => ['type' => ASN1::TYPE_INTEGER, 'optional' => \true], 'iv' => ['type' => ASN1::TYPE_OCTET_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RDNSequence.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RDNSequence.php new file mode 100644 index 0000000..3eb0812 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RDNSequence.php @@ -0,0 +1,36 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RDNSequence + * + * In practice, RDNs containing multiple name-value pairs (called "multivalued RDNs") are rare, + * but they can be useful at times when either there is no unique attribute in the entry or you + * want to ensure that the entry's DN contains some useful identifying information. + * + * - https://www.opends.org/wiki/page/DefinitionRelativeDistinguishedName + * + * @author Jim Wigginton + */ +abstract class RDNSequence +{ + const MAP = [ + 'type' => ASN1::TYPE_SEQUENCE, + // RDNSequence does not define a min or a max, which means it doesn't have one + 'min' => 0, + 'max' => -1, + 'children' => RelativeDistinguishedName::MAP, + ]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPrivateKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPrivateKey.php new file mode 100644 index 0000000..5ef30bc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPrivateKey.php @@ -0,0 +1,44 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RSAPrivateKey + * + * @author Jim Wigginton + */ +abstract class RSAPrivateKey +{ + // version must be multi if otherPrimeInfos present + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + 'version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => ['two-prime', 'multi']], + 'modulus' => ['type' => ASN1::TYPE_INTEGER], + // n + 'publicExponent' => ['type' => ASN1::TYPE_INTEGER], + // e + 'privateExponent' => ['type' => ASN1::TYPE_INTEGER], + // d + 'prime1' => ['type' => ASN1::TYPE_INTEGER], + // p + 'prime2' => ['type' => ASN1::TYPE_INTEGER], + // q + 'exponent1' => ['type' => ASN1::TYPE_INTEGER], + // d mod (p-1) + 'exponent2' => ['type' => ASN1::TYPE_INTEGER], + // d mod (q-1) + 'coefficient' => ['type' => ASN1::TYPE_INTEGER], + // (inverse of q) mod p + 'otherPrimeInfos' => OtherPrimeInfos::MAP + ['optional' => \true], + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPublicKey.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPublicKey.php new file mode 100644 index 0000000..4966fc7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPublicKey.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RSAPublicKey + * + * @author Jim Wigginton + */ +abstract class RSAPublicKey +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['modulus' => ['type' => ASN1::TYPE_INTEGER], 'publicExponent' => ['type' => ASN1::TYPE_INTEGER]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php new file mode 100644 index 0000000..30cc737 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RSASSA_PSS_params + * + * @author Jim Wigginton + */ +abstract class RSASSA_PSS_params +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['hashAlgorithm' => ['constant' => 0, 'optional' => \true, 'explicit' => \true] + HashAlgorithm::MAP, 'maskGenAlgorithm' => ['constant' => 1, 'optional' => \true, 'explicit' => \true] + MaskGenAlgorithm::MAP, 'saltLength' => ['type' => ASN1::TYPE_INTEGER, 'constant' => 2, 'optional' => \true, 'explicit' => \true, 'default' => 20], 'trailerField' => ['type' => ASN1::TYPE_INTEGER, 'constant' => 3, 'optional' => \true, 'explicit' => \true, 'default' => 1]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ReasonFlags.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ReasonFlags.php new file mode 100644 index 0000000..e848bd6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ReasonFlags.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * ReasonFlags + * + * @author Jim Wigginton + */ +abstract class ReasonFlags +{ + const MAP = ['type' => ASN1::TYPE_BIT_STRING, 'mapping' => ['unused', 'keyCompromise', 'cACompromise', 'affiliationChanged', 'superseded', 'cessationOfOperation', 'certificateHold', 'privilegeWithdrawn', 'aACompromise']]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php new file mode 100644 index 0000000..7e70c60 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php @@ -0,0 +1,30 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RelativeDistinguishedName + * + * In practice, RDNs containing multiple name-value pairs (called "multivalued RDNs") are rare, + * but they can be useful at times when either there is no unique attribute in the entry or you + * want to ensure that the entry's DN contains some useful identifying information. + * + * - https://www.opends.org/wiki/page/DefinitionRelativeDistinguishedName + * + * @author Jim Wigginton + */ +abstract class RelativeDistinguishedName +{ + const MAP = ['type' => ASN1::TYPE_SET, 'min' => 1, 'max' => -1, 'children' => AttributeTypeAndValue::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RevokedCertificate.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RevokedCertificate.php new file mode 100644 index 0000000..a725110 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RevokedCertificate.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * RevokedCertificate + * + * @author Jim Wigginton + */ +abstract class RevokedCertificate +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['userCertificate' => CertificateSerialNumber::MAP, 'revocationDate' => Time::MAP, 'crlEntryExtensions' => ['optional' => \true] + Extensions::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php new file mode 100644 index 0000000..b731969 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * SignedPublicKeyAndChallenge + * + * @author Jim Wigginton + */ +abstract class SignedPublicKeyAndChallenge +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['publicKeyAndChallenge' => PublicKeyAndChallenge::MAP, 'signatureAlgorithm' => AlgorithmIdentifier::MAP, 'signature' => ['type' => ASN1::TYPE_BIT_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php new file mode 100644 index 0000000..24647c4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * SpecifiedECDomain + * + * @author Jim Wigginton + */ +abstract class SpecifiedECDomain +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => [1 => 'ecdpVer1', 'ecdpVer2', 'ecdpVer3']], 'fieldID' => FieldID::MAP, 'curve' => Curve::MAP, 'base' => ECPoint::MAP, 'order' => ['type' => ASN1::TYPE_INTEGER], 'cofactor' => ['type' => ASN1::TYPE_INTEGER, 'optional' => \true], 'hash' => ['optional' => \true] + HashAlgorithm::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectAltName.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectAltName.php new file mode 100644 index 0000000..78a0f87 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectAltName.php @@ -0,0 +1,23 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +/** + * SubjectAltName + * + * @author Jim Wigginton + */ +abstract class SubjectAltName +{ + const MAP = GeneralNames::MAP; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php new file mode 100644 index 0000000..1a32d40 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * SubjectDirectoryAttributes + * + * @author Jim Wigginton + */ +abstract class SubjectDirectoryAttributes +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => Attribute::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php new file mode 100644 index 0000000..db4d633 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * SubjectInfoAccessSyntax + * + * @author Jim Wigginton + */ +abstract class SubjectInfoAccessSyntax +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'min' => 1, 'max' => -1, 'children' => AccessDescription::MAP]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php new file mode 100644 index 0000000..a9a893a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * SubjectPublicKeyInfo + * + * @author Jim Wigginton + */ +abstract class SubjectPublicKeyInfo +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['algorithm' => AlgorithmIdentifier::MAP, 'subjectPublicKey' => ['type' => ASN1::TYPE_BIT_STRING]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertList.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertList.php new file mode 100644 index 0000000..7653ecb --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertList.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * TBSCertList + * + * @author Jim Wigginton + */ +abstract class TBSCertList +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['version' => ['type' => ASN1::TYPE_INTEGER, 'mapping' => ['v1', 'v2', 'v3'], 'optional' => \true, 'default' => 'v2'], 'signature' => AlgorithmIdentifier::MAP, 'issuer' => Name::MAP, 'thisUpdate' => Time::MAP, 'nextUpdate' => ['optional' => \true] + Time::MAP, 'revokedCertificates' => ['type' => ASN1::TYPE_SEQUENCE, 'optional' => \true, 'min' => 0, 'max' => -1, 'children' => RevokedCertificate::MAP], 'crlExtensions' => ['constant' => 0, 'optional' => \true, 'explicit' => \true] + Extensions::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertificate.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertificate.php new file mode 100644 index 0000000..b833952 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertificate.php @@ -0,0 +1,41 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * TBSCertificate + * + * @author Jim Wigginton + */ +abstract class TBSCertificate +{ + // assert($TBSCertificate['children']['signature'] == $Certificate['children']['signatureAlgorithm']) + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => [ + // technically, default implies optional, but we'll define it as being optional, none-the-less, just to + // reenforce that fact + 'version' => ['type' => ASN1::TYPE_INTEGER, 'constant' => 0, 'optional' => \true, 'explicit' => \true, 'mapping' => ['v1', 'v2', 'v3'], 'default' => 'v1'], + 'serialNumber' => CertificateSerialNumber::MAP, + 'signature' => AlgorithmIdentifier::MAP, + 'issuer' => Name::MAP, + 'validity' => Validity::MAP, + 'subject' => Name::MAP, + 'subjectPublicKeyInfo' => SubjectPublicKeyInfo::MAP, + // implicit means that the T in the TLV structure is to be rewritten, regardless of the type + 'issuerUniqueID' => ['constant' => 1, 'optional' => \true, 'implicit' => \true] + UniqueIdentifier::MAP, + 'subjectUniqueID' => ['constant' => 2, 'optional' => \true, 'implicit' => \true] + UniqueIdentifier::MAP, + // doesn't use the EXPLICIT keyword but if + // it's not IMPLICIT, it's EXPLICIT + 'extensions' => ['constant' => 3, 'optional' => \true, 'explicit' => \true] + Extensions::MAP, + ]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TerminalIdentifier.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TerminalIdentifier.php new file mode 100644 index 0000000..a7268e3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TerminalIdentifier.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * TerminalIdentifier + * + * @author Jim Wigginton + */ +abstract class TerminalIdentifier +{ + const MAP = ['type' => ASN1::TYPE_PRINTABLE_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Time.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Time.php new file mode 100644 index 0000000..7ccc4b1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Time.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Time + * + * @author Jim Wigginton + */ +abstract class Time +{ + const MAP = ['type' => ASN1::TYPE_CHOICE, 'children' => ['utcTime' => ['type' => ASN1::TYPE_UTC_TIME], 'generalTime' => ['type' => ASN1::TYPE_GENERALIZED_TIME]]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Trinomial.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Trinomial.php new file mode 100644 index 0000000..6982404 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Trinomial.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Trinomial + * + * @author Jim Wigginton + */ +abstract class Trinomial +{ + const MAP = ['type' => ASN1::TYPE_INTEGER]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UniqueIdentifier.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UniqueIdentifier.php new file mode 100644 index 0000000..98dd80a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UniqueIdentifier.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * UniqueIdentifier + * + * @author Jim Wigginton + */ +abstract class UniqueIdentifier +{ + const MAP = ['type' => ASN1::TYPE_BIT_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UserNotice.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UserNotice.php new file mode 100644 index 0000000..9c0ebe6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UserNotice.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * UserNotice + * + * @author Jim Wigginton + */ +abstract class UserNotice +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['noticeRef' => ['optional' => \true, 'implicit' => \true] + NoticeReference::MAP, 'explicitText' => ['optional' => \true, 'implicit' => \true] + DisplayText::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Validity.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Validity.php new file mode 100644 index 0000000..d05e184 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Validity.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * Validity + * + * @author Jim Wigginton + */ +abstract class Validity +{ + const MAP = ['type' => ASN1::TYPE_SEQUENCE, 'children' => ['notBefore' => Time::MAP, 'notAfter' => Time::MAP]]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php new file mode 100644 index 0000000..647b14c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * netscape_ca_policy_url + * + * @author Jim Wigginton + */ +abstract class netscape_ca_policy_url +{ + const MAP = ['type' => ASN1::TYPE_IA5_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_cert_type.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_cert_type.php new file mode 100644 index 0000000..b40b6a8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_cert_type.php @@ -0,0 +1,26 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * netscape_cert_type + * + * mapping is from + * + * @author Jim Wigginton + */ +abstract class netscape_cert_type +{ + const MAP = ['type' => ASN1::TYPE_BIT_STRING, 'mapping' => ['SSLClient', 'SSLServer', 'Email', 'ObjectSigning', 'Reserved', 'SSLCA', 'EmailCA', 'ObjectSigningCA']]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_comment.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_comment.php new file mode 100644 index 0000000..804f5dc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_comment.php @@ -0,0 +1,24 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1; +/** + * netscape_comment + * + * @author Jim Wigginton + */ +abstract class netscape_comment +{ + const MAP = ['type' => ASN1::TYPE_IA5_STRING]; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/X509.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/X509.php new file mode 100644 index 0000000..94b3b33 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/File/X509.php @@ -0,0 +1,3505 @@ + + * @copyright 2012 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\PublicKeyLoader; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys\PSS; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Element; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\File\ASN1\Maps; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Pure-PHP X.509 Parser + * + * @author Jim Wigginton + */ +class X509 +{ + /** + * Flag to only accept signatures signed by certificate authorities + * + * Not really used anymore but retained all the same to suppress E_NOTICEs from old installs + * + */ + const VALIDATE_SIGNATURE_BY_CA = 1; + /** + * Return internal array representation + * + * @see \phpseclib3\File\X509::getDN() + */ + const DN_ARRAY = 0; + /** + * Return string + * + * @see \phpseclib3\File\X509::getDN() + */ + const DN_STRING = 1; + /** + * Return ASN.1 name string + * + * @see \phpseclib3\File\X509::getDN() + */ + const DN_ASN1 = 2; + /** + * Return OpenSSL compatible array + * + * @see \phpseclib3\File\X509::getDN() + */ + const DN_OPENSSL = 3; + /** + * Return canonical ASN.1 RDNs string + * + * @see \phpseclib3\File\X509::getDN() + */ + const DN_CANON = 4; + /** + * Return name hash for file indexing + * + * @see \phpseclib3\File\X509::getDN() + */ + const DN_HASH = 5; + /** + * Save as PEM + * + * ie. a base64-encoded PEM with a header and a footer + * + * @see \phpseclib3\File\X509::saveX509() + * @see \phpseclib3\File\X509::saveCSR() + * @see \phpseclib3\File\X509::saveCRL() + */ + const FORMAT_PEM = 0; + /** + * Save as DER + * + * @see \phpseclib3\File\X509::saveX509() + * @see \phpseclib3\File\X509::saveCSR() + * @see \phpseclib3\File\X509::saveCRL() + */ + const FORMAT_DER = 1; + /** + * Save as a SPKAC + * + * @see \phpseclib3\File\X509::saveX509() + * @see \phpseclib3\File\X509::saveCSR() + * @see \phpseclib3\File\X509::saveCRL() + * + * Only works on CSRs. Not currently supported. + */ + const FORMAT_SPKAC = 2; + /** + * Auto-detect the format + * + * Used only by the load*() functions + * + * @see \phpseclib3\File\X509::saveX509() + * @see \phpseclib3\File\X509::saveCSR() + * @see \phpseclib3\File\X509::saveCRL() + */ + const FORMAT_AUTO_DETECT = 3; + /** + * Attribute value disposition. + * If disposition is >= 0, this is the index of the target value. + */ + const ATTR_ALL = -1; + // All attribute values (array). + const ATTR_APPEND = -2; + // Add a value. + const ATTR_REPLACE = -3; + // Clear first, then add a value. + /** + * Distinguished Name + * + * @var array + */ + private $dn; + /** + * Public key + * + * @var string|PublicKey + */ + private $publicKey; + /** + * Private key + * + * @var string|PrivateKey + */ + private $privateKey; + /** + * The certificate authorities + * + * @var array + */ + private $CAs = []; + /** + * The currently loaded certificate + * + * @var array + */ + private $currentCert; + /** + * The signature subject + * + * There's no guarantee \phpseclib3\File\X509 is going to re-encode an X.509 cert in the same way it was originally + * encoded so we take save the portion of the original cert that the signature would have made for. + * + * @var string + */ + private $signatureSubject; + /** + * Certificate Start Date + * + * @var string + */ + private $startDate; + /** + * Certificate End Date + * + * @var string|Element + */ + private $endDate; + /** + * Serial Number + * + * @var string + */ + private $serialNumber; + /** + * Key Identifier + * + * See {@link http://tools.ietf.org/html/rfc5280#section-4.2.1.1 RFC5280#section-4.2.1.1} and + * {@link http://tools.ietf.org/html/rfc5280#section-4.2.1.2 RFC5280#section-4.2.1.2}. + * + * @var string + */ + private $currentKeyIdentifier; + /** + * CA Flag + * + * @var bool + */ + private $caFlag = \false; + /** + * SPKAC Challenge + * + * @var string + */ + private $challenge; + /** + * @var array + */ + private $extensionValues = []; + /** + * OIDs loaded + * + * @var bool + */ + private static $oidsLoaded = \false; + /** + * Recursion Limit + * + * @var int + */ + private static $recur_limit = 5; + /** + * URL fetch flag + * + * @var bool + */ + private static $disable_url_fetch = \false; + /** + * @var array + */ + private static $extensions = []; + /** + * @var ?array + */ + private $ipAddresses = null; + /** + * @var ?array + */ + private $domains = null; + /** + * Default Constructor. + * + * @return \phpseclib3\File\X509 + */ + public function __construct() + { + // Explicitly Tagged Module, 1988 Syntax + // http://tools.ietf.org/html/rfc5280#appendix-A.1 + if (!self::$oidsLoaded) { + // OIDs from RFC5280 and those RFCs mentioned in RFC5280#section-4.1.1.2 + ASN1::loadOIDs([ + //'id-pkix' => '1.3.6.1.5.5.7', + //'id-pe' => '1.3.6.1.5.5.7.1', + //'id-qt' => '1.3.6.1.5.5.7.2', + //'id-kp' => '1.3.6.1.5.5.7.3', + //'id-ad' => '1.3.6.1.5.5.7.48', + 'id-qt-cps' => '1.3.6.1.5.5.7.2.1', + 'id-qt-unotice' => '1.3.6.1.5.5.7.2.2', + 'id-ad-ocsp' => '1.3.6.1.5.5.7.48.1', + 'id-ad-caIssuers' => '1.3.6.1.5.5.7.48.2', + 'id-ad-timeStamping' => '1.3.6.1.5.5.7.48.3', + 'id-ad-caRepository' => '1.3.6.1.5.5.7.48.5', + //'id-at' => '2.5.4', + 'id-at-name' => '2.5.4.41', + 'id-at-surname' => '2.5.4.4', + 'id-at-givenName' => '2.5.4.42', + 'id-at-initials' => '2.5.4.43', + 'id-at-generationQualifier' => '2.5.4.44', + 'id-at-commonName' => '2.5.4.3', + 'id-at-localityName' => '2.5.4.7', + 'id-at-stateOrProvinceName' => '2.5.4.8', + 'id-at-organizationName' => '2.5.4.10', + 'id-at-organizationalUnitName' => '2.5.4.11', + 'id-at-title' => '2.5.4.12', + 'id-at-description' => '2.5.4.13', + 'id-at-dnQualifier' => '2.5.4.46', + 'id-at-countryName' => '2.5.4.6', + 'id-at-serialNumber' => '2.5.4.5', + 'id-at-pseudonym' => '2.5.4.65', + 'id-at-postalCode' => '2.5.4.17', + 'id-at-streetAddress' => '2.5.4.9', + 'id-at-uniqueIdentifier' => '2.5.4.45', + 'id-at-role' => '2.5.4.72', + 'id-at-postalAddress' => '2.5.4.16', + 'jurisdictionOfIncorporationCountryName' => '1.3.6.1.4.1.311.60.2.1.3', + 'jurisdictionOfIncorporationStateOrProvinceName' => '1.3.6.1.4.1.311.60.2.1.2', + 'jurisdictionLocalityName' => '1.3.6.1.4.1.311.60.2.1.1', + 'id-at-businessCategory' => '2.5.4.15', + //'id-domainComponent' => '0.9.2342.19200300.100.1.25', + //'pkcs-9' => '1.2.840.113549.1.9', + 'pkcs-9-at-emailAddress' => '1.2.840.113549.1.9.1', + //'id-ce' => '2.5.29', + 'id-ce-authorityKeyIdentifier' => '2.5.29.35', + 'id-ce-subjectKeyIdentifier' => '2.5.29.14', + 'id-ce-keyUsage' => '2.5.29.15', + 'id-ce-privateKeyUsagePeriod' => '2.5.29.16', + 'id-ce-certificatePolicies' => '2.5.29.32', + //'anyPolicy' => '2.5.29.32.0', + 'id-ce-policyMappings' => '2.5.29.33', + 'id-ce-subjectAltName' => '2.5.29.17', + 'id-ce-issuerAltName' => '2.5.29.18', + 'id-ce-subjectDirectoryAttributes' => '2.5.29.9', + 'id-ce-basicConstraints' => '2.5.29.19', + 'id-ce-nameConstraints' => '2.5.29.30', + 'id-ce-policyConstraints' => '2.5.29.36', + 'id-ce-cRLDistributionPoints' => '2.5.29.31', + 'id-ce-extKeyUsage' => '2.5.29.37', + //'anyExtendedKeyUsage' => '2.5.29.37.0', + 'id-kp-serverAuth' => '1.3.6.1.5.5.7.3.1', + 'id-kp-clientAuth' => '1.3.6.1.5.5.7.3.2', + 'id-kp-codeSigning' => '1.3.6.1.5.5.7.3.3', + 'id-kp-emailProtection' => '1.3.6.1.5.5.7.3.4', + 'id-kp-timeStamping' => '1.3.6.1.5.5.7.3.8', + 'id-kp-OCSPSigning' => '1.3.6.1.5.5.7.3.9', + 'id-ce-inhibitAnyPolicy' => '2.5.29.54', + 'id-ce-freshestCRL' => '2.5.29.46', + 'id-pe-authorityInfoAccess' => '1.3.6.1.5.5.7.1.1', + 'id-pe-subjectInfoAccess' => '1.3.6.1.5.5.7.1.11', + 'id-ce-cRLNumber' => '2.5.29.20', + 'id-ce-issuingDistributionPoint' => '2.5.29.28', + 'id-ce-deltaCRLIndicator' => '2.5.29.27', + 'id-ce-cRLReasons' => '2.5.29.21', + 'id-ce-certificateIssuer' => '2.5.29.29', + 'id-ce-holdInstructionCode' => '2.5.29.23', + //'holdInstruction' => '1.2.840.10040.2', + 'id-holdinstruction-none' => '1.2.840.10040.2.1', + 'id-holdinstruction-callissuer' => '1.2.840.10040.2.2', + 'id-holdinstruction-reject' => '1.2.840.10040.2.3', + 'id-ce-invalidityDate' => '2.5.29.24', + 'rsaEncryption' => '1.2.840.113549.1.1.1', + 'md2WithRSAEncryption' => '1.2.840.113549.1.1.2', + 'md5WithRSAEncryption' => '1.2.840.113549.1.1.4', + 'sha1WithRSAEncryption' => '1.2.840.113549.1.1.5', + 'sha224WithRSAEncryption' => '1.2.840.113549.1.1.14', + 'sha256WithRSAEncryption' => '1.2.840.113549.1.1.11', + 'sha384WithRSAEncryption' => '1.2.840.113549.1.1.12', + 'sha512WithRSAEncryption' => '1.2.840.113549.1.1.13', + 'id-ecPublicKey' => '1.2.840.10045.2.1', + 'ecdsa-with-SHA1' => '1.2.840.10045.4.1', + // from https://tools.ietf.org/html/rfc5758#section-3.2 + 'ecdsa-with-SHA224' => '1.2.840.10045.4.3.1', + 'ecdsa-with-SHA256' => '1.2.840.10045.4.3.2', + 'ecdsa-with-SHA384' => '1.2.840.10045.4.3.3', + 'ecdsa-with-SHA512' => '1.2.840.10045.4.3.4', + 'id-dsa' => '1.2.840.10040.4.1', + 'id-dsa-with-sha1' => '1.2.840.10040.4.3', + // from https://tools.ietf.org/html/rfc5758#section-3.1 + 'id-dsa-with-sha224' => '2.16.840.1.101.3.4.3.1', + 'id-dsa-with-sha256' => '2.16.840.1.101.3.4.3.2', + // from https://tools.ietf.org/html/rfc8410: + 'id-Ed25519' => '1.3.101.112', + 'id-Ed448' => '1.3.101.113', + 'id-RSASSA-PSS' => '1.2.840.113549.1.1.10', + //'id-sha224' => '2.16.840.1.101.3.4.2.4', + //'id-sha256' => '2.16.840.1.101.3.4.2.1', + //'id-sha384' => '2.16.840.1.101.3.4.2.2', + //'id-sha512' => '2.16.840.1.101.3.4.2.3', + //'id-GostR3411-94-with-GostR3410-94' => '1.2.643.2.2.4', + //'id-GostR3411-94-with-GostR3410-2001' => '1.2.643.2.2.3', + //'id-GostR3410-2001' => '1.2.643.2.2.20', + //'id-GostR3410-94' => '1.2.643.2.2.19', + // Netscape Object Identifiers from "Netscape Certificate Extensions" + 'netscape' => '2.16.840.1.113730', + 'netscape-cert-extension' => '2.16.840.1.113730.1', + 'netscape-cert-type' => '2.16.840.1.113730.1.1', + 'netscape-comment' => '2.16.840.1.113730.1.13', + 'netscape-ca-policy-url' => '2.16.840.1.113730.1.8', + // the following are X.509 extensions not supported by phpseclib + 'id-pe-logotype' => '1.3.6.1.5.5.7.1.12', + 'entrustVersInfo' => '1.2.840.113533.7.65.0', + 'verisignPrivate' => '2.16.840.1.113733.1.6.9', + // for Certificate Signing Requests + // see http://tools.ietf.org/html/rfc2985 + 'pkcs-9-at-unstructuredName' => '1.2.840.113549.1.9.2', + // PKCS #9 unstructured name + 'pkcs-9-at-challengePassword' => '1.2.840.113549.1.9.7', + // Challenge password for certificate revocations + 'pkcs-9-at-extensionRequest' => '1.2.840.113549.1.9.14', + ]); + } + } + /** + * Load X.509 certificate + * + * Returns an associative array describing the X.509 cert or a false if the cert failed to load + * + * @param array|string $cert + * @param int $mode + * @return mixed + */ + public function loadX509($cert, $mode = self::FORMAT_AUTO_DETECT) + { + if (is_array($cert) && isset($cert['tbsCertificate'])) { + unset($this->currentCert); + unset($this->currentKeyIdentifier); + $this->dn = $cert['tbsCertificate']['subject']; + if (!isset($this->dn)) { + return \false; + } + $this->currentCert = $cert; + $currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier'); + $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null; + unset($this->signatureSubject); + return $cert; + } + if ($mode != self::FORMAT_DER) { + $newcert = ASN1::extractBER($cert); + if ($mode == self::FORMAT_PEM && $cert == $newcert) { + return \false; + } + $cert = $newcert; + } + if ($cert === \false) { + $this->currentCert = \false; + return \false; + } + $decoded = ASN1::decodeBER($cert); + if ($decoded) { + $x509 = ASN1::asn1map($decoded[0], Maps\Certificate::MAP); + } + if (!isset($x509) || $x509 === \false) { + $this->currentCert = \false; + return \false; + } + $this->signatureSubject = substr($cert, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); + if ($this->isSubArrayValid($x509, 'tbsCertificate/extensions')) { + $this->mapInExtensions($x509, 'tbsCertificate/extensions'); + } + $this->mapInDNs($x509, 'tbsCertificate/issuer/rdnSequence'); + $this->mapInDNs($x509, 'tbsCertificate/subject/rdnSequence'); + $key = $x509['tbsCertificate']['subjectPublicKeyInfo']; + $key = ASN1::encodeDER($key, Maps\SubjectPublicKeyInfo::MAP); + $x509['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'] = "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split(base64_encode($key), 64) . "-----END PUBLIC KEY-----"; + $this->currentCert = $x509; + $this->dn = $x509['tbsCertificate']['subject']; + $currentKeyIdentifier = $this->getExtension('id-ce-subjectKeyIdentifier'); + $this->currentKeyIdentifier = is_string($currentKeyIdentifier) ? $currentKeyIdentifier : null; + return $x509; + } + /** + * Save X.509 certificate + * + * @param array $cert + * @param int $format optional + * @return string + */ + public function saveX509(array $cert, $format = self::FORMAT_PEM) + { + if (!is_array($cert) || !isset($cert['tbsCertificate'])) { + return \false; + } + switch (\true) { + // "case !$a: case !$b: break; default: whatever();" is the same thing as "if ($a && $b) whatever()" + case !($algorithm = $this->subArray($cert, 'tbsCertificate/subjectPublicKeyInfo/algorithm/algorithm')): + case is_object($cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']): + break; + default: + $cert['tbsCertificate']['subjectPublicKeyInfo'] = new Element(base64_decode(preg_replace('#-.+-|[\\r\\n]#', '', $cert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']))); + } + if ($algorithm == 'rsaEncryption') { + $cert['signatureAlgorithm']['parameters'] = null; + $cert['tbsCertificate']['signature']['parameters'] = null; + } + $filters = []; + $type_utf8_string = ['type' => ASN1::TYPE_UTF8_STRING]; + $filters['tbsCertificate']['signature']['parameters'] = $type_utf8_string; + $filters['tbsCertificate']['signature']['issuer']['rdnSequence']['value'] = $type_utf8_string; + $filters['tbsCertificate']['issuer']['rdnSequence']['value'] = $type_utf8_string; + $filters['tbsCertificate']['subject']['rdnSequence']['value'] = $type_utf8_string; + $filters['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['parameters'] = $type_utf8_string; + $filters['signatureAlgorithm']['parameters'] = $type_utf8_string; + $filters['authorityCertIssuer']['directoryName']['rdnSequence']['value'] = $type_utf8_string; + //$filters['policyQualifiers']['qualifier'] = $type_utf8_string; + $filters['distributionPoint']['fullName']['directoryName']['rdnSequence']['value'] = $type_utf8_string; + $filters['directoryName']['rdnSequence']['value'] = $type_utf8_string; + foreach (self::$extensions as $extension) { + $filters['tbsCertificate']['extensions'][] = $extension; + } + /* in the case of policyQualifiers/qualifier, the type has to be \phpseclib3\File\ASN1::TYPE_IA5_STRING. + \phpseclib3\File\ASN1::TYPE_PRINTABLE_STRING will cause OpenSSL's X.509 parser to spit out random + characters. + */ + $filters['policyQualifiers']['qualifier'] = ['type' => ASN1::TYPE_IA5_STRING]; + ASN1::setFilters($filters); + $this->mapOutExtensions($cert, 'tbsCertificate/extensions'); + $this->mapOutDNs($cert, 'tbsCertificate/issuer/rdnSequence'); + $this->mapOutDNs($cert, 'tbsCertificate/subject/rdnSequence'); + $cert = ASN1::encodeDER($cert, Maps\Certificate::MAP); + switch ($format) { + case self::FORMAT_DER: + return $cert; + // case self::FORMAT_PEM: + default: + return "-----BEGIN CERTIFICATE-----\r\n" . chunk_split(Strings::base64_encode($cert), 64) . '-----END CERTIFICATE-----'; + } + } + /** + * Map extension values from octet string to extension-specific internal + * format. + * + * @param array $root (by reference) + * @param string $path + */ + private function mapInExtensions(array &$root, $path) + { + $extensions =& $this->subArrayUnchecked($root, $path); + if ($extensions) { + for ($i = 0; $i < count($extensions); $i++) { + $id = $extensions[$i]['extnId']; + $value =& $extensions[$i]['extnValue']; + /* [extnValue] contains the DER encoding of an ASN.1 value + corresponding to the extension type identified by extnID */ + $map = $this->getMapping($id); + if (!is_bool($map)) { + $decoder = $id == 'id-ce-nameConstraints' ? [static::class, 'decodeNameConstraintIP'] : [static::class, 'decodeIP']; + $decoded = ASN1::decodeBER($value); + if (!$decoded) { + continue; + } + $mapped = ASN1::asn1map($decoded[0], $map, ['iPAddress' => $decoder]); + $value = $mapped === \false ? $decoded[0] : $mapped; + if ($id == 'id-ce-certificatePolicies') { + for ($j = 0; $j < count($value); $j++) { + if (!isset($value[$j]['policyQualifiers'])) { + continue; + } + for ($k = 0; $k < count($value[$j]['policyQualifiers']); $k++) { + $subid = $value[$j]['policyQualifiers'][$k]['policyQualifierId']; + $map = $this->getMapping($subid); + $subvalue =& $value[$j]['policyQualifiers'][$k]['qualifier']; + if ($map !== \false) { + $decoded = ASN1::decodeBER($subvalue); + if (!$decoded) { + continue; + } + $mapped = ASN1::asn1map($decoded[0], $map); + $subvalue = $mapped === \false ? $decoded[0] : $mapped; + } + } + } + } + } + } + } + } + /** + * Map extension values from extension-specific internal format to + * octet string. + * + * @param array $root (by reference) + * @param string $path + */ + private function mapOutExtensions(array &$root, $path) + { + $extensions =& $this->subArray($root, $path, !empty($this->extensionValues)); + foreach ($this->extensionValues as $id => $data) { + extract($data); + $newext = ['extnId' => $id, 'extnValue' => $value, 'critical' => $critical]; + if ($replace) { + foreach ($extensions as $key => $value) { + if ($value['extnId'] == $id) { + $extensions[$key] = $newext; + continue 2; + } + } + } + $extensions[] = $newext; + } + if (is_array($extensions)) { + $size = count($extensions); + for ($i = 0; $i < $size; $i++) { + if ($extensions[$i] instanceof Element) { + continue; + } + $id = $extensions[$i]['extnId']; + $value =& $extensions[$i]['extnValue']; + switch ($id) { + case 'id-ce-certificatePolicies': + for ($j = 0; $j < count($value); $j++) { + if (!isset($value[$j]['policyQualifiers'])) { + continue; + } + for ($k = 0; $k < count($value[$j]['policyQualifiers']); $k++) { + $subid = $value[$j]['policyQualifiers'][$k]['policyQualifierId']; + $map = $this->getMapping($subid); + $subvalue =& $value[$j]['policyQualifiers'][$k]['qualifier']; + if ($map !== \false) { + // by default \phpseclib3\File\ASN1 will try to render qualifier as a \phpseclib3\File\ASN1::TYPE_IA5_STRING since it's + // actual type is \phpseclib3\File\ASN1::TYPE_ANY + $subvalue = new Element(ASN1::encodeDER($subvalue, $map)); + } + } + } + break; + case 'id-ce-authorityKeyIdentifier': + // use 00 as the serial number instead of an empty string + if (isset($value['authorityCertSerialNumber'])) { + if ($value['authorityCertSerialNumber']->toBytes() == '') { + $temp = chr(ASN1::CLASS_CONTEXT_SPECIFIC << 6 | 2) . "\x01\x00"; + $value['authorityCertSerialNumber'] = new Element($temp); + } + } + } + /* [extnValue] contains the DER encoding of an ASN.1 value + corresponding to the extension type identified by extnID */ + $map = $this->getMapping($id); + if (is_bool($map)) { + if (!$map) { + //user_error($id . ' is not a currently supported extension'); + unset($extensions[$i]); + } + } else { + $value = ASN1::encodeDER($value, $map, ['iPAddress' => [static::class, 'encodeIP']]); + } + } + } + } + /** + * Map attribute values from ANY type to attribute-specific internal + * format. + * + * @param array $root (by reference) + * @param string $path + */ + private function mapInAttributes(&$root, $path) + { + $attributes =& $this->subArray($root, $path); + if (is_array($attributes)) { + for ($i = 0; $i < count($attributes); $i++) { + $id = $attributes[$i]['type']; + /* $value contains the DER encoding of an ASN.1 value + corresponding to the attribute type identified by type */ + $map = $this->getMapping($id); + if (is_array($attributes[$i]['value'])) { + $values =& $attributes[$i]['value']; + for ($j = 0; $j < count($values); $j++) { + $value = ASN1::encodeDER($values[$j], Maps\AttributeValue::MAP); + $decoded = ASN1::decodeBER($value); + if (!is_bool($map)) { + if (!$decoded) { + continue; + } + $mapped = ASN1::asn1map($decoded[0], $map); + if ($mapped !== \false) { + $values[$j] = $mapped; + } + if ($id == 'pkcs-9-at-extensionRequest' && $this->isSubArrayValid($values, $j)) { + $this->mapInExtensions($values, $j); + } + } elseif ($map) { + $values[$j] = $value; + } + } + } + } + } + } + /** + * Map attribute values from attribute-specific internal format to + * ANY type. + * + * @param array $root (by reference) + * @param string $path + */ + private function mapOutAttributes(&$root, $path) + { + $attributes =& $this->subArray($root, $path); + if (is_array($attributes)) { + $size = count($attributes); + for ($i = 0; $i < $size; $i++) { + /* [value] contains the DER encoding of an ASN.1 value + corresponding to the attribute type identified by type */ + $id = $attributes[$i]['type']; + $map = $this->getMapping($id); + if ($map === \false) { + //user_error($id . ' is not a currently supported attribute', E_USER_NOTICE); + unset($attributes[$i]); + } elseif (is_array($attributes[$i]['value'])) { + $values =& $attributes[$i]['value']; + for ($j = 0; $j < count($values); $j++) { + switch ($id) { + case 'pkcs-9-at-extensionRequest': + $this->mapOutExtensions($values, $j); + break; + } + if (!is_bool($map)) { + $temp = ASN1::encodeDER($values[$j], $map); + $decoded = ASN1::decodeBER($temp); + if (!$decoded) { + continue; + } + $values[$j] = ASN1::asn1map($decoded[0], Maps\AttributeValue::MAP); + } + } + } + } + } + } + /** + * Map DN values from ANY type to DN-specific internal + * format. + * + * @param array $root (by reference) + * @param string $path + */ + private function mapInDNs(array &$root, $path) + { + $dns =& $this->subArray($root, $path); + if (is_array($dns)) { + for ($i = 0; $i < count($dns); $i++) { + for ($j = 0; $j < count($dns[$i]); $j++) { + $type = $dns[$i][$j]['type']; + $value =& $dns[$i][$j]['value']; + if (is_object($value) && $value instanceof Element) { + $map = $this->getMapping($type); + if (!is_bool($map)) { + $decoded = ASN1::decodeBER($value); + if (!$decoded) { + continue; + } + $value = ASN1::asn1map($decoded[0], $map); + } + } + } + } + } + } + /** + * Map DN values from DN-specific internal format to + * ANY type. + * + * @param array $root (by reference) + * @param string $path + */ + private function mapOutDNs(array &$root, $path) + { + $dns =& $this->subArray($root, $path); + if (is_array($dns)) { + $size = count($dns); + for ($i = 0; $i < $size; $i++) { + for ($j = 0; $j < count($dns[$i]); $j++) { + $type = $dns[$i][$j]['type']; + $value =& $dns[$i][$j]['value']; + if (is_object($value) && $value instanceof Element) { + continue; + } + $map = $this->getMapping($type); + if (!is_bool($map)) { + $value = new Element(ASN1::encodeDER($value, $map)); + } + } + } + } + } + /** + * Associate an extension ID to an extension mapping + * + * @param string $extnId + * @return mixed + */ + private function getMapping($extnId) + { + if (!is_string($extnId)) { + // eg. if it's a \phpseclib3\File\ASN1\Element object + return \true; + } + if (isset(self::$extensions[$extnId])) { + return self::$extensions[$extnId]; + } + switch ($extnId) { + case 'id-ce-keyUsage': + return Maps\KeyUsage::MAP; + case 'id-ce-basicConstraints': + return Maps\BasicConstraints::MAP; + case 'id-ce-subjectKeyIdentifier': + return Maps\KeyIdentifier::MAP; + case 'id-ce-cRLDistributionPoints': + return Maps\CRLDistributionPoints::MAP; + case 'id-ce-authorityKeyIdentifier': + return Maps\AuthorityKeyIdentifier::MAP; + case 'id-ce-certificatePolicies': + return Maps\CertificatePolicies::MAP; + case 'id-ce-extKeyUsage': + return Maps\ExtKeyUsageSyntax::MAP; + case 'id-pe-authorityInfoAccess': + return Maps\AuthorityInfoAccessSyntax::MAP; + case 'id-ce-subjectAltName': + return Maps\SubjectAltName::MAP; + case 'id-ce-subjectDirectoryAttributes': + return Maps\SubjectDirectoryAttributes::MAP; + case 'id-ce-privateKeyUsagePeriod': + return Maps\PrivateKeyUsagePeriod::MAP; + case 'id-ce-issuerAltName': + return Maps\IssuerAltName::MAP; + case 'id-ce-policyMappings': + return Maps\PolicyMappings::MAP; + case 'id-ce-nameConstraints': + return Maps\NameConstraints::MAP; + case 'netscape-cert-type': + return Maps\netscape_cert_type::MAP; + case 'netscape-comment': + return Maps\netscape_comment::MAP; + case 'netscape-ca-policy-url': + return Maps\netscape_ca_policy_url::MAP; + // since id-qt-cps isn't a constructed type it will have already been decoded as a string by the time it gets + // back around to asn1map() and we don't want it decoded again. + //case 'id-qt-cps': + // return Maps\CPSuri::MAP; + case 'id-qt-unotice': + return Maps\UserNotice::MAP; + // the following OIDs are unsupported but we don't want them to give notices when calling saveX509(). + case 'id-pe-logotype': + // http://www.ietf.org/rfc/rfc3709.txt + case 'entrustVersInfo': + // http://support.microsoft.com/kb/287547 + case '1.3.6.1.4.1.311.20.2': + // szOID_ENROLL_CERTTYPE_EXTENSION + case '1.3.6.1.4.1.311.21.1': + // szOID_CERTSRV_CA_VERSION + // "SET Secure Electronic Transaction Specification" + // http://www.maithean.com/docs/set_bk3.pdf + case '2.23.42.7.0': + // id-set-hashedRootKey + // "Certificate Transparency" + // https://tools.ietf.org/html/rfc6962 + case '1.3.6.1.4.1.11129.2.4.2': + // "Qualified Certificate statements" + // https://tools.ietf.org/html/rfc3739#section-3.2.6 + case '1.3.6.1.5.5.7.1.3': + return \true; + // CSR attributes + case 'pkcs-9-at-unstructuredName': + return Maps\PKCS9String::MAP; + case 'pkcs-9-at-challengePassword': + return Maps\DirectoryString::MAP; + case 'pkcs-9-at-extensionRequest': + return Maps\Extensions::MAP; + // CRL extensions. + case 'id-ce-cRLNumber': + return Maps\CRLNumber::MAP; + case 'id-ce-deltaCRLIndicator': + return Maps\CRLNumber::MAP; + case 'id-ce-issuingDistributionPoint': + return Maps\IssuingDistributionPoint::MAP; + case 'id-ce-freshestCRL': + return Maps\CRLDistributionPoints::MAP; + case 'id-ce-cRLReasons': + return Maps\CRLReason::MAP; + case 'id-ce-invalidityDate': + return Maps\InvalidityDate::MAP; + case 'id-ce-certificateIssuer': + return Maps\CertificateIssuer::MAP; + case 'id-ce-holdInstructionCode': + return Maps\HoldInstructionCode::MAP; + case 'id-at-postalAddress': + return Maps\PostalAddress::MAP; + } + return \false; + } + /** + * Load an X.509 certificate as a certificate authority + * + * @param string $cert + * @return bool + */ + public function loadCA($cert) + { + $olddn = $this->dn; + $oldcert = $this->currentCert; + $oldsigsubj = $this->signatureSubject; + $oldkeyid = $this->currentKeyIdentifier; + $cert = $this->loadX509($cert); + if (!$cert) { + $this->dn = $olddn; + $this->currentCert = $oldcert; + $this->signatureSubject = $oldsigsubj; + $this->currentKeyIdentifier = $oldkeyid; + return \false; + } + /* From RFC5280 "PKIX Certificate and CRL Profile": + + If the keyUsage extension is present, then the subject public key + MUST NOT be used to verify signatures on certificates or CRLs unless + the corresponding keyCertSign or cRLSign bit is set. */ + //$keyUsage = $this->getExtension('id-ce-keyUsage'); + //if ($keyUsage && !in_array('keyCertSign', $keyUsage)) { + // return false; + //} + /* From RFC5280 "PKIX Certificate and CRL Profile": + + The cA boolean indicates whether the certified public key may be used + to verify certificate signatures. If the cA boolean is not asserted, + then the keyCertSign bit in the key usage extension MUST NOT be + asserted. If the basic constraints extension is not present in a + version 3 certificate, or the extension is present but the cA boolean + is not asserted, then the certified public key MUST NOT be used to + verify certificate signatures. */ + //$basicConstraints = $this->getExtension('id-ce-basicConstraints'); + //if (!$basicConstraints || !$basicConstraints['cA']) { + // return false; + //} + $this->CAs[] = $cert; + $this->dn = $olddn; + $this->currentCert = $oldcert; + $this->signatureSubject = $oldsigsubj; + return \true; + } + /** + * Validate an X.509 certificate against a URL + * + * From RFC2818 "HTTP over TLS": + * + * Matching is performed using the matching rules specified by + * [RFC2459]. If more than one identity of a given type is present in + * the certificate (e.g., more than one dNSName name, a match in any one + * of the set is considered acceptable.) Names may contain the wildcard + * character * which is considered to match any single domain name + * component or component fragment. E.g., *.a.com matches foo.a.com but + * not bar.foo.a.com. f*.com matches foo.com but not bar.com. + * + * @param string $url + * @return bool + */ + public function validateURL($url) + { + if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { + return \false; + } + $components = parse_url($url); + if (!isset($components['host'])) { + return \false; + } + if ($names = $this->getExtension('id-ce-subjectAltName')) { + foreach ($names as $name) { + foreach ($name as $key => $value) { + $value = preg_quote($value); + $value = str_replace('\\*', '[^.]*', $value); + switch ($key) { + case 'dNSName': + /* From RFC2818 "HTTP over TLS": + + If a subjectAltName extension of type dNSName is present, that MUST + be used as the identity. Otherwise, the (most specific) Common Name + field in the Subject field of the certificate MUST be used. Although + the use of the Common Name is existing practice, it is deprecated and + Certification Authorities are encouraged to use the dNSName instead. */ + if (preg_match('#^' . $value . '$#', $components['host'])) { + return \true; + } + break; + case 'iPAddress': + /* From RFC2818 "HTTP over TLS": + + In some cases, the URI is specified as an IP address rather than a + hostname. In this case, the iPAddress subjectAltName must be present + in the certificate and must exactly match the IP in the URI. */ + if (preg_match('#(?:\\d{1-3}\\.){4}#', $components['host'] . '.') && preg_match('#^' . $value . '$#', $components['host'])) { + return \true; + } + } + } + } + return \false; + } + if ($value = $this->getDNProp('id-at-commonName')) { + $value = str_replace(['.', '*'], ['\\.', '[^.]*'], $value[0]); + return preg_match('#^' . $value . '$#', $components['host']) === 1; + } + return \false; + } + /** + * Validate a date + * + * If $date isn't defined it is assumed to be the current date. + * + * @param \DateTimeInterface|string $date optional + * @return bool + */ + public function validateDate($date = null) + { + if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { + return \false; + } + if (!isset($date)) { + $date = new \DateTimeImmutable('now', new \DateTimeZone(@date_default_timezone_get())); + } + $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore']; + $notBefore = isset($notBefore['generalTime']) ? $notBefore['generalTime'] : $notBefore['utcTime']; + $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter']; + $notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime']; + if (is_string($date)) { + $date = new \DateTimeImmutable($date, new \DateTimeZone(@date_default_timezone_get())); + } + $notBefore = new \DateTimeImmutable($notBefore, new \DateTimeZone(@date_default_timezone_get())); + $notAfter = new \DateTimeImmutable($notAfter, new \DateTimeZone(@date_default_timezone_get())); + return $date >= $notBefore && $date <= $notAfter; + } + /** + * Fetches a URL + * + * @param string $url + * @return bool|string + */ + private static function fetchURL($url) + { + if (self::$disable_url_fetch) { + return \false; + } + $parts = parse_url($url); + $data = ''; + switch ($parts['scheme']) { + case 'http': + $fsock = @fsockopen($parts['host'], isset($parts['port']) ? $parts['port'] : 80); + if (!$fsock) { + return \false; + } + $path = $parts['path']; + if (isset($parts['query'])) { + $path .= '?' . $parts['query']; + } + fputs($fsock, "GET {$path} HTTP/1.0\r\n"); + fputs($fsock, "Host: {$parts['host']}\r\n\r\n"); + $line = fgets($fsock, 1024); + if (strlen($line) < 3) { + return \false; + } + preg_match('#HTTP/1.\\d (\\d{3})#', $line, $temp); + if ($temp[1] != '200') { + return \false; + } + // skip the rest of the headers in the http response + while (!feof($fsock) && fgets($fsock, 1024) != "\r\n") { + } + while (!feof($fsock)) { + $temp = fread($fsock, 1024); + if ($temp === \false) { + return \false; + } + $data .= $temp; + } + break; + } + return $data; + } + /** + * Validates an intermediate cert as identified via authority info access extension + * + * See https://tools.ietf.org/html/rfc4325 for more info + * + * @param bool $caonly + * @param int $count + * @return bool + */ + private function testForIntermediate($caonly, $count) + { + $opts = $this->getExtension('id-pe-authorityInfoAccess'); + if (!is_array($opts)) { + return \false; + } + foreach ($opts as $opt) { + if ($opt['accessMethod'] == 'id-ad-caIssuers') { + // accessLocation is a GeneralName. GeneralName fields support stuff like email addresses, IP addresses, LDAP, + // etc, but we're only supporting URI's. URI's and LDAP are the only thing https://tools.ietf.org/html/rfc4325 + // discusses + if (isset($opt['accessLocation']['uniformResourceIdentifier'])) { + $url = $opt['accessLocation']['uniformResourceIdentifier']; + break; + } + } + } + if (!isset($url)) { + return \false; + } + $cert = static::fetchURL($url); + if (!is_string($cert)) { + return \false; + } + $parent = new static(); + $parent->CAs = $this->CAs; + /* + "Conforming applications that support HTTP or FTP for accessing + certificates MUST be able to accept .cer files and SHOULD be able + to accept .p7c files." -- https://tools.ietf.org/html/rfc4325 + + A .p7c file is 'a "certs-only" CMS message as specified in RFC 2797" + + These are currently unsupported + */ + if (!is_array($parent->loadX509($cert))) { + return \false; + } + if (!$parent->validateSignatureCountable($caonly, ++$count)) { + return \false; + } + $this->CAs[] = $parent->currentCert; + //$this->loadCA($cert); + return \true; + } + /** + * Validate a signature + * + * Works on X.509 certs, CSR's and CRL's. + * Returns true if the signature is verified, false if it is not correct or null on error + * + * By default returns false for self-signed certs. Call validateSignature(false) to make this support + * self-signed. + * + * The behavior of this function is inspired by {@link http://php.net/openssl-verify openssl_verify}. + * + * @param bool $caonly optional + * @return mixed + */ + public function validateSignature($caonly = \true) + { + return $this->validateSignatureCountable($caonly, 0); + } + /** + * Validate a signature + * + * Performs said validation whilst keeping track of how many times validation method is called + * + * @param bool $caonly + * @param int $count + * @return mixed + */ + private function validateSignatureCountable($caonly, $count) + { + if (!is_array($this->currentCert) || !isset($this->signatureSubject)) { + return null; + } + if ($count == self::$recur_limit) { + return \false; + } + /* TODO: + "emailAddress attribute values are not case-sensitive (e.g., "subscriber@example.com" is the same as "SUBSCRIBER@EXAMPLE.COM")." + -- http://tools.ietf.org/html/rfc5280#section-4.1.2.6 + + implement pathLenConstraint in the id-ce-basicConstraints extension */ + switch (\true) { + case isset($this->currentCert['tbsCertificate']): + // self-signed cert + switch (\true) { + case !defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $this->currentCert['tbsCertificate']['subject']: + case defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\FILE_X509_IGNORE_TYPE') && $this->getIssuerDN(self::DN_STRING) === $this->getDN(self::DN_STRING): + $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier'); + $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier'); + switch (\true) { + case !is_array($authorityKey): + case !$subjectKeyID: + case isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: + $signingCert = $this->currentCert; + } + } + if (!empty($this->CAs)) { + for ($i = 0; $i < count($this->CAs); $i++) { + // even if the cert is a self-signed one we still want to see if it's a CA; + // if not, we'll conditionally return an error + $ca = $this->CAs[$i]; + switch (\true) { + case !defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']: + case defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\FILE_X509_IGNORE_TYPE') && $this->getDN(self::DN_STRING, $this->currentCert['tbsCertificate']['issuer']) === $this->getDN(self::DN_STRING, $ca['tbsCertificate']['subject']): + $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier'); + $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); + switch (\true) { + case !is_array($authorityKey): + case !$subjectKeyID: + case isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: + if (is_array($authorityKey) && isset($authorityKey['authorityCertSerialNumber']) && !$authorityKey['authorityCertSerialNumber']->equals($ca['tbsCertificate']['serialNumber'])) { + break 2; + // serial mismatch - check other ca + } + $signingCert = $ca; + // working cert + break 3; + } + } + } + if (count($this->CAs) == $i && $caonly) { + return $this->testForIntermediate($caonly, $count) && $this->validateSignature($caonly); + } + } elseif (!isset($signingCert) || $caonly) { + return $this->testForIntermediate($caonly, $count) && $this->validateSignature($caonly); + } + return $this->validateSignatureHelper($signingCert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['algorithm'], $signingCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject); + case isset($this->currentCert['certificationRequestInfo']): + return $this->validateSignatureHelper($this->currentCert['certificationRequestInfo']['subjectPKInfo']['algorithm']['algorithm'], $this->currentCert['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject); + case isset($this->currentCert['publicKeyAndChallenge']): + return $this->validateSignatureHelper($this->currentCert['publicKeyAndChallenge']['spki']['algorithm']['algorithm'], $this->currentCert['publicKeyAndChallenge']['spki']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject); + case isset($this->currentCert['tbsCertList']): + if (!empty($this->CAs)) { + for ($i = 0; $i < count($this->CAs); $i++) { + $ca = $this->CAs[$i]; + switch (\true) { + case !defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\FILE_X509_IGNORE_TYPE') && $this->currentCert['tbsCertList']['issuer'] === $ca['tbsCertificate']['subject']: + case defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\FILE_X509_IGNORE_TYPE') && $this->getDN(self::DN_STRING, $this->currentCert['tbsCertList']['issuer']) === $this->getDN(self::DN_STRING, $ca['tbsCertificate']['subject']): + $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier'); + $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); + switch (\true) { + case !is_array($authorityKey): + case !$subjectKeyID: + case isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: + if (is_array($authorityKey) && isset($authorityKey['authorityCertSerialNumber']) && !$authorityKey['authorityCertSerialNumber']->equals($ca['tbsCertificate']['serialNumber'])) { + break 2; + // serial mismatch - check other ca + } + $signingCert = $ca; + // working cert + break 3; + } + } + } + } + if (!isset($signingCert)) { + return \false; + } + return $this->validateSignatureHelper($signingCert['tbsCertificate']['subjectPublicKeyInfo']['algorithm']['algorithm'], $signingCert['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'], $this->currentCert['signatureAlgorithm']['algorithm'], substr($this->currentCert['signature'], 1), $this->signatureSubject); + default: + return \false; + } + } + /** + * Validates a signature + * + * Returns true if the signature is verified and false if it is not correct. + * If the algorithms are unsupposed an exception is thrown. + * + * @param string $publicKeyAlgorithm + * @param string $publicKey + * @param string $signatureAlgorithm + * @param string $signature + * @param string $signatureSubject + * @throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported + * @return bool + */ + private function validateSignatureHelper($publicKeyAlgorithm, $publicKey, $signatureAlgorithm, $signature, $signatureSubject) + { + switch ($publicKeyAlgorithm) { + case 'id-RSASSA-PSS': + $key = RSA::loadFormat('PSS', $publicKey); + break; + case 'rsaEncryption': + $key = RSA::loadFormat('PKCS8', $publicKey); + switch ($signatureAlgorithm) { + case 'id-RSASSA-PSS': + break; + case 'md2WithRSAEncryption': + case 'md5WithRSAEncryption': + case 'sha1WithRSAEncryption': + case 'sha224WithRSAEncryption': + case 'sha256WithRSAEncryption': + case 'sha384WithRSAEncryption': + case 'sha512WithRSAEncryption': + $key = $key->withHash(preg_replace('#WithRSAEncryption$#', '', $signatureAlgorithm))->withPadding(RSA::SIGNATURE_PKCS1); + break; + default: + throw new UnsupportedAlgorithmException('Signature algorithm unsupported'); + } + break; + case 'id-Ed25519': + case 'id-Ed448': + $key = EC::loadFormat('PKCS8', $publicKey); + break; + case 'id-ecPublicKey': + $key = EC::loadFormat('PKCS8', $publicKey); + switch ($signatureAlgorithm) { + case 'ecdsa-with-SHA1': + case 'ecdsa-with-SHA224': + case 'ecdsa-with-SHA256': + case 'ecdsa-with-SHA384': + case 'ecdsa-with-SHA512': + $key = $key->withHash(preg_replace('#^ecdsa-with-#', '', strtolower($signatureAlgorithm))); + break; + default: + throw new UnsupportedAlgorithmException('Signature algorithm unsupported'); + } + break; + case 'id-dsa': + $key = DSA::loadFormat('PKCS8', $publicKey); + switch ($signatureAlgorithm) { + case 'id-dsa-with-sha1': + case 'id-dsa-with-sha224': + case 'id-dsa-with-sha256': + $key = $key->withHash(preg_replace('#^id-dsa-with-#', '', strtolower($signatureAlgorithm))); + break; + default: + throw new UnsupportedAlgorithmException('Signature algorithm unsupported'); + } + break; + default: + throw new UnsupportedAlgorithmException('Public key algorithm unsupported'); + } + return $key->verify($signatureSubject, $signature); + } + /** + * Sets the recursion limit + * + * When validating a signature it may be necessary to download intermediate certs from URI's. + * An intermediate cert that linked to itself would result in an infinite loop so to prevent + * that we set a recursion limit. A negative number means that there is no recursion limit. + * + * @param int $count + */ + public static function setRecurLimit($count) + { + self::$recur_limit = $count; + } + /** + * Prevents URIs from being automatically retrieved + * + */ + public static function disableURLFetch() + { + self::$disable_url_fetch = \true; + } + /** + * Allows URIs to be automatically retrieved + * + */ + public static function enableURLFetch() + { + self::$disable_url_fetch = \false; + } + /** + * Decodes an IP address + * + * Takes in a base64 encoded "blob" and returns a human readable IP address + * + * @param string $ip + * @return string + */ + public static function decodeIP($ip) + { + return inet_ntop($ip); + } + /** + * Decodes an IP address in a name constraints extension + * + * Takes in a base64 encoded "blob" and returns a human readable IP address / mask + * + * @param string $ip + * @return array + */ + public static function decodeNameConstraintIP($ip) + { + $size = strlen($ip) >> 1; + $mask = substr($ip, $size); + $ip = substr($ip, 0, $size); + return [inet_ntop($ip), inet_ntop($mask)]; + } + /** + * Encodes an IP address + * + * Takes a human readable IP address into a base64-encoded "blob" + * + * @param string|array $ip + * @return string + */ + public static function encodeIP($ip) + { + return is_string($ip) ? inet_pton($ip) : inet_pton($ip[0]) . inet_pton($ip[1]); + } + /** + * "Normalizes" a Distinguished Name property + * + * @param string $propName + * @return mixed + */ + private function translateDNProp($propName) + { + switch (strtolower($propName)) { + case 'jurisdictionofincorporationcountryname': + case 'jurisdictioncountryname': + case 'jurisdictionc': + return 'jurisdictionOfIncorporationCountryName'; + case 'jurisdictionofincorporationstateorprovincename': + case 'jurisdictionstateorprovincename': + case 'jurisdictionst': + return 'jurisdictionOfIncorporationStateOrProvinceName'; + case 'jurisdictionlocalityname': + case 'jurisdictionl': + return 'jurisdictionLocalityName'; + case 'id-at-businesscategory': + case 'businesscategory': + return 'id-at-businessCategory'; + case 'id-at-countryname': + case 'countryname': + case 'c': + return 'id-at-countryName'; + case 'id-at-organizationname': + case 'organizationname': + case 'o': + return 'id-at-organizationName'; + case 'id-at-dnqualifier': + case 'dnqualifier': + return 'id-at-dnQualifier'; + case 'id-at-commonname': + case 'commonname': + case 'cn': + return 'id-at-commonName'; + case 'id-at-stateorprovincename': + case 'stateorprovincename': + case 'state': + case 'province': + case 'provincename': + case 'st': + return 'id-at-stateOrProvinceName'; + case 'id-at-localityname': + case 'localityname': + case 'l': + return 'id-at-localityName'; + case 'id-emailaddress': + case 'emailaddress': + return 'pkcs-9-at-emailAddress'; + case 'id-at-serialnumber': + case 'serialnumber': + return 'id-at-serialNumber'; + case 'id-at-postalcode': + case 'postalcode': + return 'id-at-postalCode'; + case 'id-at-streetaddress': + case 'streetaddress': + return 'id-at-streetAddress'; + case 'id-at-name': + case 'name': + return 'id-at-name'; + case 'id-at-givenname': + case 'givenname': + return 'id-at-givenName'; + case 'id-at-surname': + case 'surname': + case 'sn': + return 'id-at-surname'; + case 'id-at-initials': + case 'initials': + return 'id-at-initials'; + case 'id-at-generationqualifier': + case 'generationqualifier': + return 'id-at-generationQualifier'; + case 'id-at-organizationalunitname': + case 'organizationalunitname': + case 'ou': + return 'id-at-organizationalUnitName'; + case 'id-at-pseudonym': + case 'pseudonym': + return 'id-at-pseudonym'; + case 'id-at-title': + case 'title': + return 'id-at-title'; + case 'id-at-description': + case 'description': + return 'id-at-description'; + case 'id-at-role': + case 'role': + return 'id-at-role'; + case 'id-at-uniqueidentifier': + case 'uniqueidentifier': + case 'x500uniqueidentifier': + return 'id-at-uniqueIdentifier'; + case 'postaladdress': + case 'id-at-postaladdress': + return 'id-at-postalAddress'; + default: + return \false; + } + } + /** + * Set a Distinguished Name property + * + * @param string $propName + * @param mixed $propValue + * @param string $type optional + * @return bool + */ + public function setDNProp($propName, $propValue, $type = 'utf8String') + { + if (empty($this->dn)) { + $this->dn = ['rdnSequence' => []]; + } + if (($propName = $this->translateDNProp($propName)) === \false) { + return \false; + } + foreach ((array) $propValue as $v) { + if (!is_array($v) && isset($type)) { + $v = [$type => $v]; + } + $this->dn['rdnSequence'][] = [['type' => $propName, 'value' => $v]]; + } + return \true; + } + /** + * Remove Distinguished Name properties + * + * @param string $propName + */ + public function removeDNProp($propName) + { + if (empty($this->dn)) { + return; + } + if (($propName = $this->translateDNProp($propName)) === \false) { + return; + } + $dn =& $this->dn['rdnSequence']; + $size = count($dn); + for ($i = 0; $i < $size; $i++) { + if ($dn[$i][0]['type'] == $propName) { + unset($dn[$i]); + } + } + $dn = array_values($dn); + // fix for https://bugs.php.net/75433 affecting PHP 7.2 + if (!isset($dn[0])) { + $dn = array_splice($dn, 0, 0); + } + } + /** + * Get Distinguished Name properties + * + * @param string $propName + * @param array $dn optional + * @param bool $withType optional + * @return mixed + */ + public function getDNProp($propName, array $dn = null, $withType = \false) + { + if (!isset($dn)) { + $dn = $this->dn; + } + if (empty($dn)) { + return \false; + } + if (($propName = $this->translateDNProp($propName)) === \false) { + return \false; + } + $filters = []; + $filters['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; + ASN1::setFilters($filters); + $this->mapOutDNs($dn, 'rdnSequence'); + $dn = $dn['rdnSequence']; + $result = []; + for ($i = 0; $i < count($dn); $i++) { + if ($dn[$i][0]['type'] == $propName) { + $v = $dn[$i][0]['value']; + if (!$withType) { + if (is_array($v)) { + foreach ($v as $type => $s) { + $type = array_search($type, ASN1::ANY_MAP); + if ($type !== \false && array_key_exists($type, ASN1::STRING_TYPE_SIZE)) { + $s = ASN1::convert($s, $type); + if ($s !== \false) { + $v = $s; + break; + } + } + } + if (is_array($v)) { + $v = array_pop($v); + // Always strip data type. + } + } elseif (is_object($v) && $v instanceof Element) { + $map = $this->getMapping($propName); + if (!is_bool($map)) { + $decoded = ASN1::decodeBER($v); + if (!$decoded) { + return \false; + } + $v = ASN1::asn1map($decoded[0], $map); + } + } + } + $result[] = $v; + } + } + return $result; + } + /** + * Set a Distinguished Name + * + * @param mixed $dn + * @param bool $merge optional + * @param string $type optional + * @return bool + */ + public function setDN($dn, $merge = \false, $type = 'utf8String') + { + if (!$merge) { + $this->dn = null; + } + if (is_array($dn)) { + if (isset($dn['rdnSequence'])) { + $this->dn = $dn; + // No merge here. + return \true; + } + // handles stuff generated by openssl_x509_parse() + foreach ($dn as $prop => $value) { + if (!$this->setDNProp($prop, $value, $type)) { + return \false; + } + } + return \true; + } + // handles everything else + $results = preg_split('#((?:^|, *|/)(?:C=|O=|OU=|CN=|L=|ST=|SN=|postalCode=|streetAddress=|emailAddress=|serialNumber=|organizationalUnitName=|title=|description=|role=|x500UniqueIdentifier=|postalAddress=))#', $dn, -1, \PREG_SPLIT_DELIM_CAPTURE); + for ($i = 1; $i < count($results); $i += 2) { + $prop = trim($results[$i], ', =/'); + $value = $results[$i + 1]; + if (!$this->setDNProp($prop, $value, $type)) { + return \false; + } + } + return \true; + } + /** + * Get the Distinguished Name for a certificates subject + * + * @param mixed $format optional + * @param array $dn optional + * @return array|bool|string + */ + public function getDN($format = self::DN_ARRAY, array $dn = null) + { + if (!isset($dn)) { + $dn = isset($this->currentCert['tbsCertList']) ? $this->currentCert['tbsCertList']['issuer'] : $this->dn; + } + switch ((int) $format) { + case self::DN_ARRAY: + return $dn; + case self::DN_ASN1: + $filters = []; + $filters['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; + ASN1::setFilters($filters); + $this->mapOutDNs($dn, 'rdnSequence'); + return ASN1::encodeDER($dn, Maps\Name::MAP); + case self::DN_CANON: + // No SEQUENCE around RDNs and all string values normalized as + // trimmed lowercase UTF-8 with all spacing as one blank. + // constructed RDNs will not be canonicalized + $filters = []; + $filters['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; + ASN1::setFilters($filters); + $result = ''; + $this->mapOutDNs($dn, 'rdnSequence'); + foreach ($dn['rdnSequence'] as $rdn) { + foreach ($rdn as $i => $attr) { + $attr =& $rdn[$i]; + if (is_array($attr['value'])) { + foreach ($attr['value'] as $type => $v) { + $type = array_search($type, ASN1::ANY_MAP, \true); + if ($type !== \false && array_key_exists($type, ASN1::STRING_TYPE_SIZE)) { + $v = ASN1::convert($v, $type); + if ($v !== \false) { + $v = preg_replace('/\\s+/', ' ', $v); + $attr['value'] = strtolower(trim($v)); + break; + } + } + } + } + } + $result .= ASN1::encodeDER($rdn, Maps\RelativeDistinguishedName::MAP); + } + return $result; + case self::DN_HASH: + $dn = $this->getDN(self::DN_CANON, $dn); + $hash = new Hash('sha1'); + $hash = $hash->hash($dn); + extract(unpack('Vhash', $hash)); + return strtolower(Strings::bin2hex(pack('N', $hash))); + } + // Default is to return a string. + $start = \true; + $output = ''; + $result = []; + $filters = []; + $filters['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; + ASN1::setFilters($filters); + $this->mapOutDNs($dn, 'rdnSequence'); + foreach ($dn['rdnSequence'] as $field) { + $prop = $field[0]['type']; + $value = $field[0]['value']; + $delim = ', '; + switch ($prop) { + case 'id-at-countryName': + $desc = 'C'; + break; + case 'id-at-stateOrProvinceName': + $desc = 'ST'; + break; + case 'id-at-organizationName': + $desc = 'O'; + break; + case 'id-at-organizationalUnitName': + $desc = 'OU'; + break; + case 'id-at-commonName': + $desc = 'CN'; + break; + case 'id-at-localityName': + $desc = 'L'; + break; + case 'id-at-surname': + $desc = 'SN'; + break; + case 'id-at-uniqueIdentifier': + $delim = '/'; + $desc = 'x500UniqueIdentifier'; + break; + case 'id-at-postalAddress': + $delim = '/'; + $desc = 'postalAddress'; + break; + default: + $delim = '/'; + $desc = preg_replace('#.+-([^-]+)$#', '$1', $prop); + } + if (!$start) { + $output .= $delim; + } + if (is_array($value)) { + foreach ($value as $type => $v) { + $type = array_search($type, ASN1::ANY_MAP, \true); + if ($type !== \false && array_key_exists($type, ASN1::STRING_TYPE_SIZE)) { + $v = ASN1::convert($v, $type); + if ($v !== \false) { + $value = $v; + break; + } + } + } + if (is_array($value)) { + $value = array_pop($value); + // Always strip data type. + } + } elseif (is_object($value) && $value instanceof Element) { + $callback = function ($x) { + return '\\x' . bin2hex($x[0]); + }; + $value = strtoupper(preg_replace_callback('#[^\\x20-\\x7E]#', $callback, $value->element)); + } + $output .= $desc . '=' . $value; + $result[$desc] = isset($result[$desc]) ? array_merge((array) $result[$desc], [$value]) : $value; + $start = \false; + } + return $format == self::DN_OPENSSL ? $result : $output; + } + /** + * Get the Distinguished Name for a certificate/crl issuer + * + * @param int $format optional + * @return mixed + */ + public function getIssuerDN($format = self::DN_ARRAY) + { + switch (\true) { + case !isset($this->currentCert) || !is_array($this->currentCert): + break; + case isset($this->currentCert['tbsCertificate']): + return $this->getDN($format, $this->currentCert['tbsCertificate']['issuer']); + case isset($this->currentCert['tbsCertList']): + return $this->getDN($format, $this->currentCert['tbsCertList']['issuer']); + } + return \false; + } + /** + * Get the Distinguished Name for a certificate/csr subject + * Alias of getDN() + * + * @param int $format optional + * @return mixed + */ + public function getSubjectDN($format = self::DN_ARRAY) + { + switch (\true) { + case !empty($this->dn): + return $this->getDN($format); + case !isset($this->currentCert) || !is_array($this->currentCert): + break; + case isset($this->currentCert['tbsCertificate']): + return $this->getDN($format, $this->currentCert['tbsCertificate']['subject']); + case isset($this->currentCert['certificationRequestInfo']): + return $this->getDN($format, $this->currentCert['certificationRequestInfo']['subject']); + } + return \false; + } + /** + * Get an individual Distinguished Name property for a certificate/crl issuer + * + * @param string $propName + * @param bool $withType optional + * @return mixed + */ + public function getIssuerDNProp($propName, $withType = \false) + { + switch (\true) { + case !isset($this->currentCert) || !is_array($this->currentCert): + break; + case isset($this->currentCert['tbsCertificate']): + return $this->getDNProp($propName, $this->currentCert['tbsCertificate']['issuer'], $withType); + case isset($this->currentCert['tbsCertList']): + return $this->getDNProp($propName, $this->currentCert['tbsCertList']['issuer'], $withType); + } + return \false; + } + /** + * Get an individual Distinguished Name property for a certificate/csr subject + * + * @param string $propName + * @param bool $withType optional + * @return mixed + */ + public function getSubjectDNProp($propName, $withType = \false) + { + switch (\true) { + case !empty($this->dn): + return $this->getDNProp($propName, null, $withType); + case !isset($this->currentCert) || !is_array($this->currentCert): + break; + case isset($this->currentCert['tbsCertificate']): + return $this->getDNProp($propName, $this->currentCert['tbsCertificate']['subject'], $withType); + case isset($this->currentCert['certificationRequestInfo']): + return $this->getDNProp($propName, $this->currentCert['certificationRequestInfo']['subject'], $withType); + } + return \false; + } + /** + * Get the certificate chain for the current cert + * + * @return mixed + */ + public function getChain() + { + $chain = [$this->currentCert]; + if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) { + return \false; + } + while (\true) { + $currentCert = $chain[count($chain) - 1]; + for ($i = 0; $i < count($this->CAs); $i++) { + $ca = $this->CAs[$i]; + if ($currentCert['tbsCertificate']['issuer'] === $ca['tbsCertificate']['subject']) { + $authorityKey = $this->getExtension('id-ce-authorityKeyIdentifier', $currentCert); + $subjectKeyID = $this->getExtension('id-ce-subjectKeyIdentifier', $ca); + switch (\true) { + case !is_array($authorityKey): + case is_array($authorityKey) && isset($authorityKey['keyIdentifier']) && $authorityKey['keyIdentifier'] === $subjectKeyID: + if ($currentCert === $ca) { + break 3; + } + $chain[] = $ca; + break 2; + } + } + } + if ($i == count($this->CAs)) { + break; + } + } + foreach ($chain as $key => $value) { + $chain[$key] = new X509(); + $chain[$key]->loadX509($value); + } + return $chain; + } + /** + * Returns the current cert + * + * @return array|bool + */ + public function &getCurrentCert() + { + return $this->currentCert; + } + /** + * Set public key + * + * Key needs to be a \phpseclib3\Crypt\RSA object + * + * @param PublicKey $key + * @return void + */ + public function setPublicKey(PublicKey $key) + { + $this->publicKey = $key; + } + /** + * Set private key + * + * Key needs to be a \phpseclib3\Crypt\RSA object + * + * @param PrivateKey $key + */ + public function setPrivateKey(PrivateKey $key) + { + $this->privateKey = $key; + } + /** + * Set challenge + * + * Used for SPKAC CSR's + * + * @param string $challenge + */ + public function setChallenge($challenge) + { + $this->challenge = $challenge; + } + /** + * Gets the public key + * + * Returns a \phpseclib3\Crypt\RSA object or a false. + * + * @return mixed + */ + public function getPublicKey() + { + if (isset($this->publicKey)) { + return $this->publicKey; + } + if (isset($this->currentCert) && is_array($this->currentCert)) { + $paths = ['tbsCertificate/subjectPublicKeyInfo', 'certificationRequestInfo/subjectPKInfo', 'publicKeyAndChallenge/spki']; + foreach ($paths as $path) { + $keyinfo = $this->subArray($this->currentCert, $path); + if (!empty($keyinfo)) { + break; + } + } + } + if (empty($keyinfo)) { + return \false; + } + $key = $keyinfo['subjectPublicKey']; + switch ($keyinfo['algorithm']['algorithm']) { + case 'id-RSASSA-PSS': + return RSA::loadFormat('PSS', $key); + case 'rsaEncryption': + return RSA::loadFormat('PKCS8', $key)->withPadding(RSA::SIGNATURE_PKCS1); + case 'id-ecPublicKey': + case 'id-Ed25519': + case 'id-Ed448': + return EC::loadFormat('PKCS8', $key); + case 'id-dsa': + return DSA::loadFormat('PKCS8', $key); + } + return \false; + } + /** + * Load a Certificate Signing Request + * + * @param string $csr + * @param int $mode + * @return mixed + */ + public function loadCSR($csr, $mode = self::FORMAT_AUTO_DETECT) + { + if (is_array($csr) && isset($csr['certificationRequestInfo'])) { + unset($this->currentCert); + unset($this->currentKeyIdentifier); + unset($this->signatureSubject); + $this->dn = $csr['certificationRequestInfo']['subject']; + if (!isset($this->dn)) { + return \false; + } + $this->currentCert = $csr; + return $csr; + } + // see http://tools.ietf.org/html/rfc2986 + if ($mode != self::FORMAT_DER) { + $newcsr = ASN1::extractBER($csr); + if ($mode == self::FORMAT_PEM && $csr == $newcsr) { + return \false; + } + $csr = $newcsr; + } + $orig = $csr; + if ($csr === \false) { + $this->currentCert = \false; + return \false; + } + $decoded = ASN1::decodeBER($csr); + if (!$decoded) { + $this->currentCert = \false; + return \false; + } + $csr = ASN1::asn1map($decoded[0], Maps\CertificationRequest::MAP); + if (!isset($csr) || $csr === \false) { + $this->currentCert = \false; + return \false; + } + $this->mapInAttributes($csr, 'certificationRequestInfo/attributes'); + $this->mapInDNs($csr, 'certificationRequestInfo/subject/rdnSequence'); + $this->dn = $csr['certificationRequestInfo']['subject']; + $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); + $key = $csr['certificationRequestInfo']['subjectPKInfo']; + $key = ASN1::encodeDER($key, Maps\SubjectPublicKeyInfo::MAP); + $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'] = "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split(base64_encode($key), 64) . "-----END PUBLIC KEY-----"; + $this->currentKeyIdentifier = null; + $this->currentCert = $csr; + $this->publicKey = null; + $this->publicKey = $this->getPublicKey(); + return $csr; + } + /** + * Save CSR request + * + * @param array $csr + * @param int $format optional + * @return string + */ + public function saveCSR(array $csr, $format = self::FORMAT_PEM) + { + if (!is_array($csr) || !isset($csr['certificationRequestInfo'])) { + return \false; + } + switch (\true) { + case !($algorithm = $this->subArray($csr, 'certificationRequestInfo/subjectPKInfo/algorithm/algorithm')): + case is_object($csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']): + break; + default: + $csr['certificationRequestInfo']['subjectPKInfo'] = new Element(base64_decode(preg_replace('#-.+-|[\\r\\n]#', '', $csr['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']))); + } + $filters = []; + $filters['certificationRequestInfo']['subject']['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; + ASN1::setFilters($filters); + $this->mapOutDNs($csr, 'certificationRequestInfo/subject/rdnSequence'); + $this->mapOutAttributes($csr, 'certificationRequestInfo/attributes'); + $csr = ASN1::encodeDER($csr, Maps\CertificationRequest::MAP); + switch ($format) { + case self::FORMAT_DER: + return $csr; + // case self::FORMAT_PEM: + default: + return "-----BEGIN CERTIFICATE REQUEST-----\r\n" . chunk_split(Strings::base64_encode($csr), 64) . '-----END CERTIFICATE REQUEST-----'; + } + } + /** + * Load a SPKAC CSR + * + * SPKAC's are produced by the HTML5 keygen element: + * + * https://developer.mozilla.org/en-US/docs/HTML/Element/keygen + * + * @param string $spkac + * @return mixed + */ + public function loadSPKAC($spkac) + { + if (is_array($spkac) && isset($spkac['publicKeyAndChallenge'])) { + unset($this->currentCert); + unset($this->currentKeyIdentifier); + unset($this->signatureSubject); + $this->currentCert = $spkac; + return $spkac; + } + // see http://www.w3.org/html/wg/drafts/html/master/forms.html#signedpublickeyandchallenge + // OpenSSL produces SPKAC's that are preceded by the string SPKAC= + $temp = preg_replace('#(?:SPKAC=)|[ \\r\\n\\\\]#', '', $spkac); + $temp = preg_match('#^[a-zA-Z\\d/+]*={0,2}$#', $temp) ? Strings::base64_decode($temp) : \false; + if ($temp != \false) { + $spkac = $temp; + } + $orig = $spkac; + if ($spkac === \false) { + $this->currentCert = \false; + return \false; + } + $decoded = ASN1::decodeBER($spkac); + if (!$decoded) { + $this->currentCert = \false; + return \false; + } + $spkac = ASN1::asn1map($decoded[0], Maps\SignedPublicKeyAndChallenge::MAP); + if (!isset($spkac) || !is_array($spkac)) { + $this->currentCert = \false; + return \false; + } + $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); + $key = $spkac['publicKeyAndChallenge']['spki']; + $key = ASN1::encodeDER($key, Maps\SubjectPublicKeyInfo::MAP); + $spkac['publicKeyAndChallenge']['spki']['subjectPublicKey'] = "-----BEGIN PUBLIC KEY-----\r\n" . chunk_split(base64_encode($key), 64) . "-----END PUBLIC KEY-----"; + $this->currentKeyIdentifier = null; + $this->currentCert = $spkac; + $this->publicKey = null; + $this->publicKey = $this->getPublicKey(); + return $spkac; + } + /** + * Save a SPKAC CSR request + * + * @param array $spkac + * @param int $format optional + * @return string + */ + public function saveSPKAC(array $spkac, $format = self::FORMAT_PEM) + { + if (!is_array($spkac) || !isset($spkac['publicKeyAndChallenge'])) { + return \false; + } + $algorithm = $this->subArray($spkac, 'publicKeyAndChallenge/spki/algorithm/algorithm'); + switch (\true) { + case !$algorithm: + case is_object($spkac['publicKeyAndChallenge']['spki']['subjectPublicKey']): + break; + default: + $spkac['publicKeyAndChallenge']['spki'] = new Element(base64_decode(preg_replace('#-.+-|[\\r\\n]#', '', $spkac['publicKeyAndChallenge']['spki']['subjectPublicKey']))); + } + $spkac = ASN1::encodeDER($spkac, Maps\SignedPublicKeyAndChallenge::MAP); + switch ($format) { + case self::FORMAT_DER: + return $spkac; + // case self::FORMAT_PEM: + default: + // OpenSSL's implementation of SPKAC requires the SPKAC be preceded by SPKAC= and since there are pretty much + // no other SPKAC decoders phpseclib will use that same format + return 'SPKAC=' . Strings::base64_encode($spkac); + } + } + /** + * Load a Certificate Revocation List + * + * @param string $crl + * @param int $mode + * @return mixed + */ + public function loadCRL($crl, $mode = self::FORMAT_AUTO_DETECT) + { + if (is_array($crl) && isset($crl['tbsCertList'])) { + $this->currentCert = $crl; + unset($this->signatureSubject); + return $crl; + } + if ($mode != self::FORMAT_DER) { + $newcrl = ASN1::extractBER($crl); + if ($mode == self::FORMAT_PEM && $crl == $newcrl) { + return \false; + } + $crl = $newcrl; + } + $orig = $crl; + if ($crl === \false) { + $this->currentCert = \false; + return \false; + } + $decoded = ASN1::decodeBER($crl); + if (!$decoded) { + $this->currentCert = \false; + return \false; + } + $crl = ASN1::asn1map($decoded[0], Maps\CertificateList::MAP); + if (!isset($crl) || $crl === \false) { + $this->currentCert = \false; + return \false; + } + $this->signatureSubject = substr($orig, $decoded[0]['content'][0]['start'], $decoded[0]['content'][0]['length']); + $this->mapInDNs($crl, 'tbsCertList/issuer/rdnSequence'); + if ($this->isSubArrayValid($crl, 'tbsCertList/crlExtensions')) { + $this->mapInExtensions($crl, 'tbsCertList/crlExtensions'); + } + if ($this->isSubArrayValid($crl, 'tbsCertList/revokedCertificates')) { + $rclist_ref =& $this->subArrayUnchecked($crl, 'tbsCertList/revokedCertificates'); + if ($rclist_ref) { + $rclist = $crl['tbsCertList']['revokedCertificates']; + foreach ($rclist as $i => $extension) { + if ($this->isSubArrayValid($rclist, "{$i}/crlEntryExtensions")) { + $this->mapInExtensions($rclist_ref, "{$i}/crlEntryExtensions"); + } + } + } + } + $this->currentKeyIdentifier = null; + $this->currentCert = $crl; + return $crl; + } + /** + * Save Certificate Revocation List. + * + * @param array $crl + * @param int $format optional + * @return string + */ + public function saveCRL(array $crl, $format = self::FORMAT_PEM) + { + if (!is_array($crl) || !isset($crl['tbsCertList'])) { + return \false; + } + $filters = []; + $filters['tbsCertList']['issuer']['rdnSequence']['value'] = ['type' => ASN1::TYPE_UTF8_STRING]; + $filters['tbsCertList']['signature']['parameters'] = ['type' => ASN1::TYPE_UTF8_STRING]; + $filters['signatureAlgorithm']['parameters'] = ['type' => ASN1::TYPE_UTF8_STRING]; + if (empty($crl['tbsCertList']['signature']['parameters'])) { + $filters['tbsCertList']['signature']['parameters'] = ['type' => ASN1::TYPE_NULL]; + } + if (empty($crl['signatureAlgorithm']['parameters'])) { + $filters['signatureAlgorithm']['parameters'] = ['type' => ASN1::TYPE_NULL]; + } + ASN1::setFilters($filters); + $this->mapOutDNs($crl, 'tbsCertList/issuer/rdnSequence'); + $this->mapOutExtensions($crl, 'tbsCertList/crlExtensions'); + $rclist =& $this->subArray($crl, 'tbsCertList/revokedCertificates'); + if (is_array($rclist)) { + foreach ($rclist as $i => $extension) { + $this->mapOutExtensions($rclist, "{$i}/crlEntryExtensions"); + } + } + $crl = ASN1::encodeDER($crl, Maps\CertificateList::MAP); + switch ($format) { + case self::FORMAT_DER: + return $crl; + // case self::FORMAT_PEM: + default: + return "-----BEGIN X509 CRL-----\r\n" . chunk_split(Strings::base64_encode($crl), 64) . '-----END X509 CRL-----'; + } + } + /** + * Helper function to build a time field according to RFC 3280 section + * - 4.1.2.5 Validity + * - 5.1.2.4 This Update + * - 5.1.2.5 Next Update + * - 5.1.2.6 Revoked Certificates + * by choosing utcTime iff year of date given is before 2050 and generalTime else. + * + * @param string $date in format date('D, d M Y H:i:s O') + * @return array|Element + */ + private function timeField($date) + { + if ($date instanceof Element) { + return $date; + } + $dateObj = new \DateTimeImmutable($date, new \DateTimeZone('GMT')); + $year = $dateObj->format('Y'); + // the same way ASN1.php parses this + if ($year < 2050) { + return ['utcTime' => $date]; + } else { + return ['generalTime' => $date]; + } + } + /** + * Sign an X.509 certificate + * + * $issuer's private key needs to be loaded. + * $subject can be either an existing X.509 cert (if you want to resign it), + * a CSR or something with the DN and public key explicitly set. + * + * @return mixed + */ + public function sign(X509 $issuer, X509 $subject) + { + if (!is_object($issuer->privateKey) || empty($issuer->dn)) { + return \false; + } + if (isset($subject->publicKey) && !($subjectPublicKey = $subject->formatSubjectPublicKey())) { + return \false; + } + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; + $signatureAlgorithm = self::identifySignatureAlgorithm($issuer->privateKey); + if (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertificate'])) { + $this->currentCert = $subject->currentCert; + $this->currentCert['tbsCertificate']['signature'] = $signatureAlgorithm; + $this->currentCert['signatureAlgorithm'] = $signatureAlgorithm; + if (!empty($this->startDate)) { + $this->currentCert['tbsCertificate']['validity']['notBefore'] = $this->timeField($this->startDate); + } + if (!empty($this->endDate)) { + $this->currentCert['tbsCertificate']['validity']['notAfter'] = $this->timeField($this->endDate); + } + if (!empty($this->serialNumber)) { + $this->currentCert['tbsCertificate']['serialNumber'] = $this->serialNumber; + } + if (!empty($subject->dn)) { + $this->currentCert['tbsCertificate']['subject'] = $subject->dn; + } + if (!empty($subject->publicKey)) { + $this->currentCert['tbsCertificate']['subjectPublicKeyInfo'] = $subjectPublicKey; + } + $this->removeExtension('id-ce-authorityKeyIdentifier'); + if (isset($subject->domains)) { + $this->removeExtension('id-ce-subjectAltName'); + } + } elseif (isset($subject->currentCert) && is_array($subject->currentCert) && isset($subject->currentCert['tbsCertList'])) { + return \false; + } else { + if (!isset($subject->publicKey)) { + return \false; + } + $startDate = new \DateTimeImmutable('now', new \DateTimeZone(@date_default_timezone_get())); + $startDate = !empty($this->startDate) ? $this->startDate : $startDate->format('D, d M Y H:i:s O'); + $endDate = new \DateTimeImmutable('+1 year', new \DateTimeZone(@date_default_timezone_get())); + $endDate = !empty($this->endDate) ? $this->endDate : $endDate->format('D, d M Y H:i:s O'); + /* "The serial number MUST be a positive integer" + "Conforming CAs MUST NOT use serialNumber values longer than 20 octets." + -- https://tools.ietf.org/html/rfc5280#section-4.1.2.2 + + for the integer to be positive the leading bit needs to be 0 hence the + application of a bitmap + */ + $serialNumber = !empty($this->serialNumber) ? $this->serialNumber : new BigInteger(Random::string(20) & "" . str_repeat("\xff", 19), 256); + $this->currentCert = ['tbsCertificate' => [ + 'version' => 'v3', + 'serialNumber' => $serialNumber, + // $this->setSerialNumber() + 'signature' => $signatureAlgorithm, + 'issuer' => \false, + // this is going to be overwritten later + 'validity' => [ + 'notBefore' => $this->timeField($startDate), + // $this->setStartDate() + 'notAfter' => $this->timeField($endDate), + ], + 'subject' => $subject->dn, + 'subjectPublicKeyInfo' => $subjectPublicKey, + ], 'signatureAlgorithm' => $signatureAlgorithm, 'signature' => \false]; + // Copy extensions from CSR. + $csrexts = $subject->getAttribute('pkcs-9-at-extensionRequest', 0); + if (!empty($csrexts)) { + $this->currentCert['tbsCertificate']['extensions'] = $csrexts; + } + } + $this->currentCert['tbsCertificate']['issuer'] = $issuer->dn; + if (isset($issuer->currentKeyIdentifier)) { + $this->setExtension('id-ce-authorityKeyIdentifier', [ + //'authorityCertIssuer' => array( + // array( + // 'directoryName' => $issuer->dn + // ) + //), + 'keyIdentifier' => $issuer->currentKeyIdentifier, + ]); + //$extensions = &$this->currentCert['tbsCertificate']['extensions']; + //if (isset($issuer->serialNumber)) { + // $extensions[count($extensions) - 1]['authorityCertSerialNumber'] = $issuer->serialNumber; + //} + //unset($extensions); + } + if (isset($subject->currentKeyIdentifier)) { + $this->setExtension('id-ce-subjectKeyIdentifier', $subject->currentKeyIdentifier); + } + $altName = []; + if (isset($subject->domains) && count($subject->domains)) { + $altName = array_map(['\\phpseclib3\\File\\X509', 'dnsName'], $subject->domains); + } + if (isset($subject->ipAddresses) && count($subject->ipAddresses)) { + // should an IP address appear as the CN if no domain name is specified? idk + //$ips = count($subject->domains) ? $subject->ipAddresses : array_slice($subject->ipAddresses, 1); + $ipAddresses = []; + foreach ($subject->ipAddresses as $ipAddress) { + $encoded = $subject->ipAddress($ipAddress); + if ($encoded !== \false) { + $ipAddresses[] = $encoded; + } + } + if (count($ipAddresses)) { + $altName = array_merge($altName, $ipAddresses); + } + } + if (!empty($altName)) { + $this->setExtension('id-ce-subjectAltName', $altName); + } + if ($this->caFlag) { + $keyUsage = $this->getExtension('id-ce-keyUsage'); + if (!$keyUsage) { + $keyUsage = []; + } + $this->setExtension('id-ce-keyUsage', array_values(array_unique(array_merge($keyUsage, ['cRLSign', 'keyCertSign'])))); + $basicConstraints = $this->getExtension('id-ce-basicConstraints'); + if (!$basicConstraints) { + $basicConstraints = []; + } + $this->setExtension('id-ce-basicConstraints', array_merge(['cA' => \true], $basicConstraints), \true); + if (!isset($subject->currentKeyIdentifier)) { + $this->setExtension('id-ce-subjectKeyIdentifier', $this->computeKeyIdentifier($this->currentCert), \false, \false); + } + } + // resync $this->signatureSubject + // save $tbsCertificate in case there are any \phpseclib3\File\ASN1\Element objects in it + $tbsCertificate = $this->currentCert['tbsCertificate']; + $this->loadX509($this->saveX509($this->currentCert)); + $result = $this->currentCert; + $this->currentCert['signature'] = $result['signature'] = "\x00" . $issuer->privateKey->sign($this->signatureSubject); + $result['tbsCertificate'] = $tbsCertificate; + $this->currentCert = $currentCert; + $this->signatureSubject = $signatureSubject; + return $result; + } + /** + * Sign a CSR + * + * @return mixed + */ + public function signCSR() + { + if (!is_object($this->privateKey) || empty($this->dn)) { + return \false; + } + $origPublicKey = $this->publicKey; + $this->publicKey = $this->privateKey->getPublicKey(); + $publicKey = $this->formatSubjectPublicKey(); + $this->publicKey = $origPublicKey; + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; + $signatureAlgorithm = self::identifySignatureAlgorithm($this->privateKey); + if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['certificationRequestInfo'])) { + $this->currentCert['signatureAlgorithm'] = $signatureAlgorithm; + if (!empty($this->dn)) { + $this->currentCert['certificationRequestInfo']['subject'] = $this->dn; + } + $this->currentCert['certificationRequestInfo']['subjectPKInfo'] = $publicKey; + } else { + $this->currentCert = ['certificationRequestInfo' => ['version' => 'v1', 'subject' => $this->dn, 'subjectPKInfo' => $publicKey], 'signatureAlgorithm' => $signatureAlgorithm, 'signature' => \false]; + } + // resync $this->signatureSubject + // save $certificationRequestInfo in case there are any \phpseclib3\File\ASN1\Element objects in it + $certificationRequestInfo = $this->currentCert['certificationRequestInfo']; + $this->loadCSR($this->saveCSR($this->currentCert)); + $result = $this->currentCert; + $this->currentCert['signature'] = $result['signature'] = "\x00" . $this->privateKey->sign($this->signatureSubject); + $result['certificationRequestInfo'] = $certificationRequestInfo; + $this->currentCert = $currentCert; + $this->signatureSubject = $signatureSubject; + return $result; + } + /** + * Sign a SPKAC + * + * @return mixed + */ + public function signSPKAC() + { + if (!is_object($this->privateKey)) { + return \false; + } + $origPublicKey = $this->publicKey; + $this->publicKey = $this->privateKey->getPublicKey(); + $publicKey = $this->formatSubjectPublicKey(); + $this->publicKey = $origPublicKey; + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; + $signatureAlgorithm = self::identifySignatureAlgorithm($this->privateKey); + // re-signing a SPKAC seems silly but since everything else supports re-signing why not? + if (isset($this->currentCert) && is_array($this->currentCert) && isset($this->currentCert['publicKeyAndChallenge'])) { + $this->currentCert['signatureAlgorithm'] = $signatureAlgorithm; + $this->currentCert['publicKeyAndChallenge']['spki'] = $publicKey; + if (!empty($this->challenge)) { + // the bitwise AND ensures that the output is a valid IA5String + $this->currentCert['publicKeyAndChallenge']['challenge'] = $this->challenge & str_repeat("", strlen($this->challenge)); + } + } else { + $this->currentCert = ['publicKeyAndChallenge' => [ + 'spki' => $publicKey, + // quoting , + // "A challenge string that is submitted along with the public key. Defaults to an empty string if not specified." + // both Firefox and OpenSSL ("openssl spkac -key private.key") behave this way + // we could alternatively do this instead if we ignored the specs: + // Random::string(8) & str_repeat("\x7F", 8) + 'challenge' => !empty($this->challenge) ? $this->challenge : '', + ], 'signatureAlgorithm' => $signatureAlgorithm, 'signature' => \false]; + } + // resync $this->signatureSubject + // save $publicKeyAndChallenge in case there are any \phpseclib3\File\ASN1\Element objects in it + $publicKeyAndChallenge = $this->currentCert['publicKeyAndChallenge']; + $this->loadSPKAC($this->saveSPKAC($this->currentCert)); + $result = $this->currentCert; + $this->currentCert['signature'] = $result['signature'] = "\x00" . $this->privateKey->sign($this->signatureSubject); + $result['publicKeyAndChallenge'] = $publicKeyAndChallenge; + $this->currentCert = $currentCert; + $this->signatureSubject = $signatureSubject; + return $result; + } + /** + * Sign a CRL + * + * $issuer's private key needs to be loaded. + * + * @return mixed + */ + public function signCRL(X509 $issuer, X509 $crl) + { + if (!is_object($issuer->privateKey) || empty($issuer->dn)) { + return \false; + } + $currentCert = isset($this->currentCert) ? $this->currentCert : null; + $signatureSubject = isset($this->signatureSubject) ? $this->signatureSubject : null; + $signatureAlgorithm = self::identifySignatureAlgorithm($issuer->privateKey); + $thisUpdate = new \DateTimeImmutable('now', new \DateTimeZone(@date_default_timezone_get())); + $thisUpdate = !empty($this->startDate) ? $this->startDate : $thisUpdate->format('D, d M Y H:i:s O'); + if (isset($crl->currentCert) && is_array($crl->currentCert) && isset($crl->currentCert['tbsCertList'])) { + $this->currentCert = $crl->currentCert; + $this->currentCert['tbsCertList']['signature'] = $signatureAlgorithm; + $this->currentCert['signatureAlgorithm'] = $signatureAlgorithm; + } else { + $this->currentCert = ['tbsCertList' => [ + 'version' => 'v2', + 'signature' => $signatureAlgorithm, + 'issuer' => \false, + // this is going to be overwritten later + 'thisUpdate' => $this->timeField($thisUpdate), + ], 'signatureAlgorithm' => $signatureAlgorithm, 'signature' => \false]; + } + $tbsCertList =& $this->currentCert['tbsCertList']; + $tbsCertList['issuer'] = $issuer->dn; + $tbsCertList['thisUpdate'] = $this->timeField($thisUpdate); + if (!empty($this->endDate)) { + $tbsCertList['nextUpdate'] = $this->timeField($this->endDate); + // $this->setEndDate() + } else { + unset($tbsCertList['nextUpdate']); + } + if (!empty($this->serialNumber)) { + $crlNumber = $this->serialNumber; + } else { + $crlNumber = $this->getExtension('id-ce-cRLNumber'); + // "The CRL number is a non-critical CRL extension that conveys a + // monotonically increasing sequence number for a given CRL scope and + // CRL issuer. This extension allows users to easily determine when a + // particular CRL supersedes another CRL." + // -- https://tools.ietf.org/html/rfc5280#section-5.2.3 + $crlNumber = $crlNumber !== \false ? $crlNumber->add(new BigInteger(1)) : null; + } + $this->removeExtension('id-ce-authorityKeyIdentifier'); + $this->removeExtension('id-ce-issuerAltName'); + // Be sure version >= v2 if some extension found. + $version = isset($tbsCertList['version']) ? $tbsCertList['version'] : 0; + if (!$version) { + if (!empty($tbsCertList['crlExtensions'])) { + $version = 1; + // v2. + } elseif (!empty($tbsCertList['revokedCertificates'])) { + foreach ($tbsCertList['revokedCertificates'] as $cert) { + if (!empty($cert['crlEntryExtensions'])) { + $version = 1; + // v2. + } + } + } + if ($version) { + $tbsCertList['version'] = $version; + } + } + // Store additional extensions. + if (!empty($tbsCertList['version'])) { + // At least v2. + if (!empty($crlNumber)) { + $this->setExtension('id-ce-cRLNumber', $crlNumber); + } + if (isset($issuer->currentKeyIdentifier)) { + $this->setExtension('id-ce-authorityKeyIdentifier', [ + //'authorityCertIssuer' => array( + // ] + // 'directoryName' => $issuer->dn + // ] + //), + 'keyIdentifier' => $issuer->currentKeyIdentifier, + ]); + //$extensions = &$tbsCertList['crlExtensions']; + //if (isset($issuer->serialNumber)) { + // $extensions[count($extensions) - 1]['authorityCertSerialNumber'] = $issuer->serialNumber; + //} + //unset($extensions); + } + $issuerAltName = $this->getExtension('id-ce-subjectAltName', $issuer->currentCert); + if ($issuerAltName !== \false) { + $this->setExtension('id-ce-issuerAltName', $issuerAltName); + } + } + if (empty($tbsCertList['revokedCertificates'])) { + unset($tbsCertList['revokedCertificates']); + } + unset($tbsCertList); + // resync $this->signatureSubject + // save $tbsCertList in case there are any \phpseclib3\File\ASN1\Element objects in it + $tbsCertList = $this->currentCert['tbsCertList']; + $this->loadCRL($this->saveCRL($this->currentCert)); + $result = $this->currentCert; + $this->currentCert['signature'] = $result['signature'] = "\x00" . $issuer->privateKey->sign($this->signatureSubject); + $result['tbsCertList'] = $tbsCertList; + $this->currentCert = $currentCert; + $this->signatureSubject = $signatureSubject; + return $result; + } + /** + * Identify signature algorithm from key settings + * + * @param PrivateKey $key + * @throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported + * @return array + */ + private static function identifySignatureAlgorithm(PrivateKey $key) + { + if ($key instanceof RSA) { + if ($key->getPadding() & RSA::SIGNATURE_PSS) { + $r = PSS::load($key->withPassword()->toString('PSS')); + return ['algorithm' => 'id-RSASSA-PSS', 'parameters' => PSS::savePSSParams($r)]; + } + switch ($key->getHash()) { + case 'md2': + case 'md5': + case 'sha1': + case 'sha224': + case 'sha256': + case 'sha384': + case 'sha512': + return ['algorithm' => $key->getHash() . 'WithRSAEncryption']; + } + throw new UnsupportedAlgorithmException('The only supported hash algorithms for RSA are: md2, md5, sha1, sha224, sha256, sha384, sha512'); + } + if ($key instanceof DSA) { + switch ($key->getHash()) { + case 'sha1': + case 'sha224': + case 'sha256': + return ['algorithm' => 'id-dsa-with-' . $key->getHash()]; + } + throw new UnsupportedAlgorithmException('The only supported hash algorithms for DSA are: sha1, sha224, sha256'); + } + if ($key instanceof EC) { + switch ($key->getCurve()) { + case 'Ed25519': + case 'Ed448': + return ['algorithm' => 'id-' . $key->getCurve()]; + } + switch ($key->getHash()) { + case 'sha1': + case 'sha224': + case 'sha256': + case 'sha384': + case 'sha512': + return ['algorithm' => 'ecdsa-with-' . strtoupper($key->getHash())]; + } + throw new UnsupportedAlgorithmException('The only supported hash algorithms for EC are: sha1, sha224, sha256, sha384, sha512'); + } + throw new UnsupportedAlgorithmException('The only supported public key classes are: RSA, DSA, EC'); + } + /** + * Set certificate start date + * + * @param \DateTimeInterface|string $date + */ + public function setStartDate($date) + { + if (!is_object($date) || !$date instanceof \DateTimeInterface) { + $date = new \DateTimeImmutable($date, new \DateTimeZone(@date_default_timezone_get())); + } + $this->startDate = $date->format('D, d M Y H:i:s O'); + } + /** + * Set certificate end date + * + * @param \DateTimeInterface|string $date + */ + public function setEndDate($date) + { + /* + To indicate that a certificate has no well-defined expiration date, + the notAfter SHOULD be assigned the GeneralizedTime value of + 99991231235959Z. + + -- http://tools.ietf.org/html/rfc5280#section-4.1.2.5 + */ + if (is_string($date) && strtolower($date) === 'lifetime') { + $temp = '99991231235959Z'; + $temp = chr(ASN1::TYPE_GENERALIZED_TIME) . ASN1::encodeLength(strlen($temp)) . $temp; + $this->endDate = new Element($temp); + } else { + if (!is_object($date) || !$date instanceof \DateTimeInterface) { + $date = new \DateTimeImmutable($date, new \DateTimeZone(@date_default_timezone_get())); + } + $this->endDate = $date->format('D, d M Y H:i:s O'); + } + } + /** + * Set Serial Number + * + * @param string $serial + * @param int $base optional + */ + public function setSerialNumber($serial, $base = -256) + { + $this->serialNumber = new BigInteger($serial, $base); + } + /** + * Turns the certificate into a certificate authority + * + */ + public function makeCA() + { + $this->caFlag = \true; + } + /** + * Check for validity of subarray + * + * This is intended for use in conjunction with _subArrayUnchecked(), + * implementing the checks included in _subArray() but without copying + * a potentially large array by passing its reference by-value to is_array(). + * + * @param array $root + * @param string $path + * @return boolean + */ + private function isSubArrayValid(array $root, $path) + { + if (!is_array($root)) { + return \false; + } + foreach (explode('/', $path) as $i) { + if (!is_array($root)) { + return \false; + } + if (!isset($root[$i])) { + return \true; + } + $root = $root[$i]; + } + return \true; + } + /** + * Get a reference to a subarray + * + * This variant of _subArray() does no is_array() checking, + * so $root should be checked with _isSubArrayValid() first. + * + * This is here for performance reasons: + * Passing a reference (i.e. $root) by-value (i.e. to is_array()) + * creates a copy. If $root is an especially large array, this is expensive. + * + * @param array $root + * @param string $path absolute path with / as component separator + * @param bool $create optional + * @return array|false + */ + private function &subArrayUnchecked(array &$root, $path, $create = \false) + { + $false = \false; + foreach (explode('/', $path) as $i) { + if (!isset($root[$i])) { + if (!$create) { + return $false; + } + $root[$i] = []; + } + $root =& $root[$i]; + } + return $root; + } + /** + * Get a reference to a subarray + * + * @param array $root + * @param string $path absolute path with / as component separator + * @param bool $create optional + * @return array|false + */ + private function &subArray(array &$root = null, $path, $create = \false) + { + $false = \false; + if (!is_array($root)) { + return $false; + } + foreach (explode('/', $path) as $i) { + if (!is_array($root)) { + return $false; + } + if (!isset($root[$i])) { + if (!$create) { + return $false; + } + $root[$i] = []; + } + $root =& $root[$i]; + } + return $root; + } + /** + * Get a reference to an extension subarray + * + * @param array $root + * @param string $path optional absolute path with / as component separator + * @param bool $create optional + * @return array|false + */ + private function &extensions(array &$root = null, $path = null, $create = \false) + { + if (!isset($root)) { + $root = $this->currentCert; + } + switch (\true) { + case !empty($path): + case !is_array($root): + break; + case isset($root['tbsCertificate']): + $path = 'tbsCertificate/extensions'; + break; + case isset($root['tbsCertList']): + $path = 'tbsCertList/crlExtensions'; + break; + case isset($root['certificationRequestInfo']): + $pth = 'certificationRequestInfo/attributes'; + $attributes =& $this->subArray($root, $pth, $create); + if (is_array($attributes)) { + foreach ($attributes as $key => $value) { + if ($value['type'] == 'pkcs-9-at-extensionRequest') { + $path = "{$pth}/{$key}/value/0"; + break 2; + } + } + if ($create) { + $key = count($attributes); + $attributes[] = ['type' => 'pkcs-9-at-extensionRequest', 'value' => []]; + $path = "{$pth}/{$key}/value/0"; + } + } + break; + } + $extensions =& $this->subArray($root, $path, $create); + if (!is_array($extensions)) { + $false = \false; + return $false; + } + return $extensions; + } + /** + * Remove an Extension + * + * @param string $id + * @param string $path optional + * @return bool + */ + private function removeExtensionHelper($id, $path = null) + { + $extensions =& $this->extensions($this->currentCert, $path); + if (!is_array($extensions)) { + return \false; + } + $result = \false; + foreach ($extensions as $key => $value) { + if ($value['extnId'] == $id) { + unset($extensions[$key]); + $result = \true; + } + } + $extensions = array_values($extensions); + // fix for https://bugs.php.net/75433 affecting PHP 7.2 + if (!isset($extensions[0])) { + $extensions = array_splice($extensions, 0, 0); + } + return $result; + } + /** + * Get an Extension + * + * Returns the extension if it exists and false if not + * + * @param string $id + * @param array $cert optional + * @param string $path optional + * @return mixed + */ + private function getExtensionHelper($id, array $cert = null, $path = null) + { + $extensions = $this->extensions($cert, $path); + if (!is_array($extensions)) { + return \false; + } + foreach ($extensions as $key => $value) { + if ($value['extnId'] == $id) { + return $value['extnValue']; + } + } + return \false; + } + /** + * Returns a list of all extensions in use + * + * @param array $cert optional + * @param string $path optional + * @return array + */ + private function getExtensionsHelper(array $cert = null, $path = null) + { + $exts = $this->extensions($cert, $path); + $extensions = []; + if (is_array($exts)) { + foreach ($exts as $extension) { + $extensions[] = $extension['extnId']; + } + } + return $extensions; + } + /** + * Set an Extension + * + * @param string $id + * @param mixed $value + * @param bool $critical optional + * @param bool $replace optional + * @param string $path optional + * @return bool + */ + private function setExtensionHelper($id, $value, $critical = \false, $replace = \true, $path = null) + { + $extensions =& $this->extensions($this->currentCert, $path, \true); + if (!is_array($extensions)) { + return \false; + } + $newext = ['extnId' => $id, 'critical' => $critical, 'extnValue' => $value]; + foreach ($extensions as $key => $value) { + if ($value['extnId'] == $id) { + if (!$replace) { + return \false; + } + $extensions[$key] = $newext; + return \true; + } + } + $extensions[] = $newext; + return \true; + } + /** + * Remove a certificate, CSR or CRL Extension + * + * @param string $id + * @return bool + */ + public function removeExtension($id) + { + return $this->removeExtensionHelper($id); + } + /** + * Get a certificate, CSR or CRL Extension + * + * Returns the extension if it exists and false if not + * + * @param string $id + * @param array $cert optional + * @param string $path + * @return mixed + */ + public function getExtension($id, array $cert = null, $path = null) + { + return $this->getExtensionHelper($id, $cert, $path); + } + /** + * Returns a list of all extensions in use in certificate, CSR or CRL + * + * @param array $cert optional + * @param string $path optional + * @return array + */ + public function getExtensions(array $cert = null, $path = null) + { + return $this->getExtensionsHelper($cert, $path); + } + /** + * Set a certificate, CSR or CRL Extension + * + * @param string $id + * @param mixed $value + * @param bool $critical optional + * @param bool $replace optional + * @return bool + */ + public function setExtension($id, $value, $critical = \false, $replace = \true) + { + return $this->setExtensionHelper($id, $value, $critical, $replace); + } + /** + * Remove a CSR attribute. + * + * @param string $id + * @param int $disposition optional + * @return bool + */ + public function removeAttribute($id, $disposition = self::ATTR_ALL) + { + $attributes =& $this->subArray($this->currentCert, 'certificationRequestInfo/attributes'); + if (!is_array($attributes)) { + return \false; + } + $result = \false; + foreach ($attributes as $key => $attribute) { + if ($attribute['type'] == $id) { + $n = count($attribute['value']); + switch (\true) { + case $disposition == self::ATTR_APPEND: + case $disposition == self::ATTR_REPLACE: + return \false; + case $disposition >= $n: + $disposition -= $n; + break; + case $disposition == self::ATTR_ALL: + case $n == 1: + unset($attributes[$key]); + $result = \true; + break; + default: + unset($attributes[$key]['value'][$disposition]); + $attributes[$key]['value'] = array_values($attributes[$key]['value']); + $result = \true; + break; + } + if ($result && $disposition != self::ATTR_ALL) { + break; + } + } + } + $attributes = array_values($attributes); + return $result; + } + /** + * Get a CSR attribute + * + * Returns the attribute if it exists and false if not + * + * @param string $id + * @param int $disposition optional + * @param array $csr optional + * @return mixed + */ + public function getAttribute($id, $disposition = self::ATTR_ALL, array $csr = null) + { + if (empty($csr)) { + $csr = $this->currentCert; + } + $attributes = $this->subArray($csr, 'certificationRequestInfo/attributes'); + if (!is_array($attributes)) { + return \false; + } + foreach ($attributes as $key => $attribute) { + if ($attribute['type'] == $id) { + $n = count($attribute['value']); + switch (\true) { + case $disposition == self::ATTR_APPEND: + case $disposition == self::ATTR_REPLACE: + return \false; + case $disposition == self::ATTR_ALL: + return $attribute['value']; + case $disposition >= $n: + $disposition -= $n; + break; + default: + return $attribute['value'][$disposition]; + } + } + } + return \false; + } + /** + * Returns a list of all CSR attributes in use + * + * @param array $csr optional + * @return array + */ + public function getAttributes(array $csr = null) + { + if (empty($csr)) { + $csr = $this->currentCert; + } + $attributes = $this->subArray($csr, 'certificationRequestInfo/attributes'); + $attrs = []; + if (is_array($attributes)) { + foreach ($attributes as $attribute) { + $attrs[] = $attribute['type']; + } + } + return $attrs; + } + /** + * Set a CSR attribute + * + * @param string $id + * @param mixed $value + * @param int $disposition optional + * @return bool + */ + public function setAttribute($id, $value, $disposition = self::ATTR_ALL) + { + $attributes =& $this->subArray($this->currentCert, 'certificationRequestInfo/attributes', \true); + if (!is_array($attributes)) { + return \false; + } + switch ($disposition) { + case self::ATTR_REPLACE: + $disposition = self::ATTR_APPEND; + // fall-through + case self::ATTR_ALL: + $this->removeAttribute($id); + break; + } + foreach ($attributes as $key => $attribute) { + if ($attribute['type'] == $id) { + $n = count($attribute['value']); + switch (\true) { + case $disposition == self::ATTR_APPEND: + $last = $key; + break; + case $disposition >= $n: + $disposition -= $n; + break; + default: + $attributes[$key]['value'][$disposition] = $value; + return \true; + } + } + } + switch (\true) { + case $disposition >= 0: + return \false; + case isset($last): + $attributes[$last]['value'][] = $value; + break; + default: + $attributes[] = ['type' => $id, 'value' => $disposition == self::ATTR_ALL ? $value : [$value]]; + break; + } + return \true; + } + /** + * Sets the subject key identifier + * + * This is used by the id-ce-authorityKeyIdentifier and the id-ce-subjectKeyIdentifier extensions. + * + * @param string $value + */ + public function setKeyIdentifier($value) + { + if (empty($value)) { + unset($this->currentKeyIdentifier); + } else { + $this->currentKeyIdentifier = $value; + } + } + /** + * Compute a public key identifier. + * + * Although key identifiers may be set to any unique value, this function + * computes key identifiers from public key according to the two + * recommended methods (4.2.1.2 RFC 3280). + * Highly polymorphic: try to accept all possible forms of key: + * - Key object + * - \phpseclib3\File\X509 object with public or private key defined + * - Certificate or CSR array + * - \phpseclib3\File\ASN1\Element object + * - PEM or DER string + * + * @param mixed $key optional + * @param int $method optional + * @return string binary key identifier + */ + public function computeKeyIdentifier($key = null, $method = 1) + { + if (is_null($key)) { + $key = $this; + } + switch (\true) { + case is_string($key): + break; + case is_array($key) && isset($key['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey']): + return $this->computeKeyIdentifier($key['tbsCertificate']['subjectPublicKeyInfo']['subjectPublicKey'], $method); + case is_array($key) && isset($key['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey']): + return $this->computeKeyIdentifier($key['certificationRequestInfo']['subjectPKInfo']['subjectPublicKey'], $method); + case !is_object($key): + return \false; + case $key instanceof Element: + // Assume the element is a bitstring-packed key. + $decoded = ASN1::decodeBER($key->element); + if (!$decoded) { + return \false; + } + $raw = ASN1::asn1map($decoded[0], ['type' => ASN1::TYPE_BIT_STRING]); + if (empty($raw)) { + return \false; + } + // If the key is private, compute identifier from its corresponding public key. + $key = PublicKeyLoader::load($raw); + if ($key instanceof PrivateKey) { + // If private. + return $this->computeKeyIdentifier($key, $method); + } + $key = $raw; + // Is a public key. + break; + case $key instanceof X509: + if (isset($key->publicKey)) { + return $this->computeKeyIdentifier($key->publicKey, $method); + } + if (isset($key->privateKey)) { + return $this->computeKeyIdentifier($key->privateKey, $method); + } + if (isset($key->currentCert['tbsCertificate']) || isset($key->currentCert['certificationRequestInfo'])) { + return $this->computeKeyIdentifier($key->currentCert, $method); + } + return \false; + default: + // Should be a key object (i.e.: \phpseclib3\Crypt\RSA). + $key = $key->getPublicKey(); + break; + } + // If in PEM format, convert to binary. + $key = ASN1::extractBER($key); + // Now we have the key string: compute its sha-1 sum. + $hash = new Hash('sha1'); + $hash = $hash->hash($key); + if ($method == 2) { + $hash = substr($hash, -8); + $hash[0] = chr(ord($hash[0]) & 0xf | 0x40); + } + return $hash; + } + /** + * Format a public key as appropriate + * + * @return array|false + */ + private function formatSubjectPublicKey() + { + $format = $this->publicKey instanceof RSA && $this->publicKey->getPadding() & RSA::SIGNATURE_PSS ? 'PSS' : 'PKCS8'; + $publicKey = base64_decode(preg_replace('#-.+-|[\\r\\n]#', '', $this->publicKey->toString($format))); + $decoded = ASN1::decodeBER($publicKey); + if (!$decoded) { + return \false; + } + $mapped = ASN1::asn1map($decoded[0], Maps\SubjectPublicKeyInfo::MAP); + if (!is_array($mapped)) { + return \false; + } + $mapped['subjectPublicKey'] = $this->publicKey->toString($format); + return $mapped; + } + /** + * Set the domain name's which the cert is to be valid for + * + * @param mixed ...$domains + * @return void + */ + public function setDomain(...$domains) + { + $this->domains = $domains; + $this->removeDNProp('id-at-commonName'); + $this->setDNProp('id-at-commonName', $this->domains[0]); + } + /** + * Set the IP Addresses's which the cert is to be valid for + * + * @param mixed[] ...$ipAddresses + */ + public function setIPAddress(...$ipAddresses) + { + $this->ipAddresses = $ipAddresses; + /* + if (!isset($this->domains)) { + $this->removeDNProp('id-at-commonName'); + $this->setDNProp('id-at-commonName', $this->ipAddresses[0]); + } + */ + } + /** + * Helper function to build domain array + * + * @param string $domain + * @return array + */ + private static function dnsName($domain) + { + return ['dNSName' => $domain]; + } + /** + * Helper function to build IP Address array + * + * (IPv6 is not currently supported) + * + * @param string $address + * @return array + */ + private function iPAddress($address) + { + return ['iPAddress' => $address]; + } + /** + * Get the index of a revoked certificate. + * + * @param array $rclist + * @param string $serial + * @param bool $create optional + * @return int|false + */ + private function revokedCertificate(array &$rclist, $serial, $create = \false) + { + $serial = new BigInteger($serial); + foreach ($rclist as $i => $rc) { + if (!$serial->compare($rc['userCertificate'])) { + return $i; + } + } + if (!$create) { + return \false; + } + $i = count($rclist); + $revocationDate = new \DateTimeImmutable('now', new \DateTimeZone(@date_default_timezone_get())); + $rclist[] = ['userCertificate' => $serial, 'revocationDate' => $this->timeField($revocationDate->format('D, d M Y H:i:s O'))]; + return $i; + } + /** + * Revoke a certificate. + * + * @param string $serial + * @param string $date optional + * @return bool + */ + public function revoke($serial, $date = null) + { + if (isset($this->currentCert['tbsCertList'])) { + if (is_array($rclist =& $this->subArray($this->currentCert, 'tbsCertList/revokedCertificates', \true))) { + if ($this->revokedCertificate($rclist, $serial) === \false) { + // If not yet revoked + if (($i = $this->revokedCertificate($rclist, $serial, \true)) !== \false) { + if (!empty($date)) { + $rclist[$i]['revocationDate'] = $this->timeField($date); + } + return \true; + } + } + } + } + return \false; + } + /** + * Unrevoke a certificate. + * + * @param string $serial + * @return bool + */ + public function unrevoke($serial) + { + if (is_array($rclist =& $this->subArray($this->currentCert, 'tbsCertList/revokedCertificates'))) { + if (($i = $this->revokedCertificate($rclist, $serial)) !== \false) { + unset($rclist[$i]); + $rclist = array_values($rclist); + return \true; + } + } + return \false; + } + /** + * Get a revoked certificate. + * + * @param string $serial + * @return mixed + */ + public function getRevoked($serial) + { + if (is_array($rclist = $this->subArray($this->currentCert, 'tbsCertList/revokedCertificates'))) { + if (($i = $this->revokedCertificate($rclist, $serial)) !== \false) { + return $rclist[$i]; + } + } + return \false; + } + /** + * List revoked certificates + * + * @param array $crl optional + * @return array|bool + */ + public function listRevoked(array $crl = null) + { + if (!isset($crl)) { + $crl = $this->currentCert; + } + if (!isset($crl['tbsCertList'])) { + return \false; + } + $result = []; + if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) { + foreach ($rclist as $rc) { + $result[] = $rc['userCertificate']->toString(); + } + } + return $result; + } + /** + * Remove a Revoked Certificate Extension + * + * @param string $serial + * @param string $id + * @return bool + */ + public function removeRevokedCertificateExtension($serial, $id) + { + if (is_array($rclist =& $this->subArray($this->currentCert, 'tbsCertList/revokedCertificates'))) { + if (($i = $this->revokedCertificate($rclist, $serial)) !== \false) { + return $this->removeExtensionHelper($id, "tbsCertList/revokedCertificates/{$i}/crlEntryExtensions"); + } + } + return \false; + } + /** + * Get a Revoked Certificate Extension + * + * Returns the extension if it exists and false if not + * + * @param string $serial + * @param string $id + * @param array $crl optional + * @return mixed + */ + public function getRevokedCertificateExtension($serial, $id, array $crl = null) + { + if (!isset($crl)) { + $crl = $this->currentCert; + } + if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) { + if (($i = $this->revokedCertificate($rclist, $serial)) !== \false) { + return $this->getExtension($id, $crl, "tbsCertList/revokedCertificates/{$i}/crlEntryExtensions"); + } + } + return \false; + } + /** + * Returns a list of all extensions in use for a given revoked certificate + * + * @param string $serial + * @param array $crl optional + * @return array|bool + */ + public function getRevokedCertificateExtensions($serial, array $crl = null) + { + if (!isset($crl)) { + $crl = $this->currentCert; + } + if (is_array($rclist = $this->subArray($crl, 'tbsCertList/revokedCertificates'))) { + if (($i = $this->revokedCertificate($rclist, $serial)) !== \false) { + return $this->getExtensions($crl, "tbsCertList/revokedCertificates/{$i}/crlEntryExtensions"); + } + } + return \false; + } + /** + * Set a Revoked Certificate Extension + * + * @param string $serial + * @param string $id + * @param mixed $value + * @param bool $critical optional + * @param bool $replace optional + * @return bool + */ + public function setRevokedCertificateExtension($serial, $id, $value, $critical = \false, $replace = \true) + { + if (isset($this->currentCert['tbsCertList'])) { + if (is_array($rclist =& $this->subArray($this->currentCert, 'tbsCertList/revokedCertificates', \true))) { + if (($i = $this->revokedCertificate($rclist, $serial, \true)) !== \false) { + return $this->setExtensionHelper($id, $value, $critical, $replace, "tbsCertList/revokedCertificates/{$i}/crlEntryExtensions"); + } + } + } + return \false; + } + /** + * Register the mapping for a custom/unsupported extension. + * + * @param string $id + * @param array $mapping + */ + public static function registerExtension($id, array $mapping) + { + if (isset(self::$extensions[$id]) && self::$extensions[$id] !== $mapping) { + throw new \RuntimeException('Extension ' . $id . ' has already been defined with a different mapping.'); + } + self::$extensions[$id] = $mapping; + } + /** + * Register the mapping for a custom/unsupported extension. + * + * @param string $id + * + * @return array|null + */ + public static function getRegisteredExtension($id) + { + return isset(self::$extensions[$id]) ? self::$extensions[$id] : null; + } + /** + * Register the mapping for a custom/unsupported extension. + * + * @param string $id + * @param mixed $value + * @param bool $critical + * @param bool $replace + */ + public function setExtensionValue($id, $value, $critical = \false, $replace = \false) + { + $this->extensionValues[$id] = compact('critical', 'replace', 'value'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger.php new file mode 100644 index 0000000..a5c582d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger.php @@ -0,0 +1,802 @@ + + * add($b); + * + * echo $c->toString(); // outputs 5 + * ?> + * + * + * @author Jim Wigginton + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\Engine; +/** + * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 + * numbers. + * + * @author Jim Wigginton + */ +class BigInteger implements \JsonSerializable +{ + /** + * Main Engine + * + * @var class-string + */ + private static $mainEngine; + /** + * Selected Engines + * + * @var list + */ + private static $engines; + /** + * The actual BigInteger object + * + * @var object + */ + private $value; + /** + * Mode independent value used for serialization. + * + * @see self::__sleep() + * @see self::__wakeup() + * @var string + */ + private $hex; + /** + * Precision (used only for serialization) + * + * @see self::__sleep() + * @see self::__wakeup() + * @var int + */ + private $precision; + /** + * Sets engine type. + * + * Throws an exception if the type is invalid + * + * @param string $main + * @param list $modexps optional + * @return void + */ + public static function setEngine($main, array $modexps = ['DefaultEngine']) + { + self::$engines = []; + $fqmain = 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\' . $main; + if (!class_exists($fqmain) || !method_exists($fqmain, 'isValidEngine')) { + throw new \InvalidArgumentException("{$main} is not a valid engine"); + } + if (!$fqmain::isValidEngine()) { + throw new BadConfigurationException("{$main} is not setup correctly on this system"); + } + /** @var class-string $fqmain */ + self::$mainEngine = $fqmain; + $found = \false; + foreach ($modexps as $modexp) { + try { + $fqmain::setModExpEngine($modexp); + $found = \true; + break; + } catch (\Exception $e) { + } + } + if (!$found) { + throw new BadConfigurationException("No valid modular exponentiation engine found for {$main}"); + } + self::$engines = [$main, $modexp]; + } + /** + * Returns the engine type + * + * @return string[] + */ + public static function getEngine() + { + self::initialize_static_variables(); + return self::$engines; + } + /** + * Initialize static variables + */ + private static function initialize_static_variables() + { + if (!isset(self::$mainEngine)) { + $engines = [['GMP', ['DefaultEngine']], ['PHP64', ['OpenSSL']], ['BCMath', ['OpenSSL']], ['PHP32', ['OpenSSL']], ['PHP64', ['DefaultEngine']], ['PHP32', ['DefaultEngine']]]; + foreach ($engines as $engine) { + try { + self::setEngine($engine[0], $engine[1]); + return; + } catch (\Exception $e) { + } + } + throw new \UnexpectedValueException('No valid BigInteger found. This is only possible when JIT is enabled on Windows and neither the GMP or BCMath extensions are available so either disable JIT or install GMP / BCMath'); + } + } + /** + * Converts base-2, base-10, base-16, and binary strings (base-256) to BigIntegers. + * + * If the second parameter - $base - is negative, then it will be assumed that the number's are encoded using + * two's compliment. The sole exception to this is -10, which is treated the same as 10 is. + * + * @param string|int|BigInteger\Engines\Engine $x Base-10 number or base-$base number if $base set. + * @param int $base + */ + public function __construct($x = 0, $base = 10) + { + self::initialize_static_variables(); + if ($x instanceof self::$mainEngine) { + $this->value = clone $x; + } elseif ($x instanceof BigInteger\Engines\Engine) { + $this->value = new static("{$x}"); + $this->value->setPrecision($x->getPrecision()); + } else { + $this->value = new self::$mainEngine($x, $base); + } + } + /** + * Converts a BigInteger to a base-10 number. + * + * @return string + */ + public function toString() + { + return $this->value->toString(); + } + /** + * __toString() magic method + */ + public function __toString() + { + return (string) $this->value; + } + /** + * __debugInfo() magic method + * + * Will be called, automatically, when print_r() or var_dump() are called + */ + public function __debugInfo() + { + return $this->value->__debugInfo(); + } + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * @param bool $twos_compliment + * @return string + */ + public function toBytes($twos_compliment = \false) + { + return $this->value->toBytes($twos_compliment); + } + /** + * Converts a BigInteger to a hex string (eg. base-16). + * + * @param bool $twos_compliment + * @return string + */ + public function toHex($twos_compliment = \false) + { + return $this->value->toHex($twos_compliment); + } + /** + * Converts a BigInteger to a bit string (eg. base-2). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * @param bool $twos_compliment + * @return string + */ + public function toBits($twos_compliment = \false) + { + return $this->value->toBits($twos_compliment); + } + /** + * Adds two BigIntegers. + * + * @param BigInteger $y + * @return BigInteger + */ + public function add(BigInteger $y) + { + return new static($this->value->add($y->value)); + } + /** + * Subtracts two BigIntegers. + * + * @param BigInteger $y + * @return BigInteger + */ + public function subtract(BigInteger $y) + { + return new static($this->value->subtract($y->value)); + } + /** + * Multiplies two BigIntegers + * + * @param BigInteger $x + * @return BigInteger + */ + public function multiply(BigInteger $x) + { + return new static($this->value->multiply($x->value)); + } + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * Here's an example: + * + * divide($b); + * + * echo $quotient->toString(); // outputs 0 + * echo "\r\n"; + * echo $remainder->toString(); // outputs 10 + * ?> + * + * + * @param BigInteger $y + * @return BigInteger[] + */ + public function divide(BigInteger $y) + { + list($q, $r) = $this->value->divide($y->value); + return [new static($q), new static($r)]; + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * @param BigInteger $n + * @return BigInteger + */ + public function modInverse(BigInteger $n) + { + return new static($this->value->modInverse($n->value)); + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * @param BigInteger $n + * @return BigInteger[] + */ + public function extendedGCD(BigInteger $n) + { + extract($this->value->extendedGCD($n->value)); + /** + * @var BigInteger $gcd + * @var BigInteger $x + * @var BigInteger $y + */ + return ['gcd' => new static($gcd), 'x' => new static($x), 'y' => new static($y)]; + } + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * @param BigInteger $n + * @return BigInteger + */ + public function gcd(BigInteger $n) + { + return new static($this->value->gcd($n->value)); + } + /** + * Absolute value. + * + * @return BigInteger + */ + public function abs() + { + return new static($this->value->abs()); + } + /** + * Set Precision + * + * Some bitwise operations give different results depending on the precision being used. Examples include left + * shift, not, and rotates. + * + * @param int $bits + */ + public function setPrecision($bits) + { + $this->value->setPrecision($bits); + } + /** + * Get Precision + * + * Returns the precision if it exists, false if it doesn't + * + * @return int|bool + */ + public function getPrecision() + { + return $this->value->getPrecision(); + } + /** + * Serialize + * + * Will be called, automatically, when serialize() is called on a BigInteger object. + * + * __sleep() / __wakeup() have been around since PHP 4.0 + * + * \Serializable was introduced in PHP 5.1 and deprecated in PHP 8.1: + * https://wiki.php.net/rfc/phase_out_serializable + * + * __serialize() / __unserialize() were introduced in PHP 7.4: + * https://wiki.php.net/rfc/custom_object_serialization + * + * @return array + */ + public function __sleep() + { + $this->hex = $this->toHex(\true); + $vars = ['hex']; + if ($this->getPrecision() > 0) { + $vars[] = 'precision'; + } + return $vars; + } + /** + * Serialize + * + * Will be called, automatically, when unserialize() is called on a BigInteger object. + */ + public function __wakeup() + { + $temp = new static($this->hex, -16); + $this->value = $temp->value; + if ($this->precision > 0) { + // recalculate $this->bitmask + $this->setPrecision($this->precision); + } + } + /** + * JSON Serialize + * + * Will be called, automatically, when json_encode() is called on a BigInteger object. + * + * @return array{hex: string, precision?: int] + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $result = ['hex' => $this->toHex(\true)]; + if ($this->precision > 0) { + $result['precision'] = $this->getPrecision(); + } + return $result; + } + /** + * Performs modular exponentiation. + * + * @param BigInteger $e + * @param BigInteger $n + * @return BigInteger + */ + public function powMod(BigInteger $e, BigInteger $n) + { + return new static($this->value->powMod($e->value, $n->value)); + } + /** + * Performs modular exponentiation. + * + * @param BigInteger $e + * @param BigInteger $n + * @return BigInteger + */ + public function modPow(BigInteger $e, BigInteger $n) + { + return new static($this->value->modPow($e->value, $n->value)); + } + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this + * is demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * {@internal Could return $this->subtract($x), but that's not as fast as what we do do.} + * + * @param BigInteger $y + * @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @see self::equals() + */ + public function compare(BigInteger $y) + { + return $this->value->compare($y->value); + } + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use BigInteger::compare() + * + * @param BigInteger $x + * @return bool + */ + public function equals(BigInteger $x) + { + return $this->value->equals($x->value); + } + /** + * Logical Not + * + * @return BigInteger + */ + public function bitwise_not() + { + return new static($this->value->bitwise_not()); + } + /** + * Logical And + * + * @param BigInteger $x + * @return BigInteger + */ + public function bitwise_and(BigInteger $x) + { + return new static($this->value->bitwise_and($x->value)); + } + /** + * Logical Or + * + * @param BigInteger $x + * @return BigInteger + */ + public function bitwise_or(BigInteger $x) + { + return new static($this->value->bitwise_or($x->value)); + } + /** + * Logical Exclusive Or + * + * @param BigInteger $x + * @return BigInteger + */ + public function bitwise_xor(BigInteger $x) + { + return new static($this->value->bitwise_xor($x->value)); + } + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. + * + * @param int $shift + * @return BigInteger + */ + public function bitwise_rightShift($shift) + { + return new static($this->value->bitwise_rightShift($shift)); + } + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. + * + * @param int $shift + * @return BigInteger + */ + public function bitwise_leftShift($shift) + { + return new static($this->value->bitwise_leftShift($shift)); + } + /** + * Logical Left Rotate + * + * Instead of the top x bits being dropped they're appended to the shifted bit string. + * + * @param int $shift + * @return BigInteger + */ + public function bitwise_leftRotate($shift) + { + return new static($this->value->bitwise_leftRotate($shift)); + } + /** + * Logical Right Rotate + * + * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. + * + * @param int $shift + * @return BigInteger + */ + public function bitwise_rightRotate($shift) + { + return new static($this->value->bitwise_rightRotate($shift)); + } + /** + * Returns the smallest and largest n-bit number + * + * @param int $bits + * @return BigInteger[] + */ + public static function minMaxBits($bits) + { + self::initialize_static_variables(); + $class = self::$mainEngine; + extract($class::minMaxBits($bits)); + /** @var BigInteger $min + * @var BigInteger $max + */ + return ['min' => new static($min), 'max' => new static($max)]; + } + /** + * Return the size of a BigInteger in bits + * + * @return int + */ + public function getLength() + { + return $this->value->getLength(); + } + /** + * Return the size of a BigInteger in bytes + * + * @return int + */ + public function getLengthInBytes() + { + return $this->value->getLengthInBytes(); + } + /** + * Generates a random number of a certain size + * + * Bit length is equal to $size + * + * @param int $size + * @return BigInteger + */ + public static function random($size) + { + self::initialize_static_variables(); + $class = self::$mainEngine; + return new static($class::random($size)); + } + /** + * Generates a random prime number of a certain size + * + * Bit length is equal to $size + * + * @param int $size + * @return BigInteger + */ + public static function randomPrime($size) + { + self::initialize_static_variables(); + $class = self::$mainEngine; + return new static($class::randomPrime($size)); + } + /** + * Generate a random prime number between a range + * + * If there's not a prime within the given range, false will be returned. + * + * @param BigInteger $min + * @param BigInteger $max + * @return false|BigInteger + */ + public static function randomRangePrime(BigInteger $min, BigInteger $max) + { + $class = self::$mainEngine; + return new static($class::randomRangePrime($min->value, $max->value)); + } + /** + * Generate a random number between a range + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * BigInteger::randomRange($min, $max) + * BigInteger::randomRange($max, $min) + * + * @param BigInteger $min + * @param BigInteger $max + * @return BigInteger + */ + public static function randomRange(BigInteger $min, BigInteger $max) + { + $class = self::$mainEngine; + return new static($class::randomRange($min->value, $max->value)); + } + /** + * Checks a numer to see if it's prime + * + * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the + * $t parameter is distributability. BigInteger::randomPrime() can be distributed across multiple pageloads + * on a website instead of just one. + * + * @param int|bool $t + * @return bool + */ + public function isPrime($t = \false) + { + return $this->value->isPrime($t); + } + /** + * Calculates the nth root of a biginteger. + * + * Returns the nth root of a positive biginteger, where n defaults to 2 + * + * @param int $n optional + * @return BigInteger + */ + public function root($n = 2) + { + return new static($this->value->root($n)); + } + /** + * Performs exponentiation. + * + * @param BigInteger $n + * @return BigInteger + */ + public function pow(BigInteger $n) + { + return new static($this->value->pow($n->value)); + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param BigInteger ...$nums + * @return BigInteger + */ + public static function min(BigInteger ...$nums) + { + $class = self::$mainEngine; + $nums = array_map(function ($num) { + return $num->value; + }, $nums); + return new static($class::min(...$nums)); + } + /** + * Return the maximum BigInteger between an arbitrary number of BigIntegers. + * + * @param BigInteger ...$nums + * @return BigInteger + */ + public static function max(BigInteger ...$nums) + { + $class = self::$mainEngine; + $nums = array_map(function ($num) { + return $num->value; + }, $nums); + return new static($class::max(...$nums)); + } + /** + * Tests BigInteger to see if it is between two integers, inclusive + * + * @param BigInteger $min + * @param BigInteger $max + * @return bool + */ + public function between(BigInteger $min, BigInteger $max) + { + return $this->value->between($min->value, $max->value); + } + /** + * Clone + */ + public function __clone() + { + $this->value = clone $this->value; + } + /** + * Is Odd? + * + * @return bool + */ + public function isOdd() + { + return $this->value->isOdd(); + } + /** + * Tests if a bit is set + * + * @param int $x + * @return bool + */ + public function testBit($x) + { + return $this->value->testBit($x); + } + /** + * Is Negative? + * + * @return bool + */ + public function isNegative() + { + return $this->value->isNegative(); + } + /** + * Negate + * + * Given $k, returns -$k + * + * @return BigInteger + */ + public function negate() + { + return new static($this->value->negate()); + } + /** + * Scan for 1 and right shift by that amount + * + * ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); + * + * @param BigInteger $r + * @return int + */ + public static function scan1divide(BigInteger $r) + { + $class = self::$mainEngine; + return $class::scan1divide($r->value); + } + /** + * Create Recurring Modulo Function + * + * Sometimes it may be desirable to do repeated modulos with the same number outside of + * modular exponentiation + * + * @return callable + */ + public function createRecurringModuloFunction() + { + $func = $this->value->createRecurringModuloFunction(); + return function (BigInteger $x) use($func) { + return new static($func($x->value)); + }; + } + /** + * Bitwise Split + * + * Splits BigInteger's into chunks of $split bits + * + * @param int $split + * @return BigInteger[] + */ + public function bitwise_split($split) + { + return array_map(function ($val) { + return new static($val); + }, $this->value->bitwise_split($split)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php new file mode 100644 index 0000000..6900f2d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php @@ -0,0 +1,601 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +/** + * BCMath Engine. + * + * @author Jim Wigginton + */ +class BCMath extends Engine +{ + /** + * Can Bitwise operations be done fast? + * + * @see parent::bitwise_leftRotate() + * @see parent::bitwise_rightRotate() + */ + const FAST_BITWISE = \false; + /** + * Engine Directory + * + * @see parent::setModExpEngine + */ + const ENGINE_DIR = 'BCMath'; + /** + * Test for engine validity + * + * @return bool + * @see parent::__construct() + */ + public static function isValidEngine() + { + return extension_loaded('bcmath'); + } + /** + * Default constructor + * + * @param mixed $x integer Base-10 number or base-$base number if $base set. + * @param int $base + * @see parent::__construct() + */ + public function __construct($x = 0, $base = 10) + { + if (!isset(static::$isValidEngine[static::class])) { + static::$isValidEngine[static::class] = self::isValidEngine(); + } + if (!static::$isValidEngine[static::class]) { + throw new BadConfigurationException('BCMath is not setup correctly on this system'); + } + $this->value = '0'; + parent::__construct($x, $base); + } + /** + * Initialize a BCMath BigInteger Engine instance + * + * @param int $base + * @see parent::__construct() + */ + protected function initialize($base) + { + switch (abs($base)) { + case 256: + // round $len to the nearest 4 + $len = strlen($this->value) + 3 & ~3; + $x = str_pad($this->value, $len, chr(0), \STR_PAD_LEFT); + $this->value = '0'; + for ($i = 0; $i < $len; $i += 4) { + $this->value = bcmul($this->value, '4294967296', 0); + // 4294967296 == 2**32 + $this->value = bcadd($this->value, 0x1000000 * ord($x[$i]) + (ord($x[$i + 1]) << 16 | ord($x[$i + 2]) << 8 | ord($x[$i + 3])), 0); + } + if ($this->is_negative) { + $this->value = '-' . $this->value; + } + break; + case 16: + $x = strlen($this->value) & 1 ? '0' . $this->value : $this->value; + $temp = new self(Strings::hex2bin($x), 256); + $this->value = $this->is_negative ? '-' . $temp->value : $temp->value; + $this->is_negative = \false; + break; + case 10: + // explicitly casting $x to a string is necessary, here, since doing $x[0] on -1 yields different + // results then doing it on '-1' does (modInverse does $x[0]) + $this->value = $this->value === '-' ? '0' : (string) $this->value; + } + } + /** + * Converts a BigInteger to a base-10 number. + * + * @return string + */ + public function toString() + { + if ($this->value === '0') { + return '0'; + } + return ltrim($this->value, '0'); + } + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * @param bool $twos_compliment + * @return string + */ + public function toBytes($twos_compliment = \false) + { + if ($twos_compliment) { + return $this->toBytesHelper(); + } + $value = ''; + $current = $this->value; + if ($current[0] == '-') { + $current = substr($current, 1); + } + while (bccomp($current, '0', 0) > 0) { + $temp = bcmod($current, '16777216'); + $value = chr($temp >> 16) . chr($temp >> 8) . chr($temp) . $value; + $current = bcdiv($current, '16777216', 0); + } + return $this->precision > 0 ? substr(str_pad($value, $this->precision >> 3, chr(0), \STR_PAD_LEFT), -($this->precision >> 3)) : ltrim($value, chr(0)); + } + /** + * Adds two BigIntegers. + * + * @param BCMath $y + * @return BCMath + */ + public function add(BCMath $y) + { + $temp = new self(); + $temp->value = bcadd($this->value, $y->value); + return $this->normalize($temp); + } + /** + * Subtracts two BigIntegers. + * + * @param BCMath $y + * @return BCMath + */ + public function subtract(BCMath $y) + { + $temp = new self(); + $temp->value = bcsub($this->value, $y->value); + return $this->normalize($temp); + } + /** + * Multiplies two BigIntegers. + * + * @param BCMath $x + * @return BCMath + */ + public function multiply(BCMath $x) + { + $temp = new self(); + $temp->value = bcmul($this->value, $x->value); + return $this->normalize($temp); + } + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * @param BCMath $y + * @return array{static, static} + */ + public function divide(BCMath $y) + { + $quotient = new self(); + $remainder = new self(); + $quotient->value = bcdiv($this->value, $y->value, 0); + $remainder->value = bcmod($this->value, $y->value); + if ($remainder->value[0] == '-') { + $remainder->value = bcadd($remainder->value, $y->value[0] == '-' ? substr($y->value, 1) : $y->value, 0); + } + return [$this->normalize($quotient), $this->normalize($remainder)]; + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * @param BCMath $n + * @return false|BCMath + */ + public function modInverse(BCMath $n) + { + return $this->modInverseHelper($n); + } + /** + * Calculates the greatest common divisor and Bezout's identity. + * + * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that + * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which + * combination is returned is dependent upon which mode is in use. See + * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. + * + * @param BCMath $n + * @return array{gcd: static, x: static, y: static} + */ + public function extendedGCD(BCMath $n) + { + // it might be faster to use the binary xGCD algorithim here, as well, but (1) that algorithim works + // best when the base is a power of 2 and (2) i don't think it'd make much difference, anyway. as is, + // the basic extended euclidean algorithim is what we're using. + $u = $this->value; + $v = $n->value; + $a = '1'; + $b = '0'; + $c = '0'; + $d = '1'; + while (bccomp($v, '0', 0) != 0) { + $q = bcdiv($u, $v, 0); + $temp = $u; + $u = $v; + $v = bcsub($temp, bcmul($v, $q, 0), 0); + $temp = $a; + $a = $c; + $c = bcsub($temp, bcmul($a, $q, 0), 0); + $temp = $b; + $b = $d; + $d = bcsub($temp, bcmul($b, $q, 0), 0); + } + return ['gcd' => $this->normalize(new static($u)), 'x' => $this->normalize(new static($a)), 'y' => $this->normalize(new static($b))]; + } + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * @param BCMath $n + * @return BCMath + */ + public function gcd(BCMath $n) + { + extract($this->extendedGCD($n)); + /** @var BCMath $gcd */ + return $gcd; + } + /** + * Absolute value. + * + * @return BCMath + */ + public function abs() + { + $temp = new static(); + $temp->value = strlen($this->value) && $this->value[0] == '-' ? substr($this->value, 1) : $this->value; + return $temp; + } + /** + * Logical And + * + * @param BCMath $x + * @return BCMath + */ + public function bitwise_and(BCMath $x) + { + return $this->bitwiseAndHelper($x); + } + /** + * Logical Or + * + * @param BCMath $x + * @return BCMath + */ + public function bitwise_or(BCMath $x) + { + return $this->bitwiseXorHelper($x); + } + /** + * Logical Exclusive Or + * + * @param BCMath $x + * @return BCMath + */ + public function bitwise_xor(BCMath $x) + { + return $this->bitwiseXorHelper($x); + } + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. + * + * @param int $shift + * @return BCMath + */ + public function bitwise_rightShift($shift) + { + $temp = new static(); + $temp->value = bcdiv($this->value, bcpow('2', $shift, 0), 0); + return $this->normalize($temp); + } + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. + * + * @param int $shift + * @return BCMath + */ + public function bitwise_leftShift($shift) + { + $temp = new static(); + $temp->value = bcmul($this->value, bcpow('2', $shift, 0), 0); + return $this->normalize($temp); + } + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this + * is demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * {@internal Could return $this->subtract($x), but that's not as fast as what we do do.} + * + * @param BCMath $y + * @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @see self::equals() + */ + public function compare(BCMath $y) + { + return bccomp($this->value, $y->value, 0); + } + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use BigInteger::compare() + * + * @param BCMath $x + * @return bool + */ + public function equals(BCMath $x) + { + return $this->value == $x->value; + } + /** + * Performs modular exponentiation. + * + * @param BCMath $e + * @param BCMath $n + * @return BCMath + */ + public function modPow(BCMath $e, BCMath $n) + { + return $this->powModOuter($e, $n); + } + /** + * Performs modular exponentiation. + * + * Alias for modPow(). + * + * @param BCMath $e + * @param BCMath $n + * @return BCMath + */ + public function powMod(BCMath $e, BCMath $n) + { + return $this->powModOuter($e, $n); + } + /** + * Performs modular exponentiation. + * + * @param BCMath $e + * @param BCMath $n + * @return BCMath + */ + protected function powModInner(BCMath $e, BCMath $n) + { + try { + $class = static::$modexpEngine[static::class]; + return $class::powModHelper($this, $e, $n, static::class); + } catch (\Exception $err) { + return BCMath\DefaultEngine::powModHelper($this, $e, $n, static::class); + } + } + /** + * Normalize + * + * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision + * + * @param BCMath $result + * @return BCMath + */ + protected function normalize(BCMath $result) + { + $result->precision = $this->precision; + $result->bitmask = $this->bitmask; + if ($result->bitmask !== \false) { + $result->value = bcmod($result->value, $result->bitmask->value); + } + return $result; + } + /** + * Generate a random prime number between a range + * + * If there's not a prime within the given range, false will be returned. + * + * @param BCMath $min + * @param BCMath $max + * @return false|BCMath + */ + public static function randomRangePrime(BCMath $min, BCMath $max) + { + return self::randomRangePrimeOuter($min, $max); + } + /** + * Generate a random number between a range + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * BigInteger::randomRange($min, $max) + * BigInteger::randomRange($max, $min) + * + * @param BCMath $min + * @param BCMath $max + * @return BCMath + */ + public static function randomRange(BCMath $min, BCMath $max) + { + return self::randomRangeHelper($min, $max); + } + /** + * Make the current number odd + * + * If the current number is odd it'll be unchanged. If it's even, one will be added to it. + * + * @see self::randomPrime() + */ + protected function make_odd() + { + if (!$this->isOdd()) { + $this->value = bcadd($this->value, '1'); + } + } + /** + * Test the number against small primes. + * + * @see self::isPrime() + */ + protected function testSmallPrimes() + { + if ($this->value === '1') { + return \false; + } + if ($this->value === '2') { + return \true; + } + if ($this->value[strlen($this->value) - 1] % 2 == 0) { + return \false; + } + $value = $this->value; + foreach (self::PRIMES as $prime) { + $r = bcmod($this->value, $prime); + if ($r == '0') { + return $this->value == $prime; + } + } + return \true; + } + /** + * Scan for 1 and right shift by that amount + * + * ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); + * + * @param BCMath $r + * @return int + * @see self::isPrime() + */ + public static function scan1divide(BCMath $r) + { + $r_value =& $r->value; + $s = 0; + // if $n was 1, $r would be 0 and this would be an infinite loop, hence our $this->equals(static::$one[static::class]) check earlier + while ($r_value[strlen($r_value) - 1] % 2 == 0) { + $r_value = bcdiv($r_value, '2', 0); + ++$s; + } + return $s; + } + /** + * Performs exponentiation. + * + * @param BCMath $n + * @return BCMath + */ + public function pow(BCMath $n) + { + $temp = new self(); + $temp->value = bcpow($this->value, $n->value); + return $this->normalize($temp); + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param BCMath ...$nums + * @return BCMath + */ + public static function min(BCMath ...$nums) + { + return self::minHelper($nums); + } + /** + * Return the maximum BigInteger between an arbitrary number of BigIntegers. + * + * @param BCMath ...$nums + * @return BCMath + */ + public static function max(BCMath ...$nums) + { + return self::maxHelper($nums); + } + /** + * Tests BigInteger to see if it is between two integers, inclusive + * + * @param BCMath $min + * @param BCMath $max + * @return bool + */ + public function between(BCMath $min, BCMath $max) + { + return $this->compare($min) >= 0 && $this->compare($max) <= 0; + } + /** + * Set Bitmask + * + * @param int $bits + * @return Engine + * @see self::setPrecision() + */ + protected static function setBitmask($bits) + { + $temp = parent::setBitmask($bits); + return $temp->add(static::$one[static::class]); + } + /** + * Is Odd? + * + * @return bool + */ + public function isOdd() + { + return $this->value[strlen($this->value) - 1] % 2 == 1; + } + /** + * Tests if a bit is set + * + * @return bool + */ + public function testBit($x) + { + return bccomp(bcmod($this->value, bcpow('2', $x + 1, 0)), bcpow('2', $x, 0), 0) >= 0; + } + /** + * Is Negative? + * + * @return bool + */ + public function isNegative() + { + return strlen($this->value) && $this->value[0] == '-'; + } + /** + * Negate + * + * Given $k, returns -$k + * + * @return BCMath + */ + public function negate() + { + $temp = clone $this; + if (!strlen($temp->value)) { + return $temp; + } + $temp->value = $temp->value[0] == '-' ? substr($this->value, 1) : '-' . $this->value; + return $temp; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php new file mode 100644 index 0000000..c2be5f6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php @@ -0,0 +1,102 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; +/** + * Sliding Window Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Base extends BCMath +{ + /** + * Cache constants + * + * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. + * + */ + const VARIABLE = 0; + /** + * $cache[self::DATA] contains the cached data. + * + */ + const DATA = 1; + /** + * Test for engine validity + * + * @return bool + */ + public static function isValidEngine() + { + return static::class != __CLASS__; + } + /** + * Performs modular exponentiation. + * + * @param BCMath $x + * @param BCMath $e + * @param BCMath $n + * @param string $class + * @return BCMath + */ + protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n, $class) + { + if (empty($e->value)) { + $temp = new $class(); + $temp->value = '1'; + return $x->normalize($temp); + } + return $x->normalize(static::slidingWindow($x, $e, $n, $class)); + } + /** + * Modular reduction preparation + * + * @param string $x + * @param string $n + * @param string $class + * @see self::slidingWindow() + * @return string + */ + protected static function prepareReduce($x, $n, $class) + { + return static::reduce($x, $n); + } + /** + * Modular multiply + * + * @param string $x + * @param string $y + * @param string $n + * @param string $class + * @see self::slidingWindow() + * @return string + */ + protected static function multiplyReduce($x, $y, $n, $class) + { + return static::reduce(bcmul($x, $y), $n); + } + /** + * Modular square + * + * @param string $x + * @param string $n + * @param string $class + * @see self::slidingWindow() + * @return string + */ + protected static function squareReduce($x, $n, $class) + { + return static::reduce(bcmul($x, $x), $n); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php new file mode 100644 index 0000000..0f0e7d2 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php @@ -0,0 +1,37 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; +/** + * Built-In BCMath Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class BuiltIn extends BCMath +{ + /** + * Performs modular exponentiation. + * + * @param BCMath $x + * @param BCMath $e + * @param BCMath $n + * @return BCMath + */ + protected static function powModHelper(BCMath $x, BCMath $e, BCMath $n) + { + $temp = new BCMath(); + $temp->value = bcpowmod($x->value, $e->value, $n->value); + return $x->normalize($temp); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php new file mode 100644 index 0000000..873c233 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php @@ -0,0 +1,23 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath\Reductions\Barrett; +/** + * PHP Default Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class DefaultEngine extends Barrett +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php new file mode 100644 index 0000000..e02458d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php @@ -0,0 +1,23 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\OpenSSL as Progenitor; +/** + * OpenSSL Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class OpenSSL extends Progenitor +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php new file mode 100644 index 0000000..cd77adc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php @@ -0,0 +1,157 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath\Base; +/** + * PHP Barrett Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Barrett extends Base +{ + /** + * Cache constants + * + * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. + * + */ + const VARIABLE = 0; + /** + * $cache[self::DATA] contains the cached data. + * + */ + const DATA = 1; + /** + * Barrett Modular Reduction + * + * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, + * so as not to require negative numbers (initially, this script didn't support negative numbers). + * + * Employs "folding", as described at + * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from + * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." + * + * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that + * usable on account of (1) its not using reasonable radix points as discussed in + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable + * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that + * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line + * comments for details. + * + * @param string $n + * @param string $m + * @return string + */ + protected static function reduce($n, $m) + { + static $cache = [self::VARIABLE => [], self::DATA => []]; + $m_length = strlen($m); + if (strlen($n) > 2 * $m_length) { + return bcmod($n, $m); + } + // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced + if ($m_length < 5) { + return self::regularBarrett($n, $m); + } + // n = 2 * m.length + if (($key = array_search($m, $cache[self::VARIABLE])) === \false) { + $key = count($cache[self::VARIABLE]); + $cache[self::VARIABLE][] = $m; + $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); + $u = bcdiv($lhs, $m, 0); + $m1 = bcsub($lhs, bcmul($u, $m)); + $cache[self::DATA][] = [ + 'u' => $u, + // m.length >> 1 (technically (m.length >> 1) + 1) + 'm1' => $m1, + ]; + } else { + extract($cache[self::DATA][$key]); + } + $cutoff = $m_length + ($m_length >> 1); + $lsd = substr($n, -$cutoff); + $msd = substr($n, 0, -$cutoff); + $temp = bcmul($msd, $m1); + // m.length + (m.length >> 1) + $n = bcadd($lsd, $temp); + // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) + //if ($m_length & 1) { + // return self::regularBarrett($n, $m); + //} + // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 + $temp = substr($n, 0, -$m_length + 1); + // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 + // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 + $temp = bcmul($temp, $u); + // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 + // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + $temp = substr($temp, 0, -($m_length >> 1) - 1); + // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 + // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) + $temp = bcmul($temp, $m); + // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit + // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop + // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). + $result = bcsub($n, $temp); + //if (bccomp($result, '0') < 0) { + if ($result[0] == '-') { + $temp = '1' . str_repeat('0', $m_length + 1); + $result = bcadd($result, $temp); + } + while (bccomp($result, $m) >= 0) { + $result = bcsub($result, $m); + } + return $result; + } + /** + * (Regular) Barrett Modular Reduction + * + * For numbers with more than four digits BigInteger::_barrett() is faster. The difference between that and this + * is that this function does not fold the denominator into a smaller form. + * + * @param string $x + * @param string $n + * @return string + */ + private static function regularBarrett($x, $n) + { + static $cache = [self::VARIABLE => [], self::DATA => []]; + $n_length = strlen($n); + if (strlen($x) > 2 * $n_length) { + return bcmod($x, $n); + } + if (($key = array_search($n, $cache[self::VARIABLE])) === \false) { + $key = count($cache[self::VARIABLE]); + $cache[self::VARIABLE][] = $n; + $lhs = '1' . str_repeat('0', 2 * $n_length); + $cache[self::DATA][] = bcdiv($lhs, $n, 0); + } + $temp = substr($x, 0, -$n_length + 1); + $temp = bcmul($temp, $cache[self::DATA][$key]); + $temp = substr($temp, 0, -$n_length - 1); + $r1 = substr($x, -$n_length - 1); + $r2 = substr(bcmul($temp, $n), -$n_length - 1); + $result = bcsub($r1, $r2); + //if (bccomp($result, '0') < 0) { + if ($result[0] == '-') { + $q = '1' . str_repeat('0', $n_length + 1); + $result = bcadd($result, $q); + } + while (bccomp($result, $n) >= 0) { + $result = bcsub($result, $n); + } + return $result; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php new file mode 100644 index 0000000..ce1e275 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php @@ -0,0 +1,96 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\BCMath\Base; +/** + * PHP Barrett Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class EvalBarrett extends Base +{ + /** + * Custom Reduction Function + * + * @see self::generateCustomReduction + */ + private static $custom_reduction; + /** + * Barrett Modular Reduction + * + * This calls a dynamically generated loop unrolled function that's specific to a given modulo. + * Array lookups are avoided as are if statements testing for how many bits the host OS supports, etc. + * + * @param string $n + * @param string $m + * @return string + */ + protected static function reduce($n, $m) + { + $inline = self::$custom_reduction; + return $inline($n); + } + /** + * Generate Custom Reduction + * + * @param BCMath $m + * @param string $class + * @return callable|void + */ + protected static function generateCustomReduction(BCMath $m, $class) + { + $m_length = strlen($m); + if ($m_length < 5) { + $code = 'return bcmod($x, $n);'; + eval('$func = function ($n) { ' . $code . '};'); + self::$custom_reduction = $func; + return; + } + $lhs = '1' . str_repeat('0', $m_length + ($m_length >> 1)); + $u = bcdiv($lhs, $m, 0); + $m1 = bcsub($lhs, bcmul($u, $m)); + $cutoff = $m_length + ($m_length >> 1); + $m = "'{$m}'"; + $u = "'{$u}'"; + $m1 = "'{$m1}'"; + $code = ' + $lsd = substr($n, -' . $cutoff . '); + $msd = substr($n, 0, -' . $cutoff . '); + + $temp = bcmul($msd, ' . $m1 . '); + $n = bcadd($lsd, $temp); + + $temp = substr($n, 0, ' . (-$m_length + 1) . '); + $temp = bcmul($temp, ' . $u . '); + $temp = substr($temp, 0, ' . (-($m_length >> 1) - 1) . '); + $temp = bcmul($temp, ' . $m . '); + + $result = bcsub($n, $temp); + + if ($result[0] == \'-\') { + $temp = \'1' . str_repeat('0', $m_length + 1) . '\'; + $result = bcadd($result, $temp); + } + + while (bccomp($result, ' . $m . ') >= 0) { + $result = bcsub($result, ' . $m . '); + } + + return $result;'; + eval('$func = function ($n) { ' . $code . '};'); + self::$custom_reduction = $func; + return $func; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php new file mode 100644 index 0000000..4b1ac87 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php @@ -0,0 +1,1160 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * Base Engine. + * + * @author Jim Wigginton + */ +abstract class Engine implements \JsonSerializable +{ + /* final protected */ + const PRIMES = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]; + /** + * BigInteger(0) + * + * @var array, static> + */ + protected static $zero = []; + /** + * BigInteger(1) + * + * @var array, static> + */ + protected static $one = []; + /** + * BigInteger(2) + * + * @var array, static> + */ + protected static $two = []; + /** + * Modular Exponentiation Engine + * + * @var array, class-string> + */ + protected static $modexpEngine; + /** + * Engine Validity Flag + * + * @var array, bool> + */ + protected static $isValidEngine; + /** + * Holds the BigInteger's value + * + * @var \GMP|string|array|int + */ + protected $value; + /** + * Holds the BigInteger's sign + * + * @var bool + */ + protected $is_negative; + /** + * Precision + * + * @see static::setPrecision() + * @var int + */ + protected $precision = -1; + /** + * Precision Bitmask + * + * @see static::setPrecision() + * @var static|false + */ + protected $bitmask = \false; + /** + * Recurring Modulo Function + * + * @var callable + */ + protected $reduce; + /** + * Mode independent value used for serialization. + * + * @see self::__sleep() + * @see self::__wakeup() + * @var string + */ + protected $hex; + /** + * Default constructor + * + * @param int|numeric-string $x integer Base-10 number or base-$base number if $base set. + * @param int $base + */ + public function __construct($x = 0, $base = 10) + { + if (!array_key_exists(static::class, static::$zero)) { + static::$zero[static::class] = null; + // Placeholder to prevent infinite loop. + static::$zero[static::class] = new static(0); + static::$one[static::class] = new static(1); + static::$two[static::class] = new static(2); + } + // '0' counts as empty() but when the base is 256 '0' is equal to ord('0') or 48 + // '0' is the only value like this per http://php.net/empty + if (empty($x) && (abs($base) != 256 || $x !== '0')) { + return; + } + switch ($base) { + case -256: + case 256: + if ($base == -256 && ord($x[0]) & 0x80) { + $this->value = ~$x; + $this->is_negative = \true; + } else { + $this->value = $x; + $this->is_negative = \false; + } + $this->initialize($base); + if ($this->is_negative) { + $temp = $this->add(new static('-1')); + $this->value = $temp->value; + } + break; + case -16: + case 16: + if ($base > 0 && $x[0] == '-') { + $this->is_negative = \true; + $x = substr($x, 1); + } + $x = preg_replace('#^(?:0x)?([A-Fa-f0-9]*).*#s', '$1', $x); + $is_negative = \false; + if ($base < 0 && hexdec($x[0]) >= 8) { + $this->is_negative = $is_negative = \true; + $x = Strings::bin2hex(~Strings::hex2bin($x)); + } + $this->value = $x; + $this->initialize($base); + if ($is_negative) { + $temp = $this->add(new static('-1')); + $this->value = $temp->value; + } + break; + case -10: + case 10: + // (?value = preg_replace('#(?value) || $this->value == '-') { + $this->value = '0'; + } + $this->initialize($base); + break; + case -2: + case 2: + if ($base > 0 && $x[0] == '-') { + $this->is_negative = \true; + $x = substr($x, 1); + } + $x = preg_replace('#^([01]*).*#s', '$1', $x); + $temp = new static(Strings::bits2bin($x), 128 * $base); + // ie. either -16 or +16 + $this->value = $temp->value; + if ($temp->is_negative) { + $this->is_negative = \true; + } + break; + default: + } + } + /** + * Sets engine type. + * + * Throws an exception if the type is invalid + * + * @param class-string $engine + */ + public static function setModExpEngine($engine) + { + $fqengine = '\\phpseclib3\\Math\\BigInteger\\Engines\\' . static::ENGINE_DIR . '\\' . $engine; + if (!class_exists($fqengine) || !method_exists($fqengine, 'isValidEngine')) { + throw new \InvalidArgumentException("{$engine} is not a valid engine"); + } + if (!$fqengine::isValidEngine()) { + throw new BadConfigurationException("{$engine} is not setup correctly on this system"); + } + static::$modexpEngine[static::class] = $fqengine; + } + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * @return string + */ + protected function toBytesHelper() + { + $comparison = $this->compare(new static()); + if ($comparison == 0) { + return $this->precision > 0 ? str_repeat(chr(0), $this->precision + 1 >> 3) : ''; + } + $temp = $comparison < 0 ? $this->add(new static(1)) : $this; + $bytes = $temp->toBytes(); + if (!strlen($bytes)) { + // eg. if the number we're trying to convert is -1 + $bytes = chr(0); + } + if (ord($bytes[0]) & 0x80) { + $bytes = chr(0) . $bytes; + } + return $comparison < 0 ? ~$bytes : $bytes; + } + /** + * Converts a BigInteger to a hex string (eg. base-16). + * + * @param bool $twos_compliment + * @return string + */ + public function toHex($twos_compliment = \false) + { + return Strings::bin2hex($this->toBytes($twos_compliment)); + } + /** + * Converts a BigInteger to a bit string (eg. base-2). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * @param bool $twos_compliment + * @return string + */ + public function toBits($twos_compliment = \false) + { + $hex = $this->toBytes($twos_compliment); + $bits = Strings::bin2bits($hex); + $result = $this->precision > 0 ? substr($bits, -$this->precision) : ltrim($bits, '0'); + if ($twos_compliment && $this->compare(new static()) > 0 && $this->precision <= 0) { + return '0' . $result; + } + return $result; + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * {@internal See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=21 HAC 14.64} for more information.} + * + * @param Engine $n + * @return static|false + */ + protected function modInverseHelper(Engine $n) + { + // $x mod -$n == $x mod $n. + $n = $n->abs(); + if ($this->compare(static::$zero[static::class]) < 0) { + $temp = $this->abs(); + $temp = $temp->modInverse($n); + return $this->normalize($n->subtract($temp)); + } + extract($this->extendedGCD($n)); + /** + * @var Engine $gcd + * @var Engine $x + */ + if (!$gcd->equals(static::$one[static::class])) { + return \false; + } + $x = $x->compare(static::$zero[static::class]) < 0 ? $x->add($n) : $x; + return $this->compare(static::$zero[static::class]) < 0 ? $this->normalize($n->subtract($x)) : $this->normalize($x); + } + /** + * Serialize + * + * Will be called, automatically, when serialize() is called on a BigInteger object. + * + * @return array + */ + public function __sleep() + { + $this->hex = $this->toHex(\true); + $vars = ['hex']; + if ($this->precision > 0) { + $vars[] = 'precision'; + } + return $vars; + } + /** + * Serialize + * + * Will be called, automatically, when unserialize() is called on a BigInteger object. + * + * @return void + */ + public function __wakeup() + { + $temp = new static($this->hex, -16); + $this->value = $temp->value; + $this->is_negative = $temp->is_negative; + if ($this->precision > 0) { + // recalculate $this->bitmask + $this->setPrecision($this->precision); + } + } + /** + * JSON Serialize + * + * Will be called, automatically, when json_encode() is called on a BigInteger object. + * + * @return array{hex: string, precision?: int] + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + $result = ['hex' => $this->toHex(\true)]; + if ($this->precision > 0) { + $result['precision'] = $this->precision; + } + return $result; + } + /** + * Converts a BigInteger to a base-10 number. + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + /** + * __debugInfo() magic method + * + * Will be called, automatically, when print_r() or var_dump() are called + * + * @return array + */ + public function __debugInfo() + { + $result = ['value' => '0x' . $this->toHex(\true), 'engine' => basename(static::class)]; + return $this->precision > 0 ? $result + ['precision' => $this->precision] : $result; + } + /** + * Set Precision + * + * Some bitwise operations give different results depending on the precision being used. Examples include left + * shift, not, and rotates. + * + * @param int $bits + */ + public function setPrecision($bits) + { + if ($bits < 1) { + $this->precision = -1; + $this->bitmask = \false; + return; + } + $this->precision = $bits; + $this->bitmask = static::setBitmask($bits); + $temp = $this->normalize($this); + $this->value = $temp->value; + } + /** + * Get Precision + * + * Returns the precision if it exists, -1 if it doesn't + * + * @return int + */ + public function getPrecision() + { + return $this->precision; + } + /** + * Set Bitmask + * @return static + * @param int $bits + * @see self::setPrecision() + */ + protected static function setBitmask($bits) + { + return new static(chr((1 << ($bits & 0x7)) - 1) . str_repeat(chr(0xff), $bits >> 3), 256); + } + /** + * Logical Not + * + * @return Engine|string + */ + public function bitwise_not() + { + // calculuate "not" without regard to $this->precision + // (will always result in a smaller number. ie. ~1 isn't 1111 1110 - it's 0) + $temp = $this->toBytes(); + if ($temp == '') { + return $this->normalize(static::$zero[static::class]); + } + $pre_msb = decbin(ord($temp[0])); + $temp = ~$temp; + $msb = decbin(ord($temp[0])); + if (strlen($msb) == 8) { + $msb = substr($msb, strpos($msb, '0')); + } + $temp[0] = chr(bindec($msb)); + // see if we need to add extra leading 1's + $current_bits = strlen($pre_msb) + 8 * strlen($temp) - 8; + $new_bits = $this->precision - $current_bits; + if ($new_bits <= 0) { + return $this->normalize(new static($temp, 256)); + } + // generate as many leading 1's as we need to. + $leading_ones = chr((1 << ($new_bits & 0x7)) - 1) . str_repeat(chr(0xff), $new_bits >> 3); + self::base256_lshift($leading_ones, $current_bits); + $temp = str_pad($temp, strlen($leading_ones), chr(0), \STR_PAD_LEFT); + return $this->normalize(new static($leading_ones | $temp, 256)); + } + /** + * Logical Left Shift + * + * Shifts binary strings $shift bits, essentially multiplying by 2**$shift. + * + * @param string $x + * @param int $shift + * @return void + */ + protected static function base256_lshift(&$x, $shift) + { + if ($shift == 0) { + return; + } + $num_bytes = $shift >> 3; + // eg. floor($shift/8) + $shift &= 7; + // eg. $shift % 8 + $carry = 0; + for ($i = strlen($x) - 1; $i >= 0; --$i) { + $temp = ord($x[$i]) << $shift | $carry; + $x[$i] = chr($temp); + $carry = $temp >> 8; + } + $carry = $carry != 0 ? chr($carry) : ''; + $x = $carry . $x . str_repeat(chr(0), $num_bytes); + } + /** + * Logical Left Rotate + * + * Instead of the top x bits being dropped they're appended to the shifted bit string. + * + * @param int $shift + * @return Engine + */ + public function bitwise_leftRotate($shift) + { + $bits = $this->toBytes(); + if ($this->precision > 0) { + $precision = $this->precision; + if (static::FAST_BITWISE) { + $mask = $this->bitmask->toBytes(); + } else { + $mask = $this->bitmask->subtract(new static(1)); + $mask = $mask->toBytes(); + } + } else { + $temp = ord($bits[0]); + for ($i = 0; $temp >> $i; ++$i) { + } + $precision = 8 * strlen($bits) - 8 + $i; + $mask = chr((1 << ($precision & 0x7)) - 1) . str_repeat(chr(0xff), $precision >> 3); + } + if ($shift < 0) { + $shift += $precision; + } + $shift %= $precision; + if (!$shift) { + return clone $this; + } + $left = $this->bitwise_leftShift($shift); + $left = $left->bitwise_and(new static($mask, 256)); + $right = $this->bitwise_rightShift($precision - $shift); + $result = static::FAST_BITWISE ? $left->bitwise_or($right) : $left->add($right); + return $this->normalize($result); + } + /** + * Logical Right Rotate + * + * Instead of the bottom x bits being dropped they're prepended to the shifted bit string. + * + * @param int $shift + * @return Engine + */ + public function bitwise_rightRotate($shift) + { + return $this->bitwise_leftRotate(-$shift); + } + /** + * Returns the smallest and largest n-bit number + * + * @param int $bits + * @return array{min: static, max: static} + */ + public static function minMaxBits($bits) + { + $bytes = $bits >> 3; + $min = str_repeat(chr(0), $bytes); + $max = str_repeat(chr(0xff), $bytes); + $msb = $bits & 7; + if ($msb) { + $min = chr(1 << $msb - 1) . $min; + $max = chr((1 << $msb) - 1) . $max; + } else { + $min[0] = chr(0x80); + } + return ['min' => new static($min, 256), 'max' => new static($max, 256)]; + } + /** + * Return the size of a BigInteger in bits + * + * @return int + */ + public function getLength() + { + return strlen($this->toBits()); + } + /** + * Return the size of a BigInteger in bytes + * + * @return int + */ + public function getLengthInBytes() + { + return (int) ceil($this->getLength() / 8); + } + /** + * Performs some pre-processing for powMod + * + * @param Engine $e + * @param Engine $n + * @return static|false + */ + protected function powModOuter(Engine $e, Engine $n) + { + $n = $this->bitmask !== \false && $this->bitmask->compare($n) < 0 ? $this->bitmask : $n->abs(); + if ($e->compare(new static()) < 0) { + $e = $e->abs(); + $temp = $this->modInverse($n); + if ($temp === \false) { + return \false; + } + return $this->normalize($temp->powModInner($e, $n)); + } + if ($this->compare($n) > 0) { + list(, $temp) = $this->divide($n); + return $temp->powModInner($e, $n); + } + return $this->powModInner($e, $n); + } + /** + * Sliding Window k-ary Modular Exponentiation + * + * Based on {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=27 HAC 14.85} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=210 MPM 7.7}. In a departure from those algorithims, + * however, this function performs a modular reduction after every multiplication and squaring operation. + * As such, this function has the same preconditions that the reductions being used do. + * + * @template T of Engine + * @param Engine $x + * @param Engine $e + * @param Engine $n + * @param class-string $class + * @return T + */ + protected static function slidingWindow(Engine $x, Engine $e, Engine $n, $class) + { + static $window_ranges = [7, 25, 81, 241, 673, 1793]; + // from BigInteger.java's oddModPow function + //static $window_ranges = [0, 7, 36, 140, 450, 1303, 3529]; // from MPM 7.3.1 + $e_bits = $e->toBits(); + $e_length = strlen($e_bits); + // calculate the appropriate window size. + // $window_size == 3 if $window_ranges is between 25 and 81, for example. + for ($i = 0, $window_size = 1; $i < count($window_ranges) && $e_length > $window_ranges[$i]; ++$window_size, ++$i) { + } + $n_value = $n->value; + if (method_exists(static::class, 'generateCustomReduction')) { + static::generateCustomReduction($n, $class); + } + // precompute $this^0 through $this^$window_size + $powers = []; + $powers[1] = static::prepareReduce($x->value, $n_value, $class); + $powers[2] = static::squareReduce($powers[1], $n_value, $class); + // we do every other number since substr($e_bits, $i, $j+1) (see below) is supposed to end + // in a 1. ie. it's supposed to be odd. + $temp = 1 << $window_size - 1; + for ($i = 1; $i < $temp; ++$i) { + $i2 = $i << 1; + $powers[$i2 + 1] = static::multiplyReduce($powers[$i2 - 1], $powers[2], $n_value, $class); + } + $result = new $class(1); + $result = static::prepareReduce($result->value, $n_value, $class); + for ($i = 0; $i < $e_length;) { + if (!$e_bits[$i]) { + $result = static::squareReduce($result, $n_value, $class); + ++$i; + } else { + for ($j = $window_size - 1; $j > 0; --$j) { + if (!empty($e_bits[$i + $j])) { + break; + } + } + // eg. the length of substr($e_bits, $i, $j + 1) + for ($k = 0; $k <= $j; ++$k) { + $result = static::squareReduce($result, $n_value, $class); + } + $result = static::multiplyReduce($result, $powers[bindec(substr($e_bits, $i, $j + 1))], $n_value, $class); + $i += $j + 1; + } + } + $temp = new $class(); + $temp->value = static::reduce($result, $n_value, $class); + return $temp; + } + /** + * Generates a random number of a certain size + * + * Bit length is equal to $size + * + * @param int $size + * @return Engine + */ + public static function random($size) + { + extract(static::minMaxBits($size)); + /** + * @var BigInteger $min + * @var BigInteger $max + */ + return static::randomRange($min, $max); + } + /** + * Generates a random prime number of a certain size + * + * Bit length is equal to $size + * + * @param int $size + * @return Engine + */ + public static function randomPrime($size) + { + extract(static::minMaxBits($size)); + /** + * @var static $min + * @var static $max + */ + return static::randomRangePrime($min, $max); + } + /** + * Performs some pre-processing for randomRangePrime + * + * @param Engine $min + * @param Engine $max + * @return static|false + */ + protected static function randomRangePrimeOuter(Engine $min, Engine $max) + { + $compare = $max->compare($min); + if (!$compare) { + return $min->isPrime() ? $min : \false; + } elseif ($compare < 0) { + // if $min is bigger then $max, swap $min and $max + $temp = $max; + $max = $min; + $min = $temp; + } + $length = $max->getLength(); + if ($length > 8196) { + throw new \RuntimeException("Generation of random prime numbers larger than 8196 has been disabled ({$length})"); + } + $x = static::randomRange($min, $max); + return static::randomRangePrimeInner($x, $min, $max); + } + /** + * Generate a random number between a range + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * BigInteger::randomRange($min, $max) + * BigInteger::randomRange($max, $min) + * + * @param Engine $min + * @param Engine $max + * @return Engine + */ + protected static function randomRangeHelper(Engine $min, Engine $max) + { + $compare = $max->compare($min); + if (!$compare) { + return $min; + } elseif ($compare < 0) { + // if $min is bigger then $max, swap $min and $max + $temp = $max; + $max = $min; + $min = $temp; + } + if (!isset(static::$one[static::class])) { + static::$one[static::class] = new static(1); + } + $max = $max->subtract($min->subtract(static::$one[static::class])); + $size = strlen(ltrim($max->toBytes(), chr(0))); + /* + doing $random % $max doesn't work because some numbers will be more likely to occur than others. + eg. if $max is 140 and $random's max is 255 then that'd mean both $random = 5 and $random = 145 + would produce 5 whereas the only value of random that could produce 139 would be 139. ie. + not all numbers would be equally likely. some would be more likely than others. + + creating a whole new random number until you find one that is within the range doesn't work + because, for sufficiently small ranges, the likelihood that you'd get a number within that range + would be pretty small. eg. with $random's max being 255 and if your $max being 1 the probability + would be pretty high that $random would be greater than $max. + + phpseclib works around this using the technique described here: + + http://crypto.stackexchange.com/questions/5708/creating-a-small-number-from-a-cryptographically-secure-random-string + */ + $random_max = new static(chr(1) . str_repeat("\x00", $size), 256); + $random = new static(Random::string($size), 256); + list($max_multiple) = $random_max->divide($max); + $max_multiple = $max_multiple->multiply($max); + while ($random->compare($max_multiple) >= 0) { + $random = $random->subtract($max_multiple); + $random_max = $random_max->subtract($max_multiple); + $random = $random->bitwise_leftShift(8); + $random = $random->add(new static(Random::string(1), 256)); + $random_max = $random_max->bitwise_leftShift(8); + list($max_multiple) = $random_max->divide($max); + $max_multiple = $max_multiple->multiply($max); + } + list(, $random) = $random->divide($max); + return $random->add($min); + } + /** + * Performs some post-processing for randomRangePrime + * + * @param Engine $x + * @param Engine $min + * @param Engine $max + * @return static|false + */ + protected static function randomRangePrimeInner(Engine $x, Engine $min, Engine $max) + { + if (!isset(static::$two[static::class])) { + static::$two[static::class] = new static('2'); + } + $x->make_odd(); + if ($x->compare($max) > 0) { + // if $x > $max then $max is even and if $min == $max then no prime number exists between the specified range + if ($min->equals($max)) { + return \false; + } + $x = clone $min; + $x->make_odd(); + } + $initial_x = clone $x; + while (\true) { + if ($x->isPrime()) { + return $x; + } + $x = $x->add(static::$two[static::class]); + if ($x->compare($max) > 0) { + $x = clone $min; + if ($x->equals(static::$two[static::class])) { + return $x; + } + $x->make_odd(); + } + if ($x->equals($initial_x)) { + return \false; + } + } + } + /** + * Sets the $t parameter for primality testing + * + * @return int + */ + protected function setupIsPrime() + { + $length = $this->getLengthInBytes(); + // see HAC 4.49 "Note (controlling the error probability)" + // @codingStandardsIgnoreStart + if ($length >= 163) { + $t = 2; + } else { + if ($length >= 106) { + $t = 3; + } else { + if ($length >= 81) { + $t = 4; + } else { + if ($length >= 68) { + $t = 5; + } else { + if ($length >= 56) { + $t = 6; + } else { + if ($length >= 50) { + $t = 7; + } else { + if ($length >= 43) { + $t = 8; + } else { + if ($length >= 37) { + $t = 9; + } else { + if ($length >= 31) { + $t = 12; + } else { + if ($length >= 25) { + $t = 15; + } else { + if ($length >= 18) { + $t = 18; + } else { + $t = 27; + } + } + } + } + } + } + } + } + } + } + } + // @codingStandardsIgnoreEnd + return $t; + } + /** + * Tests Primality + * + * Uses the {@link http://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test Miller-Rabin primality test}. + * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap4.pdf#page=8 HAC 4.24} for more info. + * + * @param int $t + * @return bool + */ + protected function testPrimality($t) + { + if (!$this->testSmallPrimes()) { + return \false; + } + $n = clone $this; + $n_1 = $n->subtract(static::$one[static::class]); + $n_2 = $n->subtract(static::$two[static::class]); + $r = clone $n_1; + $s = static::scan1divide($r); + for ($i = 0; $i < $t; ++$i) { + $a = static::randomRange(static::$two[static::class], $n_2); + $y = $a->modPow($r, $n); + if (!$y->equals(static::$one[static::class]) && !$y->equals($n_1)) { + for ($j = 1; $j < $s && !$y->equals($n_1); ++$j) { + $y = $y->modPow(static::$two[static::class], $n); + if ($y->equals(static::$one[static::class])) { + return \false; + } + } + if (!$y->equals($n_1)) { + return \false; + } + } + } + return \true; + } + /** + * Checks a numer to see if it's prime + * + * Assuming the $t parameter is not set, this function has an error rate of 2**-80. The main motivation for the + * $t parameter is distributability. BigInteger::randomPrime() can be distributed across multiple pageloads + * on a website instead of just one. + * + * @param int|bool $t + * @return bool + */ + public function isPrime($t = \false) + { + // OpenSSL limits RSA keys to 16384 bits. The length of an RSA key is equal to the length of the modulo, which is + // produced by multiplying the primes p and q by one another. The largest number two 8196 bit primes can produce is + // a 16384 bit number so, basically, 8196 bit primes are the largest OpenSSL will generate and if that's the largest + // that it'll generate it also stands to reason that that's the largest you'll be able to test primality on + $length = $this->getLength(); + if ($length > 8196) { + throw new \RuntimeException("Primality testing is not supported for numbers larger than 8196 bits ({$length})"); + } + if (!$t) { + $t = $this->setupIsPrime(); + } + return $this->testPrimality($t); + } + /** + * Performs a few preliminary checks on root + * + * @param int $n + * @return Engine + */ + protected function rootHelper($n) + { + if ($n < 1) { + return clone static::$zero[static::class]; + } + // we want positive exponents + if ($this->compare(static::$one[static::class]) < 0) { + return clone static::$zero[static::class]; + } + // we want positive numbers + if ($this->compare(static::$two[static::class]) < 0) { + return clone static::$one[static::class]; + } + // n-th root of 1 or 2 is 1 + return $this->rootInner($n); + } + /** + * Calculates the nth root of a biginteger. + * + * Returns the nth root of a positive biginteger, where n defaults to 2 + * + * {@internal This function is based off of {@link http://mathforum.org/library/drmath/view/52605.html this page} and {@link http://stackoverflow.com/questions/11242920/calculating-nth-root-with-bcmath-in-php this stackoverflow question}.} + * + * @param int $n + * @return Engine + */ + protected function rootInner($n) + { + $n = new static($n); + // g is our guess number + $g = static::$two[static::class]; + // while (g^n < num) g=g*2 + while ($g->pow($n)->compare($this) < 0) { + $g = $g->multiply(static::$two[static::class]); + } + // if (g^n==num) num is a power of 2, we're lucky, end of job + // == 0 bccomp(bcpow($g, $n), $n->value)==0 + if ($g->pow($n)->equals($this) > 0) { + $root = $g; + return $this->normalize($root); + } + // if we're here num wasn't a power of 2 :( + $og = $g; + // og means original guess and here is our upper bound + $g = $g->divide(static::$two[static::class])[0]; + // g is set to be our lower bound + $step = $og->subtract($g)->divide(static::$two[static::class])[0]; + // step is the half of upper bound - lower bound + $g = $g->add($step); + // we start at lower bound + step , basically in the middle of our interval + // while step>1 + while ($step->compare(static::$one[static::class]) == 1) { + $guess = $g->pow($n); + $step = $step->divide(static::$two[static::class])[0]; + $comp = $guess->compare($this); + // compare our guess with real number + switch ($comp) { + case -1: + // if guess is lower we add the new step + $g = $g->add($step); + break; + case 1: + // if guess is higher we sub the new step + $g = $g->subtract($step); + break; + case 0: + // if guess is exactly the num we're done, we return the value + $root = $g; + break 2; + } + } + if ($comp == 1) { + $g = $g->subtract($step); + } + // whatever happened, g is the closest guess we can make so return it + $root = $g; + return $this->normalize($root); + } + /** + * Calculates the nth root of a biginteger. + * + * @param int $n + * @return Engine + */ + public function root($n = 2) + { + return $this->rootHelper($n); + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param array $nums + * @return Engine + */ + protected static function minHelper(array $nums) + { + if (count($nums) == 1) { + return $nums[0]; + } + $min = $nums[0]; + for ($i = 1; $i < count($nums); $i++) { + $min = $min->compare($nums[$i]) > 0 ? $nums[$i] : $min; + } + return $min; + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param array $nums + * @return Engine + */ + protected static function maxHelper(array $nums) + { + if (count($nums) == 1) { + return $nums[0]; + } + $max = $nums[0]; + for ($i = 1; $i < count($nums); $i++) { + $max = $max->compare($nums[$i]) < 0 ? $nums[$i] : $max; + } + return $max; + } + /** + * Create Recurring Modulo Function + * + * Sometimes it may be desirable to do repeated modulos with the same number outside of + * modular exponentiation + * + * @return callable + */ + public function createRecurringModuloFunction() + { + $class = static::class; + $fqengine = !method_exists(static::$modexpEngine[static::class], 'reduce') ? '\\phpseclib3\\Math\\BigInteger\\Engines\\' . static::ENGINE_DIR . '\\DefaultEngine' : static::$modexpEngine[static::class]; + if (method_exists($fqengine, 'generateCustomReduction')) { + $func = $fqengine::generateCustomReduction($this, static::class); + return eval('return function(' . static::class . ' $x) use ($func, $class) { + $r = new $class(); + $r->value = $func($x->value); + return $r; + };'); + } + $n = $this->value; + return eval('return function(' . static::class . ' $x) use ($n, $fqengine, $class) { + $r = new $class(); + $r->value = $fqengine::reduce($x->value, $n, $class); + return $r; + };'); + } + /** + * Calculates the greatest common divisor and Bezout's identity. + * + * @param Engine $n + * @return array{gcd: Engine, x: Engine, y: Engine} + */ + protected function extendedGCDHelper(Engine $n) + { + $u = clone $this; + $v = clone $n; + $one = new static(1); + $zero = new static(); + $a = clone $one; + $b = clone $zero; + $c = clone $zero; + $d = clone $one; + while (!$v->equals($zero)) { + list($q) = $u->divide($v); + $temp = $u; + $u = $v; + $v = $temp->subtract($v->multiply($q)); + $temp = $a; + $a = $c; + $c = $temp->subtract($a->multiply($q)); + $temp = $b; + $b = $d; + $d = $temp->subtract($b->multiply($q)); + } + return ['gcd' => $u, 'x' => $a, 'y' => $b]; + } + /** + * Bitwise Split + * + * Splits BigInteger's into chunks of $split bits + * + * @param int $split + * @return Engine[] + */ + public function bitwise_split($split) + { + if ($split < 1) { + throw new \RuntimeException('Offset must be greater than 1'); + } + $mask = static::$one[static::class]->bitwise_leftShift($split)->subtract(static::$one[static::class]); + $num = clone $this; + $vals = []; + while (!$num->equals(static::$zero[static::class])) { + $vals[] = $num->bitwise_and($mask); + $num = $num->bitwise_rightShift($split); + } + return array_reverse($vals); + } + /** + * Logical And + * + * @param Engine $x + * @return Engine + */ + protected function bitwiseAndHelper(Engine $x) + { + $left = $this->toBytes(\true); + $right = $x->toBytes(\true); + $length = max(strlen($left), strlen($right)); + $left = str_pad($left, $length, chr(0), \STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), \STR_PAD_LEFT); + return $this->normalize(new static($left & $right, -256)); + } + /** + * Logical Or + * + * @param Engine $x + * @return Engine + */ + protected function bitwiseOrHelper(Engine $x) + { + $left = $this->toBytes(\true); + $right = $x->toBytes(\true); + $length = max(strlen($left), strlen($right)); + $left = str_pad($left, $length, chr(0), \STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), \STR_PAD_LEFT); + return $this->normalize(new static($left | $right, -256)); + } + /** + * Logical Exclusive Or + * + * @param Engine $x + * @return Engine + */ + protected function bitwiseXorHelper(Engine $x) + { + $left = $this->toBytes(\true); + $right = $x->toBytes(\true); + $length = max(strlen($left), strlen($right)); + $left = str_pad($left, $length, chr(0), \STR_PAD_LEFT); + $right = str_pad($right, $length, chr(0), \STR_PAD_LEFT); + return $this->normalize(new static($left ^ $right, -256)); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php new file mode 100644 index 0000000..4237a35 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php @@ -0,0 +1,612 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +/** + * GMP Engine. + * + * @author Jim Wigginton + */ +class GMP extends Engine +{ + /** + * Can Bitwise operations be done fast? + * + * @see parent::bitwise_leftRotate() + * @see parent::bitwise_rightRotate() + */ + const FAST_BITWISE = \true; + /** + * Engine Directory + * + * @see parent::setModExpEngine + */ + const ENGINE_DIR = 'GMP'; + /** + * Test for engine validity + * + * @return bool + * @see parent::__construct() + */ + public static function isValidEngine() + { + return extension_loaded('gmp'); + } + /** + * Default constructor + * + * @param mixed $x integer Base-10 number or base-$base number if $base set. + * @param int $base + * @see parent::__construct() + */ + public function __construct($x = 0, $base = 10) + { + if (!isset(static::$isValidEngine[static::class])) { + static::$isValidEngine[static::class] = self::isValidEngine(); + } + if (!static::$isValidEngine[static::class]) { + throw new BadConfigurationException('GMP is not setup correctly on this system'); + } + if ($x instanceof \GMP) { + $this->value = $x; + return; + } + $this->value = gmp_init(0); + parent::__construct($x, $base); + } + /** + * Initialize a GMP BigInteger Engine instance + * + * @param int $base + * @see parent::__construct() + */ + protected function initialize($base) + { + switch (abs($base)) { + case 256: + $this->value = gmp_import($this->value); + if ($this->is_negative) { + $this->value = -$this->value; + } + break; + case 16: + $temp = $this->is_negative ? '-0x' . $this->value : '0x' . $this->value; + $this->value = gmp_init($temp); + break; + case 10: + $this->value = gmp_init(isset($this->value) ? $this->value : '0'); + } + } + /** + * Converts a BigInteger to a base-10 number. + * + * @return string + */ + public function toString() + { + return (string) $this->value; + } + /** + * Converts a BigInteger to a bit string (eg. base-2). + * + * Negative numbers are saved as positive numbers, unless $twos_compliment is set to true, at which point, they're + * saved as two's compliment. + * + * @param bool $twos_compliment + * @return string + */ + public function toBits($twos_compliment = \false) + { + $hex = $this->toHex($twos_compliment); + $bits = gmp_strval(gmp_init($hex, 16), 2); + if ($this->precision > 0) { + $bits = substr($bits, -$this->precision); + } + if ($twos_compliment && $this->compare(new static()) > 0 && $this->precision <= 0) { + return '0' . $bits; + } + return $bits; + } + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * @param bool $twos_compliment + * @return string + */ + public function toBytes($twos_compliment = \false) + { + if ($twos_compliment) { + return $this->toBytesHelper(); + } + if (gmp_cmp($this->value, gmp_init(0)) == 0) { + return $this->precision > 0 ? str_repeat(chr(0), $this->precision + 1 >> 3) : ''; + } + $temp = gmp_export($this->value); + return $this->precision > 0 ? substr(str_pad($temp, $this->precision >> 3, chr(0), \STR_PAD_LEFT), -($this->precision >> 3)) : ltrim($temp, chr(0)); + } + /** + * Adds two BigIntegers. + * + * @param GMP $y + * @return GMP + */ + public function add(GMP $y) + { + $temp = new self(); + $temp->value = $this->value + $y->value; + return $this->normalize($temp); + } + /** + * Subtracts two BigIntegers. + * + * @param GMP $y + * @return GMP + */ + public function subtract(GMP $y) + { + $temp = new self(); + $temp->value = $this->value - $y->value; + return $this->normalize($temp); + } + /** + * Multiplies two BigIntegers. + * + * @param GMP $x + * @return GMP + */ + public function multiply(GMP $x) + { + $temp = new self(); + $temp->value = $this->value * $x->value; + return $this->normalize($temp); + } + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * @param GMP $y + * @return array{GMP, GMP} + */ + public function divide(GMP $y) + { + $quotient = new self(); + $remainder = new self(); + list($quotient->value, $remainder->value) = gmp_div_qr($this->value, $y->value); + if (gmp_sign($remainder->value) < 0) { + $remainder->value = $remainder->value + gmp_abs($y->value); + } + return [$this->normalize($quotient), $this->normalize($remainder)]; + } + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this + * is demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * {@internal Could return $this->subtract($x), but that's not as fast as what we do do.} + * + * @param GMP $y + * @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @see self::equals() + */ + public function compare(GMP $y) + { + $r = gmp_cmp($this->value, $y->value); + if ($r < -1) { + $r = -1; + } + if ($r > 1) { + $r = 1; + } + return $r; + } + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use BigInteger::compare() + * + * @param GMP $x + * @return bool + */ + public function equals(GMP $x) + { + return $this->value == $x->value; + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * + * @param GMP $n + * @return false|GMP + */ + public function modInverse(GMP $n) + { + $temp = new self(); + $temp->value = gmp_invert($this->value, $n->value); + return $temp->value === \false ? \false : $this->normalize($temp); + } + /** + * Calculates the greatest common divisor and Bezout's identity. + * + * Say you have 693 and 609. The GCD is 21. Bezout's identity states that there exist integers x and y such that + * 693*x + 609*y == 21. In point of fact, there are actually an infinite number of x and y combinations and which + * combination is returned is dependent upon which mode is in use. See + * {@link http://en.wikipedia.org/wiki/B%C3%A9zout%27s_identity Bezout's identity - Wikipedia} for more information. + * + * @param GMP $n + * @return GMP[] + */ + public function extendedGCD(GMP $n) + { + extract(gmp_gcdext($this->value, $n->value)); + return ['gcd' => $this->normalize(new self($g)), 'x' => $this->normalize(new self($s)), 'y' => $this->normalize(new self($t))]; + } + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * @param GMP $n + * @return GMP + */ + public function gcd(GMP $n) + { + $r = gmp_gcd($this->value, $n->value); + return $this->normalize(new self($r)); + } + /** + * Absolute value. + * + * @return GMP + */ + public function abs() + { + $temp = new self(); + $temp->value = gmp_abs($this->value); + return $temp; + } + /** + * Logical And + * + * @param GMP $x + * @return GMP + */ + public function bitwise_and(GMP $x) + { + $temp = new self(); + $temp->value = $this->value & $x->value; + return $this->normalize($temp); + } + /** + * Logical Or + * + * @param GMP $x + * @return GMP + */ + public function bitwise_or(GMP $x) + { + $temp = new self(); + $temp->value = $this->value | $x->value; + return $this->normalize($temp); + } + /** + * Logical Exclusive Or + * + * @param GMP $x + * @return GMP + */ + public function bitwise_xor(GMP $x) + { + $temp = new self(); + $temp->value = $this->value ^ $x->value; + return $this->normalize($temp); + } + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. + * + * @param int $shift + * @return GMP + */ + public function bitwise_rightShift($shift) + { + // 0xFFFFFFFF >> 2 == -1 (on 32-bit systems) + // gmp_init('0xFFFFFFFF') >> 2 == gmp_init('0x3FFFFFFF') + $temp = new self(); + $temp->value = $this->value >> $shift; + return $this->normalize($temp); + } + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. + * + * @param int $shift + * @return GMP + */ + public function bitwise_leftShift($shift) + { + $temp = new self(); + $temp->value = $this->value << $shift; + return $this->normalize($temp); + } + /** + * Performs modular exponentiation. + * + * @param GMP $e + * @param GMP $n + * @return GMP + */ + public function modPow(GMP $e, GMP $n) + { + return $this->powModOuter($e, $n); + } + /** + * Performs modular exponentiation. + * + * Alias for modPow(). + * + * @param GMP $e + * @param GMP $n + * @return GMP + */ + public function powMod(GMP $e, GMP $n) + { + return $this->powModOuter($e, $n); + } + /** + * Performs modular exponentiation. + * + * @param GMP $e + * @param GMP $n + * @return GMP + */ + protected function powModInner(GMP $e, GMP $n) + { + $class = static::$modexpEngine[static::class]; + return $class::powModHelper($this, $e, $n); + } + /** + * Normalize + * + * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision + * + * @param GMP $result + * @return GMP + */ + protected function normalize(GMP $result) + { + $result->precision = $this->precision; + $result->bitmask = $this->bitmask; + if ($result->bitmask !== \false) { + $flip = $result->value < 0; + if ($flip) { + $result->value = -$result->value; + } + $result->value = $result->value & $result->bitmask->value; + if ($flip) { + $result->value = -$result->value; + } + } + return $result; + } + /** + * Performs some post-processing for randomRangePrime + * + * @param Engine $x + * @param Engine $min + * @param Engine $max + * @return GMP + */ + protected static function randomRangePrimeInner(Engine $x, Engine $min, Engine $max) + { + $p = gmp_nextprime($x->value); + if ($p <= $max->value) { + return new self($p); + } + if ($min->value != $x->value) { + $x = new self($x->value - 1); + } + return self::randomRangePrime($min, $x); + } + /** + * Generate a random prime number between a range + * + * If there's not a prime within the given range, false will be returned. + * + * @param GMP $min + * @param GMP $max + * @return false|GMP + */ + public static function randomRangePrime(GMP $min, GMP $max) + { + return self::randomRangePrimeOuter($min, $max); + } + /** + * Generate a random number between a range + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * BigInteger::randomRange($min, $max) + * BigInteger::randomRange($max, $min) + * + * @param GMP $min + * @param GMP $max + * @return GMP + */ + public static function randomRange(GMP $min, GMP $max) + { + return self::randomRangeHelper($min, $max); + } + /** + * Make the current number odd + * + * If the current number is odd it'll be unchanged. If it's even, one will be added to it. + * + * @see self::randomPrime() + */ + protected function make_odd() + { + gmp_setbit($this->value, 0); + } + /** + * Tests Primality + * + * @param int $t + * @return bool + */ + protected function testPrimality($t) + { + return gmp_prob_prime($this->value, $t) != 0; + } + /** + * Calculates the nth root of a biginteger. + * + * Returns the nth root of a positive biginteger, where n defaults to 2 + * + * @param int $n + * @return GMP + */ + protected function rootInner($n) + { + $root = new self(); + $root->value = gmp_root($this->value, $n); + return $this->normalize($root); + } + /** + * Performs exponentiation. + * + * @param GMP $n + * @return GMP + */ + public function pow(GMP $n) + { + $temp = new self(); + $temp->value = $this->value ** $n->value; + return $this->normalize($temp); + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param GMP ...$nums + * @return GMP + */ + public static function min(GMP ...$nums) + { + return self::minHelper($nums); + } + /** + * Return the maximum BigInteger between an arbitrary number of BigIntegers. + * + * @param GMP ...$nums + * @return GMP + */ + public static function max(GMP ...$nums) + { + return self::maxHelper($nums); + } + /** + * Tests BigInteger to see if it is between two integers, inclusive + * + * @param GMP $min + * @param GMP $max + * @return bool + */ + public function between(GMP $min, GMP $max) + { + return $this->compare($min) >= 0 && $this->compare($max) <= 0; + } + /** + * Create Recurring Modulo Function + * + * Sometimes it may be desirable to do repeated modulos with the same number outside of + * modular exponentiation + * + * @return callable + */ + public function createRecurringModuloFunction() + { + $temp = $this->value; + return function (GMP $x) use($temp) { + return new GMP($x->value % $temp); + }; + } + /** + * Scan for 1 and right shift by that amount + * + * ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); + * + * @param GMP $r + * @return int + */ + public static function scan1divide(GMP $r) + { + $s = gmp_scan1($r->value, 0); + $r->value >>= $s; + return $s; + } + /** + * Is Odd? + * + * @return bool + */ + public function isOdd() + { + return gmp_testbit($this->value, 0); + } + /** + * Tests if a bit is set + * + * @return bool + */ + public function testBit($x) + { + return gmp_testbit($this->value, $x); + } + /** + * Is Negative? + * + * @return bool + */ + public function isNegative() + { + return gmp_sign($this->value) == -1; + } + /** + * Negate + * + * Given $k, returns -$k + * + * @return GMP + */ + public function negate() + { + $temp = clone $this; + $temp->value = -$this->value; + return $temp; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php new file mode 100644 index 0000000..ecf6d6c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php @@ -0,0 +1,37 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\GMP; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\GMP; +/** + * GMP Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class DefaultEngine extends GMP +{ + /** + * Performs modular exponentiation. + * + * @param GMP $x + * @param GMP $e + * @param GMP $n + * @return GMP + */ + protected static function powModHelper(GMP $x, GMP $e, GMP $n) + { + $temp = new GMP(); + $temp->value = gmp_powm($x->value, $e->value, $n->value); + return $x->normalize($temp); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/OpenSSL.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/OpenSSL.php new file mode 100644 index 0000000..1a4c539 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/OpenSSL.php @@ -0,0 +1,58 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA\Formats\Keys\PKCS8; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +/** + * OpenSSL Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class OpenSSL +{ + /** + * Test for engine validity + * + * @return bool + */ + public static function isValidEngine() + { + return extension_loaded('openssl') && static::class != __CLASS__; + } + /** + * Performs modular exponentiation. + * + * @param Engine $x + * @param Engine $e + * @param Engine $n + * @return Engine + */ + public static function powModHelper(Engine $x, Engine $e, Engine $n) + { + if ($n->getLengthInBytes() < 31 || $n->getLengthInBytes() > 16384) { + throw new \OutOfRangeException('Only modulo between 31 and 16384 bits are accepted'); + } + $key = PKCS8::savePublicKey(new BigInteger($n), new BigInteger($e)); + $plaintext = str_pad($x->toBytes(), $n->getLengthInBytes(), "\x00", \STR_PAD_LEFT); + // this is easily prone to failure. if the modulo is a multiple of 2 or 3 or whatever it + // won't work and you'll get a "failure: error:0906D06C:PEM routines:PEM_read_bio:no start line" + // error. i suppose, for even numbers, we could do what PHP\Montgomery.php does, but then what + // about odd numbers divisible by 3, by 5, etc? + if (!openssl_public_encrypt($plaintext, $result, $key, \OPENSSL_NO_PADDING)) { + throw new \UnexpectedValueException(openssl_error_string()); + } + $class = get_class($x); + return new $class($result, 256); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php new file mode 100644 index 0000000..1b4b16a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php @@ -0,0 +1,1110 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +/** + * Pure-PHP Engine. + * + * @author Jim Wigginton + */ +abstract class PHP extends Engine +{ + /**#@+ + * Array constants + * + * Rather than create a thousands and thousands of new BigInteger objects in repeated function calls to add() and + * multiply() or whatever, we'll just work directly on arrays, taking them in as parameters and returning them. + * + */ + /** + * $result[self::VALUE] contains the value. + */ + const VALUE = 0; + /** + * $result[self::SIGN] contains the sign. + */ + const SIGN = 1; + /**#@-*/ + /** + * Karatsuba Cutoff + * + * At what point do we switch between Karatsuba multiplication and schoolbook long multiplication? + * + */ + const KARATSUBA_CUTOFF = 25; + /** + * Can Bitwise operations be done fast? + * + * @see parent::bitwise_leftRotate() + * @see parent::bitwise_rightRotate() + */ + const FAST_BITWISE = \true; + /** + * Engine Directory + * + * @see parent::setModExpEngine + */ + const ENGINE_DIR = 'PHP'; + /** + * Default constructor + * + * @param mixed $x integer Base-10 number or base-$base number if $base set. + * @param int $base + * @return PHP + * @see parent::__construct() + */ + public function __construct($x = 0, $base = 10) + { + if (!isset(static::$isValidEngine[static::class])) { + static::$isValidEngine[static::class] = static::isValidEngine(); + } + if (!static::$isValidEngine[static::class]) { + throw new BadConfigurationException(static::class . ' is not setup correctly on this system'); + } + $this->value = []; + parent::__construct($x, $base); + } + /** + * Initialize a PHP BigInteger Engine instance + * + * @param int $base + * @see parent::__construct() + */ + protected function initialize($base) + { + switch (abs($base)) { + case 16: + $x = strlen($this->value) & 1 ? '0' . $this->value : $this->value; + $temp = new static(Strings::hex2bin($x), 256); + $this->value = $temp->value; + break; + case 10: + $temp = new static(); + $multiplier = new static(); + $multiplier->value = [static::MAX10]; + $x = $this->value; + if ($x[0] == '-') { + $this->is_negative = \true; + $x = substr($x, 1); + } + $x = str_pad($x, strlen($x) + (static::MAX10LEN - 1) * strlen($x) % static::MAX10LEN, 0, \STR_PAD_LEFT); + while (strlen($x)) { + $temp = $temp->multiply($multiplier); + $temp = $temp->add(new static($this->int2bytes(substr($x, 0, static::MAX10LEN)), 256)); + $x = substr($x, static::MAX10LEN); + } + $this->value = $temp->value; + } + } + /** + * Pads strings so that unpack may be used on them + * + * @param string $str + * @return string + */ + protected function pad($str) + { + $length = strlen($str); + $pad = 4 - strlen($str) % 4; + return str_pad($str, $length + $pad, "\x00", \STR_PAD_LEFT); + } + /** + * Converts a BigInteger to a base-10 number. + * + * @return string + */ + public function toString() + { + if (!count($this->value)) { + return '0'; + } + $temp = clone $this; + $temp->bitmask = \false; + $temp->is_negative = \false; + $divisor = new static(); + $divisor->value = [static::MAX10]; + $result = ''; + while (count($temp->value)) { + list($temp, $mod) = $temp->divide($divisor); + $result = str_pad(isset($mod->value[0]) ? $mod->value[0] : '', static::MAX10LEN, '0', \STR_PAD_LEFT) . $result; + } + $result = ltrim($result, '0'); + if (empty($result)) { + $result = '0'; + } + if ($this->is_negative) { + $result = '-' . $result; + } + return $result; + } + /** + * Converts a BigInteger to a byte string (eg. base-256). + * + * @param bool $twos_compliment + * @return string + */ + public function toBytes($twos_compliment = \false) + { + if ($twos_compliment) { + return $this->toBytesHelper(); + } + if (!count($this->value)) { + return $this->precision > 0 ? str_repeat(chr(0), $this->precision + 1 >> 3) : ''; + } + $result = $this->bitwise_small_split(8); + $result = implode('', array_map('chr', $result)); + return $this->precision > 0 ? str_pad(substr($result, -($this->precision + 7 >> 3)), $this->precision + 7 >> 3, chr(0), \STR_PAD_LEFT) : $result; + } + /** + * Performs addition. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return array + */ + protected static function addHelper(array $x_value, $x_negative, array $y_value, $y_negative) + { + $x_size = count($x_value); + $y_size = count($y_value); + if ($x_size == 0) { + return [self::VALUE => $y_value, self::SIGN => $y_negative]; + } elseif ($y_size == 0) { + return [self::VALUE => $x_value, self::SIGN => $x_negative]; + } + // subtract, if appropriate + if ($x_negative != $y_negative) { + if ($x_value == $y_value) { + return [self::VALUE => [], self::SIGN => \false]; + } + $temp = self::subtractHelper($x_value, \false, $y_value, \false); + $temp[self::SIGN] = self::compareHelper($x_value, \false, $y_value, \false) > 0 ? $x_negative : $y_negative; + return $temp; + } + if ($x_size < $y_size) { + $size = $x_size; + $value = $y_value; + } else { + $size = $y_size; + $value = $x_value; + } + $value[count($value)] = 0; + // just in case the carry adds an extra digit + $carry = 0; + for ($i = 0, $j = 1; $j < $size; $i += 2, $j += 2) { + //$sum = $x_value[$j] * static::BASE_FULL + $x_value[$i] + $y_value[$j] * static::BASE_FULL + $y_value[$i] + $carry; + $sum = ($x_value[$j] + $y_value[$j]) * static::BASE_FULL + $x_value[$i] + $y_value[$i] + $carry; + $carry = $sum >= static::MAX_DIGIT2; + // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 + $sum = $carry ? $sum - static::MAX_DIGIT2 : $sum; + $temp = static::BASE === 26 ? intval($sum / 0x4000000) : $sum >> 31; + $value[$i] = (int) ($sum - static::BASE_FULL * $temp); + // eg. a faster alternative to fmod($sum, 0x4000000) + $value[$j] = $temp; + } + if ($j == $size) { + // ie. if $y_size is odd + $sum = $x_value[$i] + $y_value[$i] + $carry; + $carry = $sum >= static::BASE_FULL; + $value[$i] = $carry ? $sum - static::BASE_FULL : $sum; + ++$i; + // ie. let $i = $j since we've just done $value[$i] + } + if ($carry) { + for (; $value[$i] == static::MAX_DIGIT; ++$i) { + $value[$i] = 0; + } + ++$value[$i]; + } + return [self::VALUE => self::trim($value), self::SIGN => $x_negative]; + } + /** + * Performs subtraction. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return array + */ + public static function subtractHelper(array $x_value, $x_negative, array $y_value, $y_negative) + { + $x_size = count($x_value); + $y_size = count($y_value); + if ($x_size == 0) { + return [self::VALUE => $y_value, self::SIGN => !$y_negative]; + } elseif ($y_size == 0) { + return [self::VALUE => $x_value, self::SIGN => $x_negative]; + } + // add, if appropriate (ie. -$x - +$y or +$x - -$y) + if ($x_negative != $y_negative) { + $temp = self::addHelper($x_value, \false, $y_value, \false); + $temp[self::SIGN] = $x_negative; + return $temp; + } + $diff = self::compareHelper($x_value, $x_negative, $y_value, $y_negative); + if (!$diff) { + return [self::VALUE => [], self::SIGN => \false]; + } + // switch $x and $y around, if appropriate. + if (!$x_negative && $diff < 0 || $x_negative && $diff > 0) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + $x_negative = !$x_negative; + $x_size = count($x_value); + $y_size = count($y_value); + } + // at this point, $x_value should be at least as big as - if not bigger than - $y_value + $carry = 0; + for ($i = 0, $j = 1; $j < $y_size; $i += 2, $j += 2) { + $sum = ($x_value[$j] - $y_value[$j]) * static::BASE_FULL + $x_value[$i] - $y_value[$i] - $carry; + $carry = $sum < 0; + // eg. floor($sum / 2**52); only possible values (in any base) are 0 and 1 + $sum = $carry ? $sum + static::MAX_DIGIT2 : $sum; + $temp = static::BASE === 26 ? intval($sum / 0x4000000) : $sum >> 31; + $x_value[$i] = (int) ($sum - static::BASE_FULL * $temp); + $x_value[$j] = $temp; + } + if ($j == $y_size) { + // ie. if $y_size is odd + $sum = $x_value[$i] - $y_value[$i] - $carry; + $carry = $sum < 0; + $x_value[$i] = $carry ? $sum + static::BASE_FULL : $sum; + ++$i; + } + if ($carry) { + for (; !$x_value[$i]; ++$i) { + $x_value[$i] = static::MAX_DIGIT; + } + --$x_value[$i]; + } + return [self::VALUE => self::trim($x_value), self::SIGN => $x_negative]; + } + /** + * Performs multiplication. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return array + */ + protected static function multiplyHelper(array $x_value, $x_negative, array $y_value, $y_negative) + { + //if ( $x_value == $y_value ) { + // return [ + // self::VALUE => self::square($x_value), + // self::SIGN => $x_sign != $y_value + // ]; + //} + $x_length = count($x_value); + $y_length = count($y_value); + if (!$x_length || !$y_length) { + // a 0 is being multiplied + return [self::VALUE => [], self::SIGN => \false]; + } + return [self::VALUE => min($x_length, $y_length) < 2 * self::KARATSUBA_CUTOFF ? self::trim(self::regularMultiply($x_value, $y_value)) : self::trim(self::karatsuba($x_value, $y_value)), self::SIGN => $x_negative != $y_negative]; + } + /** + * Performs Karatsuba multiplication on two BigIntegers + * + * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=120 MPM 5.2.3}. + * + * @param array $x_value + * @param array $y_value + * @return array + */ + private static function karatsuba(array $x_value, array $y_value) + { + $m = min(count($x_value) >> 1, count($y_value) >> 1); + if ($m < self::KARATSUBA_CUTOFF) { + return self::regularMultiply($x_value, $y_value); + } + $x1 = array_slice($x_value, $m); + $x0 = array_slice($x_value, 0, $m); + $y1 = array_slice($y_value, $m); + $y0 = array_slice($y_value, 0, $m); + $z2 = self::karatsuba($x1, $y1); + $z0 = self::karatsuba($x0, $y0); + $z1 = self::addHelper($x1, \false, $x0, \false); + $temp = self::addHelper($y1, \false, $y0, \false); + $z1 = self::karatsuba($z1[self::VALUE], $temp[self::VALUE]); + $temp = self::addHelper($z2, \false, $z0, \false); + $z1 = self::subtractHelper($z1, \false, $temp[self::VALUE], \false); + $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); + $z1[self::VALUE] = array_merge(array_fill(0, $m, 0), $z1[self::VALUE]); + $xy = self::addHelper($z2, \false, $z1[self::VALUE], $z1[self::SIGN]); + $xy = self::addHelper($xy[self::VALUE], $xy[self::SIGN], $z0, \false); + return $xy[self::VALUE]; + } + /** + * Performs long multiplication on two BigIntegers + * + * Modeled after 'multiply' in MutableBigInteger.java. + * + * @param array $x_value + * @param array $y_value + * @return array + */ + protected static function regularMultiply(array $x_value, array $y_value) + { + $x_length = count($x_value); + $y_length = count($y_value); + if (!$x_length || !$y_length) { + // a 0 is being multiplied + return []; + } + $product_value = self::array_repeat(0, $x_length + $y_length); + // the following for loop could be removed if the for loop following it + // (the one with nested for loops) initially set $i to 0, but + // doing so would also make the result in one set of unnecessary adds, + // since on the outermost loops first pass, $product->value[$k] is going + // to always be 0 + $carry = 0; + for ($j = 0; $j < $x_length; ++$j) { + // ie. $i = 0 + $temp = $x_value[$j] * $y_value[0] + $carry; + // $product_value[$k] == 0 + $carry = static::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $product_value[$j] = (int) ($temp - static::BASE_FULL * $carry); + } + $product_value[$j] = $carry; + // the above for loop is what the previous comment was talking about. the + // following for loop is the "one with nested for loops" + for ($i = 1; $i < $y_length; ++$i) { + $carry = 0; + for ($j = 0, $k = $i; $j < $x_length; ++$j, ++$k) { + $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; + $carry = static::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $product_value[$k] = (int) ($temp - static::BASE_FULL * $carry); + } + $product_value[$k] = $carry; + } + return $product_value; + } + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * @return array{static, static} + * @internal This function is based off of + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=9 HAC 14.20}. + */ + protected function divideHelper(PHP $y) + { + if (count($y->value) == 1) { + list($q, $r) = $this->divide_digit($this->value, $y->value[0]); + $quotient = new static(); + $remainder = new static(); + $quotient->value = $q; + $remainder->value = [$r]; + $quotient->is_negative = $this->is_negative != $y->is_negative; + return [$this->normalize($quotient), $this->normalize($remainder)]; + } + $x = clone $this; + $y = clone $y; + $x_sign = $x->is_negative; + $y_sign = $y->is_negative; + $x->is_negative = $y->is_negative = \false; + $diff = $x->compare($y); + if (!$diff) { + $temp = new static(); + $temp->value = [1]; + $temp->is_negative = $x_sign != $y_sign; + return [$this->normalize($temp), $this->normalize(static::$zero[static::class])]; + } + if ($diff < 0) { + // if $x is negative, "add" $y. + if ($x_sign) { + $x = $y->subtract($x); + } + return [$this->normalize(static::$zero[static::class]), $this->normalize($x)]; + } + // normalize $x and $y as described in HAC 14.23 / 14.24 + $msb = $y->value[count($y->value) - 1]; + for ($shift = 0; !($msb & static::MSB); ++$shift) { + $msb <<= 1; + } + $x->lshift($shift); + $y->lshift($shift); + $y_value =& $y->value; + $x_max = count($x->value) - 1; + $y_max = count($y->value) - 1; + $quotient = new static(); + $quotient_value =& $quotient->value; + $quotient_value = self::array_repeat(0, $x_max - $y_max + 1); + static $temp, $lhs, $rhs; + if (!isset($temp)) { + $temp = new static(); + $lhs = new static(); + $rhs = new static(); + } + if (static::class != get_class($temp)) { + $temp = new static(); + $lhs = new static(); + $rhs = new static(); + } + $temp_value =& $temp->value; + $rhs_value =& $rhs->value; + // $temp = $y << ($x_max - $y_max-1) in base 2**26 + $temp_value = array_merge(self::array_repeat(0, $x_max - $y_max), $y_value); + while ($x->compare($temp) >= 0) { + // calculate the "common residue" + ++$quotient_value[$x_max - $y_max]; + $x = $x->subtract($temp); + $x_max = count($x->value) - 1; + } + for ($i = $x_max; $i >= $y_max + 1; --$i) { + $x_value =& $x->value; + $x_window = [isset($x_value[$i]) ? $x_value[$i] : 0, isset($x_value[$i - 1]) ? $x_value[$i - 1] : 0, isset($x_value[$i - 2]) ? $x_value[$i - 2] : 0]; + $y_window = [$y_value[$y_max], $y_max > 0 ? $y_value[$y_max - 1] : 0]; + $q_index = $i - $y_max - 1; + if ($x_window[0] == $y_window[0]) { + $quotient_value[$q_index] = static::MAX_DIGIT; + } else { + $quotient_value[$q_index] = self::safe_divide($x_window[0] * static::BASE_FULL + $x_window[1], $y_window[0]); + } + $temp_value = [$y_window[1], $y_window[0]]; + $lhs->value = [$quotient_value[$q_index]]; + $lhs = $lhs->multiply($temp); + $rhs_value = [$x_window[2], $x_window[1], $x_window[0]]; + while ($lhs->compare($rhs) > 0) { + --$quotient_value[$q_index]; + $lhs->value = [$quotient_value[$q_index]]; + $lhs = $lhs->multiply($temp); + } + $adjust = self::array_repeat(0, $q_index); + $temp_value = [$quotient_value[$q_index]]; + $temp = $temp->multiply($y); + $temp_value =& $temp->value; + if (count($temp_value)) { + $temp_value = array_merge($adjust, $temp_value); + } + $x = $x->subtract($temp); + if ($x->compare(static::$zero[static::class]) < 0) { + $temp_value = array_merge($adjust, $y_value); + $x = $x->add($temp); + --$quotient_value[$q_index]; + } + $x_max = count($x_value) - 1; + } + // unnormalize the remainder + $x->rshift($shift); + $quotient->is_negative = $x_sign != $y_sign; + // calculate the "common residue", if appropriate + if ($x_sign) { + $y->rshift($shift); + $x = $y->subtract($x); + } + return [$this->normalize($quotient), $this->normalize($x)]; + } + /** + * Divides a BigInteger by a regular integer + * + * abc / x = a00 / x + b0 / x + c / x + * + * @param array $dividend + * @param int $divisor + * @return array + */ + private static function divide_digit(array $dividend, $divisor) + { + $carry = 0; + $result = []; + for ($i = count($dividend) - 1; $i >= 0; --$i) { + $temp = static::BASE_FULL * $carry + $dividend[$i]; + $result[$i] = self::safe_divide($temp, $divisor); + $carry = (int) ($temp - $divisor * $result[$i]); + } + return [$result, $carry]; + } + /** + * Single digit division + * + * Even if int64 is being used the division operator will return a float64 value + * if the dividend is not evenly divisible by the divisor. Since a float64 doesn't + * have the precision of int64 this is a problem so, when int64 is being used, + * we'll guarantee that the dividend is divisible by first subtracting the remainder. + * + * @param int $x + * @param int $y + * @return int + */ + private static function safe_divide($x, $y) + { + if (static::BASE === 26) { + return (int) ($x / $y); + } + // static::BASE === 31 + /** @var int */ + return ($x - $x % $y) / $y; + } + /** + * Convert an array / boolean to a PHP BigInteger object + * + * @param array $arr + * @return static + */ + protected function convertToObj(array $arr) + { + $result = new static(); + $result->value = $arr[self::VALUE]; + $result->is_negative = $arr[self::SIGN]; + return $this->normalize($result); + } + /** + * Normalize + * + * Removes leading zeros and truncates (if necessary) to maintain the appropriate precision + * + * @param PHP $result + * @return static + */ + protected function normalize(PHP $result) + { + $result->precision = $this->precision; + $result->bitmask = $this->bitmask; + $value =& $result->value; + if (!count($value)) { + $result->is_negative = \false; + return $result; + } + $value = static::trim($value); + if (!empty($result->bitmask->value)) { + $length = min(count($value), count($result->bitmask->value)); + $value = array_slice($value, 0, $length); + for ($i = 0; $i < $length; ++$i) { + $value[$i] = $value[$i] & $result->bitmask->value[$i]; + } + $value = static::trim($value); + } + return $result; + } + /** + * Compares two numbers. + * + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @return int + * @see static::compare() + */ + protected static function compareHelper(array $x_value, $x_negative, array $y_value, $y_negative) + { + if ($x_negative != $y_negative) { + return !$x_negative && $y_negative ? 1 : -1; + } + $result = $x_negative ? -1 : 1; + if (count($x_value) != count($y_value)) { + return count($x_value) > count($y_value) ? $result : -$result; + } + $size = max(count($x_value), count($y_value)); + $x_value = array_pad($x_value, $size, 0); + $y_value = array_pad($y_value, $size, 0); + for ($i = count($x_value) - 1; $i >= 0; --$i) { + if ($x_value[$i] != $y_value[$i]) { + return $x_value[$i] > $y_value[$i] ? $result : -$result; + } + } + return 0; + } + /** + * Absolute value. + * + * @return PHP + */ + public function abs() + { + $temp = new static(); + $temp->value = $this->value; + return $temp; + } + /** + * Trim + * + * Removes leading zeros + * + * @param list $value + * @return list + */ + protected static function trim(array $value) + { + for ($i = count($value) - 1; $i >= 0; --$i) { + if ($value[$i]) { + break; + } + unset($value[$i]); + } + return $value; + } + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits, effectively dividing by 2**$shift. + * + * @param int $shift + * @return PHP + */ + public function bitwise_rightShift($shift) + { + $temp = new static(); + // could just replace lshift with this, but then all lshift() calls would need to be rewritten + // and I don't want to do that... + $temp->value = $this->value; + $temp->rshift($shift); + return $this->normalize($temp); + } + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits, effectively multiplying by 2**$shift. + * + * @param int $shift + * @return PHP + */ + public function bitwise_leftShift($shift) + { + $temp = new static(); + // could just replace _rshift with this, but then all _lshift() calls would need to be rewritten + // and I don't want to do that... + $temp->value = $this->value; + $temp->lshift($shift); + return $this->normalize($temp); + } + /** + * Converts 32-bit integers to bytes. + * + * @param int $x + * @return string + */ + private static function int2bytes($x) + { + return ltrim(pack('N', $x), chr(0)); + } + /** + * Array Repeat + * + * @param int $input + * @param int $multiplier + * @return array + */ + protected static function array_repeat($input, $multiplier) + { + return $multiplier ? array_fill(0, $multiplier, $input) : []; + } + /** + * Logical Left Shift + * + * Shifts BigInteger's by $shift bits. + * + * @param int $shift + */ + protected function lshift($shift) + { + if ($shift == 0) { + return; + } + $num_digits = (int) ($shift / static::BASE); + $shift %= static::BASE; + $shift = 1 << $shift; + $carry = 0; + for ($i = 0; $i < count($this->value); ++$i) { + $temp = $this->value[$i] * $shift + $carry; + $carry = static::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $this->value[$i] = (int) ($temp - $carry * static::BASE_FULL); + } + if ($carry) { + $this->value[count($this->value)] = $carry; + } + while ($num_digits--) { + array_unshift($this->value, 0); + } + } + /** + * Logical Right Shift + * + * Shifts BigInteger's by $shift bits. + * + * @param int $shift + */ + protected function rshift($shift) + { + if ($shift == 0) { + return; + } + $num_digits = (int) ($shift / static::BASE); + $shift %= static::BASE; + $carry_shift = static::BASE - $shift; + $carry_mask = (1 << $shift) - 1; + if ($num_digits) { + $this->value = array_slice($this->value, $num_digits); + } + $carry = 0; + for ($i = count($this->value) - 1; $i >= 0; --$i) { + $temp = $this->value[$i] >> $shift | $carry; + $carry = ($this->value[$i] & $carry_mask) << $carry_shift; + $this->value[$i] = $temp; + } + $this->value = static::trim($this->value); + } + /** + * Performs modular exponentiation. + * + * @param PHP $e + * @param PHP $n + * @return PHP + */ + protected function powModInner(PHP $e, PHP $n) + { + try { + $class = static::$modexpEngine[static::class]; + return $class::powModHelper($this, $e, $n, static::class); + } catch (\Exception $err) { + return PHP\DefaultEngine::powModHelper($this, $e, $n, static::class); + } + } + /** + * Performs squaring + * + * @param list $x + * @return list + */ + protected static function square(array $x) + { + return count($x) < 2 * self::KARATSUBA_CUTOFF ? self::trim(self::baseSquare($x)) : self::trim(self::karatsubaSquare($x)); + } + /** + * Performs traditional squaring on two BigIntegers + * + * Squaring can be done faster than multiplying a number by itself can be. See + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=7 HAC 14.2.4} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=141 MPM 5.3} for more information. + * + * @param array $value + * @return array + */ + protected static function baseSquare(array $value) + { + if (empty($value)) { + return []; + } + $square_value = self::array_repeat(0, 2 * count($value)); + for ($i = 0, $max_index = count($value) - 1; $i <= $max_index; ++$i) { + $i2 = $i << 1; + $temp = $square_value[$i2] + $value[$i] * $value[$i]; + $carry = static::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $square_value[$i2] = (int) ($temp - static::BASE_FULL * $carry); + // note how we start from $i+1 instead of 0 as we do in multiplication. + for ($j = $i + 1, $k = $i2 + 1; $j <= $max_index; ++$j, ++$k) { + $temp = $square_value[$k] + 2 * $value[$j] * $value[$i] + $carry; + $carry = static::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $square_value[$k] = (int) ($temp - static::BASE_FULL * $carry); + } + // the following line can yield values larger 2**15. at this point, PHP should switch + // over to floats. + $square_value[$i + $max_index + 1] = $carry; + } + return $square_value; + } + /** + * Performs Karatsuba "squaring" on two BigIntegers + * + * See {@link http://en.wikipedia.org/wiki/Karatsuba_algorithm Karatsuba algorithm} and + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=151 MPM 5.3.4}. + * + * @param array $value + * @return array + */ + protected static function karatsubaSquare(array $value) + { + $m = count($value) >> 1; + if ($m < self::KARATSUBA_CUTOFF) { + return self::baseSquare($value); + } + $x1 = array_slice($value, $m); + $x0 = array_slice($value, 0, $m); + $z2 = self::karatsubaSquare($x1); + $z0 = self::karatsubaSquare($x0); + $z1 = self::addHelper($x1, \false, $x0, \false); + $z1 = self::karatsubaSquare($z1[self::VALUE]); + $temp = self::addHelper($z2, \false, $z0, \false); + $z1 = self::subtractHelper($z1, \false, $temp[self::VALUE], \false); + $z2 = array_merge(array_fill(0, 2 * $m, 0), $z2); + $z1[self::VALUE] = array_merge(array_fill(0, $m, 0), $z1[self::VALUE]); + $xx = self::addHelper($z2, \false, $z1[self::VALUE], $z1[self::SIGN]); + $xx = self::addHelper($xx[self::VALUE], $xx[self::SIGN], $z0, \false); + return $xx[self::VALUE]; + } + /** + * Make the current number odd + * + * If the current number is odd it'll be unchanged. If it's even, one will be added to it. + * + * @see self::randomPrime() + */ + protected function make_odd() + { + $this->value[0] |= 1; + } + /** + * Test the number against small primes. + * + * @see self::isPrime() + */ + protected function testSmallPrimes() + { + if ($this->value == [1]) { + return \false; + } + if ($this->value == [2]) { + return \true; + } + if (~$this->value[0] & 1) { + return \false; + } + $value = $this->value; + foreach (static::PRIMES as $prime) { + list(, $r) = self::divide_digit($value, $prime); + if (!$r) { + return count($value) == 1 && $value[0] == $prime; + } + } + return \true; + } + /** + * Scan for 1 and right shift by that amount + * + * ie. $s = gmp_scan1($n, 0) and $r = gmp_div_q($n, gmp_pow(gmp_init('2'), $s)); + * + * @param PHP $r + * @return int + * @see self::isPrime() + */ + public static function scan1divide(PHP $r) + { + $r_value =& $r->value; + for ($i = 0, $r_length = count($r_value); $i < $r_length; ++$i) { + $temp = ~$r_value[$i] & static::MAX_DIGIT; + for ($j = 1; $temp >> $j & 1; ++$j) { + } + if ($j <= static::BASE) { + break; + } + } + $s = static::BASE * $i + $j; + $r->rshift($s); + return $s; + } + /** + * Performs exponentiation. + * + * @param PHP $n + * @return PHP + */ + protected function powHelper(PHP $n) + { + if ($n->compare(static::$zero[static::class]) == 0) { + return new static(1); + } + // n^0 = 1 + $temp = clone $this; + while (!$n->equals(static::$one[static::class])) { + $temp = $temp->multiply($this); + $n = $n->subtract(static::$one[static::class]); + } + return $temp; + } + /** + * Is Odd? + * + * @return bool + */ + public function isOdd() + { + return (bool) ($this->value[0] & 1); + } + /** + * Tests if a bit is set + * + * @return bool + */ + public function testBit($x) + { + $digit = (int) floor($x / static::BASE); + $bit = $x % static::BASE; + if (!isset($this->value[$digit])) { + return \false; + } + return (bool) ($this->value[$digit] & 1 << $bit); + } + /** + * Is Negative? + * + * @return bool + */ + public function isNegative() + { + return $this->is_negative; + } + /** + * Negate + * + * Given $k, returns -$k + * + * @return static + */ + public function negate() + { + $temp = clone $this; + $temp->is_negative = !$temp->is_negative; + return $temp; + } + /** + * Bitwise Split + * + * Splits BigInteger's into chunks of $split bits + * + * @param int $split + * @return list + */ + public function bitwise_split($split) + { + if ($split < 1) { + throw new \RuntimeException('Offset must be greater than 1'); + } + $width = (int) ($split / static::BASE); + if (!$width) { + $arr = $this->bitwise_small_split($split); + return array_map(function ($digit) { + $temp = new static(); + $temp->value = $digit != 0 ? [$digit] : []; + return $temp; + }, $arr); + } + $vals = []; + $val = $this->value; + $i = $overflow = 0; + $len = count($val); + while ($i < $len) { + $digit = []; + if (!$overflow) { + $digit = array_slice($val, $i, $width); + $i += $width; + $overflow = $split % static::BASE; + if ($overflow) { + $mask = (1 << $overflow) - 1; + $temp = isset($val[$i]) ? $val[$i] : 0; + $digit[] = $temp & $mask; + } + } else { + $remaining = static::BASE - $overflow; + $tempsplit = $split - $remaining; + $tempwidth = (int) ($tempsplit / static::BASE + 1); + $digit = array_slice($val, $i, $tempwidth); + $i += $tempwidth; + $tempoverflow = $tempsplit % static::BASE; + if ($tempoverflow) { + $tempmask = (1 << $tempoverflow) - 1; + $temp = isset($val[$i]) ? $val[$i] : 0; + $digit[] = $temp & $tempmask; + } + $newbits = 0; + for ($j = count($digit) - 1; $j >= 0; $j--) { + $temp = $digit[$j] & $mask; + $digit[$j] = $digit[$j] >> $overflow | $newbits << $remaining; + $newbits = $temp; + } + $overflow = $tempoverflow; + $mask = $tempmask; + } + $temp = new static(); + $temp->value = static::trim($digit); + $vals[] = $temp; + } + return array_reverse($vals); + } + /** + * Bitwise Split where $split < static::BASE + * + * @param int $split + * @return list + */ + private function bitwise_small_split($split) + { + $vals = []; + $val = $this->value; + $mask = (1 << $split) - 1; + $i = $overflow = 0; + $len = count($val); + $val[] = 0; + $remaining = static::BASE; + while ($i != $len) { + $digit = $val[$i] & $mask; + $val[$i] >>= $split; + if (!$overflow) { + $remaining -= $split; + $overflow = $split <= $remaining ? 0 : $split - $remaining; + if (!$remaining) { + $i++; + $remaining = static::BASE; + $overflow = 0; + } + } elseif (++$i != $len) { + $tempmask = (1 << $overflow) - 1; + $digit |= ($val[$i] & $tempmask) << $remaining; + $val[$i] >>= $overflow; + $remaining = static::BASE - $overflow; + $overflow = $split <= $remaining ? 0 : $split - $remaining; + } + $vals[] = $digit; + } + while ($vals[count($vals) - 1] == 0) { + unset($vals[count($vals) - 1]); + } + return array_reverse($vals); + } + /** + * @return bool + */ + protected static function testJITOnWindows() + { + // see https://github.com/php/php-src/issues/11917 + if (strtoupper(substr(\PHP_OS, 0, 3)) === 'WIN' && function_exists('opcache_get_status') && \PHP_VERSION_ID < 80213 && !defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\PHPSECLIB_ALLOW_JIT')) { + $status = opcache_get_status(); + if ($status && isset($status['jit']) && $status['jit']['enabled'] && $status['jit']['on']) { + return \true; + } + } + return \false; + } + /** + * Return the size of a BigInteger in bits + * + * @return int + */ + public function getLength() + { + $max = count($this->value) - 1; + return $max != -1 ? $max * static::BASE + intval(ceil(log($this->value[$max] + 1, 2))) : 0; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Base.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Base.php new file mode 100644 index 0000000..2ced038 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Base.php @@ -0,0 +1,133 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; +/** + * PHP Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Base extends PHP +{ + /** + * Cache constants + * + * $cache[self::VARIABLE] tells us whether or not the cached data is still valid. + * + */ + const VARIABLE = 0; + /** + * $cache[self::DATA] contains the cached data. + * + */ + const DATA = 1; + /** + * Test for engine validity + * + * @return bool + */ + public static function isValidEngine() + { + return static::class != __CLASS__; + } + /** + * Performs modular exponentiation. + * + * The most naive approach to modular exponentiation has very unreasonable requirements, and + * and although the approach involving repeated squaring does vastly better, it, too, is impractical + * for our purposes. The reason being that division - by far the most complicated and time-consuming + * of the basic operations (eg. +,-,*,/) - occurs multiple times within it. + * + * Modular reductions resolve this issue. Although an individual modular reduction takes more time + * then an individual division, when performed in succession (with the same modulo), they're a lot faster. + * + * The two most commonly used modular reductions are Barrett and Montgomery reduction. Montgomery reduction, + * although faster, only works when the gcd of the modulo and of the base being used is 1. In RSA, when the + * base is a power of two, the modulo - a product of two primes - is always going to have a gcd of 1 (because + * the product of two odd numbers is odd), but what about when RSA isn't used? + * + * In contrast, Barrett reduction has no such constraint. As such, some bigint implementations perform a + * Barrett reduction after every operation in the modpow function. Others perform Barrett reductions when the + * modulo is even and Montgomery reductions when the modulo is odd. BigInteger.java's modPow method, however, + * uses a trick involving the Chinese Remainder Theorem to factor the even modulo into two numbers - one odd and + * the other, a power of two - and recombine them, later. This is the method that this modPow function uses. + * {@link http://islab.oregonstate.edu/papers/j34monex.pdf Montgomery Reduction with Even Modulus} elaborates. + * + * @param PHP $x + * @param PHP $e + * @param PHP $n + * @param string $class + * @return PHP + */ + protected static function powModHelper(PHP $x, PHP $e, PHP $n, $class) + { + if (empty($e->value)) { + $temp = new $class(); + $temp->value = [1]; + return $x->normalize($temp); + } + if ($e->value == [1]) { + list(, $temp) = $x->divide($n); + return $x->normalize($temp); + } + if ($e->value == [2]) { + $temp = new $class(); + $temp->value = $class::square($x->value); + list(, $temp) = $temp->divide($n); + return $x->normalize($temp); + } + return $x->normalize(static::slidingWindow($x, $e, $n, $class)); + } + /** + * Modular reduction preparation + * + * @param array $x + * @param array $n + * @param string $class + * @see self::slidingWindow() + * @return array + */ + protected static function prepareReduce(array $x, array $n, $class) + { + return static::reduce($x, $n, $class); + } + /** + * Modular multiply + * + * @param array $x + * @param array $y + * @param array $n + * @param string $class + * @see self::slidingWindow() + * @return array + */ + protected static function multiplyReduce(array $x, array $y, array $n, $class) + { + $temp = $class::multiplyHelper($x, \false, $y, \false); + return static::reduce($temp[self::VALUE], $n, $class); + } + /** + * Modular square + * + * @param array $x + * @param array $n + * @param string $class + * @see self::slidingWindow() + * @return array + */ + protected static function squareReduce(array $x, array $n, $class) + { + return static::reduce($class::square($x), $n, $class); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php new file mode 100644 index 0000000..c4dbae1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php @@ -0,0 +1,23 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions\EvalBarrett; +/** + * PHP Default Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class DefaultEngine extends EvalBarrett +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php new file mode 100644 index 0000000..35c74d1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php @@ -0,0 +1,78 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\Engine; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions\PowerOfTwo; +/** + * PHP Montgomery Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Montgomery extends Base +{ + /** + * Test for engine validity + * + * @return bool + */ + public static function isValidEngine() + { + return static::class != __CLASS__; + } + /** + * Performs modular exponentiation. + * + * @template T of Engine + * @param Engine $x + * @param Engine $e + * @param Engine $n + * @param class-string $class + * @return T + */ + protected static function slidingWindow(Engine $x, Engine $e, Engine $n, $class) + { + // is the modulo odd? + if ($n->value[0] & 1) { + return parent::slidingWindow($x, $e, $n, $class); + } + // if it's not, it's even + // find the lowest set bit (eg. the max pow of 2 that divides $n) + for ($i = 0; $i < count($n->value); ++$i) { + if ($n->value[$i]) { + $temp = decbin($n->value[$i]); + $j = strlen($temp) - strrpos($temp, '1') - 1; + $j += $class::BASE * $i; + break; + } + } + // at this point, 2^$j * $n/(2^$j) == $n + $mod1 = clone $n; + $mod1->rshift($j); + $mod2 = new $class(); + $mod2->value = [1]; + $mod2->lshift($j); + $part1 = $mod1->value != [1] ? parent::slidingWindow($x, $e, $mod1, $class) : new $class(); + $part2 = PowerOfTwo::slidingWindow($x, $e, $mod2, $class); + $y1 = $mod2->modInverse($mod1); + $y2 = $mod1->modInverse($mod2); + $result = $part1->multiply($mod2); + $result = $result->multiply($y1); + $temp = $part2->multiply($mod1); + $temp = $temp->multiply($y2); + $result = $result->add($temp); + list(, $result) = $result->divide($n); + return $result; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php new file mode 100644 index 0000000..b9458ca --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php @@ -0,0 +1,23 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\OpenSSL as Progenitor; +/** + * OpenSSL Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class OpenSSL extends Progenitor +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php new file mode 100644 index 0000000..5f6d3ca --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php @@ -0,0 +1,239 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Base; +/** + * PHP Barrett Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Barrett extends Base +{ + /** + * Barrett Modular Reduction + * + * See {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=14 HAC 14.3.3} / + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=165 MPM 6.2.5} for more information. Modified slightly, + * so as not to require negative numbers (initially, this script didn't support negative numbers). + * + * Employs "folding", as described at + * {@link http://www.cosic.esat.kuleuven.be/publications/thesis-149.pdf#page=66 thesis-149.pdf#page=66}. To quote from + * it, "the idea [behind folding] is to find a value x' such that x (mod m) = x' (mod m), with x' being smaller than x." + * + * Unfortunately, the "Barrett Reduction with Folding" algorithm described in thesis-149.pdf is not, as written, all that + * usable on account of (1) its not using reasonable radix points as discussed in + * {@link http://math.libtomcrypt.com/files/tommath.pdf#page=162 MPM 6.2.2} and (2) the fact that, even with reasonable + * radix points, it only works when there are an even number of digits in the denominator. The reason for (2) is that + * (x >> 1) + (x >> 1) != x / 2 + x / 2. If x is even, they're the same, but if x is odd, they're not. See the in-line + * comments for details. + * + * @param array $n + * @param array $m + * @param class-string $class + * @return array + */ + protected static function reduce(array $n, array $m, $class) + { + static $cache = [self::VARIABLE => [], self::DATA => []]; + $m_length = count($m); + // if (self::compareHelper($n, $static::square($m)) >= 0) { + if (count($n) > 2 * $m_length) { + $lhs = new $class(); + $rhs = new $class(); + $lhs->value = $n; + $rhs->value = $m; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + // if (m.length >> 1) + 2 <= m.length then m is too small and n can't be reduced + if ($m_length < 5) { + return self::regularBarrett($n, $m, $class); + } + // n = 2 * m.length + if (($key = array_search($m, $cache[self::VARIABLE])) === \false) { + $key = count($cache[self::VARIABLE]); + $cache[self::VARIABLE][] = $m; + $lhs = new $class(); + $lhs_value =& $lhs->value; + $lhs_value = self::array_repeat(0, $m_length + ($m_length >> 1)); + $lhs_value[] = 1; + $rhs = new $class(); + $rhs->value = $m; + list($u, $m1) = $lhs->divide($rhs); + $u = $u->value; + $m1 = $m1->value; + $cache[self::DATA][] = [ + 'u' => $u, + // m.length >> 1 (technically (m.length >> 1) + 1) + 'm1' => $m1, + ]; + } else { + extract($cache[self::DATA][$key]); + } + $cutoff = $m_length + ($m_length >> 1); + $lsd = array_slice($n, 0, $cutoff); + // m.length + (m.length >> 1) + $msd = array_slice($n, $cutoff); + // m.length >> 1 + $lsd = self::trim($lsd); + $temp = $class::multiplyHelper($msd, \false, $m1, \false); + // m.length + (m.length >> 1) + $n = $class::addHelper($lsd, \false, $temp[self::VALUE], \false); + // m.length + (m.length >> 1) + 1 (so basically we're adding two same length numbers) + //if ($m_length & 1) { + // return self::regularBarrett($n[self::VALUE], $m, $class); + //} + // (m.length + (m.length >> 1) + 1) - (m.length - 1) == (m.length >> 1) + 2 + $temp = array_slice($n[self::VALUE], $m_length - 1); + // if even: ((m.length >> 1) + 2) + (m.length >> 1) == m.length + 2 + // if odd: ((m.length >> 1) + 2) + (m.length >> 1) == (m.length - 1) + 2 == m.length + 1 + $temp = $class::multiplyHelper($temp, \false, $u, \false); + // if even: (m.length + 2) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + 1 + // if odd: (m.length + 1) - ((m.length >> 1) + 1) = m.length - (m.length >> 1) + $temp = array_slice($temp[self::VALUE], ($m_length >> 1) + 1); + // if even: (m.length - (m.length >> 1) + 1) + m.length = 2 * m.length - (m.length >> 1) + 1 + // if odd: (m.length - (m.length >> 1)) + m.length = 2 * m.length - (m.length >> 1) + $temp = $class::multiplyHelper($temp, \false, $m, \false); + // at this point, if m had an odd number of digits, we'd be subtracting a 2 * m.length - (m.length >> 1) digit + // number from a m.length + (m.length >> 1) + 1 digit number. ie. there'd be an extra digit and the while loop + // following this comment would loop a lot (hence our calling _regularBarrett() in that situation). + $result = $class::subtractHelper($n[self::VALUE], \false, $temp[self::VALUE], \false); + while (self::compareHelper($result[self::VALUE], $result[self::SIGN], $m, \false) >= 0) { + $result = $class::subtractHelper($result[self::VALUE], $result[self::SIGN], $m, \false); + } + return $result[self::VALUE]; + } + /** + * (Regular) Barrett Modular Reduction + * + * For numbers with more than four digits BigInteger::_barrett() is faster. The difference between that and this + * is that this function does not fold the denominator into a smaller form. + * + * @param array $x + * @param array $n + * @param string $class + * @return array + */ + private static function regularBarrett(array $x, array $n, $class) + { + static $cache = [self::VARIABLE => [], self::DATA => []]; + $n_length = count($n); + if (count($x) > 2 * $n_length) { + $lhs = new $class(); + $rhs = new $class(); + $lhs->value = $x; + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + if (($key = array_search($n, $cache[self::VARIABLE])) === \false) { + $key = count($cache[self::VARIABLE]); + $cache[self::VARIABLE][] = $n; + $lhs = new $class(); + $lhs_value =& $lhs->value; + $lhs_value = self::array_repeat(0, 2 * $n_length); + $lhs_value[] = 1; + $rhs = new $class(); + $rhs->value = $n; + list($temp, ) = $lhs->divide($rhs); + // m.length + $cache[self::DATA][] = $temp->value; + } + // 2 * m.length - (m.length - 1) = m.length + 1 + $temp = array_slice($x, $n_length - 1); + // (m.length + 1) + m.length = 2 * m.length + 1 + $temp = $class::multiplyHelper($temp, \false, $cache[self::DATA][$key], \false); + // (2 * m.length + 1) - (m.length - 1) = m.length + 2 + $temp = array_slice($temp[self::VALUE], $n_length + 1); + // m.length + 1 + $result = array_slice($x, 0, $n_length + 1); + // m.length + 1 + $temp = self::multiplyLower($temp, \false, $n, \false, $n_length + 1, $class); + // $temp == array_slice($class::regularMultiply($temp, false, $n, false)->value, 0, $n_length + 1) + if (self::compareHelper($result, \false, $temp[self::VALUE], $temp[self::SIGN]) < 0) { + $corrector_value = self::array_repeat(0, $n_length + 1); + $corrector_value[count($corrector_value)] = 1; + $result = $class::addHelper($result, \false, $corrector_value, \false); + $result = $result[self::VALUE]; + } + // at this point, we're subtracting a number with m.length + 1 digits from another number with m.length + 1 digits + $result = $class::subtractHelper($result, \false, $temp[self::VALUE], $temp[self::SIGN]); + while (self::compareHelper($result[self::VALUE], $result[self::SIGN], $n, \false) > 0) { + $result = $class::subtractHelper($result[self::VALUE], $result[self::SIGN], $n, \false); + } + return $result[self::VALUE]; + } + /** + * Performs long multiplication up to $stop digits + * + * If you're going to be doing array_slice($product->value, 0, $stop), some cycles can be saved. + * + * @see self::regularBarrett() + * @param array $x_value + * @param bool $x_negative + * @param array $y_value + * @param bool $y_negative + * @param int $stop + * @param string $class + * @return array + */ + private static function multiplyLower(array $x_value, $x_negative, array $y_value, $y_negative, $stop, $class) + { + $x_length = count($x_value); + $y_length = count($y_value); + if (!$x_length || !$y_length) { + // a 0 is being multiplied + return [self::VALUE => [], self::SIGN => \false]; + } + if ($x_length < $y_length) { + $temp = $x_value; + $x_value = $y_value; + $y_value = $temp; + $x_length = count($x_value); + $y_length = count($y_value); + } + $product_value = self::array_repeat(0, $x_length + $y_length); + // the following for loop could be removed if the for loop following it + // (the one with nested for loops) initially set $i to 0, but + // doing so would also make the result in one set of unnecessary adds, + // since on the outermost loops first pass, $product->value[$k] is going + // to always be 0 + $carry = 0; + for ($j = 0; $j < $x_length; ++$j) { + // ie. $i = 0, $k = $i + $temp = $x_value[$j] * $y_value[0] + $carry; + // $product_value[$k] == 0 + $carry = $class::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $product_value[$j] = (int) ($temp - $class::BASE_FULL * $carry); + } + if ($j < $stop) { + $product_value[$j] = $carry; + } + // the above for loop is what the previous comment was talking about. the + // following for loop is the "one with nested for loops" + for ($i = 1; $i < $y_length; ++$i) { + $carry = 0; + for ($j = 0, $k = $i; $j < $x_length && $k < $stop; ++$j, ++$k) { + $temp = $product_value[$k] + $x_value[$j] * $y_value[$i] + $carry; + $carry = $class::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31; + $product_value[$k] = (int) ($temp - $class::BASE_FULL * $carry); + } + if ($k < $stop) { + $product_value[$k] = $carry; + } + } + return [self::VALUE => self::trim($product_value), self::SIGN => $x_negative != $y_negative]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php new file mode 100644 index 0000000..1e027fd --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php @@ -0,0 +1,40 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Base; +/** + * PHP Classic Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Classic extends Base +{ + /** + * Regular Division + * + * @param array $x + * @param array $n + * @param string $class + * @return array + */ + protected static function reduce(array $x, array $n, $class) + { + $lhs = new $class(); + $lhs->value = $x; + $rhs = new $class(); + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php new file mode 100644 index 0000000..12dafbc --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php @@ -0,0 +1,412 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Base; +/** + * PHP Dynamic Barrett Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class EvalBarrett extends Base +{ + /** + * Custom Reduction Function + * + * @see self::generateCustomReduction + */ + private static $custom_reduction; + /** + * Barrett Modular Reduction + * + * This calls a dynamically generated loop unrolled function that's specific to a given modulo. + * Array lookups are avoided as are if statements testing for how many bits the host OS supports, etc. + * + * @param array $n + * @param array $m + * @param string $class + * @return array + */ + protected static function reduce(array $n, array $m, $class) + { + $inline = self::$custom_reduction; + return $inline($n); + } + /** + * Generate Custom Reduction + * + * @param PHP $m + * @param string $class + * @return callable + */ + protected static function generateCustomReduction(PHP $m, $class) + { + $m_length = count($m->value); + if ($m_length < 5) { + $code = ' + $lhs = new ' . $class . '(); + $lhs->value = $x; + $rhs = new ' . $class . '(); + $rhs->value = [' . implode(',', array_map(self::class . '::float2string', $m->value)) . ']; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + '; + eval('$func = function ($x) { ' . $code . '};'); + self::$custom_reduction = $func; + //self::$custom_reduction = \Closure::bind($func, $m, $class); + return $func; + } + $lhs = new $class(); + $lhs_value =& $lhs->value; + $lhs_value = self::array_repeat(0, $m_length + ($m_length >> 1)); + $lhs_value[] = 1; + $rhs = new $class(); + list($u, $m1) = $lhs->divide($m); + if ($class::BASE != 26) { + $u = $u->value; + } else { + $lhs_value = self::array_repeat(0, 2 * $m_length); + $lhs_value[] = 1; + $rhs = new $class(); + list($u) = $lhs->divide($m); + $u = $u->value; + } + $m = $m->value; + $m1 = $m1->value; + $cutoff = count($m) + (count($m) >> 1); + $code = ' + if (count($n) > ' . 2 * count($m) . ') { + $lhs = new ' . $class . '(); + $rhs = new ' . $class . '(); + $lhs->value = $n; + $rhs->value = [' . implode(',', array_map(self::class . '::float2string', $m)) . ']; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + + $lsd = array_slice($n, 0, ' . $cutoff . '); + $msd = array_slice($n, ' . $cutoff . ');'; + $code .= self::generateInlineTrim('msd'); + $code .= self::generateInlineMultiply('msd', $m1, 'temp', $class); + $code .= self::generateInlineAdd('lsd', 'temp', 'n', $class); + $code .= '$temp = array_slice($n, ' . (count($m) - 1) . ');'; + $code .= self::generateInlineMultiply('temp', $u, 'temp2', $class); + $code .= self::generateInlineTrim('temp2'); + $code .= $class::BASE == 26 ? '$temp = array_slice($temp2, ' . (count($m) + 1) . ');' : '$temp = array_slice($temp2, ' . ((count($m) >> 1) + 1) . ');'; + $code .= self::generateInlineMultiply('temp', $m, 'temp2', $class); + $code .= self::generateInlineTrim('temp2'); + /* + if ($class::BASE == 26) { + $code.= '$n = array_slice($n, 0, ' . (count($m) + 1) . '); + $temp2 = array_slice($temp2, 0, ' . (count($m) + 1) . ');'; + } + */ + $code .= self::generateInlineSubtract2('n', 'temp2', 'temp', $class); + $subcode = self::generateInlineSubtract1('temp', $m, 'temp2', $class); + $subcode .= '$temp = $temp2;'; + $code .= self::generateInlineCompare($m, 'temp', $subcode); + $code .= 'return $temp;'; + eval('$func = function ($n) { ' . $code . '};'); + self::$custom_reduction = $func; + return $func; + //self::$custom_reduction = \Closure::bind($func, $m, $class); + } + /** + * Inline Trim + * + * Removes leading zeros + * + * @param string $name + * @return string + */ + private static function generateInlineTrim($name) + { + return ' + for ($i = count($' . $name . ') - 1; $i >= 0; --$i) { + if ($' . $name . '[$i]) { + break; + } + unset($' . $name . '[$i]); + }'; + } + /** + * Inline Multiply (unknown, known) + * + * @param string $input + * @param array $arr + * @param string $output + * @param string $class + * @return string + */ + private static function generateInlineMultiply($input, array $arr, $output, $class) + { + if (!count($arr)) { + return 'return [];'; + } + $regular = ' + $length = count($' . $input . '); + if (!$length) { + $' . $output . ' = []; + }else{ + $' . $output . ' = array_fill(0, $length + ' . count($arr) . ', 0); + $carry = 0;'; + for ($i = 0; $i < count($arr); $i++) { + $regular .= ' + $subtemp = $' . $input . '[0] * ' . $arr[$i]; + $regular .= $i ? ' + $carry;' : ';'; + $regular .= '$carry = '; + $regular .= $class::BASE === 26 ? 'intval($subtemp / 0x4000000);' : '$subtemp >> 31;'; + $regular .= '$' . $output . '[' . $i . '] = '; + if ($class::BASE === 26) { + $regular .= '(int) ('; + } + $regular .= '$subtemp - ' . $class::BASE_FULL . ' * $carry'; + $regular .= $class::BASE === 26 ? ');' : ';'; + } + $regular .= '$' . $output . '[' . count($arr) . '] = $carry;'; + $regular .= ' + for ($i = 1; $i < $length; ++$i) {'; + for ($j = 0; $j < count($arr); $j++) { + $regular .= $j ? '$k++;' : '$k = $i;'; + $regular .= ' + $subtemp = $' . $output . '[$k] + $' . $input . '[$i] * ' . $arr[$j]; + $regular .= $j ? ' + $carry;' : ';'; + $regular .= '$carry = '; + $regular .= $class::BASE === 26 ? 'intval($subtemp / 0x4000000);' : '$subtemp >> 31;'; + $regular .= '$' . $output . '[$k] = '; + if ($class::BASE === 26) { + $regular .= '(int) ('; + } + $regular .= '$subtemp - ' . $class::BASE_FULL . ' * $carry'; + $regular .= $class::BASE === 26 ? ');' : ';'; + } + $regular .= '$' . $output . '[++$k] = $carry; $carry = 0;'; + $regular .= '}}'; + //if (count($arr) < 2 * self::KARATSUBA_CUTOFF) { + //} + return $regular; + } + /** + * Inline Addition + * + * @param string $x + * @param string $y + * @param string $result + * @param string $class + * @return string + */ + private static function generateInlineAdd($x, $y, $result, $class) + { + $code = ' + $length = max(count($' . $x . '), count($' . $y . ')); + $' . $result . ' = array_pad($' . $x . ', $length + 1, 0); + $_' . $y . ' = array_pad($' . $y . ', $length, 0); + $carry = 0; + for ($i = 0, $j = 1; $j < $length; $i+=2, $j+=2) { + $sum = ($' . $result . '[$j] + $_' . $y . '[$j]) * ' . $class::BASE_FULL . ' + + $' . $result . '[$i] + $_' . $y . '[$i] + + $carry; + $carry = $sum >= ' . self::float2string($class::MAX_DIGIT2) . '; + $sum = $carry ? $sum - ' . self::float2string($class::MAX_DIGIT2) . ' : $sum;'; + $code .= $class::BASE === 26 ? '$upper = intval($sum / 0x4000000); $' . $result . '[$i] = (int) ($sum - ' . $class::BASE_FULL . ' * $upper);' : '$upper = $sum >> 31; $' . $result . '[$i] = $sum - ' . $class::BASE_FULL . ' * $upper;'; + $code .= ' + $' . $result . '[$j] = $upper; + } + if ($j == $length) { + $sum = $' . $result . '[$i] + $_' . $y . '[$i] + $carry; + $carry = $sum >= ' . self::float2string($class::BASE_FULL) . '; + $' . $result . '[$i] = $carry ? $sum - ' . self::float2string($class::BASE_FULL) . ' : $sum; + ++$i; + } + if ($carry) { + for (; $' . $result . '[$i] == ' . $class::MAX_DIGIT . '; ++$i) { + $' . $result . '[$i] = 0; + } + ++$' . $result . '[$i]; + }'; + $code .= self::generateInlineTrim($result); + return $code; + } + /** + * Inline Subtraction 2 + * + * For when $known is more digits than $unknown. This is the harder use case to optimize for. + * + * @param string $known + * @param string $unknown + * @param string $result + * @param string $class + * @return string + */ + private static function generateInlineSubtract2($known, $unknown, $result, $class) + { + $code = ' + $' . $result . ' = $' . $known . '; + $carry = 0; + $size = count($' . $unknown . '); + for ($i = 0, $j = 1; $j < $size; $i+= 2, $j+= 2) { + $sum = ($' . $known . '[$j] - $' . $unknown . '[$j]) * ' . $class::BASE_FULL . ' + $' . $known . '[$i] + - $' . $unknown . '[$i] + - $carry; + $carry = $sum < 0; + if ($carry) { + $sum+= ' . self::float2string($class::MAX_DIGIT2) . '; + } + $subtemp = '; + $code .= $class::BASE === 26 ? 'intval($sum / 0x4000000);' : '$sum >> 31;'; + $code .= '$' . $result . '[$i] = '; + if ($class::BASE === 26) { + $code .= '(int) ('; + } + $code .= '$sum - ' . $class::BASE_FULL . ' * $subtemp'; + if ($class::BASE === 26) { + $code .= ')'; + } + $code .= '; + $' . $result . '[$j] = $subtemp; + } + if ($j == $size) { + $sum = $' . $known . '[$i] - $' . $unknown . '[$i] - $carry; + $carry = $sum < 0; + $' . $result . '[$i] = $carry ? $sum + ' . $class::BASE_FULL . ' : $sum; + ++$i; + } + + if ($carry) { + for (; !$' . $result . '[$i]; ++$i) { + $' . $result . '[$i] = ' . $class::MAX_DIGIT . '; + } + --$' . $result . '[$i]; + }'; + $code .= self::generateInlineTrim($result); + return $code; + } + /** + * Inline Subtraction 1 + * + * For when $unknown is more digits than $known. This is the easier use case to optimize for. + * + * @param string $unknown + * @param array $known + * @param string $result + * @param string $class + * @return string + */ + private static function generateInlineSubtract1($unknown, array $known, $result, $class) + { + $code = '$' . $result . ' = $' . $unknown . ';'; + for ($i = 0, $j = 1; $j < count($known); $i += 2, $j += 2) { + $code .= '$sum = $' . $unknown . '[' . $j . '] * ' . $class::BASE_FULL . ' + $' . $unknown . '[' . $i . '] - '; + $code .= self::float2string($known[$j] * $class::BASE_FULL + $known[$i]); + if ($i != 0) { + $code .= ' - $carry'; + } + $code .= '; + if ($carry = $sum < 0) { + $sum+= ' . self::float2string($class::MAX_DIGIT2) . '; + } + $subtemp = '; + $code .= $class::BASE === 26 ? 'intval($sum / 0x4000000);' : '$sum >> 31;'; + $code .= ' + $' . $result . '[' . $i . '] = '; + if ($class::BASE === 26) { + $code .= ' (int) ('; + } + $code .= '$sum - ' . $class::BASE_FULL . ' * $subtemp'; + if ($class::BASE === 26) { + $code .= ')'; + } + $code .= '; + $' . $result . '[' . $j . '] = $subtemp;'; + } + $code .= '$i = ' . $i . ';'; + if ($j == count($known)) { + $code .= ' + $sum = $' . $unknown . '[' . $i . '] - ' . $known[$i] . ' - $carry; + $carry = $sum < 0; + $' . $result . '[' . $i . '] = $carry ? $sum + ' . $class::BASE_FULL . ' : $sum; + ++$i;'; + } + $code .= ' + if ($carry) { + for (; !$' . $result . '[$i]; ++$i) { + $' . $result . '[$i] = ' . $class::MAX_DIGIT . '; + } + --$' . $result . '[$i]; + }'; + $code .= self::generateInlineTrim($result); + return $code; + } + /** + * Inline Comparison + * + * If $unknown >= $known then loop + * + * @param array $known + * @param string $unknown + * @param string $subcode + * @return string + */ + private static function generateInlineCompare(array $known, $unknown, $subcode) + { + $uniqid = uniqid(); + $code = 'loop_' . $uniqid . ': + $clength = count($' . $unknown . '); + switch (true) { + case $clength < ' . count($known) . ': + goto end_' . $uniqid . '; + case $clength > ' . count($known) . ':'; + for ($i = count($known) - 1; $i >= 0; $i--) { + $code .= ' + case $' . $unknown . '[' . $i . '] > ' . $known[$i] . ': + goto subcode_' . $uniqid . '; + case $' . $unknown . '[' . $i . '] < ' . $known[$i] . ': + goto end_' . $uniqid . ';'; + } + $code .= ' + default: + // do subcode + } + + subcode_' . $uniqid . ':' . $subcode . ' + goto loop_' . $uniqid . '; + + end_' . $uniqid . ':'; + return $code; + } + /** + * Convert a float to a string + * + * If you do echo floatval(pow(2, 52)) you'll get 4.6116860184274E+18. It /can/ be displayed without a loss of + * precision but displayed in this way there will be precision loss, hence the need for this method. + * + * @param int|float $num + * @return string + */ + private static function float2string($num) + { + if (!is_float($num)) { + return (string) $num; + } + if ($num < 0) { + return '-' . self::float2string(abs($num)); + } + $temp = ''; + while ($num) { + $temp = fmod($num, 10) . $temp; + $num = floor($num / 10); + } + return $temp; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php new file mode 100644 index 0000000..853ffdf --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php @@ -0,0 +1,113 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Montgomery as Progenitor; +/** + * PHP Montgomery Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class Montgomery extends Progenitor +{ + /** + * Prepare a number for use in Montgomery Modular Reductions + * + * @param array $x + * @param array $n + * @param string $class + * @return array + */ + protected static function prepareReduce(array $x, array $n, $class) + { + $lhs = new $class(); + $lhs->value = array_merge(self::array_repeat(0, count($n)), $x); + $rhs = new $class(); + $rhs->value = $n; + list(, $temp) = $lhs->divide($rhs); + return $temp->value; + } + /** + * Montgomery Multiply + * + * Interleaves the montgomery reduction and long multiplication algorithms together as described in + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} + * + * @param array $x + * @param array $n + * @param string $class + * @return array + */ + protected static function reduce(array $x, array $n, $class) + { + static $cache = [self::VARIABLE => [], self::DATA => []]; + if (($key = array_search($n, $cache[self::VARIABLE])) === \false) { + $key = count($cache[self::VARIABLE]); + $cache[self::VARIABLE][] = $x; + $cache[self::DATA][] = self::modInverse67108864($n, $class); + } + $k = count($n); + $result = [self::VALUE => $x]; + for ($i = 0; $i < $k; ++$i) { + $temp = $result[self::VALUE][$i] * $cache[self::DATA][$key]; + $temp = $temp - $class::BASE_FULL * ($class::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31); + $temp = $class::regularMultiply([$temp], $n); + $temp = array_merge(self::array_repeat(0, $i), $temp); + $result = $class::addHelper($result[self::VALUE], \false, $temp, \false); + } + $result[self::VALUE] = array_slice($result[self::VALUE], $k); + if (self::compareHelper($result, \false, $n, \false) >= 0) { + $result = $class::subtractHelper($result[self::VALUE], \false, $n, \false); + } + return $result[self::VALUE]; + } + /** + * Modular Inverse of a number mod 2**26 (eg. 67108864) + * + * Based off of the bnpInvDigit function implemented and justified in the following URL: + * + * {@link http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js} + * + * The following URL provides more info: + * + * {@link http://groups.google.com/group/sci.crypt/msg/7a137205c1be7d85} + * + * As for why we do all the bitmasking... strange things can happen when converting from floats to ints. For + * instance, on some computers, var_dump((int) -4294967297) yields int(-1) and on others, it yields + * int(-2147483648). To avoid problems stemming from this, we use bitmasks to guarantee that ints aren't + * auto-converted to floats. The outermost bitmask is present because without it, there's no guarantee that + * the "residue" returned would be the so-called "common residue". We use fmod, in the last step, because the + * maximum possible $x is 26 bits and the maximum $result is 16 bits. Thus, we have to be able to handle up to + * 40 bits, which only 64-bit floating points will support. + * + * Thanks to Pedro Gimeno Fortea for input! + * + * @param array $x + * @param string $class + * @return int + */ + protected static function modInverse67108864(array $x, $class) + { + $x = -$x[0]; + $result = $x & 0x3; + // x**-1 mod 2**2 + $result = $result * (2 - $x * $result) & 0xf; + // x**-1 mod 2**4 + $result = $result * (2 - ($x & 0xff) * $result) & 0xff; + // x**-1 mod 2**8 + $result = $result * (2 - ($x & 0xffff) * $result & 0xffff) & 0xffff; + // x**-1 mod 2**16 + $result = $class::BASE == 26 ? fmod($result * (2 - fmod($x * $result, $class::BASE_FULL)), $class::BASE_FULL) : $result * (2 - $x * $result % $class::BASE_FULL) % $class::BASE_FULL; + return $result & $class::MAX_DIGIT; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php new file mode 100644 index 0000000..20e0e53 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php @@ -0,0 +1,68 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP; +/** + * PHP Montgomery Modular Exponentiation Engine with interleaved multiplication + * + * @author Jim Wigginton + */ +abstract class MontgomeryMult extends Montgomery +{ + /** + * Montgomery Multiply + * + * Interleaves the montgomery reduction and long multiplication algorithms together as described in + * {@link http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf#page=13 HAC 14.36} + * + * @see self::_prepMontgomery() + * @see self::_montgomery() + * @param array $x + * @param array $y + * @param array $m + * @param class-string $class + * @return array + */ + public static function multiplyReduce(array $x, array $y, array $m, $class) + { + // the following code, although not callable, can be run independently of the above code + // although the above code performed better in my benchmarks the following could might + // perform better under different circumstances. in lieu of deleting it it's just been + // made uncallable + static $cache = [self::VARIABLE => [], self::DATA => []]; + if (($key = array_search($m, $cache[self::VARIABLE])) === \false) { + $key = count($cache[self::VARIABLE]); + $cache[self::VARIABLE][] = $m; + $cache[self::DATA][] = self::modInverse67108864($m, $class); + } + $n = max(count($x), count($y), count($m)); + $x = array_pad($x, $n, 0); + $y = array_pad($y, $n, 0); + $m = array_pad($m, $n, 0); + $a = [self::VALUE => self::array_repeat(0, $n + 1)]; + for ($i = 0; $i < $n; ++$i) { + $temp = $a[self::VALUE][0] + $x[$i] * $y[0]; + $temp = $temp - $class::BASE_FULL * ($class::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31); + $temp = $temp * $cache[self::DATA][$key]; + $temp = $temp - $class::BASE_FULL * ($class::BASE === 26 ? intval($temp / 0x4000000) : $temp >> 31); + $temp = $class::addHelper($class::regularMultiply([$x[$i]], $y), \false, $class::regularMultiply([$temp], $m), \false); + $a = $class::addHelper($a[self::VALUE], \false, $temp[self::VALUE], \false); + $a[self::VALUE] = array_slice($a[self::VALUE], 1); + } + if (self::compareHelper($a[self::VALUE], \false, $m, \false) >= 0) { + $a = $class::subtractHelper($a[self::VALUE], \false, $m, \false); + } + return $a[self::VALUE]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php new file mode 100644 index 0000000..645bcb1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php @@ -0,0 +1,54 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Reductions; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines\PHP\Base; +/** + * PHP Power Of Two Modular Exponentiation Engine + * + * @author Jim Wigginton + */ +abstract class PowerOfTwo extends Base +{ + /** + * Prepare a number for use in Montgomery Modular Reductions + * + * @param array $x + * @param array $n + * @param string $class + * @return array + */ + protected static function prepareReduce(array $x, array $n, $class) + { + return self::reduce($x, $n, $class); + } + /** + * Power Of Two Reduction + * + * @param array $x + * @param array $n + * @param string $class + * @return array + */ + protected static function reduce(array $x, array $n, $class) + { + $lhs = new $class(); + $lhs->value = $x; + $rhs = new $class(); + $rhs->value = $n; + $temp = new $class(); + $temp->value = [1]; + $result = $lhs->bitwise_and($rhs->subtract($temp)); + return $result->value; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php new file mode 100644 index 0000000..e9ef75e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php @@ -0,0 +1,341 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +/** + * Pure-PHP 32-bit Engine. + * + * Uses 64-bit floats if int size is 4 bits + * + * @author Jim Wigginton + */ +class PHP32 extends PHP +{ + // Constants used by PHP.php + const BASE = 26; + const BASE_FULL = 0x4000000; + const MAX_DIGIT = 0x3ffffff; + const MSB = 0x2000000; + /** + * MAX10 in greatest MAX10LEN satisfying + * MAX10 = 10**MAX10LEN <= 2**BASE. + */ + const MAX10 = 10000000; + /** + * MAX10LEN in greatest MAX10LEN satisfying + * MAX10 = 10**MAX10LEN <= 2**BASE. + */ + const MAX10LEN = 7; + const MAX_DIGIT2 = 4503599627370496; + /** + * Initialize a PHP32 BigInteger Engine instance + * + * @param int $base + * @see parent::initialize() + */ + protected function initialize($base) + { + if ($base != 256 && $base != -256) { + return parent::initialize($base); + } + $val = $this->value; + $this->value = []; + $vals =& $this->value; + $i = strlen($val); + if (!$i) { + return; + } + while (\true) { + $i -= 4; + if ($i < 0) { + if ($i == -4) { + break; + } + $val = substr($val, 0, 4 + $i); + $val = str_pad($val, 4, "\x00", \STR_PAD_LEFT); + if ($val == "\x00\x00\x00\x00") { + break; + } + $i = 0; + } + list(, $digit) = unpack('N', substr($val, $i, 4)); + if ($digit < 0) { + $digit += 0xffffffff + 1; + } + $step = count($vals) & 3; + if ($step) { + $digit = (int) floor($digit / pow(2, 2 * $step)); + } + if ($step != 3) { + $digit = (int) fmod($digit, static::BASE_FULL); + $i++; + } + $vals[] = $digit; + } + while (end($vals) === 0) { + array_pop($vals); + } + reset($vals); + } + /** + * Test for engine validity + * + * @see parent::__construct() + * @return bool + */ + public static function isValidEngine() + { + return \PHP_INT_SIZE >= 4 && !self::testJITOnWindows(); + } + /** + * Adds two BigIntegers. + * + * @param PHP32 $y + * @return PHP32 + */ + public function add(PHP32 $y) + { + $temp = self::addHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + return $this->convertToObj($temp); + } + /** + * Subtracts two BigIntegers. + * + * @param PHP32 $y + * @return PHP32 + */ + public function subtract(PHP32 $y) + { + $temp = self::subtractHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + return $this->convertToObj($temp); + } + /** + * Multiplies two BigIntegers. + * + * @param PHP32 $y + * @return PHP32 + */ + public function multiply(PHP32 $y) + { + $temp = self::multiplyHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + return $this->convertToObj($temp); + } + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * @param PHP32 $y + * @return array{PHP32, PHP32} + */ + public function divide(PHP32 $y) + { + return $this->divideHelper($y); + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * @param PHP32 $n + * @return false|PHP32 + */ + public function modInverse(PHP32 $n) + { + return $this->modInverseHelper($n); + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * @param PHP32 $n + * @return PHP32[] + */ + public function extendedGCD(PHP32 $n) + { + return $this->extendedGCDHelper($n); + } + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * @param PHP32 $n + * @return PHP32 + */ + public function gcd(PHP32 $n) + { + return $this->extendedGCD($n)['gcd']; + } + /** + * Logical And + * + * @param PHP32 $x + * @return PHP32 + */ + public function bitwise_and(PHP32 $x) + { + return $this->bitwiseAndHelper($x); + } + /** + * Logical Or + * + * @param PHP32 $x + * @return PHP32 + */ + public function bitwise_or(PHP32 $x) + { + return $this->bitwiseOrHelper($x); + } + /** + * Logical Exclusive Or + * + * @param PHP32 $x + * @return PHP32 + */ + public function bitwise_xor(PHP32 $x) + { + return $this->bitwiseXorHelper($x); + } + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is + * demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * {@internal Could return $this->subtract($x), but that's not as fast as what we do do.} + * + * @param PHP32 $y + * @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @see self::equals() + */ + public function compare(PHP32 $y) + { + return $this->compareHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + } + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use BigInteger::compare() + * + * @param PHP32 $x + * @return bool + */ + public function equals(PHP32 $x) + { + return $this->value === $x->value && $this->is_negative == $x->is_negative; + } + /** + * Performs modular exponentiation. + * + * @param PHP32 $e + * @param PHP32 $n + * @return PHP32 + */ + public function modPow(PHP32 $e, PHP32 $n) + { + return $this->powModOuter($e, $n); + } + /** + * Performs modular exponentiation. + * + * Alias for modPow(). + * + * @param PHP32 $e + * @param PHP32 $n + * @return PHP32 + */ + public function powMod(PHP32 $e, PHP32 $n) + { + return $this->powModOuter($e, $n); + } + /** + * Generate a random prime number between a range + * + * If there's not a prime within the given range, false will be returned. + * + * @param PHP32 $min + * @param PHP32 $max + * @return false|PHP32 + */ + public static function randomRangePrime(PHP32 $min, PHP32 $max) + { + return self::randomRangePrimeOuter($min, $max); + } + /** + * Generate a random number between a range + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * BigInteger::randomRange($min, $max) + * BigInteger::randomRange($max, $min) + * + * @param PHP32 $min + * @param PHP32 $max + * @return PHP32 + */ + public static function randomRange(PHP32 $min, PHP32 $max) + { + return self::randomRangeHelper($min, $max); + } + /** + * Performs exponentiation. + * + * @param PHP32 $n + * @return PHP32 + */ + public function pow(PHP32 $n) + { + return $this->powHelper($n); + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param PHP32 ...$nums + * @return PHP32 + */ + public static function min(PHP32 ...$nums) + { + return self::minHelper($nums); + } + /** + * Return the maximum BigInteger between an arbitrary number of BigIntegers. + * + * @param PHP32 ...$nums + * @return PHP32 + */ + public static function max(PHP32 ...$nums) + { + return self::maxHelper($nums); + } + /** + * Tests BigInteger to see if it is between two integers, inclusive + * + * @param PHP32 $min + * @param PHP32 $max + * @return bool + */ + public function between(PHP32 $min, PHP32 $max) + { + return $this->compare($min) >= 0 && $this->compare($max) <= 0; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php new file mode 100644 index 0000000..20642ea --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php @@ -0,0 +1,342 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger\Engines; + +/** + * Pure-PHP 64-bit Engine. + * + * Uses 64-bit integers if int size is 8 bits + * + * @author Jim Wigginton + */ +class PHP64 extends PHP +{ + // Constants used by PHP.php + const BASE = 31; + const BASE_FULL = 0x80000000; + const MAX_DIGIT = 0x7fffffff; + const MSB = 0x40000000; + /** + * MAX10 in greatest MAX10LEN satisfying + * MAX10 = 10**MAX10LEN <= 2**BASE. + */ + const MAX10 = 1000000000; + /** + * MAX10LEN in greatest MAX10LEN satisfying + * MAX10 = 10**MAX10LEN <= 2**BASE. + */ + const MAX10LEN = 9; + const MAX_DIGIT2 = 4611686018427387904; + /** + * Initialize a PHP64 BigInteger Engine instance + * + * @param int $base + * @see parent::initialize() + */ + protected function initialize($base) + { + if ($base != 256 && $base != -256) { + return parent::initialize($base); + } + $val = $this->value; + $this->value = []; + $vals =& $this->value; + $i = strlen($val); + if (!$i) { + return; + } + while (\true) { + $i -= 4; + if ($i < 0) { + if ($i == -4) { + break; + } + $val = substr($val, 0, 4 + $i); + $val = str_pad($val, 4, "\x00", \STR_PAD_LEFT); + if ($val == "\x00\x00\x00\x00") { + break; + } + $i = 0; + } + list(, $digit) = unpack('N', substr($val, $i, 4)); + $step = count($vals) & 7; + if (!$step) { + $digit &= static::MAX_DIGIT; + $i++; + } else { + $shift = 8 - $step; + $digit >>= $shift; + $shift = 32 - $shift; + $digit &= (1 << $shift) - 1; + $temp = $i > 0 ? ord($val[$i - 1]) : 0; + $digit |= $temp << $shift & 0x7f000000; + } + $vals[] = $digit; + } + while (end($vals) === 0) { + array_pop($vals); + } + reset($vals); + } + /** + * Test for engine validity + * + * @see parent::__construct() + * @return bool + */ + public static function isValidEngine() + { + return \PHP_INT_SIZE >= 8 && !self::testJITOnWindows(); + } + /** + * Adds two BigIntegers. + * + * @param PHP64 $y + * @return PHP64 + */ + public function add(PHP64 $y) + { + $temp = self::addHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + return $this->convertToObj($temp); + } + /** + * Subtracts two BigIntegers. + * + * @param PHP64 $y + * @return PHP64 + */ + public function subtract(PHP64 $y) + { + $temp = self::subtractHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + return $this->convertToObj($temp); + } + /** + * Multiplies two BigIntegers. + * + * @param PHP64 $y + * @return PHP64 + */ + public function multiply(PHP64 $y) + { + $temp = self::multiplyHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + return $this->convertToObj($temp); + } + /** + * Divides two BigIntegers. + * + * Returns an array whose first element contains the quotient and whose second element contains the + * "common residue". If the remainder would be positive, the "common residue" and the remainder are the + * same. If the remainder would be negative, the "common residue" is equal to the sum of the remainder + * and the divisor (basically, the "common residue" is the first positive modulo). + * + * @param PHP64 $y + * @return array{PHP64, PHP64} + */ + public function divide(PHP64 $y) + { + return $this->divideHelper($y); + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * @param PHP64 $n + * @return false|PHP64 + */ + public function modInverse(PHP64 $n) + { + return $this->modInverseHelper($n); + } + /** + * Calculates modular inverses. + * + * Say you have (30 mod 17 * x mod 17) mod 17 == 1. x can be found using modular inverses. + * @param PHP64 $n + * @return PHP64[] + */ + public function extendedGCD(PHP64 $n) + { + return $this->extendedGCDHelper($n); + } + /** + * Calculates the greatest common divisor + * + * Say you have 693 and 609. The GCD is 21. + * + * @param PHP64 $n + * @return PHP64 + */ + public function gcd(PHP64 $n) + { + return $this->extendedGCD($n)['gcd']; + } + /** + * Logical And + * + * @param PHP64 $x + * @return PHP64 + */ + public function bitwise_and(PHP64 $x) + { + return $this->bitwiseAndHelper($x); + } + /** + * Logical Or + * + * @param PHP64 $x + * @return PHP64 + */ + public function bitwise_or(PHP64 $x) + { + return $this->bitwiseOrHelper($x); + } + /** + * Logical Exclusive Or + * + * @param PHP64 $x + * @return PHP64 + */ + public function bitwise_xor(PHP64 $x) + { + return $this->bitwiseXorHelper($x); + } + /** + * Compares two numbers. + * + * Although one might think !$x->compare($y) means $x != $y, it, in fact, means the opposite. The reason for this is + * demonstrated thusly: + * + * $x > $y: $x->compare($y) > 0 + * $x < $y: $x->compare($y) < 0 + * $x == $y: $x->compare($y) == 0 + * + * Note how the same comparison operator is used. If you want to test for equality, use $x->equals($y). + * + * {@internal Could return $this->subtract($x), but that's not as fast as what we do do.} + * + * @param PHP64 $y + * @return int in case < 0 if $this is less than $y; > 0 if $this is greater than $y, and 0 if they are equal. + * @see self::equals() + */ + public function compare(PHP64 $y) + { + return parent::compareHelper($this->value, $this->is_negative, $y->value, $y->is_negative); + } + /** + * Tests the equality of two numbers. + * + * If you need to see if one number is greater than or less than another number, use BigInteger::compare() + * + * @param PHP64 $x + * @return bool + */ + public function equals(PHP64 $x) + { + return $this->value === $x->value && $this->is_negative == $x->is_negative; + } + /** + * Performs modular exponentiation. + * + * @param PHP64 $e + * @param PHP64 $n + * @return PHP64 + */ + public function modPow(PHP64 $e, PHP64 $n) + { + return $this->powModOuter($e, $n); + } + /** + * Performs modular exponentiation. + * + * Alias for modPow(). + * + * @param PHP64 $e + * @param PHP64 $n + * @return PHP64|false + */ + public function powMod(PHP64 $e, PHP64 $n) + { + return $this->powModOuter($e, $n); + } + /** + * Generate a random prime number between a range + * + * If there's not a prime within the given range, false will be returned. + * + * @param PHP64 $min + * @param PHP64 $max + * @return false|PHP64 + */ + public static function randomRangePrime(PHP64 $min, PHP64 $max) + { + return self::randomRangePrimeOuter($min, $max); + } + /** + * Generate a random number between a range + * + * Returns a random number between $min and $max where $min and $max + * can be defined using one of the two methods: + * + * BigInteger::randomRange($min, $max) + * BigInteger::randomRange($max, $min) + * + * @param PHP64 $min + * @param PHP64 $max + * @return PHP64 + */ + public static function randomRange(PHP64 $min, PHP64 $max) + { + return self::randomRangeHelper($min, $max); + } + /** + * Performs exponentiation. + * + * @param PHP64 $n + * @return PHP64 + */ + public function pow(PHP64 $n) + { + return $this->powHelper($n); + } + /** + * Return the minimum BigInteger between an arbitrary number of BigIntegers. + * + * @param PHP64 ...$nums + * @return PHP64 + */ + public static function min(PHP64 ...$nums) + { + return self::minHelper($nums); + } + /** + * Return the maximum BigInteger between an arbitrary number of BigIntegers. + * + * @param PHP64 ...$nums + * @return PHP64 + */ + public static function max(PHP64 ...$nums) + { + return self::maxHelper($nums); + } + /** + * Tests BigInteger to see if it is between two integers, inclusive + * + * @param PHP64 $min + * @param PHP64 $max + * @return bool + */ + public function between(PHP64 $min, PHP64 $max) + { + return $this->compare($min) >= 0 && $this->compare($max) <= 0; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BinaryField.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BinaryField.php new file mode 100644 index 0000000..0fc361a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BinaryField.php @@ -0,0 +1,183 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BinaryField\Integer; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField; +/** + * Binary Finite Fields + * + * @author Jim Wigginton + */ +class BinaryField extends FiniteField +{ + /** + * Instance Counter + * + * @var int + */ + private static $instanceCounter = 0; + /** + * Keeps track of current instance + * + * @var int + */ + protected $instanceID; + /** @var BigInteger */ + private $randomMax; + /** + * Default constructor + */ + public function __construct(...$indices) + { + $m = array_shift($indices); + if ($m > 571) { + /* sect571r1 and sect571k1 are the largest binary curves that https://www.secg.org/sec2-v2.pdf defines + altho theoretically there may be legit reasons to use binary finite fields with larger degrees + imposing a limit on the maximum size is both reasonable and precedented. in particular, + http://tools.ietf.org/html/rfc4253#section-6.1 (The Secure Shell (SSH) Transport Layer Protocol) says + "implementations SHOULD check that the packet length is reasonable in order for the implementation to + avoid denial of service and/or buffer overflow attacks" */ + throw new \OutOfBoundsException('Degrees larger than 571 are not supported'); + } + $val = str_repeat('0', $m) . '1'; + foreach ($indices as $index) { + $val[$index] = '1'; + } + $modulo = static::base2ToBase256(strrev($val)); + $mStart = 2 * $m - 2; + $t = ceil($m / 8); + $finalMask = chr((1 << $m % 8) - 1); + if ($finalMask == "\x00") { + $finalMask = "\xff"; + } + $bitLen = $mStart + 1; + $pad = ceil($bitLen / 8); + $h = $bitLen & 7; + $h = $h ? 8 - $h : 0; + $r = rtrim(substr($val, 0, -1), '0'); + $u = [static::base2ToBase256(strrev($r))]; + for ($i = 1; $i < 8; $i++) { + $u[] = static::base2ToBase256(strrev(str_repeat('0', $i) . $r)); + } + // implements algorithm 2.40 (in section 2.3.5) in "Guide to Elliptic Curve Cryptography" + // with W = 8 + $reduce = function ($c) use($u, $mStart, $m, $t, $finalMask, $pad, $h) { + $c = str_pad($c, $pad, "\x00", \STR_PAD_LEFT); + for ($i = $mStart; $i >= $m;) { + $g = $h >> 3; + $mask = $h & 7; + $mask = $mask ? 1 << 7 - $mask : 0x80; + for (; $mask > 0; $mask >>= 1, $i--, $h++) { + if (ord($c[$g]) & $mask) { + $temp = $i - $m; + $j = $temp >> 3; + $k = $temp & 7; + $t1 = $j ? substr($c, 0, -$j) : $c; + $length = strlen($t1); + if ($length) { + $t2 = str_pad($u[$k], $length, "\x00", \STR_PAD_LEFT); + $temp = $t1 ^ $t2; + $c = $j ? substr_replace($c, $temp, 0, $length) : $temp; + } + } + } + } + $c = substr($c, -$t); + if (strlen($c) == $t) { + $c[0] = $c[0] & $finalMask; + } + return ltrim($c, "\x00"); + }; + $this->instanceID = self::$instanceCounter++; + Integer::setModulo($this->instanceID, $modulo); + Integer::setRecurringModuloFunction($this->instanceID, $reduce); + $this->randomMax = new BigInteger($modulo, 2); + } + /** + * Returns an instance of a dynamically generated PrimeFieldInteger class + * + * @param string $num + * @return Integer + */ + public function newInteger($num) + { + return new Integer($this->instanceID, $num instanceof BigInteger ? $num->toBytes() : $num); + } + /** + * Returns an integer on the finite field between one and the prime modulo + * + * @return Integer + */ + public function randomInteger() + { + static $one; + if (!isset($one)) { + $one = new BigInteger(1); + } + return new Integer($this->instanceID, BigInteger::randomRange($one, $this->randomMax)->toBytes()); + } + /** + * Returns the length of the modulo in bytes + * + * @return int + */ + public function getLengthInBytes() + { + return strlen(Integer::getModulo($this->instanceID)); + } + /** + * Returns the length of the modulo in bits + * + * @return int + */ + public function getLength() + { + return strlen(Integer::getModulo($this->instanceID)) << 3; + } + /** + * Converts a base-2 string to a base-256 string + * + * @param string $x + * @param int|null $size + * @return string + */ + public static function base2ToBase256($x, $size = null) + { + $str = Strings::bits2bin($x); + $pad = strlen($x) >> 3; + if (strlen($x) & 3) { + $pad++; + } + $str = str_pad($str, $pad, "\x00", \STR_PAD_LEFT); + if (isset($size)) { + $str = str_pad($str, $size, "\x00", \STR_PAD_LEFT); + } + return $str; + } + /** + * Converts a base-256 string to a base-2 string + * + * @param string $x + * @return string + */ + public static function base256ToBase2($x) + { + if (function_exists('gmp_import')) { + return gmp_strval(gmp_import($x), 2); + } + return Strings::bin2bits($x); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BinaryField/Integer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BinaryField/Integer.php new file mode 100644 index 0000000..0d1fe34 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/BinaryField/Integer.php @@ -0,0 +1,442 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BinaryField; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BinaryField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField\Integer as Base; +/** + * Binary Finite Fields + * + * @author Jim Wigginton + */ +class Integer extends Base +{ + /** + * Holds the BinaryField's value + * + * @var string + */ + protected $value; + /** + * Keeps track of current instance + * + * @var int + */ + protected $instanceID; + /** + * Holds the PrimeField's modulo + * + * @var array + */ + protected static $modulo; + /** + * Holds a pre-generated function to perform modulo reductions + * + * @var callable[] + */ + protected static $reduce; + /** + * Default constructor + */ + public function __construct($instanceID, $num = '') + { + $this->instanceID = $instanceID; + if (!strlen($num)) { + $this->value = ''; + } else { + $reduce = static::$reduce[$instanceID]; + $this->value = $reduce($num); + } + } + /** + * Set the modulo for a given instance + * @param int $instanceID + * @param string $modulo + */ + public static function setModulo($instanceID, $modulo) + { + static::$modulo[$instanceID] = $modulo; + } + /** + * Set the modulo for a given instance + */ + public static function setRecurringModuloFunction($instanceID, callable $function) + { + static::$reduce[$instanceID] = $function; + } + /** + * Tests a parameter to see if it's of the right instance + * + * Throws an exception if the incorrect class is being utilized + */ + private static function checkInstance(self $x, self $y) + { + if ($x->instanceID != $y->instanceID) { + throw new \UnexpectedValueException('The instances of the two BinaryField\\Integer objects do not match'); + } + } + /** + * Tests the equality of two numbers. + * + * @return bool + */ + public function equals(self $x) + { + static::checkInstance($this, $x); + return $this->value == $x->value; + } + /** + * Compares two numbers. + * + * @return int + */ + public function compare(self $x) + { + static::checkInstance($this, $x); + $a = $this->value; + $b = $x->value; + $length = max(strlen($a), strlen($b)); + $a = str_pad($a, $length, "\x00", \STR_PAD_LEFT); + $b = str_pad($b, $length, "\x00", \STR_PAD_LEFT); + return strcmp($a, $b); + } + /** + * Returns the degree of the polynomial + * + * @param string $x + * @return int + */ + private static function deg($x) + { + $x = ltrim($x, "\x00"); + $xbit = decbin(ord($x[0])); + $xlen = $xbit == '0' ? 0 : strlen($xbit); + $len = strlen($x); + if (!$len) { + return -1; + } + return 8 * strlen($x) - 9 + $xlen; + } + /** + * Perform polynomial division + * + * @return string[] + * @link https://en.wikipedia.org/wiki/Polynomial_greatest_common_divisor#Euclidean_division + */ + private static function polynomialDivide($x, $y) + { + // in wikipedia's description of the algorithm, lc() is the leading coefficient. over a binary field that's + // always going to be 1. + $q = chr(0); + $d = static::deg($y); + $r = $x; + while (($degr = static::deg($r)) >= $d) { + $s = '1' . str_repeat('0', $degr - $d); + $s = BinaryField::base2ToBase256($s); + $length = max(strlen($s), strlen($q)); + $q = !isset($q) ? $s : str_pad($q, $length, "\x00", \STR_PAD_LEFT) ^ str_pad($s, $length, "\x00", \STR_PAD_LEFT); + $s = static::polynomialMultiply($s, $y); + $length = max(strlen($r), strlen($s)); + $r = str_pad($r, $length, "\x00", \STR_PAD_LEFT) ^ str_pad($s, $length, "\x00", \STR_PAD_LEFT); + } + return [ltrim($q, "\x00"), ltrim($r, "\x00")]; + } + /** + * Perform polynomial multiplation in the traditional way + * + * @return string + * @link https://en.wikipedia.org/wiki/Finite_field_arithmetic#Multiplication + */ + private static function regularPolynomialMultiply($x, $y) + { + $precomputed = [ltrim($x, "\x00")]; + $x = strrev(BinaryField::base256ToBase2($x)); + $y = strrev(BinaryField::base256ToBase2($y)); + if (strlen($x) == strlen($y)) { + $length = strlen($x); + } else { + $length = max(strlen($x), strlen($y)); + $x = str_pad($x, $length, '0'); + $y = str_pad($y, $length, '0'); + } + $result = str_repeat('0', 2 * $length - 1); + $result = BinaryField::base2ToBase256($result); + $size = strlen($result); + $x = strrev($x); + // precompute left shift 1 through 7 + for ($i = 1; $i < 8; $i++) { + $precomputed[$i] = BinaryField::base2ToBase256($x . str_repeat('0', $i)); + } + for ($i = 0; $i < strlen($y); $i++) { + if ($y[$i] == '1') { + $temp = $precomputed[$i & 7] . str_repeat("\x00", $i >> 3); + $result ^= str_pad($temp, $size, "\x00", \STR_PAD_LEFT); + } + } + return $result; + } + /** + * Perform polynomial multiplation + * + * Uses karatsuba multiplication to reduce x-bit multiplications to a series of 32-bit multiplications + * + * @return string + * @link https://en.wikipedia.org/wiki/Karatsuba_algorithm + */ + private static function polynomialMultiply($x, $y) + { + if (strlen($x) == strlen($y)) { + $length = strlen($x); + } else { + $length = max(strlen($x), strlen($y)); + $x = str_pad($x, $length, "\x00", \STR_PAD_LEFT); + $y = str_pad($y, $length, "\x00", \STR_PAD_LEFT); + } + switch (\true) { + case \PHP_INT_SIZE == 8 && $length <= 4: + return $length != 4 ? self::subMultiply(str_pad($x, 4, "\x00", \STR_PAD_LEFT), str_pad($y, 4, "\x00", \STR_PAD_LEFT)) : self::subMultiply($x, $y); + case \PHP_INT_SIZE == 4 || $length > 32: + return self::regularPolynomialMultiply($x, $y); + } + $m = $length >> 1; + $x1 = substr($x, 0, -$m); + $x0 = substr($x, -$m); + $y1 = substr($y, 0, -$m); + $y0 = substr($y, -$m); + $z2 = self::polynomialMultiply($x1, $y1); + $z0 = self::polynomialMultiply($x0, $y0); + $z1 = self::polynomialMultiply(self::subAdd2($x1, $x0), self::subAdd2($y1, $y0)); + $z1 = self::subAdd3($z1, $z2, $z0); + $xy = self::subAdd3($z2 . str_repeat("\x00", 2 * $m), $z1 . str_repeat("\x00", $m), $z0); + return ltrim($xy, "\x00"); + } + /** + * Perform polynomial multiplication on 2x 32-bit numbers, returning + * a 64-bit number + * + * @param string $x + * @param string $y + * @return string + * @link https://www.bearssl.org/constanttime.html#ghash-for-gcm + */ + private static function subMultiply($x, $y) + { + $x = unpack('N', $x)[1]; + $y = unpack('N', $y)[1]; + $x0 = $x & 0x11111111; + $x1 = $x & 0x22222222; + $x2 = $x & 0x44444444; + $x3 = $x & 0x88888888; + $y0 = $y & 0x11111111; + $y1 = $y & 0x22222222; + $y2 = $y & 0x44444444; + $y3 = $y & 0x88888888; + $z0 = $x0 * $y0 ^ $x1 * $y3 ^ $x2 * $y2 ^ $x3 * $y1; + $z1 = $x0 * $y1 ^ $x1 * $y0 ^ $x2 * $y3 ^ $x3 * $y2; + $z2 = $x0 * $y2 ^ $x1 * $y1 ^ $x2 * $y0 ^ $x3 * $y3; + $z3 = $x0 * $y3 ^ $x1 * $y2 ^ $x2 * $y1 ^ $x3 * $y0; + $z0 &= 0x1111111111111111; + $z1 &= 0x2222222222222222; + $z2 &= 0x4444444444444444; + $z3 &= -8608480567731124088; + // 0x8888888888888888 gets interpreted as a float + $z = $z0 | $z1 | $z2 | $z3; + return pack('J', $z); + } + /** + * Adds two numbers + * + * @param string $x + * @param string $y + * @return string + */ + private static function subAdd2($x, $y) + { + $length = max(strlen($x), strlen($y)); + $x = str_pad($x, $length, "\x00", \STR_PAD_LEFT); + $y = str_pad($y, $length, "\x00", \STR_PAD_LEFT); + return $x ^ $y; + } + /** + * Adds three numbers + * + * @param string $x + * @param string $y + * @return string + */ + private static function subAdd3($x, $y, $z) + { + $length = max(strlen($x), strlen($y), strlen($z)); + $x = str_pad($x, $length, "\x00", \STR_PAD_LEFT); + $y = str_pad($y, $length, "\x00", \STR_PAD_LEFT); + $z = str_pad($z, $length, "\x00", \STR_PAD_LEFT); + return $x ^ $y ^ $z; + } + /** + * Adds two BinaryFieldIntegers. + * + * @return static + */ + public function add(self $y) + { + static::checkInstance($this, $y); + $length = strlen(static::$modulo[$this->instanceID]); + $x = str_pad($this->value, $length, "\x00", \STR_PAD_LEFT); + $y = str_pad($y->value, $length, "\x00", \STR_PAD_LEFT); + return new static($this->instanceID, $x ^ $y); + } + /** + * Subtracts two BinaryFieldIntegers. + * + * @return static + */ + public function subtract(self $x) + { + return $this->add($x); + } + /** + * Multiplies two BinaryFieldIntegers. + * + * @return static + */ + public function multiply(self $y) + { + static::checkInstance($this, $y); + return new static($this->instanceID, static::polynomialMultiply($this->value, $y->value)); + } + /** + * Returns the modular inverse of a BinaryFieldInteger + * + * @return static + */ + public function modInverse() + { + $remainder0 = static::$modulo[$this->instanceID]; + $remainder1 = $this->value; + if ($remainder1 == '') { + return new static($this->instanceID); + } + $aux0 = "\x00"; + $aux1 = "\x01"; + while ($remainder1 != "\x01") { + list($q, $r) = static::polynomialDivide($remainder0, $remainder1); + $remainder0 = $remainder1; + $remainder1 = $r; + // the auxiliary in row n is given by the sum of the auxiliary in + // row n-2 and the product of the quotient and the auxiliary in row + // n-1 + $temp = static::polynomialMultiply($aux1, $q); + $aux = str_pad($aux0, strlen($temp), "\x00", \STR_PAD_LEFT) ^ str_pad($temp, strlen($aux0), "\x00", \STR_PAD_LEFT); + $aux0 = $aux1; + $aux1 = $aux; + } + $temp = new static($this->instanceID); + $temp->value = ltrim($aux1, "\x00"); + return $temp; + } + /** + * Divides two PrimeFieldIntegers. + * + * @return static + */ + public function divide(self $x) + { + static::checkInstance($this, $x); + $x = $x->modInverse(); + return $this->multiply($x); + } + /** + * Negate + * + * A negative number can be written as 0-12. With modulos, 0 is the same thing as the modulo + * so 0-12 is the same thing as modulo-12 + * + * @return object + */ + public function negate() + { + $x = str_pad($this->value, strlen(static::$modulo[$this->instanceID]), "\x00", \STR_PAD_LEFT); + return new static($this->instanceID, $x ^ static::$modulo[$this->instanceID]); + } + /** + * Returns the modulo + * + * @return string + */ + public static function getModulo($instanceID) + { + return static::$modulo[$instanceID]; + } + /** + * Converts an Integer to a byte string (eg. base-256). + * + * @return string + */ + public function toBytes() + { + return str_pad($this->value, strlen(static::$modulo[$this->instanceID]), "\x00", \STR_PAD_LEFT); + } + /** + * Converts an Integer to a hex string (eg. base-16). + * + * @return string + */ + public function toHex() + { + return Strings::bin2hex($this->toBytes()); + } + /** + * Converts an Integer to a bit string (eg. base-2). + * + * @return string + */ + public function toBits() + { + //return str_pad(BinaryField::base256ToBase2($this->value), strlen(static::$modulo[$this->instanceID]), '0', STR_PAD_LEFT); + return BinaryField::base256ToBase2($this->value); + } + /** + * Converts an Integer to a BigInteger + * + * @return string + */ + public function toBigInteger() + { + return new BigInteger($this->value, 256); + } + /** + * __toString() magic method + * + */ + public function __toString() + { + return (string) $this->toBigInteger(); + } + /** + * __debugInfo() magic method + * + */ + public function __debugInfo() + { + return ['value' => $this->toHex()]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField.php new file mode 100644 index 0000000..7ebf649 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField.php @@ -0,0 +1,21 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common; + +/** + * Finite Fields + * + * @author Jim Wigginton + */ +abstract class FiniteField +{ +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php new file mode 100644 index 0000000..e8733f5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php @@ -0,0 +1,42 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField; + +/** + * Finite Field Integer + * + * @author Jim Wigginton + */ +abstract class Integer implements \JsonSerializable +{ + /** + * JSON Serialize + * + * Will be called, automatically, when json_encode() is called on a BigInteger object. + * + * PHP Serialize isn't supported because unserializing would require the factory be + * serialized as well and that just sounds like too much + * + * @return array{hex: string} + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ['hex' => $this->toHex(\true)]; + } + /** + * Converts an Integer to a hex string (eg. base-16). + * + * @return string + */ + public abstract function toHex(); +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/PrimeField.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/PrimeField.php new file mode 100644 index 0000000..2b031c8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/PrimeField.php @@ -0,0 +1,106 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://pear.php.net/package/Math_BigInteger + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField\Integer; +/** + * Prime Finite Fields + * + * @author Jim Wigginton + */ +class PrimeField extends FiniteField +{ + /** + * Instance Counter + * + * @var int + */ + private static $instanceCounter = 0; + /** + * Keeps track of current instance + * + * @var int + */ + protected $instanceID; + /** + * Default constructor + */ + public function __construct(BigInteger $modulo) + { + if (!$modulo->isPrime()) { + throw new \UnexpectedValueException('PrimeField requires a prime number be passed to the constructor'); + } + $this->instanceID = self::$instanceCounter++; + Integer::setModulo($this->instanceID, $modulo); + Integer::setRecurringModuloFunction($this->instanceID, $modulo->createRecurringModuloFunction()); + } + /** + * Use a custom defined modular reduction function + * + * @return void + */ + public function setReduction(\Closure $func) + { + $this->reduce = $func->bindTo($this, $this); + } + /** + * Returns an instance of a dynamically generated PrimeFieldInteger class + * + * @return Integer + */ + public function newInteger(BigInteger $num) + { + return new Integer($this->instanceID, $num); + } + /** + * Returns an integer on the finite field between one and the prime modulo + * + * @return Integer + */ + public function randomInteger() + { + static $one; + if (!isset($one)) { + $one = new BigInteger(1); + } + return new Integer($this->instanceID, BigInteger::randomRange($one, Integer::getModulo($this->instanceID))); + } + /** + * Returns the length of the modulo in bytes + * + * @return int + */ + public function getLengthInBytes() + { + return Integer::getModulo($this->instanceID)->getLengthInBytes(); + } + /** + * Returns the length of the modulo in bits + * + * @return int + */ + public function getLength() + { + return Integer::getModulo($this->instanceID)->getLength(); + } + /** + * Destructor + */ + public function __destruct() + { + Integer::cleanupCache($this->instanceID); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php new file mode 100644 index 0000000..72cabc0 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php @@ -0,0 +1,370 @@ + + * @copyright 2017 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\PrimeField; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\Common\FiniteField\Integer as Base; +/** + * Prime Finite Fields + * + * @author Jim Wigginton + */ +class Integer extends Base +{ + /** + * Holds the PrimeField's value + * + * @var BigInteger + */ + protected $value; + /** + * Keeps track of current instance + * + * @var int + */ + protected $instanceID; + /** + * Holds the PrimeField's modulo + * + * @var array + */ + protected static $modulo; + /** + * Holds a pre-generated function to perform modulo reductions + * + * @var array + */ + protected static $reduce; + /** + * Zero + * + * @var BigInteger + */ + protected static $zero; + /** + * Default constructor + * + * @param int $instanceID + */ + public function __construct($instanceID, BigInteger $num = null) + { + $this->instanceID = $instanceID; + if (!isset($num)) { + $this->value = clone static::$zero[static::class]; + } else { + $reduce = static::$reduce[$instanceID]; + $this->value = $reduce($num); + } + } + /** + * Set the modulo for a given instance + * + * @param int $instanceID + * @return void + */ + public static function setModulo($instanceID, BigInteger $modulo) + { + static::$modulo[$instanceID] = $modulo; + } + /** + * Set the modulo for a given instance + * + * @param int $instanceID + * @return void + */ + public static function setRecurringModuloFunction($instanceID, callable $function) + { + static::$reduce[$instanceID] = $function; + if (!isset(static::$zero[static::class])) { + static::$zero[static::class] = new BigInteger(); + } + } + /** + * Delete the modulo for a given instance + */ + public static function cleanupCache($instanceID) + { + unset(static::$modulo[$instanceID]); + unset(static::$reduce[$instanceID]); + } + /** + * Returns the modulo + * + * @param int $instanceID + * @return BigInteger + */ + public static function getModulo($instanceID) + { + return static::$modulo[$instanceID]; + } + /** + * Tests a parameter to see if it's of the right instance + * + * Throws an exception if the incorrect class is being utilized + * + * @return void + */ + public static function checkInstance(self $x, self $y) + { + if ($x->instanceID != $y->instanceID) { + throw new \UnexpectedValueException('The instances of the two PrimeField\\Integer objects do not match'); + } + } + /** + * Tests the equality of two numbers. + * + * @return bool + */ + public function equals(self $x) + { + static::checkInstance($this, $x); + return $this->value->equals($x->value); + } + /** + * Compares two numbers. + * + * @return int + */ + public function compare(self $x) + { + static::checkInstance($this, $x); + return $this->value->compare($x->value); + } + /** + * Adds two PrimeFieldIntegers. + * + * @return static + */ + public function add(self $x) + { + static::checkInstance($this, $x); + $temp = new static($this->instanceID); + $temp->value = $this->value->add($x->value); + if ($temp->value->compare(static::$modulo[$this->instanceID]) >= 0) { + $temp->value = $temp->value->subtract(static::$modulo[$this->instanceID]); + } + return $temp; + } + /** + * Subtracts two PrimeFieldIntegers. + * + * @return static + */ + public function subtract(self $x) + { + static::checkInstance($this, $x); + $temp = new static($this->instanceID); + $temp->value = $this->value->subtract($x->value); + if ($temp->value->isNegative()) { + $temp->value = $temp->value->add(static::$modulo[$this->instanceID]); + } + return $temp; + } + /** + * Multiplies two PrimeFieldIntegers. + * + * @return static + */ + public function multiply(self $x) + { + static::checkInstance($this, $x); + return new static($this->instanceID, $this->value->multiply($x->value)); + } + /** + * Divides two PrimeFieldIntegers. + * + * @return static + */ + public function divide(self $x) + { + static::checkInstance($this, $x); + $denominator = $x->value->modInverse(static::$modulo[$this->instanceID]); + return new static($this->instanceID, $this->value->multiply($denominator)); + } + /** + * Performs power operation on a PrimeFieldInteger. + * + * @return static + */ + public function pow(BigInteger $x) + { + $temp = new static($this->instanceID); + $temp->value = $this->value->powMod($x, static::$modulo[$this->instanceID]); + return $temp; + } + /** + * Calculates the square root + * + * @link https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm + * @return static|false + */ + public function squareRoot() + { + static $one, $two; + if (!isset($one)) { + $one = new BigInteger(1); + $two = new BigInteger(2); + } + $reduce = static::$reduce[$this->instanceID]; + $p_1 = static::$modulo[$this->instanceID]->subtract($one); + $q = clone $p_1; + $s = BigInteger::scan1divide($q); + list($pow) = $p_1->divide($two); + for ($z = $one; !$z->equals(static::$modulo[$this->instanceID]); $z = $z->add($one)) { + $temp = $z->powMod($pow, static::$modulo[$this->instanceID]); + if ($temp->equals($p_1)) { + break; + } + } + $m = new BigInteger($s); + $c = $z->powMod($q, static::$modulo[$this->instanceID]); + $t = $this->value->powMod($q, static::$modulo[$this->instanceID]); + list($temp) = $q->add($one)->divide($two); + $r = $this->value->powMod($temp, static::$modulo[$this->instanceID]); + while (!$t->equals($one)) { + for ($i = clone $one; $i->compare($m) < 0; $i = $i->add($one)) { + if ($t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) { + break; + } + } + if ($i->compare($m) == 0) { + return \false; + } + $b = $c->powMod($two->pow($m->subtract($i)->subtract($one)), static::$modulo[$this->instanceID]); + $m = $i; + $c = $reduce($b->multiply($b)); + $t = $reduce($t->multiply($c)); + $r = $reduce($r->multiply($b)); + } + return new static($this->instanceID, $r); + } + /** + * Is Odd? + * + * @return bool + */ + public function isOdd() + { + return $this->value->isOdd(); + } + /** + * Negate + * + * A negative number can be written as 0-12. With modulos, 0 is the same thing as the modulo + * so 0-12 is the same thing as modulo-12 + * + * @return static + */ + public function negate() + { + return new static($this->instanceID, static::$modulo[$this->instanceID]->subtract($this->value)); + } + /** + * Converts an Integer to a byte string (eg. base-256). + * + * @return string + */ + public function toBytes() + { + if (isset(static::$modulo[$this->instanceID])) { + $length = static::$modulo[$this->instanceID]->getLengthInBytes(); + return str_pad($this->value->toBytes(), $length, "\x00", \STR_PAD_LEFT); + } + return $this->value->toBytes(); + } + /** + * Converts an Integer to a hex string (eg. base-16). + * + * @return string + */ + public function toHex() + { + return Strings::bin2hex($this->toBytes()); + } + /** + * Converts an Integer to a bit string (eg. base-2). + * + * @return string + */ + public function toBits() + { + // return $this->value->toBits(); + static $length; + if (!isset($length)) { + $length = static::$modulo[$this->instanceID]->getLength(); + } + return str_pad($this->value->toBits(), $length, '0', \STR_PAD_LEFT); + } + /** + * Returns the w-ary non-adjacent form (wNAF) + * + * @param int $w optional + * @return array + */ + public function getNAF($w = 1) + { + $w++; + $mask = new BigInteger((1 << $w) - 1); + $sub = new BigInteger(1 << $w); + //$sub = new BigInteger(1 << ($w - 1)); + $d = $this->toBigInteger(); + $d_i = []; + $i = 0; + while ($d->compare(static::$zero[static::class]) > 0) { + if ($d->isOdd()) { + // start mods + $bigInteger = $d->testBit($w - 1) ? $d->bitwise_and($mask)->subtract($sub) : $d->bitwise_and($mask); + // end mods + $d = $d->subtract($bigInteger); + $d_i[$i] = (int) $bigInteger->toString(); + } else { + $d_i[$i] = 0; + } + $shift = !$d->equals(static::$zero[static::class]) && $d->bitwise_and($mask)->equals(static::$zero[static::class]) ? $w : 1; + // $w or $w + 1? + $d = $d->bitwise_rightShift($shift); + while (--$shift > 0) { + $d_i[++$i] = 0; + } + $i++; + } + return $d_i; + } + /** + * Converts an Integer to a BigInteger + * + * @return BigInteger + */ + public function toBigInteger() + { + return clone $this->value; + } + /** + * __toString() magic method + * + * @return string + */ + public function __toString() + { + return (string) $this->value; + } + /** + * __debugInfo() magic method + * + * @return array + */ + public function __debugInfo() + { + return ['value' => $this->toHex()]; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SFTP.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SFTP.php new file mode 100644 index 0000000..5bb2373 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SFTP.php @@ -0,0 +1,3058 @@ + + * login('username', 'password')) { + * exit('Login Failed'); + * } + * + * echo $sftp->pwd() . "\r\n"; + * $sftp->put('filename.ext', 'hello, world!'); + * print_r($sftp->nlist()); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2009 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Net; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\FileNotFoundException; +/** + * Pure-PHP implementations of SFTP. + * + * @author Jim Wigginton + */ +class SFTP extends SSH2 +{ + /** + * SFTP channel constant + * + * \phpseclib3\Net\SSH2::exec() uses 0 and \phpseclib3\Net\SSH2::read() / \phpseclib3\Net\SSH2::write() use 1. + * + * @see \phpseclib3\Net\SSH2::send_channel_packet() + * @see \phpseclib3\Net\SSH2::get_channel_packet() + */ + const CHANNEL = 0x100; + /** + * Reads data from a local file. + * + * @see \phpseclib3\Net\SFTP::put() + */ + const SOURCE_LOCAL_FILE = 1; + /** + * Reads data from a string. + * + * @see \phpseclib3\Net\SFTP::put() + */ + // this value isn't really used anymore but i'm keeping it reserved for historical reasons + const SOURCE_STRING = 2; + /** + * Reads data from callback: + * function callback($length) returns string to proceed, null for EOF + * + * @see \phpseclib3\Net\SFTP::put() + */ + const SOURCE_CALLBACK = 16; + /** + * Resumes an upload + * + * @see \phpseclib3\Net\SFTP::put() + */ + const RESUME = 4; + /** + * Append a local file to an already existing remote file + * + * @see \phpseclib3\Net\SFTP::put() + */ + const RESUME_START = 8; + /** + * Packet Types + * + * @see self::__construct() + * @var array + * @access private + */ + private static $packet_types = []; + /** + * Status Codes + * + * @see self::__construct() + * @var array + * @access private + */ + private static $status_codes = []; + /** @var array */ + private static $attributes; + /** @var array */ + private static $open_flags; + /** @var array */ + private static $open_flags5; + /** @var array */ + private static $file_types; + /** + * The Request ID + * + * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support + * concurrent actions, so it's somewhat academic, here. + * + * @var boolean + * @see self::_send_sftp_packet() + */ + private $use_request_id = \false; + /** + * The Packet Type + * + * The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support + * concurrent actions, so it's somewhat academic, here. + * + * @var int + * @see self::_get_sftp_packet() + */ + private $packet_type = -1; + /** + * Packet Buffer + * + * @var string + * @see self::_get_sftp_packet() + */ + private $packet_buffer = ''; + /** + * Extensions supported by the server + * + * @var array + * @see self::_initChannel() + */ + private $extensions = []; + /** + * Server SFTP version + * + * @var int + * @see self::_initChannel() + */ + private $version; + /** + * Default Server SFTP version + * + * @var int + * @see self::_initChannel() + */ + private $defaultVersion; + /** + * Preferred SFTP version + * + * @var int + * @see self::_initChannel() + */ + private $preferredVersion = 3; + /** + * Current working directory + * + * @var string|bool + * @see self::realpath() + * @see self::chdir() + */ + private $pwd = \false; + /** + * Packet Type Log + * + * @see self::getLog() + * @var array + */ + private $packet_type_log = []; + /** + * Packet Log + * + * @see self::getLog() + * @var array + */ + private $packet_log = []; + /** + * Real-time log file pointer + * + * @see self::_append_log() + * @var resource|closed-resource + */ + private $realtime_log_file; + /** + * Real-time log file size + * + * @see self::_append_log() + * @var int + */ + private $realtime_log_size; + /** + * Real-time log file wrap boolean + * + * @see self::_append_log() + * @var bool + */ + private $realtime_log_wrap; + /** + * Current log size + * + * Should never exceed self::LOG_MAX_SIZE + * + * @var int + */ + private $log_size; + /** + * Error information + * + * @see self::getSFTPErrors() + * @see self::getLastSFTPError() + * @var array + */ + private $sftp_errors = []; + /** + * Stat Cache + * + * Rather than always having to open a directory and close it immediately there after to see if a file is a directory + * we'll cache the results. + * + * @see self::_update_stat_cache() + * @see self::_remove_from_stat_cache() + * @see self::_query_stat_cache() + * @var array + */ + private $stat_cache = []; + /** + * Max SFTP Packet Size + * + * @see self::__construct() + * @see self::get() + * @var int + */ + private $max_sftp_packet; + /** + * Stat Cache Flag + * + * @see self::disableStatCache() + * @see self::enableStatCache() + * @var bool + */ + private $use_stat_cache = \true; + /** + * Sort Options + * + * @see self::_comparator() + * @see self::setListOrder() + * @var array + */ + protected $sortOptions = []; + /** + * Canonicalization Flag + * + * Determines whether or not paths should be canonicalized before being + * passed on to the remote server. + * + * @see self::enablePathCanonicalization() + * @see self::disablePathCanonicalization() + * @see self::realpath() + * @var bool + */ + private $canonicalize_paths = \true; + /** + * Request Buffers + * + * @see self::_get_sftp_packet() + * @var array + */ + private $requestBuffer = []; + /** + * Preserve timestamps on file downloads / uploads + * + * @see self::get() + * @see self::put() + * @var bool + */ + private $preserveTime = \false; + /** + * Arbitrary Length Packets Flag + * + * Determines whether or not packets of any length should be allowed, + * in cases where the server chooses the packet length (such as + * directory listings). By default, packets are only allowed to be + * 256 * 1024 bytes (SFTP_MAX_MSG_LENGTH from OpenSSH's sftp-common.h) + * + * @see self::enableArbitraryLengthPackets() + * @see self::_get_sftp_packet() + * @var bool + */ + private $allow_arbitrary_length_packets = \false; + /** + * Was the last packet due to the channels being closed or not? + * + * @see self::get() + * @see self::get_sftp_packet() + * @var bool + */ + private $channel_close = \false; + /** + * Has the SFTP channel been partially negotiated? + * + * @var bool + */ + private $partial_init = \false; + /** + * Default Constructor. + * + * Connects to an SFTP server + * + * $host can either be a string, representing the host, or a stream resource. + * + * @param mixed $host + * @param int $port + * @param int $timeout + */ + public function __construct($host, $port = 22, $timeout = 10) + { + parent::__construct($host, $port, $timeout); + $this->max_sftp_packet = 1 << 15; + if (empty(self::$packet_types)) { + self::$packet_types = [1 => 'NET_SFTP_INIT', 2 => 'NET_SFTP_VERSION', 3 => 'NET_SFTP_OPEN', 4 => 'NET_SFTP_CLOSE', 5 => 'NET_SFTP_READ', 6 => 'NET_SFTP_WRITE', 7 => 'NET_SFTP_LSTAT', 9 => 'NET_SFTP_SETSTAT', 10 => 'NET_SFTP_FSETSTAT', 11 => 'NET_SFTP_OPENDIR', 12 => 'NET_SFTP_READDIR', 13 => 'NET_SFTP_REMOVE', 14 => 'NET_SFTP_MKDIR', 15 => 'NET_SFTP_RMDIR', 16 => 'NET_SFTP_REALPATH', 17 => 'NET_SFTP_STAT', 18 => 'NET_SFTP_RENAME', 19 => 'NET_SFTP_READLINK', 20 => 'NET_SFTP_SYMLINK', 21 => 'NET_SFTP_LINK', 101 => 'NET_SFTP_STATUS', 102 => 'NET_SFTP_HANDLE', 103 => 'NET_SFTP_DATA', 104 => 'NET_SFTP_NAME', 105 => 'NET_SFTP_ATTRS', 200 => 'NET_SFTP_EXTENDED']; + self::$status_codes = [0 => 'NET_SFTP_STATUS_OK', 1 => 'NET_SFTP_STATUS_EOF', 2 => 'NET_SFTP_STATUS_NO_SUCH_FILE', 3 => 'NET_SFTP_STATUS_PERMISSION_DENIED', 4 => 'NET_SFTP_STATUS_FAILURE', 5 => 'NET_SFTP_STATUS_BAD_MESSAGE', 6 => 'NET_SFTP_STATUS_NO_CONNECTION', 7 => 'NET_SFTP_STATUS_CONNECTION_LOST', 8 => 'NET_SFTP_STATUS_OP_UNSUPPORTED', 9 => 'NET_SFTP_STATUS_INVALID_HANDLE', 10 => 'NET_SFTP_STATUS_NO_SUCH_PATH', 11 => 'NET_SFTP_STATUS_FILE_ALREADY_EXISTS', 12 => 'NET_SFTP_STATUS_WRITE_PROTECT', 13 => 'NET_SFTP_STATUS_NO_MEDIA', 14 => 'NET_SFTP_STATUS_NO_SPACE_ON_FILESYSTEM', 15 => 'NET_SFTP_STATUS_QUOTA_EXCEEDED', 16 => 'NET_SFTP_STATUS_UNKNOWN_PRINCIPAL', 17 => 'NET_SFTP_STATUS_LOCK_CONFLICT', 18 => 'NET_SFTP_STATUS_DIR_NOT_EMPTY', 19 => 'NET_SFTP_STATUS_NOT_A_DIRECTORY', 20 => 'NET_SFTP_STATUS_INVALID_FILENAME', 21 => 'NET_SFTP_STATUS_LINK_LOOP', 22 => 'NET_SFTP_STATUS_CANNOT_DELETE', 23 => 'NET_SFTP_STATUS_INVALID_PARAMETER', 24 => 'NET_SFTP_STATUS_FILE_IS_A_DIRECTORY', 25 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_CONFLICT', 26 => 'NET_SFTP_STATUS_BYTE_RANGE_LOCK_REFUSED', 27 => 'NET_SFTP_STATUS_DELETE_PENDING', 28 => 'NET_SFTP_STATUS_FILE_CORRUPT', 29 => 'NET_SFTP_STATUS_OWNER_INVALID', 30 => 'NET_SFTP_STATUS_GROUP_INVALID', 31 => 'NET_SFTP_STATUS_NO_MATCHING_BYTE_RANGE_LOCK']; + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-7.1 + // the order, in this case, matters quite a lot - see \phpseclib3\Net\SFTP::_parseAttributes() to understand why + self::$attributes = [ + 0x1 => 'NET_SFTP_ATTR_SIZE', + 0x2 => 'NET_SFTP_ATTR_UIDGID', + // defined in SFTPv3, removed in SFTPv4+ + 0x80 => 'NET_SFTP_ATTR_OWNERGROUP', + // defined in SFTPv4+ + 0x4 => 'NET_SFTP_ATTR_PERMISSIONS', + 0x8 => 'NET_SFTP_ATTR_ACCESSTIME', + 0x10 => 'NET_SFTP_ATTR_CREATETIME', + // SFTPv4+ + 0x20 => 'NET_SFTP_ATTR_MODIFYTIME', + 0x40 => 'NET_SFTP_ATTR_ACL', + 0x100 => 'NET_SFTP_ATTR_SUBSECOND_TIMES', + 0x200 => 'NET_SFTP_ATTR_BITS', + // SFTPv5+ + 0x400 => 'NET_SFTP_ATTR_ALLOCATION_SIZE', + // SFTPv6+ + 0x800 => 'NET_SFTP_ATTR_TEXT_HINT', + 0x1000 => 'NET_SFTP_ATTR_MIME_TYPE', + 0x2000 => 'NET_SFTP_ATTR_LINK_COUNT', + 0x4000 => 'NET_SFTP_ATTR_UNTRANSLATED_NAME', + 0x8000 => 'NET_SFTP_ATTR_CTIME', + // 0x80000000 will yield a floating point on 32-bit systems and converting floating points to integers + // yields inconsistent behavior depending on how php is compiled. so we left shift -1 (which, in + // two's compliment, consists of all 1 bits) by 31. on 64-bit systems this'll yield 0xFFFFFFFF80000000. + // that's not a problem, however, and 'anded' and a 32-bit number, as all the leading 1 bits are ignored. + \PHP_INT_SIZE == 4 ? -1 << 31 : 0x80000000 => 'NET_SFTP_ATTR_EXTENDED', + ]; + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-6.3 + // the flag definitions change somewhat in SFTPv5+. if SFTPv5+ support is added to this library, maybe name + // the array for that $this->open5_flags and similarly alter the constant names. + self::$open_flags = [0x1 => 'NET_SFTP_OPEN_READ', 0x2 => 'NET_SFTP_OPEN_WRITE', 0x4 => 'NET_SFTP_OPEN_APPEND', 0x8 => 'NET_SFTP_OPEN_CREATE', 0x10 => 'NET_SFTP_OPEN_TRUNCATE', 0x20 => 'NET_SFTP_OPEN_EXCL', 0x40 => 'NET_SFTP_OPEN_TEXT']; + // SFTPv5+ changed the flags up: + // https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-8.1.1.3 + self::$open_flags5 = [ + // when SSH_FXF_ACCESS_DISPOSITION is a 3 bit field that controls how the file is opened + 0x0 => 'NET_SFTP_OPEN_CREATE_NEW', + 0x1 => 'NET_SFTP_OPEN_CREATE_TRUNCATE', + 0x2 => 'NET_SFTP_OPEN_OPEN_EXISTING', + 0x3 => 'NET_SFTP_OPEN_OPEN_OR_CREATE', + 0x4 => 'NET_SFTP_OPEN_TRUNCATE_EXISTING', + // the rest of the flags are not supported + 0x8 => 'NET_SFTP_OPEN_APPEND_DATA', + // "the offset field of SS_FXP_WRITE requests is ignored" + 0x10 => 'NET_SFTP_OPEN_APPEND_DATA_ATOMIC', + 0x20 => 'NET_SFTP_OPEN_TEXT_MODE', + 0x40 => 'NET_SFTP_OPEN_BLOCK_READ', + 0x80 => 'NET_SFTP_OPEN_BLOCK_WRITE', + 0x100 => 'NET_SFTP_OPEN_BLOCK_DELETE', + 0x200 => 'NET_SFTP_OPEN_BLOCK_ADVISORY', + 0x400 => 'NET_SFTP_OPEN_NOFOLLOW', + 0x800 => 'NET_SFTP_OPEN_DELETE_ON_CLOSE', + 0x1000 => 'NET_SFTP_OPEN_ACCESS_AUDIT_ALARM_INFO', + 0x2000 => 'NET_SFTP_OPEN_ACCESS_BACKUP', + 0x4000 => 'NET_SFTP_OPEN_BACKUP_STREAM', + 0x8000 => 'NET_SFTP_OPEN_OVERRIDE_OWNER', + ]; + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2 + // see \phpseclib3\Net\SFTP::_parseLongname() for an explanation + self::$file_types = [ + 1 => 'NET_SFTP_TYPE_REGULAR', + 2 => 'NET_SFTP_TYPE_DIRECTORY', + 3 => 'NET_SFTP_TYPE_SYMLINK', + 4 => 'NET_SFTP_TYPE_SPECIAL', + 5 => 'NET_SFTP_TYPE_UNKNOWN', + // the following types were first defined for use in SFTPv5+ + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#section-5.2 + 6 => 'NET_SFTP_TYPE_SOCKET', + 7 => 'NET_SFTP_TYPE_CHAR_DEVICE', + 8 => 'NET_SFTP_TYPE_BLOCK_DEVICE', + 9 => 'NET_SFTP_TYPE_FIFO', + ]; + self::define_array(self::$packet_types, self::$status_codes, self::$attributes, self::$open_flags, self::$open_flags5, self::$file_types); + } + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_QUEUE_SIZE')) { + define('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_QUEUE_SIZE', 32); + } + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_UPLOAD_QUEUE_SIZE')) { + define('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_UPLOAD_QUEUE_SIZE', 1024); + } + } + /** + * Check a few things before SFTP functions are called + * + * @return bool + */ + private function precheck() + { + if (!($this->bitmap & SSH2::MASK_LOGIN)) { + return \false; + } + if ($this->pwd === \false) { + return $this->init_sftp_connection(); + } + return \true; + } + /** + * Partially initialize an SFTP connection + * + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return bool + */ + private function partial_init_sftp_connection() + { + $response = $this->openChannel(self::CHANNEL, \true); + if ($response === \true && $this->isTimeout()) { + return \false; + } + $packet = Strings::packSSH2('CNsbs', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL], 'subsystem', \true, 'sftp'); + $this->send_binary_packet($packet); + $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; + $response = $this->get_channel_packet(self::CHANNEL, \true); + if ($response === \false) { + // from PuTTY's psftp.exe + $command = "test -x /usr/lib/sftp-server && exec /usr/lib/sftp-server\n" . "test -x /usr/local/lib/sftp-server && exec /usr/local/lib/sftp-server\n" . "exec sftp-server"; + // we don't do $this->exec($command, false) because exec() operates on a different channel and plus the SSH_MSG_CHANNEL_OPEN that exec() does + // is redundant + $packet = Strings::packSSH2('CNsCs', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL], 'exec', 1, $command); + $this->send_binary_packet($packet); + $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_REQUEST; + $response = $this->get_channel_packet(self::CHANNEL, \true); + if ($response === \false) { + return \false; + } + } elseif ($response === \true && $this->isTimeout()) { + return \false; + } + $this->channel_status[self::CHANNEL] = NET_SSH2_MSG_CHANNEL_DATA; + $this->send_sftp_packet(NET_SFTP_INIT, "\x00\x00\x00\x03"); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_VERSION) { + throw new \UnexpectedValueException('Expected NET_SFTP_VERSION. ' . 'Got packet type: ' . $this->packet_type); + } + $this->use_request_id = \true; + list($this->defaultVersion) = Strings::unpackSSH2('N', $response); + while (!empty($response)) { + list($key, $value) = Strings::unpackSSH2('ss', $response); + $this->extensions[$key] = $value; + } + $this->partial_init = \true; + return \true; + } + /** + * (Re)initializes the SFTP channel + * + * @return bool + */ + private function init_sftp_connection() + { + if (!$this->partial_init && !$this->partial_init_sftp_connection()) { + return \false; + } + /* + A Note on SFTPv4/5/6 support: + states the following: + + "If the client wishes to interoperate with servers that support noncontiguous version + numbers it SHOULD send '3'" + + Given that the server only sends its version number after the client has already done so, the above + seems to be suggesting that v3 should be the default version. This makes sense given that v3 is the + most popular. + + states the following; + + "If the server did not send the "versions" extension, or the version-from-list was not included, the + server MAY send a status response describing the failure, but MUST then close the channel without + processing any further requests." + + So what do you do if you have a client whose initial SSH_FXP_INIT packet says it implements v3 and + a server whose initial SSH_FXP_VERSION reply says it implements v4 and only v4? If it only implements + v4, the "versions" extension is likely not going to have been sent so version re-negotiation as discussed + in draft-ietf-secsh-filexfer-13 would be quite impossible. As such, what \phpseclib3\Net\SFTP would do is close the + channel and reopen it with a new and updated SSH_FXP_INIT packet. + */ + $this->version = $this->defaultVersion; + if (isset($this->extensions['versions']) && (!$this->preferredVersion || $this->preferredVersion != $this->version)) { + $versions = explode(',', $this->extensions['versions']); + $supported = [6, 5, 4]; + if ($this->preferredVersion) { + $supported = array_diff($supported, [$this->preferredVersion]); + array_unshift($supported, $this->preferredVersion); + } + foreach ($supported as $ver) { + if (in_array($ver, $versions)) { + if ($ver === $this->version) { + break; + } + $this->version = (int) $ver; + $packet = Strings::packSSH2('ss', 'version-select', "{$ver}"); + $this->send_sftp_packet(NET_SFTP_EXTENDED, $packet); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS_OK. ' . ' Got ' . $status); + } + break; + } + } + } + /* + SFTPv4+ defines a 'newline' extension. SFTPv3 seems to have unofficial support for it via 'newline@vandyke.com', + however, I'm not sure what 'newline@vandyke.com' is supposed to do (the fact that it's unofficial means that it's + not in the official SFTPv3 specs) and 'newline@vandyke.com' / 'newline' are likely not drop-in substitutes for + one another due to the fact that 'newline' comes with a SSH_FXF_TEXT bitmask whereas it seems unlikely that + 'newline@vandyke.com' would. + */ + /* + if (isset($this->extensions['newline@vandyke.com'])) { + $this->extensions['newline'] = $this->extensions['newline@vandyke.com']; + unset($this->extensions['newline@vandyke.com']); + } + */ + if ($this->version < 2 || $this->version > 6) { + return \false; + } + $this->pwd = \true; + try { + $this->pwd = $this->realpath('.'); + } catch (\UnexpectedValueException $e) { + if (!$this->canonicalize_paths) { + throw $e; + } + $this->canonicalize_paths = \false; + $this->reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST); + } + $this->update_stat_cache($this->pwd, []); + return \true; + } + /** + * Disable the stat cache + * + */ + public function disableStatCache() + { + $this->use_stat_cache = \false; + } + /** + * Enable the stat cache + * + */ + public function enableStatCache() + { + $this->use_stat_cache = \true; + } + /** + * Clear the stat cache + * + */ + public function clearStatCache() + { + $this->stat_cache = []; + } + /** + * Enable path canonicalization + * + */ + public function enablePathCanonicalization() + { + $this->canonicalize_paths = \true; + } + /** + * Disable path canonicalization + * + * If this is enabled then $sftp->pwd() will not return the canonicalized absolute path + * + */ + public function disablePathCanonicalization() + { + $this->canonicalize_paths = \false; + } + /** + * Enable arbitrary length packets + * + */ + public function enableArbitraryLengthPackets() + { + $this->allow_arbitrary_length_packets = \true; + } + /** + * Disable arbitrary length packets + * + */ + public function disableArbitraryLengthPackets() + { + $this->allow_arbitrary_length_packets = \false; + } + /** + * Returns the current directory name + * + * @return string|bool + */ + public function pwd() + { + if (!$this->precheck()) { + return \false; + } + return $this->pwd; + } + /** + * Logs errors + * + * @param string $response + * @param int $status + */ + private function logError($response, $status = -1) + { + if ($status == -1) { + list($status) = Strings::unpackSSH2('N', $response); + } + $error = self::$status_codes[$status]; + if ($this->version > 2) { + list($message) = Strings::unpackSSH2('s', $response); + $this->sftp_errors[] = "{$error}: {$message}"; + } else { + $this->sftp_errors[] = $error; + } + } + /** + * Canonicalize the Server-Side Path Name + * + * SFTP doesn't provide a mechanism by which the current working directory can be changed, so we'll emulate it. Returns + * the absolute (canonicalized) path. + * + * If canonicalize_paths has been disabled using disablePathCanonicalization(), $path is returned as-is. + * + * @see self::chdir() + * @see self::disablePathCanonicalization() + * @param string $path + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return mixed + */ + public function realpath($path) + { + if ($this->precheck() === \false) { + return \false; + } + if (!$this->canonicalize_paths) { + if ($this->pwd === \true) { + return '.'; + } + if (!strlen($path) || $path[0] != '/') { + $path = $this->pwd . '/' . $path; + } + $parts = explode('/', $path); + $afterPWD = $beforePWD = []; + foreach ($parts as $part) { + switch ($part) { + //case '': // some SFTP servers /require/ double /'s. see https://github.com/phpseclib/phpseclib/pull/1137 + case '.': + break; + case '..': + if (!empty($afterPWD)) { + array_pop($afterPWD); + } else { + $beforePWD[] = '..'; + } + break; + default: + $afterPWD[] = $part; + } + } + $beforePWD = count($beforePWD) ? implode('/', $beforePWD) : '.'; + return $beforePWD . '/' . implode('/', $afterPWD); + } + if ($this->pwd === \true) { + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.9 + $this->send_sftp_packet(NET_SFTP_REALPATH, Strings::packSSH2('s', $path)); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_NAME: + // although SSH_FXP_NAME is implemented differently in SFTPv3 than it is in SFTPv4+, the following + // should work on all SFTP versions since the only part of the SSH_FXP_NAME packet the following looks + // at is the first part and that part is defined the same in SFTP versions 3 through 6. + list(, $filename) = Strings::unpackSSH2('Ns', $response); + return $filename; + case NET_SFTP_STATUS: + $this->logError($response); + return \false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_NAME or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + } + if (!strlen($path) || $path[0] != '/') { + $path = $this->pwd . '/' . $path; + } + $path = explode('/', $path); + $new = []; + foreach ($path as $dir) { + if (!strlen($dir)) { + continue; + } + switch ($dir) { + case '..': + array_pop($new); + // fall-through + case '.': + break; + default: + $new[] = $dir; + } + } + return '/' . implode('/', $new); + } + /** + * Changes the current directory + * + * @param string $dir + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return bool + */ + public function chdir($dir) + { + if (!$this->precheck()) { + return \false; + } + // assume current dir if $dir is empty + if ($dir === '') { + $dir = './'; + // suffix a slash if needed + } elseif ($dir[strlen($dir) - 1] != '/') { + $dir .= '/'; + } + $dir = $this->realpath($dir); + // confirm that $dir is, in fact, a valid directory + if ($this->use_stat_cache && is_array($this->query_stat_cache($dir))) { + $this->pwd = $dir; + return \true; + } + // we could do a stat on the alleged $dir to see if it's a directory but that doesn't tell us + // the currently logged in user has the appropriate permissions or not. maybe you could see if + // the file's uid / gid match the currently logged in user's uid / gid but how there's no easy + // way to get those with SFTP + $this->send_sftp_packet(NET_SFTP_OPENDIR, Strings::packSSH2('s', $dir)); + // see \phpseclib3\Net\SFTP::nlist() for a more thorough explanation of the following + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + $handle = substr($response, 4); + break; + case NET_SFTP_STATUS: + $this->logError($response); + return \false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS' . 'Got packet type: ' . $this->packet_type); + } + if (!$this->close_handle($handle)) { + return \false; + } + $this->update_stat_cache($dir, []); + $this->pwd = $dir; + return \true; + } + /** + * Returns a list of files in the given directory + * + * @param string $dir + * @param bool $recursive + * @return array|false + */ + public function nlist($dir = '.', $recursive = \false) + { + return $this->nlist_helper($dir, $recursive, ''); + } + /** + * Helper method for nlist + * + * @param string $dir + * @param bool $recursive + * @param string $relativeDir + * @return array|false + */ + private function nlist_helper($dir, $recursive, $relativeDir) + { + $files = $this->readlist($dir, \false); + // If we get an int back, then that is an "unexpected" status. + // We do not have a file list, so return false. + if (is_int($files)) { + return \false; + } + if (!$recursive || $files === \false) { + return $files; + } + $result = []; + foreach ($files as $value) { + if ($value == '.' || $value == '..') { + $result[] = $relativeDir . $value; + continue; + } + if (is_array($this->query_stat_cache($this->realpath($dir . '/' . $value)))) { + $temp = $this->nlist_helper($dir . '/' . $value, \true, $relativeDir . $value . '/'); + $temp = is_array($temp) ? $temp : []; + $result = array_merge($result, $temp); + } else { + $result[] = $relativeDir . $value; + } + } + return $result; + } + /** + * Returns a detailed list of files in the given directory + * + * @param string $dir + * @param bool $recursive + * @return array|false + */ + public function rawlist($dir = '.', $recursive = \false) + { + $files = $this->readlist($dir, \true); + // If we get an int back, then that is an "unexpected" status. + // We do not have a file list, so return false. + if (is_int($files)) { + return \false; + } + if (!$recursive || $files === \false) { + return $files; + } + static $depth = 0; + foreach ($files as $key => $value) { + if ($depth != 0 && $key == '..') { + unset($files[$key]); + continue; + } + $is_directory = \false; + if ($key != '.' && $key != '..') { + if ($this->use_stat_cache) { + $is_directory = is_array($this->query_stat_cache($this->realpath($dir . '/' . $key))); + } else { + $stat = $this->lstat($dir . '/' . $key); + $is_directory = $stat && $stat['type'] === NET_SFTP_TYPE_DIRECTORY; + } + } + if ($is_directory) { + $depth++; + $files[$key] = $this->rawlist($dir . '/' . $key, \true); + $depth--; + } else { + $files[$key] = (object) $value; + } + } + return $files; + } + /** + * Reads a list, be it detailed or not, of files in the given directory + * + * @param string $dir + * @param bool $raw + * @return array|false + * @throws \UnexpectedValueException on receipt of unexpected packets + */ + private function readlist($dir, $raw = \true) + { + if (!$this->precheck()) { + return \false; + } + $dir = $this->realpath($dir . '/'); + if ($dir === \false) { + return \false; + } + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.2 + $this->send_sftp_packet(NET_SFTP_OPENDIR, Strings::packSSH2('s', $dir)); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.2 + // since 'handle' is the last field in the SSH_FXP_HANDLE packet, we'll just remove the first four bytes that + // represent the length of the string and leave it at that + $handle = substr($response, 4); + break; + case NET_SFTP_STATUS: + // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + list($status) = Strings::unpackSSH2('N', $response); + $this->logError($response, $status); + return $status; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + $this->update_stat_cache($dir, []); + $contents = []; + while (\true) { + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.2 + // why multiple SSH_FXP_READDIR packets would be sent when the response to a single one can span arbitrarily many + // SSH_MSG_CHANNEL_DATA messages is not known to me. + $this->send_sftp_packet(NET_SFTP_READDIR, Strings::packSSH2('s', $handle)); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_NAME: + list($count) = Strings::unpackSSH2('N', $response); + for ($i = 0; $i < $count; $i++) { + list($shortname) = Strings::unpackSSH2('s', $response); + // SFTPv4 "removed the long filename from the names structure-- it can now be + // built from information available in the attrs structure." + if ($this->version < 4) { + list($longname) = Strings::unpackSSH2('s', $response); + } + $attributes = $this->parseAttributes($response); + if (!isset($attributes['type']) && $this->version < 4) { + $fileType = $this->parseLongname($longname); + if ($fileType) { + $attributes['type'] = $fileType; + } + } + $contents[$shortname] = $attributes + ['filename' => $shortname]; + if (isset($attributes['type']) && $attributes['type'] == NET_SFTP_TYPE_DIRECTORY && ($shortname != '.' && $shortname != '..')) { + $this->update_stat_cache($dir . '/' . $shortname, []); + } else { + if ($shortname == '..') { + $temp = $this->realpath($dir . '/..') . '/.'; + } else { + $temp = $dir . '/' . $shortname; + } + $this->update_stat_cache($temp, (object) ['lstat' => $attributes]); + } + // SFTPv6 has an optional boolean end-of-list field, but we'll ignore that, since the + // final SSH_FXP_STATUS packet should tell us that, already. + } + break; + case NET_SFTP_STATUS: + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_EOF) { + $this->logError($response, $status); + return $status; + } + break 2; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_NAME or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + } + if (!$this->close_handle($handle)) { + return \false; + } + if (count($this->sortOptions)) { + uasort($contents, [&$this, 'comparator']); + } + return $raw ? $contents : array_map('strval', array_keys($contents)); + } + /** + * Compares two rawlist entries using parameters set by setListOrder() + * + * Intended for use with uasort() + * + * @param array $a + * @param array $b + * @return int + */ + private function comparator(array $a, array $b) + { + switch (\true) { + case $a['filename'] === '.' || $b['filename'] === '.': + if ($a['filename'] === $b['filename']) { + return 0; + } + return $a['filename'] === '.' ? -1 : 1; + case $a['filename'] === '..' || $b['filename'] === '..': + if ($a['filename'] === $b['filename']) { + return 0; + } + return $a['filename'] === '..' ? -1 : 1; + case isset($a['type']) && $a['type'] === NET_SFTP_TYPE_DIRECTORY: + if (!isset($b['type'])) { + return 1; + } + if ($b['type'] !== $a['type']) { + return -1; + } + break; + case isset($b['type']) && $b['type'] === NET_SFTP_TYPE_DIRECTORY: + return 1; + } + foreach ($this->sortOptions as $sort => $order) { + if (!isset($a[$sort]) || !isset($b[$sort])) { + if (isset($a[$sort])) { + return -1; + } + if (isset($b[$sort])) { + return 1; + } + return 0; + } + switch ($sort) { + case 'filename': + $result = strcasecmp($a['filename'], $b['filename']); + if ($result) { + return $order === \SORT_DESC ? -$result : $result; + } + break; + case 'mode': + $a[$sort] &= 07777; + $b[$sort] &= 07777; + // fall-through + default: + if ($a[$sort] === $b[$sort]) { + break; + } + return $order === \SORT_ASC ? $a[$sort] - $b[$sort] : $b[$sort] - $a[$sort]; + } + } + } + /** + * Defines how nlist() and rawlist() will be sorted - if at all. + * + * If sorting is enabled directories and files will be sorted independently with + * directories appearing before files in the resultant array that is returned. + * + * Any parameter returned by stat is a valid sort parameter for this function. + * Filename comparisons are case insensitive. + * + * Examples: + * + * $sftp->setListOrder('filename', SORT_ASC); + * $sftp->setListOrder('size', SORT_DESC, 'filename', SORT_ASC); + * $sftp->setListOrder(true); + * Separates directories from files but doesn't do any sorting beyond that + * $sftp->setListOrder(); + * Don't do any sort of sorting + * + * @param string ...$args + */ + public function setListOrder(...$args) + { + $this->sortOptions = []; + if (empty($args)) { + return; + } + $len = count($args) & 0x7ffffffe; + for ($i = 0; $i < $len; $i += 2) { + $this->sortOptions[$args[$i]] = $args[$i + 1]; + } + if (!count($this->sortOptions)) { + $this->sortOptions = ['bogus' => \true]; + } + } + /** + * Save files / directories to cache + * + * @param string $path + * @param mixed $value + */ + private function update_stat_cache($path, $value) + { + if ($this->use_stat_cache === \false) { + return; + } + // preg_replace('#^/|/(?=/)|/$#', '', $dir) == str_replace('//', '/', trim($path, '/')) + $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path)); + $temp =& $this->stat_cache; + $max = count($dirs) - 1; + foreach ($dirs as $i => $dir) { + // if $temp is an object that means one of two things. + // 1. a file was deleted and changed to a directory behind phpseclib's back + // 2. it's a symlink. when lstat is done it's unclear what it's a symlink to + if (is_object($temp)) { + $temp = []; + } + if (!isset($temp[$dir])) { + $temp[$dir] = []; + } + if ($i === $max) { + if (is_object($temp[$dir]) && is_object($value)) { + if (!isset($value->stat) && isset($temp[$dir]->stat)) { + $value->stat = $temp[$dir]->stat; + } + if (!isset($value->lstat) && isset($temp[$dir]->lstat)) { + $value->lstat = $temp[$dir]->lstat; + } + } + $temp[$dir] = $value; + break; + } + $temp =& $temp[$dir]; + } + } + /** + * Remove files / directories from cache + * + * @param string $path + * @return bool + */ + private function remove_from_stat_cache($path) + { + $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path)); + $temp =& $this->stat_cache; + $max = count($dirs) - 1; + foreach ($dirs as $i => $dir) { + if (!is_array($temp)) { + return \false; + } + if ($i === $max) { + unset($temp[$dir]); + return \true; + } + if (!isset($temp[$dir])) { + return \false; + } + $temp =& $temp[$dir]; + } + } + /** + * Checks cache for path + * + * Mainly used by file_exists + * + * @param string $path + * @return mixed + */ + private function query_stat_cache($path) + { + $dirs = explode('/', preg_replace('#^/|/(?=/)|/$#', '', $path)); + $temp =& $this->stat_cache; + foreach ($dirs as $dir) { + if (!is_array($temp)) { + return null; + } + if (!isset($temp[$dir])) { + return null; + } + $temp =& $temp[$dir]; + } + return $temp; + } + /** + * Returns general information about a file. + * + * Returns an array on success and false otherwise. + * + * @param string $filename + * @return array|false + */ + public function stat($filename) + { + if (!$this->precheck()) { + return \false; + } + $filename = $this->realpath($filename); + if ($filename === \false) { + return \false; + } + if ($this->use_stat_cache) { + $result = $this->query_stat_cache($filename); + if (is_array($result) && isset($result['.']) && isset($result['.']->stat)) { + return $result['.']->stat; + } + if (is_object($result) && isset($result->stat)) { + return $result->stat; + } + } + $stat = $this->stat_helper($filename, NET_SFTP_STAT); + if ($stat === \false) { + $this->remove_from_stat_cache($filename); + return \false; + } + if (isset($stat['type'])) { + if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) { + $filename .= '/.'; + } + $this->update_stat_cache($filename, (object) ['stat' => $stat]); + return $stat; + } + $pwd = $this->pwd; + $stat['type'] = $this->chdir($filename) ? NET_SFTP_TYPE_DIRECTORY : NET_SFTP_TYPE_REGULAR; + $this->pwd = $pwd; + if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) { + $filename .= '/.'; + } + $this->update_stat_cache($filename, (object) ['stat' => $stat]); + return $stat; + } + /** + * Returns general information about a file or symbolic link. + * + * Returns an array on success and false otherwise. + * + * @param string $filename + * @return array|false + */ + public function lstat($filename) + { + if (!$this->precheck()) { + return \false; + } + $filename = $this->realpath($filename); + if ($filename === \false) { + return \false; + } + if ($this->use_stat_cache) { + $result = $this->query_stat_cache($filename); + if (is_array($result) && isset($result['.']) && isset($result['.']->lstat)) { + return $result['.']->lstat; + } + if (is_object($result) && isset($result->lstat)) { + return $result->lstat; + } + } + $lstat = $this->stat_helper($filename, NET_SFTP_LSTAT); + if ($lstat === \false) { + $this->remove_from_stat_cache($filename); + return \false; + } + if (isset($lstat['type'])) { + if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) { + $filename .= '/.'; + } + $this->update_stat_cache($filename, (object) ['lstat' => $lstat]); + return $lstat; + } + $stat = $this->stat_helper($filename, NET_SFTP_STAT); + if ($lstat != $stat) { + $lstat = array_merge($lstat, ['type' => NET_SFTP_TYPE_SYMLINK]); + $this->update_stat_cache($filename, (object) ['lstat' => $lstat]); + return $stat; + } + $pwd = $this->pwd; + $lstat['type'] = $this->chdir($filename) ? NET_SFTP_TYPE_DIRECTORY : NET_SFTP_TYPE_REGULAR; + $this->pwd = $pwd; + if ($lstat['type'] == NET_SFTP_TYPE_DIRECTORY) { + $filename .= '/.'; + } + $this->update_stat_cache($filename, (object) ['lstat' => $lstat]); + return $lstat; + } + /** + * Returns general information about a file or symbolic link + * + * Determines information without calling \phpseclib3\Net\SFTP::realpath(). + * The second parameter can be either NET_SFTP_STAT or NET_SFTP_LSTAT. + * + * @param string $filename + * @param int $type + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return array|false + */ + private function stat_helper($filename, $type) + { + // SFTPv4+ adds an additional 32-bit integer field - flags - to the following: + $packet = Strings::packSSH2('s', $filename); + $this->send_sftp_packet($type, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_ATTRS: + return $this->parseAttributes($response); + case NET_SFTP_STATUS: + $this->logError($response); + return \false; + } + throw new \UnexpectedValueException('Expected NET_SFTP_ATTRS or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + /** + * Truncates a file to a given length + * + * @param string $filename + * @param int $new_size + * @return bool + */ + public function truncate($filename, $new_size) + { + $attr = Strings::packSSH2('NQ', NET_SFTP_ATTR_SIZE, $new_size); + return $this->setstat($filename, $attr, \false); + } + /** + * Sets access and modification time of file. + * + * If the file does not exist, it will be created. + * + * @param string $filename + * @param int $time + * @param int $atime + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return bool + */ + public function touch($filename, $time = null, $atime = null) + { + if (!$this->precheck()) { + return \false; + } + $filename = $this->realpath($filename); + if ($filename === \false) { + return \false; + } + if (!isset($time)) { + $time = time(); + } + if (!isset($atime)) { + $atime = $time; + } + $attr = $this->version < 4 ? pack('N3', NET_SFTP_ATTR_ACCESSTIME, $atime, $time) : Strings::packSSH2('NQ2', NET_SFTP_ATTR_ACCESSTIME | NET_SFTP_ATTR_MODIFYTIME, $atime, $time); + $packet = Strings::packSSH2('s', $filename); + $packet .= $this->version >= 5 ? pack('N2', 0, NET_SFTP_OPEN_OPEN_EXISTING) : pack('N', NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE | NET_SFTP_OPEN_EXCL); + $packet .= $attr; + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + return $this->close_handle(substr($response, 4)); + case NET_SFTP_STATUS: + $this->logError($response); + break; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + return $this->setstat($filename, $attr, \false); + } + /** + * Changes file or directory owner + * + * $uid should be an int for SFTPv3 and a string for SFTPv4+. Ideally the string + * would be of the form "user@dns_domain" but it does not need to be. + * `$sftp->getSupportedVersions()['version']` will return the specific version + * that's being used. + * + * Returns true on success or false on error. + * + * @param string $filename + * @param int|string $uid + * @param bool $recursive + * @return bool + */ + public function chown($filename, $uid, $recursive = \false) + { + /* + quoting , + + "To avoid a representation that is tied to a particular underlying + implementation at the client or server, the use of UTF-8 strings has + been chosen. The string should be of the form "user@dns_domain". + This will allow for a client and server that do not use the same + local representation the ability to translate to a common syntax that + can be interpreted by both. In the case where there is no + translation available to the client or server, the attribute value + must be constructed without the "@"." + + phpseclib _could_ auto append the dns_domain to $uid BUT what if it shouldn't + have one? phpseclib would have no way of knowing so rather than guess phpseclib + will just use whatever value the user provided + */ + $attr = $this->version < 4 ? pack('N3', NET_SFTP_ATTR_UIDGID, $uid, -1) : Strings::packSSH2('Nss', NET_SFTP_ATTR_OWNERGROUP, $uid, ''); + return $this->setstat($filename, $attr, $recursive); + } + /** + * Changes file or directory group + * + * $gid should be an int for SFTPv3 and a string for SFTPv4+. Ideally the string + * would be of the form "user@dns_domain" but it does not need to be. + * `$sftp->getSupportedVersions()['version']` will return the specific version + * that's being used. + * + * Returns true on success or false on error. + * + * @param string $filename + * @param int|string $gid + * @param bool $recursive + * @return bool + */ + public function chgrp($filename, $gid, $recursive = \false) + { + $attr = $this->version < 4 ? pack('N3', NET_SFTP_ATTR_UIDGID, -1, $gid) : Strings::packSSH2('Nss', NET_SFTP_ATTR_OWNERGROUP, '', $gid); + return $this->setstat($filename, $attr, $recursive); + } + /** + * Set permissions on a file. + * + * Returns the new file permissions on success or false on error. + * If $recursive is true than this just returns true or false. + * + * @param int $mode + * @param string $filename + * @param bool $recursive + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return mixed + */ + public function chmod($mode, $filename, $recursive = \false) + { + if (is_string($mode) && is_int($filename)) { + $temp = $mode; + $mode = $filename; + $filename = $temp; + } + $attr = pack('N2', NET_SFTP_ATTR_PERMISSIONS, $mode & 07777); + if (!$this->setstat($filename, $attr, $recursive)) { + return \false; + } + if ($recursive) { + return \true; + } + $filename = $this->realpath($filename); + // rather than return what the permissions *should* be, we'll return what they actually are. this will also + // tell us if the file actually exists. + // incidentally, SFTPv4+ adds an additional 32-bit integer field - flags - to the following: + $packet = pack('Na*', strlen($filename), $filename); + $this->send_sftp_packet(NET_SFTP_STAT, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_ATTRS: + $attrs = $this->parseAttributes($response); + return $attrs['mode']; + case NET_SFTP_STATUS: + $this->logError($response); + return \false; + } + throw new \UnexpectedValueException('Expected NET_SFTP_ATTRS or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + /** + * Sets information about a file + * + * @param string $filename + * @param string $attr + * @param bool $recursive + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return bool + */ + private function setstat($filename, $attr, $recursive) + { + if (!$this->precheck()) { + return \false; + } + $filename = $this->realpath($filename); + if ($filename === \false) { + return \false; + } + $this->remove_from_stat_cache($filename); + if ($recursive) { + $i = 0; + $result = $this->setstat_recursive($filename, $attr, $i); + $this->read_put_responses($i); + return $result; + } + $packet = Strings::packSSH2('s', $filename); + $packet .= $this->version >= 4 ? pack('a*Ca*', substr($attr, 0, 4), NET_SFTP_TYPE_UNKNOWN, substr($attr, 4)) : $attr; + $this->send_sftp_packet(NET_SFTP_SETSTAT, $packet); + /* + "Because some systems must use separate system calls to set various attributes, it is possible that a failure + response will be returned, but yet some of the attributes may be have been successfully modified. If possible, + servers SHOULD avoid this situation; however, clients MUST be aware that this is possible." + + -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.6 + */ + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + return \false; + } + return \true; + } + /** + * Recursively sets information on directories on the SFTP server + * + * Minimizes directory lookups and SSH_FXP_STATUS requests for speed. + * + * @param string $path + * @param string $attr + * @param int $i + * @return bool + */ + private function setstat_recursive($path, $attr, &$i) + { + if (!$this->read_put_responses($i)) { + return \false; + } + $i = 0; + $entries = $this->readlist($path, \true); + if ($entries === \false || is_int($entries)) { + return $this->setstat($path, $attr, \false); + } + // normally $entries would have at least . and .. but it might not if the directories + // permissions didn't allow reading + if (empty($entries)) { + return \false; + } + unset($entries['.'], $entries['..']); + foreach ($entries as $filename => $props) { + if (!isset($props['type'])) { + return \false; + } + $temp = $path . '/' . $filename; + if ($props['type'] == NET_SFTP_TYPE_DIRECTORY) { + if (!$this->setstat_recursive($temp, $attr, $i)) { + return \false; + } + } else { + $packet = Strings::packSSH2('s', $temp); + $packet .= $this->version >= 4 ? pack('Ca*', NET_SFTP_TYPE_UNKNOWN, $attr) : $attr; + $this->send_sftp_packet(NET_SFTP_SETSTAT, $packet); + $i++; + if ($i >= NET_SFTP_QUEUE_SIZE) { + if (!$this->read_put_responses($i)) { + return \false; + } + $i = 0; + } + } + } + $packet = Strings::packSSH2('s', $path); + $packet .= $this->version >= 4 ? pack('Ca*', NET_SFTP_TYPE_UNKNOWN, $attr) : $attr; + $this->send_sftp_packet(NET_SFTP_SETSTAT, $packet); + $i++; + if ($i >= NET_SFTP_QUEUE_SIZE) { + if (!$this->read_put_responses($i)) { + return \false; + } + $i = 0; + } + return \true; + } + /** + * Return the target of a symbolic link + * + * @param string $link + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return mixed + */ + public function readlink($link) + { + if (!$this->precheck()) { + return \false; + } + $link = $this->realpath($link); + $this->send_sftp_packet(NET_SFTP_READLINK, Strings::packSSH2('s', $link)); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_NAME: + break; + case NET_SFTP_STATUS: + $this->logError($response); + return \false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_NAME or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($count) = Strings::unpackSSH2('N', $response); + // the file isn't a symlink + if (!$count) { + return \false; + } + list($filename) = Strings::unpackSSH2('s', $response); + return $filename; + } + /** + * Create a symlink + * + * symlink() creates a symbolic link to the existing target with the specified name link. + * + * @param string $target + * @param string $link + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return bool + */ + public function symlink($target, $link) + { + if (!$this->precheck()) { + return \false; + } + //$target = $this->realpath($target); + $link = $this->realpath($link); + /* quoting https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-09#section-12.1 : + + Changed the SYMLINK packet to be LINK and give it the ability to + create hard links. Also change it's packet number because many + implementation implemented SYMLINK with the arguments reversed. + Hopefully the new argument names make it clear which way is which. + */ + if ($this->version == 6) { + $type = NET_SFTP_LINK; + $packet = Strings::packSSH2('ssC', $link, $target, 1); + } else { + $type = NET_SFTP_SYMLINK; + /* quoting http://bxr.su/OpenBSD/usr.bin/ssh/PROTOCOL#347 : + + 3.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK + + When OpenSSH's sftp-server was implemented, the order of the arguments + to the SSH_FXP_SYMLINK method was inadvertently reversed. Unfortunately, + the reversal was not noticed until the server was widely deployed. Since + fixing this to follow the specification would cause incompatibility, the + current order was retained. For correct operation, clients should send + SSH_FXP_SYMLINK as follows: + + uint32 id + string targetpath + string linkpath */ + $packet = substr($this->server_identifier, 0, 15) == 'SSH-2.0-OpenSSH' ? Strings::packSSH2('ss', $target, $link) : Strings::packSSH2('ss', $link, $target); + } + $this->send_sftp_packet($type, $packet); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + return \false; + } + return \true; + } + /** + * Creates a directory. + * + * @param string $dir + * @param int $mode + * @param bool $recursive + * @return bool + */ + public function mkdir($dir, $mode = -1, $recursive = \false) + { + if (!$this->precheck()) { + return \false; + } + $dir = $this->realpath($dir); + if ($recursive) { + $dirs = explode('/', preg_replace('#/(?=/)|/$#', '', $dir)); + if (empty($dirs[0])) { + array_shift($dirs); + $dirs[0] = '/' . $dirs[0]; + } + for ($i = 0; $i < count($dirs); $i++) { + $temp = array_slice($dirs, 0, $i + 1); + $temp = implode('/', $temp); + $result = $this->mkdir_helper($temp, $mode); + } + return $result; + } + return $this->mkdir_helper($dir, $mode); + } + /** + * Helper function for directory creation + * + * @param string $dir + * @param int $mode + * @return bool + */ + private function mkdir_helper($dir, $mode) + { + // send SSH_FXP_MKDIR without any attributes (that's what the \0\0\0\0 is doing) + $this->send_sftp_packet(NET_SFTP_MKDIR, Strings::packSSH2('s', $dir) . "\x00\x00\x00\x00"); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + return \false; + } + if ($mode !== -1) { + $this->chmod($mode, $dir); + } + return \true; + } + /** + * Removes a directory. + * + * @param string $dir + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return bool + */ + public function rmdir($dir) + { + if (!$this->precheck()) { + return \false; + } + $dir = $this->realpath($dir); + if ($dir === \false) { + return \false; + } + $this->send_sftp_packet(NET_SFTP_RMDIR, Strings::packSSH2('s', $dir)); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED? + $this->logError($response, $status); + return \false; + } + $this->remove_from_stat_cache($dir); + // the following will do a soft delete, which would be useful if you deleted a file + // and then tried to do a stat on the deleted file. the above, in contrast, does + // a hard delete + //$this->update_stat_cache($dir, false); + return \true; + } + /** + * Uploads a file to the SFTP server. + * + * By default, \phpseclib3\Net\SFTP::put() does not read from the local filesystem. $data is dumped directly into $remote_file. + * So, for example, if you set $data to 'filename.ext' and then do \phpseclib3\Net\SFTP::get(), you will get a file, twelve bytes + * long, containing 'filename.ext' as its contents. + * + * Setting $mode to self::SOURCE_LOCAL_FILE will change the above behavior. With self::SOURCE_LOCAL_FILE, $remote_file will + * contain as many bytes as filename.ext does on your local filesystem. If your filename.ext is 1MB then that is how + * large $remote_file will be, as well. + * + * Setting $mode to self::SOURCE_CALLBACK will use $data as callback function, which gets only one parameter -- number + * of bytes to return, and returns a string if there is some data or null if there is no more data + * + * If $data is a resource then it'll be used as a resource instead. + * + * Currently, only binary mode is supported. As such, if the line endings need to be adjusted, you will need to take + * care of that, yourself. + * + * $mode can take an additional two parameters - self::RESUME and self::RESUME_START. These are bitwise AND'd with + * $mode. So if you want to resume upload of a 300mb file on the local file system you'd set $mode to the following: + * + * self::SOURCE_LOCAL_FILE | self::RESUME + * + * If you wanted to simply append the full contents of a local file to the full contents of a remote file you'd replace + * self::RESUME with self::RESUME_START. + * + * If $mode & (self::RESUME | self::RESUME_START) then self::RESUME_START will be assumed. + * + * $start and $local_start give you more fine grained control over this process and take precident over self::RESUME + * when they're non-negative. ie. $start could let you write at the end of a file (like self::RESUME) or in the middle + * of one. $local_start could let you start your reading from the end of a file (like self::RESUME_START) or in the + * middle of one. + * + * Setting $local_start to > 0 or $mode | self::RESUME_START doesn't do anything unless $mode | self::SOURCE_LOCAL_FILE. + * + * {@internal ASCII mode for SFTPv4/5/6 can be supported by adding a new function - \phpseclib3\Net\SFTP::setMode().} + * + * @param string $remote_file + * @param string|resource $data + * @param int $mode + * @param int $start + * @param int $local_start + * @param callable|null $progressCallback + * @throws \UnexpectedValueException on receipt of unexpected packets + * @throws \BadFunctionCallException if you're uploading via a callback and the callback function is invalid + * @throws \phpseclib3\Exception\FileNotFoundException if you're uploading via a file and the file doesn't exist + * @return bool + */ + public function put($remote_file, $data, $mode = self::SOURCE_STRING, $start = -1, $local_start = -1, $progressCallback = null) + { + if (!$this->precheck()) { + return \false; + } + $remote_file = $this->realpath($remote_file); + if ($remote_file === \false) { + return \false; + } + $this->remove_from_stat_cache($remote_file); + if ($this->version >= 5) { + $flags = NET_SFTP_OPEN_OPEN_OR_CREATE; + } else { + $flags = NET_SFTP_OPEN_WRITE | NET_SFTP_OPEN_CREATE; + // according to the SFTP specs, NET_SFTP_OPEN_APPEND should "force all writes to append data at the end of the file." + // in practice, it doesn't seem to do that. + //$flags|= ($mode & self::RESUME) ? NET_SFTP_OPEN_APPEND : NET_SFTP_OPEN_TRUNCATE; + } + if ($start >= 0) { + $offset = $start; + } elseif ($mode & (self::RESUME | self::RESUME_START)) { + // if NET_SFTP_OPEN_APPEND worked as it should _size() wouldn't need to be called + $stat = $this->stat($remote_file); + $offset = $stat !== \false && $stat['size'] ? $stat['size'] : 0; + } else { + $offset = 0; + if ($this->version >= 5) { + $flags = NET_SFTP_OPEN_CREATE_TRUNCATE; + } else { + $flags |= NET_SFTP_OPEN_TRUNCATE; + } + } + $this->remove_from_stat_cache($remote_file); + $packet = Strings::packSSH2('s', $remote_file); + $packet .= $this->version >= 5 ? pack('N3', 0, $flags, 0) : pack('N2', $flags, 0); + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + $handle = substr($response, 4); + break; + case NET_SFTP_STATUS: + $this->logError($response); + return \false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.3 + $dataCallback = \false; + switch (\true) { + case $mode & self::SOURCE_CALLBACK: + if (!is_callable($data)) { + throw new \BadFunctionCallException("\$data should be is_callable() if you specify SOURCE_CALLBACK flag"); + } + $dataCallback = $data; + // do nothing + break; + case is_resource($data): + $mode = $mode & ~self::SOURCE_LOCAL_FILE; + $info = stream_get_meta_data($data); + if (isset($info['wrapper_type']) && $info['wrapper_type'] == 'PHP' && $info['stream_type'] == 'Input') { + $fp = fopen('php://memory', 'w+'); + stream_copy_to_stream($data, $fp); + rewind($fp); + } else { + $fp = $data; + } + break; + case $mode & self::SOURCE_LOCAL_FILE: + if (!is_file($data)) { + throw new FileNotFoundException("{$data} is not a valid file"); + } + $fp = @fopen($data, 'rb'); + if (!$fp) { + return \false; + } + } + if (isset($fp)) { + $stat = fstat($fp); + $size = !empty($stat) ? $stat['size'] : 0; + if ($local_start >= 0) { + fseek($fp, $local_start); + $size -= $local_start; + } elseif ($mode & self::RESUME) { + fseek($fp, $offset); + $size -= $offset; + } + } elseif ($dataCallback) { + $size = 0; + } else { + $size = strlen($data); + } + $sent = 0; + $size = $size < 0 ? ($size & 0x7fffffff) + 0x80000000 : $size; + $sftp_packet_size = $this->max_sftp_packet; + // make the SFTP packet be exactly the SFTP packet size by including the bytes in the NET_SFTP_WRITE packets "header" + $sftp_packet_size -= strlen($handle) + 25; + $i = $j = 0; + while ($dataCallback || ($size === 0 || $sent < $size)) { + if ($dataCallback) { + $temp = $dataCallback($sftp_packet_size); + if (is_null($temp)) { + break; + } + } else { + $temp = isset($fp) ? fread($fp, $sftp_packet_size) : substr($data, $sent, $sftp_packet_size); + if ($temp === \false || $temp === '') { + break; + } + } + $subtemp = $offset + $sent; + $packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp); + try { + $this->send_sftp_packet(NET_SFTP_WRITE, $packet, $j); + } catch (\Exception $e) { + if ($mode & self::SOURCE_LOCAL_FILE) { + fclose($fp); + } + throw $e; + } + $sent += strlen($temp); + if (is_callable($progressCallback)) { + $progressCallback($sent); + } + $i++; + $j++; + if ($i == NET_SFTP_UPLOAD_QUEUE_SIZE) { + if (!$this->read_put_responses($i)) { + $i = 0; + break; + } + $i = 0; + } + } + $result = $this->close_handle($handle); + if (!$this->read_put_responses($i)) { + if ($mode & self::SOURCE_LOCAL_FILE) { + fclose($fp); + } + $this->close_handle($handle); + return \false; + } + if ($mode & SFTP::SOURCE_LOCAL_FILE) { + if (isset($fp) && is_resource($fp)) { + fclose($fp); + } + if ($this->preserveTime) { + $stat = stat($data); + $attr = $this->version < 4 ? pack('N3', NET_SFTP_ATTR_ACCESSTIME, $stat['atime'], $stat['mtime']) : Strings::packSSH2('NQ2', NET_SFTP_ATTR_ACCESSTIME | NET_SFTP_ATTR_MODIFYTIME, $stat['atime'], $stat['mtime']); + if (!$this->setstat($remote_file, $attr, \false)) { + throw new \RuntimeException('Error setting file time'); + } + } + } + return $result; + } + /** + * Reads multiple successive SSH_FXP_WRITE responses + * + * Sending an SSH_FXP_WRITE packet and immediately reading its response isn't as efficient as blindly sending out $i + * SSH_FXP_WRITEs, in succession, and then reading $i responses. + * + * @param int $i + * @return bool + * @throws \UnexpectedValueException on receipt of unexpected packets + */ + private function read_put_responses($i) + { + while ($i--) { + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + break; + } + } + return $i < 0; + } + /** + * Close handle + * + * @param string $handle + * @return bool + * @throws \UnexpectedValueException on receipt of unexpected packets + */ + private function close_handle($handle) + { + $this->send_sftp_packet(NET_SFTP_CLOSE, pack('Na*', strlen($handle), $handle)); + // "The client MUST release all resources associated with the handle regardless of the status." + // -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.3 + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + return \false; + } + return \true; + } + /** + * Downloads a file from the SFTP server. + * + * Returns a string containing the contents of $remote_file if $local_file is left undefined or a boolean false if + * the operation was unsuccessful. If $local_file is defined, returns true or false depending on the success of the + * operation. + * + * $offset and $length can be used to download files in chunks. + * + * @param string $remote_file + * @param string|bool|resource|callable $local_file + * @param int $offset + * @param int $length + * @param callable|null $progressCallback + * @throws \UnexpectedValueException on receipt of unexpected packets + * @return string|bool + */ + public function get($remote_file, $local_file = \false, $offset = 0, $length = -1, $progressCallback = null) + { + if (!$this->precheck()) { + return \false; + } + $remote_file = $this->realpath($remote_file); + if ($remote_file === \false) { + return \false; + } + $packet = Strings::packSSH2('s', $remote_file); + $packet .= $this->version >= 5 ? pack('N3', 0, NET_SFTP_OPEN_OPEN_EXISTING, 0) : pack('N2', NET_SFTP_OPEN_READ, 0); + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + $handle = substr($response, 4); + break; + case NET_SFTP_STATUS: + // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + $this->logError($response); + return \false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + if (is_resource($local_file)) { + $fp = $local_file; + $stat = fstat($fp); + $res_offset = $stat['size']; + } else { + $res_offset = 0; + if ($local_file !== \false && !is_callable($local_file)) { + $fp = fopen($local_file, 'wb'); + if (!$fp) { + return \false; + } + } else { + $content = ''; + } + } + $fclose_check = $local_file !== \false && !is_callable($local_file) && !is_resource($local_file); + $start = $offset; + $read = 0; + while (\true) { + $i = 0; + while ($i < NET_SFTP_QUEUE_SIZE && ($length < 0 || $read < $length)) { + $tempoffset = $start + $read; + $packet_size = $length > 0 ? min($this->max_sftp_packet, $length - $read) : $this->max_sftp_packet; + $packet = Strings::packSSH2('sN3', $handle, $tempoffset / 4294967296, $tempoffset, $packet_size); + try { + $this->send_sftp_packet(NET_SFTP_READ, $packet, $i); + } catch (\Exception $e) { + if ($fclose_check) { + fclose($fp); + } + throw $e; + } + $packet = null; + $read += $packet_size; + $i++; + } + if (!$i) { + break; + } + $packets_sent = $i - 1; + $clear_responses = \false; + while ($i > 0) { + $i--; + if ($clear_responses) { + $this->get_sftp_packet($packets_sent - $i); + continue; + } else { + $response = $this->get_sftp_packet($packets_sent - $i); + } + switch ($this->packet_type) { + case NET_SFTP_DATA: + $temp = substr($response, 4); + $offset += strlen($temp); + if ($local_file === \false) { + $content .= $temp; + } elseif (is_callable($local_file)) { + $local_file($temp); + } else { + fputs($fp, $temp); + } + if (is_callable($progressCallback)) { + call_user_func($progressCallback, $offset); + } + $temp = null; + break; + case NET_SFTP_STATUS: + // could, in theory, return false if !strlen($content) but we'll hold off for the time being + $this->logError($response); + $clear_responses = \true; + // don't break out of the loop yet, so we can read the remaining responses + break; + default: + if ($fclose_check) { + fclose($fp); + } + if ($this->channel_close) { + $this->partial_init = \false; + $this->init_sftp_connection(); + return \false; + } else { + throw new \UnexpectedValueException('Expected NET_SFTP_DATA or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + } + $response = null; + } + if ($clear_responses) { + break; + } + } + if ($fclose_check) { + fclose($fp); + if ($this->preserveTime) { + $stat = $this->stat($remote_file); + touch($local_file, $stat['mtime'], $stat['atime']); + } + } + if (!$this->close_handle($handle)) { + return \false; + } + // if $content isn't set that means a file was written to + return isset($content) ? $content : \true; + } + /** + * Deletes a file on the SFTP server. + * + * @param string $path + * @param bool $recursive + * @return bool + * @throws \UnexpectedValueException on receipt of unexpected packets + */ + public function delete($path, $recursive = \true) + { + if (!$this->precheck()) { + return \false; + } + if (is_object($path)) { + // It's an object. Cast it as string before we check anything else. + $path = (string) $path; + } + if (!is_string($path) || $path == '') { + return \false; + } + $path = $this->realpath($path); + if ($path === \false) { + return \false; + } + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 + $this->send_sftp_packet(NET_SFTP_REMOVE, pack('Na*', strlen($path), $path)); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + if (!$recursive) { + return \false; + } + $i = 0; + $result = $this->delete_recursive($path, $i); + $this->read_put_responses($i); + return $result; + } + $this->remove_from_stat_cache($path); + return \true; + } + /** + * Recursively deletes directories on the SFTP server + * + * Minimizes directory lookups and SSH_FXP_STATUS requests for speed. + * + * @param string $path + * @param int $i + * @return bool + */ + private function delete_recursive($path, &$i) + { + if (!$this->read_put_responses($i)) { + return \false; + } + $i = 0; + $entries = $this->readlist($path, \true); + // The folder does not exist at all, so we cannot delete it. + if ($entries === NET_SFTP_STATUS_NO_SUCH_FILE) { + return \false; + } + // Normally $entries would have at least . and .. but it might not if the directories + // permissions didn't allow reading. If this happens then default to an empty list of files. + if ($entries === \false || is_int($entries)) { + $entries = []; + } + unset($entries['.'], $entries['..']); + foreach ($entries as $filename => $props) { + if (!isset($props['type'])) { + return \false; + } + $temp = $path . '/' . $filename; + if ($props['type'] == NET_SFTP_TYPE_DIRECTORY) { + if (!$this->delete_recursive($temp, $i)) { + return \false; + } + } else { + $this->send_sftp_packet(NET_SFTP_REMOVE, Strings::packSSH2('s', $temp)); + $this->remove_from_stat_cache($temp); + $i++; + if ($i >= NET_SFTP_QUEUE_SIZE) { + if (!$this->read_put_responses($i)) { + return \false; + } + $i = 0; + } + } + } + $this->send_sftp_packet(NET_SFTP_RMDIR, Strings::packSSH2('s', $path)); + $this->remove_from_stat_cache($path); + $i++; + if ($i >= NET_SFTP_QUEUE_SIZE) { + if (!$this->read_put_responses($i)) { + return \false; + } + $i = 0; + } + return \true; + } + /** + * Checks whether a file or directory exists + * + * @param string $path + * @return bool + */ + public function file_exists($path) + { + if ($this->use_stat_cache) { + if (!$this->precheck()) { + return \false; + } + $path = $this->realpath($path); + $result = $this->query_stat_cache($path); + if (isset($result)) { + // return true if $result is an array or if it's an stdClass object + return $result !== \false; + } + } + return $this->stat($path) !== \false; + } + /** + * Tells whether the filename is a directory + * + * @param string $path + * @return bool + */ + public function is_dir($path) + { + $result = $this->get_stat_cache_prop($path, 'type'); + if ($result === \false) { + return \false; + } + return $result === NET_SFTP_TYPE_DIRECTORY; + } + /** + * Tells whether the filename is a regular file + * + * @param string $path + * @return bool + */ + public function is_file($path) + { + $result = $this->get_stat_cache_prop($path, 'type'); + if ($result === \false) { + return \false; + } + return $result === NET_SFTP_TYPE_REGULAR; + } + /** + * Tells whether the filename is a symbolic link + * + * @param string $path + * @return bool + */ + public function is_link($path) + { + $result = $this->get_lstat_cache_prop($path, 'type'); + if ($result === \false) { + return \false; + } + return $result === NET_SFTP_TYPE_SYMLINK; + } + /** + * Tells whether a file exists and is readable + * + * @param string $path + * @return bool + */ + public function is_readable($path) + { + if (!$this->precheck()) { + return \false; + } + $packet = Strings::packSSH2('sNN', $this->realpath($path), NET_SFTP_OPEN_READ, 0); + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + return \true; + case NET_SFTP_STATUS: + // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + return \false; + default: + throw new \UnexpectedValueException('Expected NET_SFTP_HANDLE or NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + } + /** + * Tells whether the filename is writable + * + * @param string $path + * @return bool + */ + public function is_writable($path) + { + if (!$this->precheck()) { + return \false; + } + $packet = Strings::packSSH2('sNN', $this->realpath($path), NET_SFTP_OPEN_WRITE, 0); + $this->send_sftp_packet(NET_SFTP_OPEN, $packet); + $response = $this->get_sftp_packet(); + switch ($this->packet_type) { + case NET_SFTP_HANDLE: + return \true; + case NET_SFTP_STATUS: + // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + return \false; + default: + throw new \UnexpectedValueException('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + } + /** + * Tells whether the filename is writeable + * + * Alias of is_writable + * + * @param string $path + * @return bool + */ + public function is_writeable($path) + { + return $this->is_writable($path); + } + /** + * Gets last access time of file + * + * @param string $path + * @return mixed + */ + public function fileatime($path) + { + return $this->get_stat_cache_prop($path, 'atime'); + } + /** + * Gets file modification time + * + * @param string $path + * @return mixed + */ + public function filemtime($path) + { + return $this->get_stat_cache_prop($path, 'mtime'); + } + /** + * Gets file permissions + * + * @param string $path + * @return mixed + */ + public function fileperms($path) + { + return $this->get_stat_cache_prop($path, 'mode'); + } + /** + * Gets file owner + * + * @param string $path + * @return mixed + */ + public function fileowner($path) + { + return $this->get_stat_cache_prop($path, 'uid'); + } + /** + * Gets file group + * + * @param string $path + * @return mixed + */ + public function filegroup($path) + { + return $this->get_stat_cache_prop($path, 'gid'); + } + /** + * Recursively go through rawlist() output to get the total filesize + * + * @return int + */ + private static function recursiveFilesize(array $files) + { + $size = 0; + foreach ($files as $name => $file) { + if ($name == '.' || $name == '..') { + continue; + } + $size += is_array($file) ? self::recursiveFilesize($file) : $file->size; + } + return $size; + } + /** + * Gets file size + * + * @param string $path + * @param bool $recursive + * @return mixed + */ + public function filesize($path, $recursive = \false) + { + return !$recursive || $this->filetype($path) != 'dir' ? $this->get_stat_cache_prop($path, 'size') : self::recursiveFilesize($this->rawlist($path, \true)); + } + /** + * Gets file type + * + * @param string $path + * @return string|false + */ + public function filetype($path) + { + $type = $this->get_stat_cache_prop($path, 'type'); + if ($type === \false) { + return \false; + } + switch ($type) { + case NET_SFTP_TYPE_BLOCK_DEVICE: + return 'block'; + case NET_SFTP_TYPE_CHAR_DEVICE: + return 'char'; + case NET_SFTP_TYPE_DIRECTORY: + return 'dir'; + case NET_SFTP_TYPE_FIFO: + return 'fifo'; + case NET_SFTP_TYPE_REGULAR: + return 'file'; + case NET_SFTP_TYPE_SYMLINK: + return 'link'; + default: + return \false; + } + } + /** + * Return a stat properity + * + * Uses cache if appropriate. + * + * @param string $path + * @param string $prop + * @return mixed + */ + private function get_stat_cache_prop($path, $prop) + { + return $this->get_xstat_cache_prop($path, $prop, 'stat'); + } + /** + * Return an lstat properity + * + * Uses cache if appropriate. + * + * @param string $path + * @param string $prop + * @return mixed + */ + private function get_lstat_cache_prop($path, $prop) + { + return $this->get_xstat_cache_prop($path, $prop, 'lstat'); + } + /** + * Return a stat or lstat properity + * + * Uses cache if appropriate. + * + * @param string $path + * @param string $prop + * @param string $type + * @return mixed + */ + private function get_xstat_cache_prop($path, $prop, $type) + { + if (!$this->precheck()) { + return \false; + } + if ($this->use_stat_cache) { + $path = $this->realpath($path); + $result = $this->query_stat_cache($path); + if (is_object($result) && isset($result->{$type})) { + return $result->{$type}[$prop]; + } + } + $result = $this->{$type}($path); + if ($result === \false || !isset($result[$prop])) { + return \false; + } + return $result[$prop]; + } + /** + * Renames a file or a directory on the SFTP server. + * + * If the file already exists this will return false + * + * @param string $oldname + * @param string $newname + * @return bool + * @throws \UnexpectedValueException on receipt of unexpected packets + */ + public function rename($oldname, $newname) + { + if (!$this->precheck()) { + return \false; + } + $oldname = $this->realpath($oldname); + $newname = $this->realpath($newname); + if ($oldname === \false || $newname === \false) { + return \false; + } + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3 + $packet = Strings::packSSH2('ss', $oldname, $newname); + if ($this->version >= 5) { + /* quoting https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-05#section-6.5 , + + 'flags' is 0 or a combination of: + + SSH_FXP_RENAME_OVERWRITE 0x00000001 + SSH_FXP_RENAME_ATOMIC 0x00000002 + SSH_FXP_RENAME_NATIVE 0x00000004 + + (none of these are currently supported) */ + $packet .= "\x00\x00\x00\x00"; + } + $this->send_sftp_packet(NET_SFTP_RENAME, $packet); + $response = $this->get_sftp_packet(); + if ($this->packet_type != NET_SFTP_STATUS) { + throw new \UnexpectedValueException('Expected NET_SFTP_STATUS. ' . 'Got packet type: ' . $this->packet_type); + } + // if $status isn't SSH_FX_OK it's probably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED + list($status) = Strings::unpackSSH2('N', $response); + if ($status != NET_SFTP_STATUS_OK) { + $this->logError($response, $status); + return \false; + } + // don't move the stat cache entry over since this operation could very well change the + // atime and mtime attributes + //$this->update_stat_cache($newname, $this->query_stat_cache($oldname)); + $this->remove_from_stat_cache($oldname); + $this->remove_from_stat_cache($newname); + return \true; + } + /** + * Parse Time + * + * See '7.7. Times' of draft-ietf-secsh-filexfer-13 for more info. + * + * @param string $key + * @param int $flags + * @param string $response + * @return array + */ + private function parseTime($key, $flags, &$response) + { + $attr = []; + list($attr[$key]) = Strings::unpackSSH2('Q', $response); + if ($flags & NET_SFTP_ATTR_SUBSECOND_TIMES) { + list($attr[$key . '-nseconds']) = Strings::unpackSSH2('N', $response); + } + return $attr; + } + /** + * Parse Attributes + * + * See '7. File Attributes' of draft-ietf-secsh-filexfer-13 for more info. + * + * @param string $response + * @return array + */ + protected function parseAttributes(&$response) + { + if ($this->version >= 4) { + list($flags, $attr['type']) = Strings::unpackSSH2('NC', $response); + } else { + list($flags) = Strings::unpackSSH2('N', $response); + } + foreach (self::$attributes as $key => $value) { + switch ($flags & $key) { + case NET_SFTP_ATTR_UIDGID: + if ($this->version > 3) { + continue 2; + } + break; + case NET_SFTP_ATTR_CREATETIME: + case NET_SFTP_ATTR_MODIFYTIME: + case NET_SFTP_ATTR_ACL: + case NET_SFTP_ATTR_OWNERGROUP: + case NET_SFTP_ATTR_SUBSECOND_TIMES: + if ($this->version < 4) { + continue 2; + } + break; + case NET_SFTP_ATTR_BITS: + if ($this->version < 5) { + continue 2; + } + break; + case NET_SFTP_ATTR_ALLOCATION_SIZE: + case NET_SFTP_ATTR_TEXT_HINT: + case NET_SFTP_ATTR_MIME_TYPE: + case NET_SFTP_ATTR_LINK_COUNT: + case NET_SFTP_ATTR_UNTRANSLATED_NAME: + case NET_SFTP_ATTR_CTIME: + if ($this->version < 6) { + continue 2; + } + } + switch ($flags & $key) { + case NET_SFTP_ATTR_SIZE: + // 0x00000001 + // The size attribute is defined as an unsigned 64-bit integer. + // The following will use floats on 32-bit platforms, if necessary. + // As can be seen in the BigInteger class, floats are generally + // IEEE 754 binary64 "double precision" on such platforms and + // as such can represent integers of at least 2^50 without loss + // of precision. Interpreted in filesize, 2^50 bytes = 1024 TiB. + list($attr['size']) = Strings::unpackSSH2('Q', $response); + break; + case NET_SFTP_ATTR_UIDGID: + // 0x00000002 (SFTPv3 only) + list($attr['uid'], $attr['gid']) = Strings::unpackSSH2('NN', $response); + break; + case NET_SFTP_ATTR_PERMISSIONS: + // 0x00000004 + list($attr['mode']) = Strings::unpackSSH2('N', $response); + $fileType = $this->parseMode($attr['mode']); + if ($this->version < 4 && $fileType !== \false) { + $attr += ['type' => $fileType]; + } + break; + case NET_SFTP_ATTR_ACCESSTIME: + // 0x00000008 + if ($this->version >= 4) { + $attr += $this->parseTime('atime', $flags, $response); + break; + } + list($attr['atime'], $attr['mtime']) = Strings::unpackSSH2('NN', $response); + break; + case NET_SFTP_ATTR_CREATETIME: + // 0x00000010 (SFTPv4+) + $attr += $this->parseTime('createtime', $flags, $response); + break; + case NET_SFTP_ATTR_MODIFYTIME: + // 0x00000020 + $attr += $this->parseTime('mtime', $flags, $response); + break; + case NET_SFTP_ATTR_ACL: + // 0x00000040 + // access control list + // see https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-04#section-5.7 + // currently unsupported + list($count) = Strings::unpackSSH2('N', $response); + for ($i = 0; $i < $count; $i++) { + list($type, $flag, $mask, $who) = Strings::unpackSSH2('N3s', $result); + } + break; + case NET_SFTP_ATTR_OWNERGROUP: + // 0x00000080 + list($attr['owner'], $attr['$group']) = Strings::unpackSSH2('ss', $response); + break; + case NET_SFTP_ATTR_SUBSECOND_TIMES: + // 0x00000100 + break; + case NET_SFTP_ATTR_BITS: + // 0x00000200 (SFTPv5+) + // see https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-05#section-5.8 + // currently unsupported + // tells if you file is: + // readonly, system, hidden, case inensitive, archive, encrypted, compressed, sparse + // append only, immutable, sync + list($attrib_bits, $attrib_bits_valid) = Strings::unpackSSH2('N2', $response); + // if we were actually gonna implement the above it ought to be + // $attr['attrib-bits'] and $attr['attrib-bits-valid'] + // eg. - instead of _ + break; + case NET_SFTP_ATTR_ALLOCATION_SIZE: + // 0x00000400 (SFTPv6+) + // see https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-7.4 + // represents the number of bytes that the file consumes on the disk. will + // usually be larger than the 'size' field + list($attr['allocation-size']) = Strings::unpackSSH2('Q', $response); + break; + case NET_SFTP_ATTR_TEXT_HINT: + // 0x00000800 + // https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-7.10 + // currently unsupported + // tells if file is "known text", "guessed text", "known binary", "guessed binary" + list($text_hint) = Strings::unpackSSH2('C', $response); + // the above should be $attr['text-hint'] + break; + case NET_SFTP_ATTR_MIME_TYPE: + // 0x00001000 + // see https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-7.11 + list($attr['mime-type']) = Strings::unpackSSH2('s', $response); + break; + case NET_SFTP_ATTR_LINK_COUNT: + // 0x00002000 + // see https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-7.12 + list($attr['link-count']) = Strings::unpackSSH2('N', $response); + break; + case NET_SFTP_ATTR_UNTRANSLATED_NAME: + // 0x00004000 + // see https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13#section-7.13 + list($attr['untranslated-name']) = Strings::unpackSSH2('s', $response); + break; + case NET_SFTP_ATTR_CTIME: + // 0x00008000 + // 'ctime' contains the last time the file attributes were changed. The + // exact meaning of this field depends on the server. + $attr += $this->parseTime('ctime', $flags, $response); + break; + case NET_SFTP_ATTR_EXTENDED: + // 0x80000000 + list($count) = Strings::unpackSSH2('N', $response); + for ($i = 0; $i < $count; $i++) { + list($key, $value) = Strings::unpackSSH2('ss', $response); + $attr[$key] = $value; + } + } + } + return $attr; + } + /** + * Attempt to identify the file type + * + * Quoting the SFTP RFC, "Implementations MUST NOT send bits that are not defined" but they seem to anyway + * + * @param int $mode + * @return int + */ + private function parseMode($mode) + { + // values come from http://lxr.free-electrons.com/source/include/uapi/linux/stat.h#L12 + // see, also, http://linux.die.net/man/2/stat + switch ($mode & 0170000) { + // ie. 1111 0000 0000 0000 + case 00: + // no file type specified - figure out the file type using alternative means + return \false; + case 040000: + return NET_SFTP_TYPE_DIRECTORY; + case 0100000: + return NET_SFTP_TYPE_REGULAR; + case 0120000: + return NET_SFTP_TYPE_SYMLINK; + // new types introduced in SFTPv5+ + // http://tools.ietf.org/html/draft-ietf-secsh-filexfer-05#section-5.2 + case 010000: + // named pipe (fifo) + return NET_SFTP_TYPE_FIFO; + case 020000: + // character special + return NET_SFTP_TYPE_CHAR_DEVICE; + case 060000: + // block special + return NET_SFTP_TYPE_BLOCK_DEVICE; + case 0140000: + // socket + return NET_SFTP_TYPE_SOCKET; + case 0160000: + // whiteout + // "SPECIAL should be used for files that are of + // a known type which cannot be expressed in the protocol" + return NET_SFTP_TYPE_SPECIAL; + default: + return NET_SFTP_TYPE_UNKNOWN; + } + } + /** + * Parse Longname + * + * SFTPv3 doesn't provide any easy way of identifying a file type. You could try to open + * a file as a directory and see if an error is returned or you could try to parse the + * SFTPv3-specific longname field of the SSH_FXP_NAME packet. That's what this function does. + * The result is returned using the + * {@link http://tools.ietf.org/html/draft-ietf-secsh-filexfer-04#section-5.2 SFTPv4 type constants}. + * + * If the longname is in an unrecognized format bool(false) is returned. + * + * @param string $longname + * @return mixed + */ + private function parseLongname($longname) + { + // http://en.wikipedia.org/wiki/Unix_file_types + // http://en.wikipedia.org/wiki/Filesystem_permissions#Notation_of_traditional_Unix_permissions + if (preg_match('#^[^/]([r-][w-][xstST-]){3}#', $longname)) { + switch ($longname[0]) { + case '-': + return NET_SFTP_TYPE_REGULAR; + case 'd': + return NET_SFTP_TYPE_DIRECTORY; + case 'l': + return NET_SFTP_TYPE_SYMLINK; + default: + return NET_SFTP_TYPE_SPECIAL; + } + } + return \false; + } + /** + * Sends SFTP Packets + * + * See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info. + * + * @param int $type + * @param string $data + * @param int $request_id + * @see self::_get_sftp_packet() + * @see self::send_channel_packet() + * @return void + */ + private function send_sftp_packet($type, $data, $request_id = 1) + { + // in SSH2.php the timeout is cumulative per function call. eg. exec() will + // timeout after 10s. but for SFTP.php it's cumulative per packet + $this->curTimeout = $this->timeout; + $packet = $this->use_request_id ? pack('NCNa*', strlen($data) + 5, $type, $request_id, $data) : pack('NCa*', strlen($data) + 1, $type, $data); + $start = microtime(\true); + $this->send_channel_packet(self::CHANNEL, $packet); + $stop = microtime(\true); + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_LOGGING')) { + $packet_type = '-> ' . self::$packet_types[$type] . ' (' . round($stop - $start, 4) . 's)'; + $this->append_log($packet_type, $data); + } + } + /** + * Resets a connection for re-use + * + * @param int $reason + */ + protected function reset_connection($reason) + { + parent::reset_connection($reason); + $this->use_request_id = \false; + $this->pwd = \false; + $this->requestBuffer = []; + $this->partial_init = \false; + } + /** + * Receives SFTP Packets + * + * See '6. General Packet Format' of draft-ietf-secsh-filexfer-13 for more info. + * + * Incidentally, the number of SSH_MSG_CHANNEL_DATA messages has no bearing on the number of SFTP packets present. + * There can be one SSH_MSG_CHANNEL_DATA messages containing two SFTP packets or there can be two SSH_MSG_CHANNEL_DATA + * messages containing one SFTP packet. + * + * @see self::_send_sftp_packet() + * @return string + */ + private function get_sftp_packet($request_id = null) + { + $this->channel_close = \false; + if (isset($request_id) && isset($this->requestBuffer[$request_id])) { + $this->packet_type = $this->requestBuffer[$request_id]['packet_type']; + $temp = $this->requestBuffer[$request_id]['packet']; + unset($this->requestBuffer[$request_id]); + return $temp; + } + // in SSH2.php the timeout is cumulative per function call. eg. exec() will + // timeout after 10s. but for SFTP.php it's cumulative per packet + $this->curTimeout = $this->timeout; + $start = microtime(\true); + // SFTP packet length + while (strlen($this->packet_buffer) < 4) { + $temp = $this->get_channel_packet(self::CHANNEL, \true); + if ($temp === \true) { + if ($this->channel_status[self::CHANNEL] === NET_SSH2_MSG_CHANNEL_CLOSE) { + $this->channel_close = \true; + } + $this->packet_type = \false; + $this->packet_buffer = ''; + return \false; + } + $this->packet_buffer .= $temp; + } + if (strlen($this->packet_buffer) < 4) { + throw new \RuntimeException('Packet is too small'); + } + extract(unpack('Nlength', Strings::shift($this->packet_buffer, 4))); + /** @var integer $length */ + $tempLength = $length; + $tempLength -= strlen($this->packet_buffer); + // 256 * 1024 is what SFTP_MAX_MSG_LENGTH is set to in OpenSSH's sftp-common.h + if (!$this->allow_arbitrary_length_packets && !$this->use_request_id && $tempLength > 256 * 1024) { + throw new \RuntimeException('Invalid Size'); + } + // SFTP packet type and data payload + while ($tempLength > 0) { + $temp = $this->get_channel_packet(self::CHANNEL, \true); + if ($temp === \true) { + if ($this->channel_status[self::CHANNEL] === NET_SSH2_MSG_CHANNEL_CLOSE) { + $this->channel_close = \true; + } + $this->packet_type = \false; + $this->packet_buffer = ''; + return \false; + } + $this->packet_buffer .= $temp; + $tempLength -= strlen($temp); + } + $stop = microtime(\true); + $this->packet_type = ord(Strings::shift($this->packet_buffer)); + if ($this->use_request_id) { + extract(unpack('Npacket_id', Strings::shift($this->packet_buffer, 4))); + // remove the request id + $length -= 5; + // account for the request id and the packet type + } else { + $length -= 1; + // account for the packet type + } + $packet = Strings::shift($this->packet_buffer, $length); + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_LOGGING')) { + $packet_type = '<- ' . self::$packet_types[$this->packet_type] . ' (' . round($stop - $start, 4) . 's)'; + $this->append_log($packet_type, $packet); + } + if (isset($request_id) && $this->use_request_id && $packet_id != $request_id) { + $this->requestBuffer[$packet_id] = ['packet_type' => $this->packet_type, 'packet' => $packet]; + return $this->get_sftp_packet($request_id); + } + return $packet; + } + /** + * Logs data packets + * + * Makes sure that only the last 1MB worth of packets will be logged + * + * @param string $message_number + * @param string $message + */ + private function append_log($message_number, $message) + { + $this->append_log_helper(NET_SFTP_LOGGING, $message_number, $message, $this->packet_type_log, $this->packet_log, $this->log_size, $this->realtime_log_file, $this->realtime_log_wrap, $this->realtime_log_size); + } + /** + * Returns a log of the packets that have been sent and received. + * + * Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING') + * + * @return array|string|false + */ + public function getSFTPLog() + { + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_LOGGING')) { + return \false; + } + switch (NET_SFTP_LOGGING) { + case self::LOG_COMPLEX: + return $this->format_log($this->packet_log, $this->packet_type_log); + break; + //case self::LOG_SIMPLE: + default: + return $this->packet_type_log; + } + } + /** + * Returns all errors on the SFTP layer + * + * @return array + */ + public function getSFTPErrors() + { + return $this->sftp_errors; + } + /** + * Returns the last error on the SFTP layer + * + * @return string + */ + public function getLastSFTPError() + { + return count($this->sftp_errors) ? $this->sftp_errors[count($this->sftp_errors) - 1] : ''; + } + /** + * Get supported SFTP versions + * + * @return array + */ + public function getSupportedVersions() + { + if (!($this->bitmap & SSH2::MASK_LOGIN)) { + return \false; + } + if (!$this->partial_init) { + $this->partial_init_sftp_connection(); + } + $temp = ['version' => $this->defaultVersion]; + if (isset($this->extensions['versions'])) { + $temp['extensions'] = $this->extensions['versions']; + } + return $temp; + } + /** + * Get supported SFTP versions + * + * @return int|false + */ + public function getNegotiatedVersion() + { + if (!$this->precheck()) { + return \false; + } + return $this->version; + } + /** + * Set preferred version + * + * If you're preferred version isn't supported then the highest supported + * version of SFTP will be utilized. Set to null or false or int(0) to + * unset the preferred version + * + * @param int $version + */ + public function setPreferredVersion($version) + { + $this->preferredVersion = $version; + } + /** + * Disconnect + * + * @param int $reason + * @return false + */ + protected function disconnect_helper($reason) + { + $this->pwd = \false; + return parent::disconnect_helper($reason); + } + /** + * Enable Date Preservation + * + */ + public function enableDatePreservation() + { + $this->preserveTime = \true; + } + /** + * Disable Date Preservation + * + */ + public function disableDatePreservation() + { + $this->preserveTime = \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php new file mode 100644 index 0000000..e2269e1 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php @@ -0,0 +1,697 @@ + + * @copyright 2013 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Net\SFTP; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Net\SFTP; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Net\SSH2; +/** + * SFTP Stream Wrapper + * + * @author Jim Wigginton + */ +class Stream +{ + /** + * SFTP instances + * + * Rather than re-create the connection we re-use instances if possible + * + * @var array + */ + public static $instances; + /** + * SFTP instance + * + * @var object + */ + private $sftp; + /** + * Path + * + * @var string + */ + private $path; + /** + * Mode + * + * @var string + */ + private $mode; + /** + * Position + * + * @var int + */ + private $pos; + /** + * Size + * + * @var int + */ + private $size; + /** + * Directory entries + * + * @var array + */ + private $entries; + /** + * EOF flag + * + * @var bool + */ + private $eof; + /** + * Context resource + * + * Technically this needs to be publicly accessible so PHP can set it directly + * + * @var resource + */ + public $context; + /** + * Notification callback function + * + * @var callable + */ + private $notification; + /** + * Registers this class as a URL wrapper. + * + * @param string $protocol The wrapper name to be registered. + * @return bool True on success, false otherwise. + */ + public static function register($protocol = 'sftp') + { + if (in_array($protocol, stream_get_wrappers(), \true)) { + return \false; + } + return stream_wrapper_register($protocol, get_called_class()); + } + /** + * The Constructor + * + */ + public function __construct() + { + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_STREAM_LOGGING')) { + echo "__construct()\r\n"; + } + } + /** + * Path Parser + * + * Extract a path from a URI and actually connect to an SSH server if appropriate + * + * If "notification" is set as a context parameter the message code for successful login is + * NET_SSH2_MSG_USERAUTH_SUCCESS. For a failed login it's NET_SSH2_MSG_USERAUTH_FAILURE. + * + * @param string $path + * @return string + */ + protected function parse_path($path) + { + $orig = $path; + extract(parse_url($path) + ['port' => 22]); + if (isset($query)) { + $path .= '?' . $query; + } elseif (preg_match('/(\\?|\\?#)$/', $orig)) { + $path .= '?'; + } + if (isset($fragment)) { + $path .= '#' . $fragment; + } elseif ($orig[strlen($orig) - 1] == '#') { + $path .= '#'; + } + if (!isset($host)) { + return \false; + } + if (isset($this->context)) { + $context = stream_context_get_params($this->context); + if (isset($context['notification'])) { + $this->notification = $context['notification']; + } + } + if (preg_match('/^{[a-z0-9]+}$/i', $host)) { + $host = SSH2::getConnectionByResourceId($host); + if ($host === \false) { + return \false; + } + $this->sftp = $host; + } else { + if (isset($this->context)) { + $context = stream_context_get_options($this->context); + } + if (isset($context[$scheme]['session'])) { + $sftp = $context[$scheme]['session']; + } + if (isset($context[$scheme]['sftp'])) { + $sftp = $context[$scheme]['sftp']; + } + if (isset($sftp) && $sftp instanceof SFTP) { + $this->sftp = $sftp; + return $path; + } + if (isset($context[$scheme]['username'])) { + $user = $context[$scheme]['username']; + } + if (isset($context[$scheme]['password'])) { + $pass = $context[$scheme]['password']; + } + if (isset($context[$scheme]['privkey']) && $context[$scheme]['privkey'] instanceof PrivateKey) { + $pass = $context[$scheme]['privkey']; + } + if (!isset($user) || !isset($pass)) { + return \false; + } + // casting $pass to a string is necessary in the event that it's a \phpseclib3\Crypt\RSA object + if (isset(self::$instances[$host][$port][$user][(string) $pass])) { + $this->sftp = self::$instances[$host][$port][$user][(string) $pass]; + } else { + $this->sftp = new SFTP($host, $port); + $this->sftp->disableStatCache(); + if (isset($this->notification) && is_callable($this->notification)) { + /* if !is_callable($this->notification) we could do this: + + user_error('fopen(): failed to call user notifier', E_USER_WARNING); + + the ftp wrapper gives errors like that when the notifier isn't callable. + i've opted not to do that, however, since the ftp wrapper gives the line + on which the fopen occurred as the line number - not the line that the + user_error is on. + */ + call_user_func($this->notification, \STREAM_NOTIFY_CONNECT, \STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); + call_user_func($this->notification, \STREAM_NOTIFY_AUTH_REQUIRED, \STREAM_NOTIFY_SEVERITY_INFO, '', 0, 0, 0); + if (!$this->sftp->login($user, $pass)) { + call_user_func($this->notification, \STREAM_NOTIFY_AUTH_RESULT, \STREAM_NOTIFY_SEVERITY_ERR, 'Login Failure', NET_SSH2_MSG_USERAUTH_FAILURE, 0, 0); + return \false; + } + call_user_func($this->notification, \STREAM_NOTIFY_AUTH_RESULT, \STREAM_NOTIFY_SEVERITY_INFO, 'Login Success', NET_SSH2_MSG_USERAUTH_SUCCESS, 0, 0); + } else { + if (!$this->sftp->login($user, $pass)) { + return \false; + } + } + self::$instances[$host][$port][$user][(string) $pass] = $this->sftp; + } + } + return $path; + } + /** + * Opens file or URL + * + * @param string $path + * @param string $mode + * @param int $options + * @param string $opened_path + * @return bool + */ + private function _stream_open($path, $mode, $options, &$opened_path) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + $this->path = $path; + $this->size = $this->sftp->filesize($path); + $this->mode = preg_replace('#[bt]$#', '', $mode); + $this->eof = \false; + if ($this->size === \false) { + if ($this->mode[0] == 'r') { + return \false; + } else { + $this->sftp->touch($path); + $this->size = 0; + } + } else { + switch ($this->mode[0]) { + case 'x': + return \false; + case 'w': + $this->sftp->truncate($path, 0); + $this->size = 0; + } + } + $this->pos = $this->mode[0] != 'a' ? 0 : $this->size; + return \true; + } + /** + * Read from stream + * + * @param int $count + * @return mixed + */ + private function _stream_read($count) + { + switch ($this->mode) { + case 'w': + case 'a': + case 'x': + case 'c': + return \false; + } + // commented out because some files - eg. /dev/urandom - will say their size is 0 when in fact it's kinda infinite + //if ($this->pos >= $this->size) { + // $this->eof = true; + // return false; + //} + $result = $this->sftp->get($this->path, \false, $this->pos, $count); + if (isset($this->notification) && is_callable($this->notification)) { + if ($result === \false) { + call_user_func($this->notification, \STREAM_NOTIFY_FAILURE, \STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0); + return 0; + } + // seems that PHP calls stream_read in 8k chunks + call_user_func($this->notification, \STREAM_NOTIFY_PROGRESS, \STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($result), $this->size); + } + if (empty($result)) { + // ie. false or empty string + $this->eof = \true; + return \false; + } + $this->pos += strlen($result); + return $result; + } + /** + * Write to stream + * + * @param string $data + * @return int|false + */ + private function _stream_write($data) + { + switch ($this->mode) { + case 'r': + return \false; + } + $result = $this->sftp->put($this->path, $data, SFTP::SOURCE_STRING, $this->pos); + if (isset($this->notification) && is_callable($this->notification)) { + if (!$result) { + call_user_func($this->notification, \STREAM_NOTIFY_FAILURE, \STREAM_NOTIFY_SEVERITY_ERR, $this->sftp->getLastSFTPError(), NET_SFTP_OPEN, 0, 0); + return 0; + } + // seems that PHP splits up strings into 8k blocks before calling stream_write + call_user_func($this->notification, \STREAM_NOTIFY_PROGRESS, \STREAM_NOTIFY_SEVERITY_INFO, '', 0, strlen($data), strlen($data)); + } + if ($result === \false) { + return \false; + } + $this->pos += strlen($data); + if ($this->pos > $this->size) { + $this->size = $this->pos; + } + $this->eof = \false; + return strlen($data); + } + /** + * Retrieve the current position of a stream + * + * @return int + */ + private function _stream_tell() + { + return $this->pos; + } + /** + * Tests for end-of-file on a file pointer + * + * In my testing there are four classes functions that normally effect the pointer: + * fseek, fputs / fwrite, fgets / fread and ftruncate. + * + * Only fgets / fread, however, results in feof() returning true. do fputs($fp, 'aaa') on a blank file and feof() + * will return false. do fread($fp, 1) and feof() will then return true. do fseek($fp, 10) on ablank file and feof() + * will return false. do fread($fp, 1) and feof() will then return true. + * + * @return bool + */ + private function _stream_eof() + { + return $this->eof; + } + /** + * Seeks to specific location in a stream + * + * @param int $offset + * @param int $whence + * @return bool + */ + private function _stream_seek($offset, $whence) + { + switch ($whence) { + case \SEEK_SET: + if ($offset < 0) { + return \false; + } + break; + case \SEEK_CUR: + $offset += $this->pos; + break; + case \SEEK_END: + $offset += $this->size; + } + $this->pos = $offset; + $this->eof = \false; + return \true; + } + /** + * Change stream options + * + * @param string $path + * @param int $option + * @param mixed $var + * @return bool + */ + private function _stream_metadata($path, $option, $var) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + // stream_metadata was introduced in PHP 5.4.0 but as of 5.4.11 the constants haven't been defined + // see http://www.php.net/streamwrapper.stream-metadata and https://bugs.php.net/64246 + // and https://github.com/php/php-src/blob/master/main/php_streams.h#L592 + switch ($option) { + case 1: + // PHP_STREAM_META_TOUCH + $time = isset($var[0]) ? $var[0] : null; + $atime = isset($var[1]) ? $var[1] : null; + return $this->sftp->touch($path, $time, $atime); + case 2: + // PHP_STREAM_OWNER_NAME + case 3: + // PHP_STREAM_GROUP_NAME + return \false; + case 4: + // PHP_STREAM_META_OWNER + return $this->sftp->chown($path, $var); + case 5: + // PHP_STREAM_META_GROUP + return $this->sftp->chgrp($path, $var); + case 6: + // PHP_STREAM_META_ACCESS + return $this->sftp->chmod($path, $var) !== \false; + } + } + /** + * Retrieve the underlaying resource + * + * @param int $cast_as + * @return resource + */ + private function _stream_cast($cast_as) + { + return $this->sftp->fsock; + } + /** + * Advisory file locking + * + * @param int $operation + * @return bool + */ + private function _stream_lock($operation) + { + return \false; + } + /** + * Renames a file or directory + * + * Attempts to rename oldname to newname, moving it between directories if necessary. + * If newname exists, it will be overwritten. This is a departure from what \phpseclib3\Net\SFTP + * does. + * + * @param string $path_from + * @param string $path_to + * @return bool + */ + private function _rename($path_from, $path_to) + { + $path1 = parse_url($path_from); + $path2 = parse_url($path_to); + unset($path1['path'], $path2['path']); + if ($path1 != $path2) { + return \false; + } + $path_from = $this->parse_path($path_from); + $path_to = parse_url($path_to); + if ($path_from === \false) { + return \false; + } + $path_to = $path_to['path']; + // the $component part of parse_url() was added in PHP 5.1.2 + // "It is an error if there already exists a file with the name specified by newpath." + // -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02#section-6.5 + if (!$this->sftp->rename($path_from, $path_to)) { + if ($this->sftp->stat($path_to)) { + return $this->sftp->delete($path_to, \true) && $this->sftp->rename($path_from, $path_to); + } + return \false; + } + return \true; + } + /** + * Open directory handle + * + * The only $options is "whether or not to enforce safe_mode (0x04)". Since safe mode was deprecated in 5.3 and + * removed in 5.4 I'm just going to ignore it. + * + * Also, nlist() is the best that this function is realistically going to be able to do. When an SFTP client + * sends a SSH_FXP_READDIR packet you don't generally get info on just one file but on multiple files. Quoting + * the SFTP specs: + * + * The SSH_FXP_NAME response has the following format: + * + * uint32 id + * uint32 count + * repeats count times: + * string filename + * string longname + * ATTRS attrs + * + * @param string $path + * @param int $options + * @return bool + */ + private function _dir_opendir($path, $options) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + $this->pos = 0; + $this->entries = $this->sftp->nlist($path); + return $this->entries !== \false; + } + /** + * Read entry from directory handle + * + * @return mixed + */ + private function _dir_readdir() + { + if (isset($this->entries[$this->pos])) { + return $this->entries[$this->pos++]; + } + return \false; + } + /** + * Rewind directory handle + * + * @return bool + */ + private function _dir_rewinddir() + { + $this->pos = 0; + return \true; + } + /** + * Close directory handle + * + * @return bool + */ + private function _dir_closedir() + { + return \true; + } + /** + * Create a directory + * + * Only valid $options is STREAM_MKDIR_RECURSIVE + * + * @param string $path + * @param int $mode + * @param int $options + * @return bool + */ + private function _mkdir($path, $mode, $options) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + return $this->sftp->mkdir($path, $mode, $options & \STREAM_MKDIR_RECURSIVE); + } + /** + * Removes a directory + * + * Only valid $options is STREAM_MKDIR_RECURSIVE per , however, + * does not have a $recursive parameter as mkdir() does so I don't know how + * STREAM_MKDIR_RECURSIVE is supposed to be set. Also, when I try it out with rmdir() I get 8 as + * $options. What does 8 correspond to? + * + * @param string $path + * @param int $options + * @return bool + */ + private function _rmdir($path, $options) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + return $this->sftp->rmdir($path); + } + /** + * Flushes the output + * + * See . Always returns true because \phpseclib3\Net\SFTP doesn't cache stuff before writing + * + * @return bool + */ + private function _stream_flush() + { + return \true; + } + /** + * Retrieve information about a file resource + * + * @return mixed + */ + private function _stream_stat() + { + $results = $this->sftp->stat($this->path); + if ($results === \false) { + return \false; + } + return $results; + } + /** + * Delete a file + * + * @param string $path + * @return bool + */ + private function _unlink($path) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + return $this->sftp->delete($path, \false); + } + /** + * Retrieve information about a file + * + * Ignores the STREAM_URL_STAT_QUIET flag because the entirety of \phpseclib3\Net\SFTP\Stream is quiet by default + * might be worthwhile to reconstruct bits 12-16 (ie. the file type) if mode doesn't have them but we'll + * cross that bridge when and if it's reached + * + * @param string $path + * @param int $flags + * @return mixed + */ + private function _url_stat($path, $flags) + { + $path = $this->parse_path($path); + if ($path === \false) { + return \false; + } + $results = $flags & \STREAM_URL_STAT_LINK ? $this->sftp->lstat($path) : $this->sftp->stat($path); + if ($results === \false) { + return \false; + } + return $results; + } + /** + * Truncate stream + * + * @param int $new_size + * @return bool + */ + private function _stream_truncate($new_size) + { + if (!$this->sftp->truncate($this->path, $new_size)) { + return \false; + } + $this->eof = \false; + $this->size = $new_size; + return \true; + } + /** + * Change stream options + * + * STREAM_OPTION_WRITE_BUFFER isn't supported for the same reason stream_flush isn't. + * The other two aren't supported because of limitations in \phpseclib3\Net\SFTP. + * + * @param int $option + * @param int $arg1 + * @param int $arg2 + * @return bool + */ + private function _stream_set_option($option, $arg1, $arg2) + { + return \false; + } + /** + * Close an resource + * + */ + private function _stream_close() + { + } + /** + * __call Magic Method + * + * When you're utilizing an SFTP stream you're not calling the methods in this class directly - PHP is calling them for you. + * Which kinda begs the question... what methods is PHP calling and what parameters is it passing to them? This function + * lets you figure that out. + * + * If NET_SFTP_STREAM_LOGGING is defined all calls will be output on the screen and then (regardless of whether or not + * NET_SFTP_STREAM_LOGGING is enabled) the parameters will be passed through to the appropriate method. + * + * @param string $name + * @param array $arguments + * @return mixed + */ + public function __call($name, array $arguments) + { + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SFTP_STREAM_LOGGING')) { + echo $name . '('; + $last = count($arguments) - 1; + foreach ($arguments as $i => $argument) { + var_export($argument); + if ($i != $last) { + echo ','; + } + } + echo ")\r\n"; + } + $name = '_' . $name; + if (!method_exists($this, $name)) { + return \false; + } + return $this->{$name}(...$arguments); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SSH2.php new file mode 100644 index 0000000..4fb1a2a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/Net/SSH2.php @@ -0,0 +1,4594 @@ + + * login('username', 'password')) { + * exit('Login Failed'); + * } + * + * echo $ssh->exec('pwd'); + * echo $ssh->exec('ls -la'); + * ?> + * + * + * + * login('username', $key)) { + * exit('Login Failed'); + * } + * + * echo $ssh->read('username@username:~$'); + * $ssh->write("ls -la\n"); + * echo $ssh->read('username@username:~$'); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2007 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Net; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Blowfish; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\ChaCha20; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\AsymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\SymmetricKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DH; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Hash; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Random; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RC4; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Rijndael; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\TripleDES; +// Used to do Diffie-Hellman key exchange and DSA/RSA signature verification. +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Twofish; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\ConnectionClosedException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\InsufficientSetupException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\NoSupportedAlgorithmsException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnableToConnectException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedCurveException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Math\BigInteger; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH\Agent; +/** + * Pure-PHP implementation of SSHv2. + * + * @author Jim Wigginton + */ +class SSH2 +{ + /**#@+ + * Compression Types + * + */ + /** + * No compression + */ + const NET_SSH2_COMPRESSION_NONE = 1; + /** + * zlib compression + */ + const NET_SSH2_COMPRESSION_ZLIB = 2; + /** + * zlib@openssh.com + */ + const NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH = 3; + /**#@-*/ + // Execution Bitmap Masks + const MASK_CONSTRUCTOR = 0x1; + const MASK_CONNECTED = 0x2; + const MASK_LOGIN_REQ = 0x4; + const MASK_LOGIN = 0x8; + const MASK_SHELL = 0x10; + const MASK_WINDOW_ADJUST = 0x20; + /* + * Channel constants + * + * RFC4254 refers not to client and server channels but rather to sender and recipient channels. we don't refer + * to them in that way because RFC4254 toggles the meaning. the client sends a SSH_MSG_CHANNEL_OPEN message with + * a sender channel and the server sends a SSH_MSG_CHANNEL_OPEN_CONFIRMATION in response, with a sender and a + * recipient channel. at first glance, you might conclude that SSH_MSG_CHANNEL_OPEN_CONFIRMATION's sender channel + * would be the same thing as SSH_MSG_CHANNEL_OPEN's sender channel, but it's not, per this snippet: + * The 'recipient channel' is the channel number given in the original + * open request, and 'sender channel' is the channel number allocated by + * the other side. + * + * @see \phpseclib3\Net\SSH2::send_channel_packet() + * @see \phpseclib3\Net\SSH2::get_channel_packet() + */ + const CHANNEL_EXEC = 1; + // PuTTy uses 0x100 + const CHANNEL_SHELL = 2; + const CHANNEL_SUBSYSTEM = 3; + const CHANNEL_AGENT_FORWARD = 4; + const CHANNEL_KEEP_ALIVE = 5; + /** + * Returns the message numbers + * + * @see \phpseclib3\Net\SSH2::getLog() + */ + const LOG_SIMPLE = 1; + /** + * Returns the message content + * + * @see \phpseclib3\Net\SSH2::getLog() + */ + const LOG_COMPLEX = 2; + /** + * Outputs the content real-time + */ + const LOG_REALTIME = 3; + /** + * Dumps the content real-time to a file + */ + const LOG_REALTIME_FILE = 4; + /** + * Outputs the message numbers real-time + */ + const LOG_SIMPLE_REALTIME = 5; + /** + * Make sure that the log never gets larger than this + * + * @see \phpseclib3\Net\SSH2::getLog() + */ + const LOG_MAX_SIZE = 1048576; + // 1024 * 1024 + /** + * Returns when a string matching $expect exactly is found + * + * @see \phpseclib3\Net\SSH2::read() + */ + const READ_SIMPLE = 1; + /** + * Returns when a string matching the regular expression $expect is found + * + * @see \phpseclib3\Net\SSH2::read() + */ + const READ_REGEX = 2; + /** + * Returns whenever a data packet is received. + * + * Some data packets may only contain a single character so it may be necessary + * to call read() multiple times when using this option + * + * @see \phpseclib3\Net\SSH2::read() + */ + const READ_NEXT = 3; + /** + * The SSH identifier + * + * @var string + */ + private $identifier; + /** + * The Socket Object + * + * @var resource|closed-resource|null + */ + public $fsock; + /** + * Execution Bitmap + * + * The bits that are set represent functions that have been called already. This is used to determine + * if a requisite function has been successfully executed. If not, an error should be thrown. + * + * @var int + */ + protected $bitmap = 0; + /** + * Error information + * + * @see self::getErrors() + * @see self::getLastError() + * @var array + */ + private $errors = []; + /** + * Server Identifier + * + * @see self::getServerIdentification() + * @var string|false + */ + protected $server_identifier = \false; + /** + * Key Exchange Algorithms + * + * @see self::getKexAlgorithims() + * @var array|false + */ + private $kex_algorithms = \false; + /** + * Key Exchange Algorithm + * + * @see self::getMethodsNegotiated() + * @var string|false + */ + private $kex_algorithm = \false; + /** + * Minimum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods + * + * @see self::_key_exchange() + * @var int + */ + private $kex_dh_group_size_min = 1536; + /** + * Preferred Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods + * + * @see self::_key_exchange() + * @var int + */ + private $kex_dh_group_size_preferred = 2048; + /** + * Maximum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods + * + * @see self::_key_exchange() + * @var int + */ + private $kex_dh_group_size_max = 4096; + /** + * Server Host Key Algorithms + * + * @see self::getServerHostKeyAlgorithms() + * @var array|false + */ + private $server_host_key_algorithms = \false; + /** + * Supported Private Key Algorithms + * + * In theory this should be the same as the Server Host Key Algorithms but, in practice, + * some servers (eg. Azure) will support rsa-sha2-512 as a server host key algorithm but + * not a private key algorithm + * + * @see self::privatekey_login() + * @var array|false + */ + private $supported_private_key_algorithms = \false; + /** + * Encryption Algorithms: Client to Server + * + * @see self::getEncryptionAlgorithmsClient2Server() + * @var array|false + */ + private $encryption_algorithms_client_to_server = \false; + /** + * Encryption Algorithms: Server to Client + * + * @see self::getEncryptionAlgorithmsServer2Client() + * @var array|false + */ + private $encryption_algorithms_server_to_client = \false; + /** + * MAC Algorithms: Client to Server + * + * @see self::getMACAlgorithmsClient2Server() + * @var array|false + */ + private $mac_algorithms_client_to_server = \false; + /** + * MAC Algorithms: Server to Client + * + * @see self::getMACAlgorithmsServer2Client() + * @var array|false + */ + private $mac_algorithms_server_to_client = \false; + /** + * Compression Algorithms: Client to Server + * + * @see self::getCompressionAlgorithmsClient2Server() + * @var array|false + */ + private $compression_algorithms_client_to_server = \false; + /** + * Compression Algorithms: Server to Client + * + * @see self::getCompressionAlgorithmsServer2Client() + * @var array|false + */ + private $compression_algorithms_server_to_client = \false; + /** + * Languages: Server to Client + * + * @see self::getLanguagesServer2Client() + * @var array|false + */ + private $languages_server_to_client = \false; + /** + * Languages: Client to Server + * + * @see self::getLanguagesClient2Server() + * @var array|false + */ + private $languages_client_to_server = \false; + /** + * Preferred Algorithms + * + * @see self::setPreferredAlgorithms() + * @var array + */ + private $preferred = []; + /** + * Block Size for Server to Client Encryption + * + * "Note that the length of the concatenation of 'packet_length', + * 'padding_length', 'payload', and 'random padding' MUST be a multiple + * of the cipher block size or 8, whichever is larger. This constraint + * MUST be enforced, even when using stream ciphers." + * + * -- http://tools.ietf.org/html/rfc4253#section-6 + * + * @see self::__construct() + * @see self::_send_binary_packet() + * @var int + */ + private $encrypt_block_size = 8; + /** + * Block Size for Client to Server Encryption + * + * @see self::__construct() + * @see self::_get_binary_packet() + * @var int + */ + private $decrypt_block_size = 8; + /** + * Server to Client Encryption Object + * + * @see self::_get_binary_packet() + * @var SymmetricKey|false + */ + private $decrypt = \false; + /** + * Decryption Algorithm Name + * + * @var string|null + */ + private $decryptName; + /** + * Decryption Invocation Counter + * + * Used by GCM + * + * @var string|null + */ + private $decryptInvocationCounter; + /** + * Fixed Part of Nonce + * + * Used by GCM + * + * @var string|null + */ + private $decryptFixedPart; + /** + * Server to Client Length Encryption Object + * + * @see self::_get_binary_packet() + * @var object + */ + private $lengthDecrypt = \false; + /** + * Client to Server Encryption Object + * + * @see self::_send_binary_packet() + * @var SymmetricKey|false + */ + private $encrypt = \false; + /** + * Encryption Algorithm Name + * + * @var string|null + */ + private $encryptName; + /** + * Encryption Invocation Counter + * + * Used by GCM + * + * @var string|null + */ + private $encryptInvocationCounter; + /** + * Fixed Part of Nonce + * + * Used by GCM + * + * @var string|null + */ + private $encryptFixedPart; + /** + * Client to Server Length Encryption Object + * + * @see self::_send_binary_packet() + * @var object + */ + private $lengthEncrypt = \false; + /** + * Client to Server HMAC Object + * + * @see self::_send_binary_packet() + * @var object + */ + private $hmac_create = \false; + /** + * Client to Server HMAC Name + * + * @var string|false + */ + private $hmac_create_name; + /** + * Client to Server ETM + * + * @var int|false + */ + private $hmac_create_etm; + /** + * Server to Client HMAC Object + * + * @see self::_get_binary_packet() + * @var object + */ + private $hmac_check = \false; + /** + * Server to Client HMAC Name + * + * @var string|false + */ + private $hmac_check_name; + /** + * Server to Client ETM + * + * @var int|false + */ + private $hmac_check_etm; + /** + * Size of server to client HMAC + * + * We need to know how big the HMAC will be for the server to client direction so that we know how many bytes to read. + * For the client to server side, the HMAC object will make the HMAC as long as it needs to be. All we need to do is + * append it. + * + * @see self::_get_binary_packet() + * @var int + */ + private $hmac_size = \false; + /** + * Server Public Host Key + * + * @see self::getServerPublicHostKey() + * @var string + */ + private $server_public_host_key; + /** + * Session identifier + * + * "The exchange hash H from the first key exchange is additionally + * used as the session identifier, which is a unique identifier for + * this connection." + * + * -- http://tools.ietf.org/html/rfc4253#section-7.2 + * + * @see self::_key_exchange() + * @var string + */ + private $session_id = \false; + /** + * Exchange hash + * + * The current exchange hash + * + * @see self::_key_exchange() + * @var string + */ + private $exchange_hash = \false; + /** + * Message Numbers + * + * @see self::__construct() + * @var array + * @access private + */ + private static $message_numbers = []; + /** + * Disconnection Message 'reason codes' defined in RFC4253 + * + * @see self::__construct() + * @var array + * @access private + */ + private static $disconnect_reasons = []; + /** + * SSH_MSG_CHANNEL_OPEN_FAILURE 'reason codes', defined in RFC4254 + * + * @see self::__construct() + * @var array + * @access private + */ + private static $channel_open_failure_reasons = []; + /** + * Terminal Modes + * + * @link http://tools.ietf.org/html/rfc4254#section-8 + * @see self::__construct() + * @var array + * @access private + */ + private static $terminal_modes = []; + /** + * SSH_MSG_CHANNEL_EXTENDED_DATA's data_type_codes + * + * @link http://tools.ietf.org/html/rfc4254#section-5.2 + * @see self::__construct() + * @var array + * @access private + */ + private static $channel_extended_data_type_codes = []; + /** + * Send Sequence Number + * + * See 'Section 6.4. Data Integrity' of rfc4253 for more info. + * + * @see self::_send_binary_packet() + * @var int + */ + private $send_seq_no = 0; + /** + * Get Sequence Number + * + * See 'Section 6.4. Data Integrity' of rfc4253 for more info. + * + * @see self::_get_binary_packet() + * @var int + */ + private $get_seq_no = 0; + /** + * Server Channels + * + * Maps client channels to server channels + * + * @see self::get_channel_packet() + * @see self::exec() + * @var array + */ + protected $server_channels = []; + /** + * Channel Buffers + * + * If a client requests a packet from one channel but receives two packets from another those packets should + * be placed in a buffer + * + * @see self::get_channel_packet() + * @see self::exec() + * @var array + */ + private $channel_buffers = []; + /** + * Channel Status + * + * Contains the type of the last sent message + * + * @see self::get_channel_packet() + * @var array + */ + protected $channel_status = []; + /** + * The identifier of the interactive channel which was opened most recently + * + * @see self::getInteractiveChannelId() + * @var int + */ + private $channel_id_last_interactive = 0; + /** + * Packet Size + * + * Maximum packet size indexed by channel + * + * @see self::send_channel_packet() + * @var array + */ + private $packet_size_client_to_server = []; + /** + * Message Number Log + * + * @see self::getLog() + * @var array + */ + private $message_number_log = []; + /** + * Message Log + * + * @see self::getLog() + * @var array + */ + private $message_log = []; + /** + * The Window Size + * + * Bytes the other party can send before it must wait for the window to be adjusted (0x7FFFFFFF = 2GB) + * + * @var int + * @see self::send_channel_packet() + * @see self::exec() + */ + protected $window_size = 0x7fffffff; + /** + * What we resize the window to + * + * When PuTTY resizes the window it doesn't add an additional 0x7FFFFFFF bytes - it adds 0x40000000 bytes. + * Some SFTP clients (GoAnywhere) don't support adding 0x7FFFFFFF to the window size after the fact so + * we'll just do what PuTTY does + * + * @var int + * @see self::_send_channel_packet() + * @see self::exec() + */ + private $window_resize = 0x40000000; + /** + * Window size, server to client + * + * Window size indexed by channel + * + * @see self::send_channel_packet() + * @var array + */ + protected $window_size_server_to_client = []; + /** + * Window size, client to server + * + * Window size indexed by channel + * + * @see self::get_channel_packet() + * @var array + */ + private $window_size_client_to_server = []; + /** + * Server signature + * + * Verified against $this->session_id + * + * @see self::getServerPublicHostKey() + * @var string + */ + private $signature = ''; + /** + * Server signature format + * + * ssh-rsa or ssh-dss. + * + * @see self::getServerPublicHostKey() + * @var string + */ + private $signature_format = ''; + /** + * Interactive Buffer + * + * @see self::read() + * @var string + */ + private $interactiveBuffer = ''; + /** + * Current log size + * + * Should never exceed self::LOG_MAX_SIZE + * + * @see self::_send_binary_packet() + * @see self::_get_binary_packet() + * @var int + */ + private $log_size; + /** + * Timeout + * + * @see self::setTimeout() + */ + protected $timeout; + /** + * Current Timeout + * + * @see self::get_channel_packet() + */ + protected $curTimeout; + /** + * Keep Alive Interval + * + * @see self::setKeepAlive() + */ + private $keepAlive; + /** + * Real-time log file pointer + * + * @see self::_append_log() + * @var resource|closed-resource + */ + private $realtime_log_file; + /** + * Real-time log file size + * + * @see self::_append_log() + * @var int + */ + private $realtime_log_size; + /** + * Has the signature been validated? + * + * @see self::getServerPublicHostKey() + * @var bool + */ + private $signature_validated = \false; + /** + * Real-time log file wrap boolean + * + * @see self::_append_log() + * @var bool + */ + private $realtime_log_wrap; + /** + * Flag to suppress stderr from output + * + * @see self::enableQuietMode() + */ + private $quiet_mode = \false; + /** + * Time of first network activity + * + * @var float + */ + private $last_packet; + /** + * Exit status returned from ssh if any + * + * @var int + */ + private $exit_status; + /** + * Flag to request a PTY when using exec() + * + * @var bool + * @see self::enablePTY() + */ + private $request_pty = \false; + /** + * Contents of stdError + * + * @var string + */ + private $stdErrorLog; + /** + * The Last Interactive Response + * + * @see self::_keyboard_interactive_process() + * @var string + */ + private $last_interactive_response = ''; + /** + * Keyboard Interactive Request / Responses + * + * @see self::_keyboard_interactive_process() + * @var array + */ + private $keyboard_requests_responses = []; + /** + * Banner Message + * + * Quoting from the RFC, "in some jurisdictions, sending a warning message before + * authentication may be relevant for getting legal protection." + * + * @see self::_filter() + * @see self::getBannerMessage() + * @var string + */ + private $banner_message = ''; + /** + * Did read() timeout or return normally? + * + * @see self::isTimeout() + * @var bool + */ + private $is_timeout = \false; + /** + * Log Boundary + * + * @see self::_format_log() + * @var string + */ + private $log_boundary = ':'; + /** + * Log Long Width + * + * @see self::_format_log() + * @var int + */ + private $log_long_width = 65; + /** + * Log Short Width + * + * @see self::_format_log() + * @var int + */ + private $log_short_width = 16; + /** + * Hostname + * + * @see self::__construct() + * @see self::_connect() + * @var string + */ + private $host; + /** + * Port Number + * + * @see self::__construct() + * @see self::_connect() + * @var int + */ + private $port; + /** + * Number of columns for terminal window size + * + * @see self::getWindowColumns() + * @see self::setWindowColumns() + * @see self::setWindowSize() + * @var int + */ + private $windowColumns = 80; + /** + * Number of columns for terminal window size + * + * @see self::getWindowRows() + * @see self::setWindowRows() + * @see self::setWindowSize() + * @var int + */ + private $windowRows = 24; + /** + * Crypto Engine + * + * @see self::setCryptoEngine() + * @see self::_key_exchange() + * @var int + */ + private static $crypto_engine = \false; + /** + * A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario + * + * @var Agent + */ + private $agent; + /** + * Connection storage to replicates ssh2 extension functionality: + * {@link http://php.net/manual/en/wrappers.ssh2.php#refsect1-wrappers.ssh2-examples} + * + * @var array> + */ + private static $connections; + /** + * Send the identification string first? + * + * @var bool + */ + private $send_id_string_first = \true; + /** + * Send the key exchange initiation packet first? + * + * @var bool + */ + private $send_kex_first = \true; + /** + * Some versions of OpenSSH incorrectly calculate the key size + * + * @var bool + */ + private $bad_key_size_fix = \false; + /** + * Should we try to re-connect to re-establish keys? + * + * @var bool + */ + private $retry_connect = \false; + /** + * Binary Packet Buffer + * + * @var string|false + */ + private $binary_packet_buffer = \false; + /** + * Preferred Signature Format + * + * @var string|false + */ + protected $preferred_signature_format = \false; + /** + * Authentication Credentials + * + * @var array + */ + protected $auth = []; + /** + * Terminal + * + * @var string + */ + private $term = 'vt100'; + /** + * The authentication methods that may productively continue authentication. + * + * @see https://tools.ietf.org/html/rfc4252#section-5.1 + * @var array|null + */ + private $auth_methods_to_continue = null; + /** + * Compression method + * + * @var int + */ + private $compress = self::NET_SSH2_COMPRESSION_NONE; + /** + * Decompression method + * + * @var int + */ + private $decompress = self::NET_SSH2_COMPRESSION_NONE; + /** + * Compression context + * + * @var resource|false|null + */ + private $compress_context; + /** + * Decompression context + * + * @var resource|object + */ + private $decompress_context; + /** + * Regenerate Compression Context + * + * @var bool + */ + private $regenerate_compression_context = \false; + /** + * Regenerate Decompression Context + * + * @var bool + */ + private $regenerate_decompression_context = \false; + /** + * Smart multi-factor authentication flag + * + * @var bool + */ + private $smartMFA = \true; + /** + * How many channels are currently opened + * + * @var int + */ + private $channelCount = 0; + /** + * Does the server support multiple channels? If not then error out + * when multiple channels are attempted to be opened + * + * @var bool + */ + private $errorOnMultipleChannels; + /** + * Terrapin Countermeasure + * + * "During initial KEX, terminate the connection if any unexpected or out-of-sequence packet is received" + * -- https://github.com/openssh/openssh-portable/commit/1edb00c58f8a6875fad6a497aa2bacf37f9e6cd5 + * + * @var int + */ + private $extra_packets; + /** + * Default Constructor. + * + * $host can either be a string, representing the host, or a stream resource. + * If $host is a stream resource then $port doesn't do anything, altho $timeout + * still will be used + * + * @param mixed $host + * @param int $port + * @param int $timeout + * @see self::login() + */ + public function __construct($host, $port = 22, $timeout = 10) + { + if (empty(self::$message_numbers)) { + self::$message_numbers = [ + 1 => 'NET_SSH2_MSG_DISCONNECT', + 2 => 'NET_SSH2_MSG_IGNORE', + 3 => 'NET_SSH2_MSG_UNIMPLEMENTED', + 4 => 'NET_SSH2_MSG_DEBUG', + 5 => 'NET_SSH2_MSG_SERVICE_REQUEST', + 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT', + 7 => 'NET_SSH2_MSG_EXT_INFO', + // RFC 8308 + 20 => 'NET_SSH2_MSG_KEXINIT', + 21 => 'NET_SSH2_MSG_NEWKEYS', + 30 => 'NET_SSH2_MSG_KEXDH_INIT', + 31 => 'NET_SSH2_MSG_KEXDH_REPLY', + 50 => 'NET_SSH2_MSG_USERAUTH_REQUEST', + 51 => 'NET_SSH2_MSG_USERAUTH_FAILURE', + 52 => 'NET_SSH2_MSG_USERAUTH_SUCCESS', + 53 => 'NET_SSH2_MSG_USERAUTH_BANNER', + 80 => 'NET_SSH2_MSG_GLOBAL_REQUEST', + 81 => 'NET_SSH2_MSG_REQUEST_SUCCESS', + 82 => 'NET_SSH2_MSG_REQUEST_FAILURE', + 90 => 'NET_SSH2_MSG_CHANNEL_OPEN', + 91 => 'NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION', + 92 => 'NET_SSH2_MSG_CHANNEL_OPEN_FAILURE', + 93 => 'NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST', + 94 => 'NET_SSH2_MSG_CHANNEL_DATA', + 95 => 'NET_SSH2_MSG_CHANNEL_EXTENDED_DATA', + 96 => 'NET_SSH2_MSG_CHANNEL_EOF', + 97 => 'NET_SSH2_MSG_CHANNEL_CLOSE', + 98 => 'NET_SSH2_MSG_CHANNEL_REQUEST', + 99 => 'NET_SSH2_MSG_CHANNEL_SUCCESS', + 100 => 'NET_SSH2_MSG_CHANNEL_FAILURE', + ]; + self::$disconnect_reasons = [1 => 'NET_SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT', 2 => 'NET_SSH2_DISCONNECT_PROTOCOL_ERROR', 3 => 'NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED', 4 => 'NET_SSH2_DISCONNECT_RESERVED', 5 => 'NET_SSH2_DISCONNECT_MAC_ERROR', 6 => 'NET_SSH2_DISCONNECT_COMPRESSION_ERROR', 7 => 'NET_SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE', 8 => 'NET_SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED', 9 => 'NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE', 10 => 'NET_SSH2_DISCONNECT_CONNECTION_LOST', 11 => 'NET_SSH2_DISCONNECT_BY_APPLICATION', 12 => 'NET_SSH2_DISCONNECT_TOO_MANY_CONNECTIONS', 13 => 'NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER', 14 => 'NET_SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE', 15 => 'NET_SSH2_DISCONNECT_ILLEGAL_USER_NAME']; + self::$channel_open_failure_reasons = [1 => 'NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED']; + self::$terminal_modes = [0 => 'NET_SSH2_TTY_OP_END']; + self::$channel_extended_data_type_codes = [1 => 'NET_SSH2_EXTENDED_DATA_STDERR']; + self::define_array( + self::$message_numbers, + self::$disconnect_reasons, + self::$channel_open_failure_reasons, + self::$terminal_modes, + self::$channel_extended_data_type_codes, + [60 => 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'], + [60 => 'NET_SSH2_MSG_USERAUTH_PK_OK'], + [60 => 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST', 61 => 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE'], + // RFC 4419 - diffie-hellman-group-exchange-sha{1,256} + [30 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST_OLD', 31 => 'NET_SSH2_MSG_KEXDH_GEX_GROUP', 32 => 'NET_SSH2_MSG_KEXDH_GEX_INIT', 33 => 'NET_SSH2_MSG_KEXDH_GEX_REPLY', 34 => 'NET_SSH2_MSG_KEXDH_GEX_REQUEST'], + // RFC 5656 - Elliptic Curves (for curve25519-sha256@libssh.org) + [30 => 'NET_SSH2_MSG_KEX_ECDH_INIT', 31 => 'NET_SSH2_MSG_KEX_ECDH_REPLY'] + ); + } + /** + * Typehint is required due to a bug in Psalm: https://github.com/vimeo/psalm/issues/7508 + * @var \WeakReference|SSH2 + */ + self::$connections[$this->getResourceId()] = class_exists('WeakReference') ? \WeakReference::create($this) : $this; + $this->timeout = $timeout; + if (is_resource($host)) { + $this->fsock = $host; + return; + } + if (Strings::is_stringable($host)) { + $this->host = $host; + $this->port = $port; + } + } + /** + * Set Crypto Engine Mode + * + * Possible $engine values: + * OpenSSL, mcrypt, Eval, PHP + * + * @param int $engine + */ + public static function setCryptoEngine($engine) + { + self::$crypto_engine = $engine; + } + /** + * Send Identification String First + * + * https://tools.ietf.org/html/rfc4253#section-4.2 says "when the connection has been established, + * both sides MUST send an identification string". It does not say which side sends it first. In + * theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy + * + */ + public function sendIdentificationStringFirst() + { + $this->send_id_string_first = \true; + } + /** + * Send Identification String Last + * + * https://tools.ietf.org/html/rfc4253#section-4.2 says "when the connection has been established, + * both sides MUST send an identification string". It does not say which side sends it first. In + * theory it shouldn't matter but it is a fact of life that some SSH servers are simply buggy + * + */ + public function sendIdentificationStringLast() + { + $this->send_id_string_first = \false; + } + /** + * Send SSH_MSG_KEXINIT First + * + * https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending + * sending the [SSH_MSG_KEXINIT] packet". It does not say which side sends it first. In theory + * it shouldn't matter but it is a fact of life that some SSH servers are simply buggy + * + */ + public function sendKEXINITFirst() + { + $this->send_kex_first = \true; + } + /** + * Send SSH_MSG_KEXINIT Last + * + * https://tools.ietf.org/html/rfc4253#section-7.1 says "key exchange begins by each sending + * sending the [SSH_MSG_KEXINIT] packet". It does not say which side sends it first. In theory + * it shouldn't matter but it is a fact of life that some SSH servers are simply buggy + * + */ + public function sendKEXINITLast() + { + $this->send_kex_first = \false; + } + /** + * stream_select wrapper + * + * Quoting https://stackoverflow.com/a/14262151/569976, + * "The general approach to `EINTR` is to simply handle the error and retry the operation again" + * + * This wrapper does that loop + */ + private static function stream_select(&$read, &$write, &$except, $seconds, $microseconds = null) + { + $remaining = $seconds + $microseconds / 1000000; + $start = microtime(\true); + while (\true) { + $result = @stream_select($read, $write, $except, $seconds, $microseconds); + if ($result !== \false) { + return $result; + } + $elapsed = microtime(\true) - $start; + $seconds = (int) ($remaining - floor($elapsed)); + $microseconds = (int) (1000000 * ($remaining - $seconds)); + if ($elapsed >= $remaining) { + return \false; + } + } + } + /** + * Connect to an SSHv2 server + * + * @throws \UnexpectedValueException on receipt of unexpected packets + * @throws \RuntimeException on other errors + */ + private function connect() + { + if ($this->bitmap & self::MASK_CONSTRUCTOR) { + return; + } + $this->bitmap |= self::MASK_CONSTRUCTOR; + $this->curTimeout = $this->timeout; + $this->last_packet = microtime(\true); + if (!is_resource($this->fsock)) { + $start = microtime(\true); + // with stream_select a timeout of 0 means that no timeout takes place; + // with fsockopen a timeout of 0 means that you instantly timeout + // to resolve this incompatibility a timeout of 100,000 will be used for fsockopen if timeout is 0 + $this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->curTimeout == 0 ? 100000 : $this->curTimeout); + if (!$this->fsock) { + $host = $this->host . ':' . $this->port; + throw new UnableToConnectException(rtrim("Cannot connect to {$host}. Error {$errno}. {$errstr}")); + } + $elapsed = microtime(\true) - $start; + if ($this->curTimeout) { + $this->curTimeout -= $elapsed; + if ($this->curTimeout < 0) { + throw new \RuntimeException('Connection timed out whilst attempting to open socket connection'); + } + } + } + $this->identifier = $this->generate_identifier(); + if ($this->send_id_string_first) { + fputs($this->fsock, $this->identifier . "\r\n"); + } + /* According to the SSH2 specs, + + "The server MAY send other lines of data before sending the version + string. Each line SHOULD be terminated by a Carriage Return and Line + Feed. Such lines MUST NOT begin with "SSH-", and SHOULD be encoded + in ISO-10646 UTF-8 [RFC3629] (language is not specified). Clients + MUST be able to process such lines." */ + $data = ''; + while (!feof($this->fsock) && !preg_match('#(.*)^(SSH-(\\d\\.\\d+).*)#ms', $data, $matches)) { + $line = ''; + while (\true) { + if ($this->curTimeout) { + if ($this->curTimeout < 0) { + throw new \RuntimeException('Connection timed out whilst receiving server identification string'); + } + $read = [$this->fsock]; + $write = $except = null; + $start = microtime(\true); + $sec = (int) floor($this->curTimeout); + $usec = (int) (1000000 * ($this->curTimeout - $sec)); + if (static::stream_select($read, $write, $except, $sec, $usec) === \false) { + throw new \RuntimeException('Connection timed out whilst receiving server identification string'); + } + $elapsed = microtime(\true) - $start; + $this->curTimeout -= $elapsed; + } + $temp = stream_get_line($this->fsock, 255, "\n"); + if ($temp === \false) { + throw new \RuntimeException('Error reading from socket'); + } + if (strlen($temp) == 255) { + continue; + } + $line .= "{$temp}\n"; + // quoting RFC4253, "Implementers who wish to maintain + // compatibility with older, undocumented versions of this protocol may + // want to process the identification string without expecting the + // presence of the carriage return character for reasons described in + // Section 5 of this document." + //if (substr($line, -2) == "\r\n") { + // break; + //} + break; + } + $data .= $line; + } + if (feof($this->fsock)) { + $this->bitmap = 0; + throw new ConnectionClosedException('Connection closed by server'); + } + $extra = $matches[1]; + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SSH2_LOGGING')) { + $this->append_log('<-', $matches[0]); + $this->append_log('->', $this->identifier . "\r\n"); + } + $this->server_identifier = trim($temp, "\r\n"); + if (strlen($extra)) { + $this->errors[] = $data; + } + if (version_compare($matches[3], '1.99', '<')) { + $this->bitmap = 0; + throw new UnableToConnectException("Cannot connect to SSH {$matches[3]} servers"); + } + // Ubuntu's OpenSSH from 5.8 to 6.9 didn't work with multiple channels. see + // https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1334916 for more info. + // https://lists.ubuntu.com/archives/oneiric-changes/2011-July/005772.html discusses + // when consolekit was incorporated. + // https://marc.info/?l=openssh-unix-dev&m=163409903417589&w=2 discusses some of the + // issues with how Ubuntu incorporated consolekit + $pattern = '#^SSH-2\\.0-OpenSSH_([\\d.]+)[^ ]* Ubuntu-.*$#'; + $match = preg_match($pattern, $this->server_identifier, $matches); + $match = $match && version_compare('5.8', $matches[1], '<='); + $match = $match && version_compare('6.9', $matches[1], '>='); + $this->errorOnMultipleChannels = $match; + if (!$this->send_id_string_first) { + fputs($this->fsock, $this->identifier . "\r\n"); + } + if (!$this->send_kex_first) { + $response = $this->get_binary_packet(); + if (is_bool($response) || !strlen($response) || ord($response[0]) != NET_SSH2_MSG_KEXINIT) { + $this->bitmap = 0; + throw new \UnexpectedValueException('Expected SSH_MSG_KEXINIT'); + } + $this->key_exchange($response); + } + if ($this->send_kex_first) { + $this->key_exchange(); + } + $this->bitmap |= self::MASK_CONNECTED; + return \true; + } + /** + * Generates the SSH identifier + * + * You should overwrite this method in your own class if you want to use another identifier + * + * @return string + */ + private function generate_identifier() + { + $identifier = 'SSH-2.0-phpseclib_3.0'; + $ext = []; + if (extension_loaded('sodium')) { + $ext[] = 'libsodium'; + } + if (extension_loaded('openssl')) { + $ext[] = 'openssl'; + } elseif (extension_loaded('mcrypt')) { + $ext[] = 'mcrypt'; + } + if (extension_loaded('gmp')) { + $ext[] = 'gmp'; + } elseif (extension_loaded('bcmath')) { + $ext[] = 'bcmath'; + } + if (!empty($ext)) { + $identifier .= ' (' . implode(', ', $ext) . ')'; + } + return $identifier; + } + /** + * Key Exchange + * + * @return bool + * @param string|bool $kexinit_payload_server optional + * @throws \UnexpectedValueException on receipt of unexpected packets + * @throws \RuntimeException on other errors + * @throws \phpseclib3\Exception\NoSupportedAlgorithmsException when none of the algorithms phpseclib has loaded are compatible + */ + private function key_exchange($kexinit_payload_server = \false) + { + $preferred = $this->preferred; + $send_kex = \true; + $kex_algorithms = isset($preferred['kex']) ? $preferred['kex'] : SSH2::getSupportedKEXAlgorithms(); + $server_host_key_algorithms = isset($preferred['hostkey']) ? $preferred['hostkey'] : SSH2::getSupportedHostKeyAlgorithms(); + $s2c_encryption_algorithms = isset($preferred['server_to_client']['crypt']) ? $preferred['server_to_client']['crypt'] : SSH2::getSupportedEncryptionAlgorithms(); + $c2s_encryption_algorithms = isset($preferred['client_to_server']['crypt']) ? $preferred['client_to_server']['crypt'] : SSH2::getSupportedEncryptionAlgorithms(); + $s2c_mac_algorithms = isset($preferred['server_to_client']['mac']) ? $preferred['server_to_client']['mac'] : SSH2::getSupportedMACAlgorithms(); + $c2s_mac_algorithms = isset($preferred['client_to_server']['mac']) ? $preferred['client_to_server']['mac'] : SSH2::getSupportedMACAlgorithms(); + $s2c_compression_algorithms = isset($preferred['server_to_client']['comp']) ? $preferred['server_to_client']['comp'] : SSH2::getSupportedCompressionAlgorithms(); + $c2s_compression_algorithms = isset($preferred['client_to_server']['comp']) ? $preferred['client_to_server']['comp'] : SSH2::getSupportedCompressionAlgorithms(); + $kex_algorithms = array_merge($kex_algorithms, ['ext-info-c', 'kex-strict-c-v00@openssh.com']); + // some SSH servers have buggy implementations of some of the above algorithms + switch (\true) { + case $this->server_identifier == 'SSH-2.0-SSHD': + case substr($this->server_identifier, 0, 13) == 'SSH-2.0-DLINK': + if (!isset($preferred['server_to_client']['mac'])) { + $s2c_mac_algorithms = array_values(array_diff($s2c_mac_algorithms, ['hmac-sha1-96', 'hmac-md5-96'])); + } + if (!isset($preferred['client_to_server']['mac'])) { + $c2s_mac_algorithms = array_values(array_diff($c2s_mac_algorithms, ['hmac-sha1-96', 'hmac-md5-96'])); + } + break; + case substr($this->server_identifier, 0, 24) == 'SSH-2.0-TurboFTP_SERVER_': + if (!isset($preferred['server_to_client']['crypt'])) { + $s2c_encryption_algorithms = array_values(array_diff($s2c_encryption_algorithms, ['aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'])); + } + if (!isset($preferred['client_to_server']['crypt'])) { + $c2s_encryption_algorithms = array_values(array_diff($c2s_encryption_algorithms, ['aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'])); + } + } + $client_cookie = Random::string(16); + $kexinit_payload_client = pack('Ca*', NET_SSH2_MSG_KEXINIT, $client_cookie); + $kexinit_payload_client .= Strings::packSSH2( + 'L10bN', + $kex_algorithms, + $server_host_key_algorithms, + $c2s_encryption_algorithms, + $s2c_encryption_algorithms, + $c2s_mac_algorithms, + $s2c_mac_algorithms, + $c2s_compression_algorithms, + $s2c_compression_algorithms, + [], + // language, client to server + [], + // language, server to client + \false, + // first_kex_packet_follows + 0 + ); + if ($kexinit_payload_server === \false) { + $this->send_binary_packet($kexinit_payload_client); + $this->extra_packets = 0; + $kexinit_payload_server = $this->get_binary_packet(); + if (is_bool($kexinit_payload_server) || !strlen($kexinit_payload_server) || ord($kexinit_payload_server[0]) != NET_SSH2_MSG_KEXINIT) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_PROTOCOL_ERROR); + throw new \UnexpectedValueException('Expected SSH_MSG_KEXINIT'); + } + $send_kex = \false; + } + $response = $kexinit_payload_server; + Strings::shift($response, 1); + // skip past the message number (it should be SSH_MSG_KEXINIT) + $server_cookie = Strings::shift($response, 16); + list($this->kex_algorithms, $this->server_host_key_algorithms, $this->encryption_algorithms_client_to_server, $this->encryption_algorithms_server_to_client, $this->mac_algorithms_client_to_server, $this->mac_algorithms_server_to_client, $this->compression_algorithms_client_to_server, $this->compression_algorithms_server_to_client, $this->languages_client_to_server, $this->languages_server_to_client, $first_kex_packet_follows) = Strings::unpackSSH2('L10C', $response); + if (in_array('kex-strict-s-v00@openssh.com', $this->kex_algorithms)) { + if ($this->session_id === \false && $this->extra_packets) { + throw new \UnexpectedValueException('Possible Terrapin Attack detected'); + } + } + $this->supported_private_key_algorithms = $this->server_host_key_algorithms; + if ($send_kex) { + $this->send_binary_packet($kexinit_payload_client); + } + // we need to decide upon the symmetric encryption algorithms before we do the diffie-hellman key exchange + // we don't initialize any crypto-objects, yet - we do that, later. for now, we need the lengths to make the + // diffie-hellman key exchange as fast as possible + $decrypt = self::array_intersect_first($s2c_encryption_algorithms, $this->encryption_algorithms_server_to_client); + $decryptKeyLength = $this->encryption_algorithm_to_key_size($decrypt); + if ($decryptKeyLength === null) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible server to client encryption algorithms found'); + } + $encrypt = self::array_intersect_first($c2s_encryption_algorithms, $this->encryption_algorithms_client_to_server); + $encryptKeyLength = $this->encryption_algorithm_to_key_size($encrypt); + if ($encryptKeyLength === null) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible client to server encryption algorithms found'); + } + // through diffie-hellman key exchange a symmetric key is obtained + $this->kex_algorithm = self::array_intersect_first($kex_algorithms, $this->kex_algorithms); + if ($this->kex_algorithm === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible key exchange algorithms found'); + } + $server_host_key_algorithm = self::array_intersect_first($server_host_key_algorithms, $this->server_host_key_algorithms); + if ($server_host_key_algorithm === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible server host key algorithms found'); + } + $mac_algorithm_out = self::array_intersect_first($c2s_mac_algorithms, $this->mac_algorithms_client_to_server); + if ($mac_algorithm_out === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible client to server message authentication algorithms found'); + } + $mac_algorithm_in = self::array_intersect_first($s2c_mac_algorithms, $this->mac_algorithms_server_to_client); + if ($mac_algorithm_in === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible server to client message authentication algorithms found'); + } + $compression_map = ['none' => self::NET_SSH2_COMPRESSION_NONE, 'zlib' => self::NET_SSH2_COMPRESSION_ZLIB, 'zlib@openssh.com' => self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH]; + $compression_algorithm_in = self::array_intersect_first($s2c_compression_algorithms, $this->compression_algorithms_server_to_client); + if ($compression_algorithm_in === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible server to client compression algorithms found'); + } + $this->decompress = $compression_map[$compression_algorithm_in]; + $compression_algorithm_out = self::array_intersect_first($c2s_compression_algorithms, $this->compression_algorithms_client_to_server); + if ($compression_algorithm_out === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + throw new NoSupportedAlgorithmsException('No compatible client to server compression algorithms found'); + } + $this->compress = $compression_map[$compression_algorithm_out]; + switch ($this->kex_algorithm) { + case 'diffie-hellman-group15-sha512': + case 'diffie-hellman-group16-sha512': + case 'diffie-hellman-group17-sha512': + case 'diffie-hellman-group18-sha512': + case 'ecdh-sha2-nistp521': + $kexHash = new Hash('sha512'); + break; + case 'ecdh-sha2-nistp384': + $kexHash = new Hash('sha384'); + break; + case 'diffie-hellman-group-exchange-sha256': + case 'diffie-hellman-group14-sha256': + case 'ecdh-sha2-nistp256': + case 'curve25519-sha256@libssh.org': + case 'curve25519-sha256': + $kexHash = new Hash('sha256'); + break; + default: + $kexHash = new Hash('sha1'); + } + // Only relevant in diffie-hellman-group-exchange-sha{1,256}, otherwise empty. + $exchange_hash_rfc4419 = ''; + if (strpos($this->kex_algorithm, 'curve25519-sha256') === 0 || strpos($this->kex_algorithm, 'ecdh-sha2-nistp') === 0) { + $curve = strpos($this->kex_algorithm, 'curve25519-sha256') === 0 ? 'Curve25519' : substr($this->kex_algorithm, 10); + $ourPrivate = EC::createKey($curve); + $ourPublicBytes = $ourPrivate->getPublicKey()->getEncodedCoordinates(); + $clientKexInitMessage = 'NET_SSH2_MSG_KEX_ECDH_INIT'; + $serverKexReplyMessage = 'NET_SSH2_MSG_KEX_ECDH_REPLY'; + } else { + if (strpos($this->kex_algorithm, 'diffie-hellman-group-exchange') === 0) { + $dh_group_sizes_packed = pack('NNN', $this->kex_dh_group_size_min, $this->kex_dh_group_size_preferred, $this->kex_dh_group_size_max); + $packet = pack('Ca*', NET_SSH2_MSG_KEXDH_GEX_REQUEST, $dh_group_sizes_packed); + $this->send_binary_packet($packet); + $this->updateLogHistory('UNKNOWN (34)', 'NET_SSH2_MSG_KEXDH_GEX_REQUEST'); + $response = $this->get_binary_packet(); + list($type, $primeBytes, $gBytes) = Strings::unpackSSH2('Css', $response); + if ($type != NET_SSH2_MSG_KEXDH_GEX_GROUP) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_PROTOCOL_ERROR); + throw new \UnexpectedValueException('Expected SSH_MSG_KEX_DH_GEX_GROUP'); + } + $this->updateLogHistory('NET_SSH2_MSG_KEXDH_REPLY', 'NET_SSH2_MSG_KEXDH_GEX_GROUP'); + $prime = new BigInteger($primeBytes, -256); + $g = new BigInteger($gBytes, -256); + $exchange_hash_rfc4419 = $dh_group_sizes_packed . Strings::packSSH2('ss', $primeBytes, $gBytes); + $params = DH::createParameters($prime, $g); + $clientKexInitMessage = 'NET_SSH2_MSG_KEXDH_GEX_INIT'; + $serverKexReplyMessage = 'NET_SSH2_MSG_KEXDH_GEX_REPLY'; + } else { + $params = DH::createParameters($this->kex_algorithm); + $clientKexInitMessage = 'NET_SSH2_MSG_KEXDH_INIT'; + $serverKexReplyMessage = 'NET_SSH2_MSG_KEXDH_REPLY'; + } + $keyLength = min($kexHash->getLengthInBytes(), max($encryptKeyLength, $decryptKeyLength)); + $ourPrivate = DH::createKey($params, 16 * $keyLength); + // 2 * 8 * $keyLength + $ourPublic = $ourPrivate->getPublicKey()->toBigInteger(); + $ourPublicBytes = $ourPublic->toBytes(\true); + } + $data = pack('CNa*', constant($clientKexInitMessage), strlen($ourPublicBytes), $ourPublicBytes); + $this->send_binary_packet($data); + switch ($clientKexInitMessage) { + case 'NET_SSH2_MSG_KEX_ECDH_INIT': + $this->updateLogHistory('NET_SSH2_MSG_KEXDH_INIT', 'NET_SSH2_MSG_KEX_ECDH_INIT'); + break; + case 'NET_SSH2_MSG_KEXDH_GEX_INIT': + $this->updateLogHistory('UNKNOWN (32)', 'NET_SSH2_MSG_KEXDH_GEX_INIT'); + } + $response = $this->get_binary_packet(); + list($type, $server_public_host_key, $theirPublicBytes, $this->signature) = Strings::unpackSSH2('Csss', $response); + if ($type != constant($serverKexReplyMessage)) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_PROTOCOL_ERROR); + throw new \UnexpectedValueException("Expected {$serverKexReplyMessage}"); + } + switch ($serverKexReplyMessage) { + case 'NET_SSH2_MSG_KEX_ECDH_REPLY': + $this->updateLogHistory('NET_SSH2_MSG_KEXDH_REPLY', 'NET_SSH2_MSG_KEX_ECDH_REPLY'); + break; + case 'NET_SSH2_MSG_KEXDH_GEX_REPLY': + $this->updateLogHistory('UNKNOWN (33)', 'NET_SSH2_MSG_KEXDH_GEX_REPLY'); + } + $this->server_public_host_key = $server_public_host_key; + list($public_key_format) = Strings::unpackSSH2('s', $server_public_host_key); + if (strlen($this->signature) < 4) { + throw new \LengthException('The signature needs at least four bytes'); + } + $temp = unpack('Nlength', substr($this->signature, 0, 4)); + $this->signature_format = substr($this->signature, 4, $temp['length']); + $keyBytes = DH::computeSecret($ourPrivate, $theirPublicBytes); + if (($keyBytes & "\xff\x80") === "\x00\x00") { + $keyBytes = substr($keyBytes, 1); + } elseif (($keyBytes[0] & "\x80") === "\x80") { + $keyBytes = "\x00{$keyBytes}"; + } + $this->exchange_hash = Strings::packSSH2('s5', $this->identifier, $this->server_identifier, $kexinit_payload_client, $kexinit_payload_server, $this->server_public_host_key); + $this->exchange_hash .= $exchange_hash_rfc4419; + $this->exchange_hash .= Strings::packSSH2('s3', $ourPublicBytes, $theirPublicBytes, $keyBytes); + $this->exchange_hash = $kexHash->hash($this->exchange_hash); + if ($this->session_id === \false) { + $this->session_id = $this->exchange_hash; + } + switch ($server_host_key_algorithm) { + case 'rsa-sha2-256': + case 'rsa-sha2-512': + //case 'ssh-rsa': + $expected_key_format = 'ssh-rsa'; + break; + default: + $expected_key_format = $server_host_key_algorithm; + } + if ($public_key_format != $expected_key_format || $this->signature_format != $server_host_key_algorithm) { + switch (\true) { + case $this->signature_format == $server_host_key_algorithm: + case $server_host_key_algorithm != 'rsa-sha2-256' && $server_host_key_algorithm != 'rsa-sha2-512': + case $this->signature_format != 'ssh-rsa': + $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); + throw new \RuntimeException('Server Host Key Algorithm Mismatch (' . $this->signature_format . ' vs ' . $server_host_key_algorithm . ')'); + } + } + $packet = pack('C', NET_SSH2_MSG_NEWKEYS); + $this->send_binary_packet($packet); + $response = $this->get_binary_packet(); + if ($response === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST); + throw new ConnectionClosedException('Connection closed by server'); + } + list($type) = Strings::unpackSSH2('C', $response); + if ($type != NET_SSH2_MSG_NEWKEYS) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_PROTOCOL_ERROR); + throw new \UnexpectedValueException('Expected SSH_MSG_NEWKEYS'); + } + if (in_array('kex-strict-s-v00@openssh.com', $this->kex_algorithms)) { + $this->get_seq_no = $this->send_seq_no = 0; + } + $keyBytes = pack('Na*', strlen($keyBytes), $keyBytes); + $this->encrypt = self::encryption_algorithm_to_crypt_instance($encrypt); + if ($this->encrypt) { + if (self::$crypto_engine) { + $this->encrypt->setPreferredEngine(self::$crypto_engine); + } + if ($this->encrypt->getBlockLengthInBytes()) { + $this->encrypt_block_size = $this->encrypt->getBlockLengthInBytes(); + } + $this->encrypt->disablePadding(); + if ($this->encrypt->usesIV()) { + $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id); + while ($this->encrypt_block_size > strlen($iv)) { + $iv .= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); + } + $this->encrypt->setIV(substr($iv, 0, $this->encrypt_block_size)); + } + switch ($encrypt) { + case 'aes128-gcm@openssh.com': + case 'aes256-gcm@openssh.com': + $nonce = $kexHash->hash($keyBytes . $this->exchange_hash . 'A' . $this->session_id); + $this->encryptFixedPart = substr($nonce, 0, 4); + $this->encryptInvocationCounter = substr($nonce, 4, 8); + // fall-through + case 'chacha20-poly1305@openssh.com': + break; + default: + $this->encrypt->enableContinuousBuffer(); + } + $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'C' . $this->session_id); + while ($encryptKeyLength > strlen($key)) { + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); + } + switch ($encrypt) { + case 'chacha20-poly1305@openssh.com': + $encryptKeyLength = 32; + $this->lengthEncrypt = self::encryption_algorithm_to_crypt_instance($encrypt); + $this->lengthEncrypt->setKey(substr($key, 32, 32)); + } + $this->encrypt->setKey(substr($key, 0, $encryptKeyLength)); + $this->encryptName = $encrypt; + } + $this->decrypt = self::encryption_algorithm_to_crypt_instance($decrypt); + if ($this->decrypt) { + if (self::$crypto_engine) { + $this->decrypt->setPreferredEngine(self::$crypto_engine); + } + if ($this->decrypt->getBlockLengthInBytes()) { + $this->decrypt_block_size = $this->decrypt->getBlockLengthInBytes(); + } + $this->decrypt->disablePadding(); + if ($this->decrypt->usesIV()) { + $iv = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id); + while ($this->decrypt_block_size > strlen($iv)) { + $iv .= $kexHash->hash($keyBytes . $this->exchange_hash . $iv); + } + $this->decrypt->setIV(substr($iv, 0, $this->decrypt_block_size)); + } + switch ($decrypt) { + case 'aes128-gcm@openssh.com': + case 'aes256-gcm@openssh.com': + // see https://tools.ietf.org/html/rfc5647#section-7.1 + $nonce = $kexHash->hash($keyBytes . $this->exchange_hash . 'B' . $this->session_id); + $this->decryptFixedPart = substr($nonce, 0, 4); + $this->decryptInvocationCounter = substr($nonce, 4, 8); + // fall-through + case 'chacha20-poly1305@openssh.com': + break; + default: + $this->decrypt->enableContinuousBuffer(); + } + $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'D' . $this->session_id); + while ($decryptKeyLength > strlen($key)) { + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); + } + switch ($decrypt) { + case 'chacha20-poly1305@openssh.com': + $decryptKeyLength = 32; + $this->lengthDecrypt = self::encryption_algorithm_to_crypt_instance($decrypt); + $this->lengthDecrypt->setKey(substr($key, 32, 32)); + } + $this->decrypt->setKey(substr($key, 0, $decryptKeyLength)); + $this->decryptName = $decrypt; + } + /* The "arcfour128" algorithm is the RC4 cipher, as described in + [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream + generated by the cipher MUST be discarded, and the first byte of the + first encrypted packet MUST be encrypted using the 1537th byte of + keystream. + + -- http://tools.ietf.org/html/rfc4345#section-4 */ + if ($encrypt == 'arcfour128' || $encrypt == 'arcfour256') { + $this->encrypt->encrypt(str_repeat("\x00", 1536)); + } + if ($decrypt == 'arcfour128' || $decrypt == 'arcfour256') { + $this->decrypt->decrypt(str_repeat("\x00", 1536)); + } + if (!$this->encrypt->usesNonce()) { + list($this->hmac_create, $createKeyLength) = self::mac_algorithm_to_hash_instance($mac_algorithm_out); + } else { + $this->hmac_create = new \stdClass(); + $this->hmac_create_name = $mac_algorithm_out; + //$mac_algorithm_out = 'none'; + $createKeyLength = 0; + } + if ($this->hmac_create instanceof Hash) { + $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'E' . $this->session_id); + while ($createKeyLength > strlen($key)) { + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); + } + $this->hmac_create->setKey(substr($key, 0, $createKeyLength)); + $this->hmac_create_name = $mac_algorithm_out; + $this->hmac_create_etm = preg_match('#-etm@openssh\\.com$#', $mac_algorithm_out); + } + if (!$this->decrypt->usesNonce()) { + list($this->hmac_check, $checkKeyLength) = self::mac_algorithm_to_hash_instance($mac_algorithm_in); + $this->hmac_size = $this->hmac_check->getLengthInBytes(); + } else { + $this->hmac_check = new \stdClass(); + $this->hmac_check_name = $mac_algorithm_in; + //$mac_algorithm_in = 'none'; + $checkKeyLength = 0; + $this->hmac_size = 0; + } + if ($this->hmac_check instanceof Hash) { + $key = $kexHash->hash($keyBytes . $this->exchange_hash . 'F' . $this->session_id); + while ($checkKeyLength > strlen($key)) { + $key .= $kexHash->hash($keyBytes . $this->exchange_hash . $key); + } + $this->hmac_check->setKey(substr($key, 0, $checkKeyLength)); + $this->hmac_check_name = $mac_algorithm_in; + $this->hmac_check_etm = preg_match('#-etm@openssh\\.com$#', $mac_algorithm_in); + } + $this->regenerate_compression_context = $this->regenerate_decompression_context = \true; + return \true; + } + /** + * Maps an encryption algorithm name to the number of key bytes. + * + * @param string $algorithm Name of the encryption algorithm + * @return int|null Number of bytes as an integer or null for unknown + */ + private function encryption_algorithm_to_key_size($algorithm) + { + if ($this->bad_key_size_fix && self::bad_algorithm_candidate($algorithm)) { + return 16; + } + switch ($algorithm) { + case 'none': + return 0; + case 'aes128-gcm@openssh.com': + case 'aes128-cbc': + case 'aes128-ctr': + case 'arcfour': + case 'arcfour128': + case 'blowfish-cbc': + case 'blowfish-ctr': + case 'twofish128-cbc': + case 'twofish128-ctr': + return 16; + case '3des-cbc': + case '3des-ctr': + case 'aes192-cbc': + case 'aes192-ctr': + case 'twofish192-cbc': + case 'twofish192-ctr': + return 24; + case 'aes256-gcm@openssh.com': + case 'aes256-cbc': + case 'aes256-ctr': + case 'arcfour256': + case 'twofish-cbc': + case 'twofish256-cbc': + case 'twofish256-ctr': + return 32; + case 'chacha20-poly1305@openssh.com': + return 64; + } + return null; + } + /** + * Maps an encryption algorithm name to an instance of a subclass of + * \phpseclib3\Crypt\Common\SymmetricKey. + * + * @param string $algorithm Name of the encryption algorithm + * @return SymmetricKey|null + */ + private static function encryption_algorithm_to_crypt_instance($algorithm) + { + switch ($algorithm) { + case '3des-cbc': + return new TripleDES('cbc'); + case '3des-ctr': + return new TripleDES('ctr'); + case 'aes256-cbc': + case 'aes192-cbc': + case 'aes128-cbc': + return new Rijndael('cbc'); + case 'aes256-ctr': + case 'aes192-ctr': + case 'aes128-ctr': + return new Rijndael('ctr'); + case 'blowfish-cbc': + return new Blowfish('cbc'); + case 'blowfish-ctr': + return new Blowfish('ctr'); + case 'twofish128-cbc': + case 'twofish192-cbc': + case 'twofish256-cbc': + case 'twofish-cbc': + return new Twofish('cbc'); + case 'twofish128-ctr': + case 'twofish192-ctr': + case 'twofish256-ctr': + return new Twofish('ctr'); + case 'arcfour': + case 'arcfour128': + case 'arcfour256': + return new RC4(); + case 'aes128-gcm@openssh.com': + case 'aes256-gcm@openssh.com': + return new Rijndael('gcm'); + case 'chacha20-poly1305@openssh.com': + return new ChaCha20(); + } + return null; + } + /** + * Maps an encryption algorithm name to an instance of a subclass of + * \phpseclib3\Crypt\Hash. + * + * @param string $algorithm Name of the encryption algorithm + * @return array{Hash, int}|null + */ + private static function mac_algorithm_to_hash_instance($algorithm) + { + switch ($algorithm) { + case 'umac-64@openssh.com': + case 'umac-64-etm@openssh.com': + return [new Hash('umac-64'), 16]; + case 'umac-128@openssh.com': + case 'umac-128-etm@openssh.com': + return [new Hash('umac-128'), 16]; + case 'hmac-sha2-512': + case 'hmac-sha2-512-etm@openssh.com': + return [new Hash('sha512'), 64]; + case 'hmac-sha2-256': + case 'hmac-sha2-256-etm@openssh.com': + return [new Hash('sha256'), 32]; + case 'hmac-sha1': + case 'hmac-sha1-etm@openssh.com': + return [new Hash('sha1'), 20]; + case 'hmac-sha1-96': + return [new Hash('sha1-96'), 20]; + case 'hmac-md5': + return [new Hash('md5'), 16]; + case 'hmac-md5-96': + return [new Hash('md5-96'), 16]; + } + } + /* + * Tests whether or not proposed algorithm has a potential for issues + * + * @link https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/ssh2-aesctr-openssh.html + * @link https://bugzilla.mindrot.org/show_bug.cgi?id=1291 + * @param string $algorithm Name of the encryption algorithm + * @return bool + */ + private static function bad_algorithm_candidate($algorithm) + { + switch ($algorithm) { + case 'arcfour256': + case 'aes192-ctr': + case 'aes256-ctr': + return \true; + } + return \false; + } + /** + * Login + * + * The $password parameter can be a plaintext password, a \phpseclib3\Crypt\RSA|EC|DSA object, a \phpseclib3\System\SSH\Agent object or an array + * + * @param string $username + * @param string|PrivateKey|array[]|Agent|null ...$args + * @return bool + * @see self::_login() + */ + public function login($username, ...$args) + { + if (!$this->retry_connect) { + $this->auth[] = func_get_args(); + } + // try logging with 'none' as an authentication method first since that's what + // PuTTY does + if (substr($this->server_identifier, 0, 15) != 'SSH-2.0-CoreFTP' && $this->auth_methods_to_continue === null) { + if ($this->sublogin($username)) { + return \true; + } + if (!count($args)) { + return \false; + } + } + return $this->sublogin($username, ...$args); + } + /** + * Login Helper + * + * @param string $username + * @param string|PrivateKey|array[]|Agent|null ...$args + * @return bool + * @see self::_login_helper() + */ + protected function sublogin($username, ...$args) + { + if (!($this->bitmap & self::MASK_CONSTRUCTOR)) { + $this->connect(); + } + if (empty($args)) { + return $this->login_helper($username); + } + foreach ($args as $arg) { + switch (\true) { + case $arg instanceof PublicKey: + throw new \UnexpectedValueException('A PublicKey object was passed to the login method instead of a PrivateKey object'); + case $arg instanceof PrivateKey: + case $arg instanceof Agent: + case is_array($arg): + case Strings::is_stringable($arg): + break; + default: + throw new \UnexpectedValueException('$password needs to either be an instance of \\phpseclib3\\Crypt\\Common\\PrivateKey, \\System\\SSH\\Agent, an array or a string'); + } + } + while (count($args)) { + if (!$this->auth_methods_to_continue || !$this->smartMFA) { + $newargs = $args; + $args = []; + } else { + $newargs = []; + foreach ($this->auth_methods_to_continue as $method) { + switch ($method) { + case 'publickey': + foreach ($args as $key => $arg) { + if ($arg instanceof PrivateKey || $arg instanceof Agent) { + $newargs[] = $arg; + unset($args[$key]); + break; + } + } + break; + case 'keyboard-interactive': + $hasArray = $hasString = \false; + foreach ($args as $arg) { + if ($hasArray || is_array($arg)) { + $hasArray = \true; + break; + } + if ($hasString || Strings::is_stringable($arg)) { + $hasString = \true; + break; + } + } + if ($hasArray && $hasString) { + foreach ($args as $key => $arg) { + if (is_array($arg)) { + $newargs[] = $arg; + break 2; + } + } + } + // fall-through + case 'password': + foreach ($args as $key => $arg) { + $newargs[] = $arg; + unset($args[$key]); + break; + } + } + } + } + if (!count($newargs)) { + return \false; + } + foreach ($newargs as $arg) { + if ($this->login_helper($username, $arg)) { + return \true; + } + } + } + return \false; + } + /** + * Login Helper + * + * {@internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis} + * by sending dummy SSH_MSG_IGNORE messages.} + * + * @param string $username + * @param string|AsymmetricKey|array[]|Agent|null ...$args + * @return bool + * @throws \UnexpectedValueException on receipt of unexpected packets + * @throws \RuntimeException on other errors + */ + private function login_helper($username, $password = null) + { + if (!($this->bitmap & self::MASK_CONNECTED)) { + return \false; + } + if (!($this->bitmap & self::MASK_LOGIN_REQ)) { + $packet = Strings::packSSH2('Cs', NET_SSH2_MSG_SERVICE_REQUEST, 'ssh-userauth'); + $this->send_binary_packet($packet); + try { + $response = $this->get_binary_packet(); + } catch (\Exception $e) { + if ($this->retry_connect) { + $this->retry_connect = \false; + $this->connect(); + return $this->login_helper($username, $password); + } + $this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST); + throw $e; + } + list($type) = Strings::unpackSSH2('C', $response); + if ($type == NET_SSH2_MSG_EXT_INFO) { + list($nr_extensions) = Strings::unpackSSH2('N', $response); + for ($i = 0; $i < $nr_extensions; $i++) { + list($extension_name, $extension_value) = Strings::unpackSSH2('ss', $response); + if ($extension_name == 'server-sig-algs') { + $this->supported_private_key_algorithms = explode(',', $extension_value); + } + } + $response = $this->get_binary_packet(); + list($type) = Strings::unpackSSH2('C', $response); + } + list($service) = Strings::unpackSSH2('s', $response); + if ($type != NET_SSH2_MSG_SERVICE_ACCEPT || $service != 'ssh-userauth') { + $this->disconnect_helper(NET_SSH2_DISCONNECT_PROTOCOL_ERROR); + throw new \UnexpectedValueException('Expected SSH_MSG_SERVICE_ACCEPT'); + } + $this->bitmap |= self::MASK_LOGIN_REQ; + } + if (strlen($this->last_interactive_response)) { + return !Strings::is_stringable($password) && !is_array($password) ? \false : $this->keyboard_interactive_process($password); + } + if ($password instanceof PrivateKey) { + return $this->privatekey_login($username, $password); + } + if ($password instanceof Agent) { + return $this->ssh_agent_login($username, $password); + } + if (is_array($password)) { + if ($this->keyboard_interactive_login($username, $password)) { + $this->bitmap |= self::MASK_LOGIN; + return \true; + } + return \false; + } + if (!isset($password)) { + $packet = Strings::packSSH2('Cs3', NET_SSH2_MSG_USERAUTH_REQUEST, $username, 'ssh-connection', 'none'); + $this->send_binary_packet($packet); + $response = $this->get_binary_packet(); + list($type) = Strings::unpackSSH2('C', $response); + switch ($type) { + case NET_SSH2_MSG_USERAUTH_SUCCESS: + $this->bitmap |= self::MASK_LOGIN; + return \true; + case NET_SSH2_MSG_USERAUTH_FAILURE: + list($auth_methods) = Strings::unpackSSH2('L', $response); + $this->auth_methods_to_continue = $auth_methods; + // fall-through + default: + return \false; + } + } + $packet = Strings::packSSH2('Cs3bs', NET_SSH2_MSG_USERAUTH_REQUEST, $username, 'ssh-connection', 'password', \false, $password); + // remove the username and password from the logged packet + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SSH2_LOGGING')) { + $logged = null; + } else { + $logged = Strings::packSSH2('Cs3bs', NET_SSH2_MSG_USERAUTH_REQUEST, $username, 'ssh-connection', 'password', \false, 'password'); + } + $this->send_binary_packet($packet, $logged); + $response = $this->get_binary_packet(); + if ($response === \false) { + return \false; + } + list($type) = Strings::unpackSSH2('C', $response); + switch ($type) { + case NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: + // in theory, the password can be changed + $this->updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ'); + list($message) = Strings::unpackSSH2('s', $response); + $this->errors[] = 'SSH_MSG_USERAUTH_PASSWD_CHANGEREQ: ' . $message; + return $this->disconnect_helper(NET_SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER); + case NET_SSH2_MSG_USERAUTH_FAILURE: + // can we use keyboard-interactive authentication? if not then either the login is bad or the server employees + // multi-factor authentication + list($auth_methods, $partial_success) = Strings::unpackSSH2('Lb', $response); + $this->auth_methods_to_continue = $auth_methods; + if (!$partial_success && in_array('keyboard-interactive', $auth_methods)) { + if ($this->keyboard_interactive_login($username, $password)) { + $this->bitmap |= self::MASK_LOGIN; + return \true; + } + return \false; + } + return \false; + case NET_SSH2_MSG_USERAUTH_SUCCESS: + $this->bitmap |= self::MASK_LOGIN; + return \true; + } + return \false; + } + /** + * Login via keyboard-interactive authentication + * + * See {@link http://tools.ietf.org/html/rfc4256 RFC4256} for details. This is not a full-featured keyboard-interactive authenticator. + * + * @param string $username + * @param string|array $password + * @return bool + */ + private function keyboard_interactive_login($username, $password) + { + $packet = Strings::packSSH2( + 'Cs5', + NET_SSH2_MSG_USERAUTH_REQUEST, + $username, + 'ssh-connection', + 'keyboard-interactive', + '', + // language tag + '' + ); + $this->send_binary_packet($packet); + return $this->keyboard_interactive_process($password); + } + /** + * Handle the keyboard-interactive requests / responses. + * + * @param string|array ...$responses + * @return bool + * @throws \RuntimeException on connection error + */ + private function keyboard_interactive_process(...$responses) + { + if (strlen($this->last_interactive_response)) { + $response = $this->last_interactive_response; + } else { + $orig = $response = $this->get_binary_packet(); + } + list($type) = Strings::unpackSSH2('C', $response); + switch ($type) { + case NET_SSH2_MSG_USERAUTH_INFO_REQUEST: + list(, , , $num_prompts) = Strings::unpackSSH2('s3N', $response); + for ($i = 0; $i < count($responses); $i++) { + if (is_array($responses[$i])) { + foreach ($responses[$i] as $key => $value) { + $this->keyboard_requests_responses[$key] = $value; + } + unset($responses[$i]); + } + } + $responses = array_values($responses); + if (isset($this->keyboard_requests_responses)) { + for ($i = 0; $i < $num_prompts; $i++) { + list($prompt, ) = Strings::unpackSSH2('sC', $response); + foreach ($this->keyboard_requests_responses as $key => $value) { + if (substr($prompt, 0, strlen($key)) == $key) { + $responses[] = $value; + break; + } + } + } + } + // see http://tools.ietf.org/html/rfc4256#section-3.2 + if (strlen($this->last_interactive_response)) { + $this->last_interactive_response = ''; + } else { + $this->updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_INFO_REQUEST'); + } + if (!count($responses) && $num_prompts) { + $this->last_interactive_response = $orig; + return \false; + } + /* + After obtaining the requested information from the user, the client + MUST respond with an SSH_MSG_USERAUTH_INFO_RESPONSE message. + */ + // see http://tools.ietf.org/html/rfc4256#section-3.4 + $packet = $logged = pack('CN', NET_SSH2_MSG_USERAUTH_INFO_RESPONSE, count($responses)); + for ($i = 0; $i < count($responses); $i++) { + $packet .= Strings::packSSH2('s', $responses[$i]); + $logged .= Strings::packSSH2('s', 'dummy-answer'); + } + $this->send_binary_packet($packet, $logged); + $this->updateLogHistory('UNKNOWN (61)', 'NET_SSH2_MSG_USERAUTH_INFO_RESPONSE'); + /* + After receiving the response, the server MUST send either an + SSH_MSG_USERAUTH_SUCCESS, SSH_MSG_USERAUTH_FAILURE, or another + SSH_MSG_USERAUTH_INFO_REQUEST message. + */ + // maybe phpseclib should force close the connection after x request / responses? unless something like that is done + // there could be an infinite loop of request / responses. + return $this->keyboard_interactive_process(); + case NET_SSH2_MSG_USERAUTH_SUCCESS: + return \true; + case NET_SSH2_MSG_USERAUTH_FAILURE: + list($auth_methods) = Strings::unpackSSH2('L', $response); + $this->auth_methods_to_continue = $auth_methods; + return \false; + } + return \false; + } + /** + * Login with an ssh-agent provided key + * + * @param string $username + * @param \phpseclib3\System\SSH\Agent $agent + * @return bool + */ + private function ssh_agent_login($username, Agent $agent) + { + $this->agent = $agent; + $keys = $agent->requestIdentities(); + foreach ($keys as $key) { + if ($this->privatekey_login($username, $key)) { + return \true; + } + } + return \false; + } + /** + * Login with an RSA private key + * + * {@internal It might be worthwhile, at some point, to protect against {@link http://tools.ietf.org/html/rfc4251#section-9.3.9 traffic analysis} + * by sending dummy SSH_MSG_IGNORE messages.} + * + * @param string $username + * @param \phpseclib3\Crypt\Common\PrivateKey $privatekey + * @return bool + * @throws \RuntimeException on connection error + */ + private function privatekey_login($username, PrivateKey $privatekey) + { + $publickey = $privatekey->getPublicKey(); + if ($publickey instanceof RSA) { + $privatekey = $privatekey->withPadding(RSA::SIGNATURE_PKCS1); + $algos = ['rsa-sha2-256', 'rsa-sha2-512', 'ssh-rsa']; + if (isset($this->preferred['hostkey'])) { + $algos = array_intersect($algos, $this->preferred['hostkey']); + } + $algo = self::array_intersect_first($algos, $this->supported_private_key_algorithms); + switch ($algo) { + case 'rsa-sha2-512': + $hash = 'sha512'; + $signatureType = 'rsa-sha2-512'; + break; + case 'rsa-sha2-256': + $hash = 'sha256'; + $signatureType = 'rsa-sha2-256'; + break; + //case 'ssh-rsa': + default: + $hash = 'sha1'; + $signatureType = 'ssh-rsa'; + } + } elseif ($publickey instanceof EC) { + $privatekey = $privatekey->withSignatureFormat('SSH2'); + $curveName = $privatekey->getCurve(); + switch ($curveName) { + case 'Ed25519': + $hash = 'sha512'; + $signatureType = 'ssh-ed25519'; + break; + case 'secp256r1': + // nistp256 + $hash = 'sha256'; + $signatureType = 'ecdsa-sha2-nistp256'; + break; + case 'secp384r1': + // nistp384 + $hash = 'sha384'; + $signatureType = 'ecdsa-sha2-nistp384'; + break; + case 'secp521r1': + // nistp521 + $hash = 'sha512'; + $signatureType = 'ecdsa-sha2-nistp521'; + break; + default: + if (is_array($curveName)) { + throw new UnsupportedCurveException('Specified Curves are not supported by SSH2'); + } + throw new UnsupportedCurveException('Named Curve of ' . $curveName . ' is not supported by phpseclib3\'s SSH2 implementation'); + } + } elseif ($publickey instanceof DSA) { + $privatekey = $privatekey->withSignatureFormat('SSH2'); + $hash = 'sha1'; + $signatureType = 'ssh-dss'; + } else { + throw new UnsupportedAlgorithmException('Please use either an RSA key, an EC one or a DSA key'); + } + $publickeyStr = $publickey->toString('OpenSSH', ['binary' => \true]); + $part1 = Strings::packSSH2('Csss', NET_SSH2_MSG_USERAUTH_REQUEST, $username, 'ssh-connection', 'publickey'); + $part2 = Strings::packSSH2('ss', $signatureType, $publickeyStr); + $packet = $part1 . chr(0) . $part2; + $this->send_binary_packet($packet); + $response = $this->get_binary_packet(); + list($type) = Strings::unpackSSH2('C', $response); + switch ($type) { + case NET_SSH2_MSG_USERAUTH_FAILURE: + list($auth_methods) = Strings::unpackSSH2('L', $response); + if (in_array('publickey', $auth_methods) && substr($signatureType, 0, 9) == 'rsa-sha2-') { + $this->supported_private_key_algorithms = array_diff($this->supported_private_key_algorithms, ['rsa-sha2-256', 'rsa-sha2-512']); + return $this->privatekey_login($username, $privatekey); + } + $this->auth_methods_to_continue = $auth_methods; + $this->errors[] = 'SSH_MSG_USERAUTH_FAILURE'; + return \false; + case NET_SSH2_MSG_USERAUTH_PK_OK: + // we'll just take it on faith that the public key blob and the public key algorithm name are as + // they should be + $this->updateLogHistory('UNKNOWN (60)', 'NET_SSH2_MSG_USERAUTH_PK_OK'); + break; + case NET_SSH2_MSG_USERAUTH_SUCCESS: + $this->bitmap |= self::MASK_LOGIN; + return \true; + default: + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new ConnectionClosedException('Unexpected response to publickey authentication pt 1'); + } + $packet = $part1 . chr(1) . $part2; + $privatekey = $privatekey->withHash($hash); + $signature = $privatekey->sign(Strings::packSSH2('s', $this->session_id) . $packet); + if ($publickey instanceof RSA) { + $signature = Strings::packSSH2('ss', $signatureType, $signature); + } + $packet .= Strings::packSSH2('s', $signature); + $this->send_binary_packet($packet); + $response = $this->get_binary_packet(); + list($type) = Strings::unpackSSH2('C', $response); + switch ($type) { + case NET_SSH2_MSG_USERAUTH_FAILURE: + // either the login is bad or the server employs multi-factor authentication + list($auth_methods) = Strings::unpackSSH2('L', $response); + $this->auth_methods_to_continue = $auth_methods; + return \false; + case NET_SSH2_MSG_USERAUTH_SUCCESS: + $this->bitmap |= self::MASK_LOGIN; + return \true; + } + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new ConnectionClosedException('Unexpected response to publickey authentication pt 2'); + } + /** + * Return the currently configured timeout + * + * @return int + */ + public function getTimeout() + { + return $this->timeout; + } + /** + * Set Timeout + * + * $ssh->exec('ping 127.0.0.1'); on a Linux host will never return and will run indefinitely. setTimeout() makes it so it'll timeout. + * Setting $timeout to false or 0 will mean there is no timeout. + * + * @param mixed $timeout + */ + public function setTimeout($timeout) + { + $this->timeout = $this->curTimeout = $timeout; + } + /** + * Set Keep Alive + * + * Sends an SSH2_MSG_IGNORE message every x seconds, if x is a positive non-zero number. + * + * @param int $interval + */ + public function setKeepAlive($interval) + { + $this->keepAlive = $interval; + } + /** + * Get the output from stdError + * + */ + public function getStdError() + { + return $this->stdErrorLog; + } + /** + * Execute Command + * + * If $callback is set to false then \phpseclib3\Net\SSH2::get_channel_packet(self::CHANNEL_EXEC) will need to be called manually. + * In all likelihood, this is not a feature you want to be taking advantage of. + * + * @param string $command + * @return string|bool + * @psalm-return ($callback is callable ? bool : string|bool) + * @throws \RuntimeException on connection error + */ + public function exec($command, callable $callback = null) + { + $this->curTimeout = $this->timeout; + $this->is_timeout = \false; + $this->stdErrorLog = ''; + if (!$this->isAuthenticated()) { + return \false; + } + //if ($this->isPTYOpen()) { + // throw new \RuntimeException('If you want to run multiple exec()\'s you will need to disable (and re-enable if appropriate) a PTY for each one.'); + //} + $this->openChannel(self::CHANNEL_EXEC); + if ($this->request_pty === \true) { + $terminal_modes = pack('C', NET_SSH2_TTY_OP_END); + $packet = Strings::packSSH2('CNsCsN4s', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_EXEC], 'pty-req', 1, $this->term, $this->windowColumns, $this->windowRows, 0, 0, $terminal_modes); + $this->send_binary_packet($packet); + $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_REQUEST; + if (!$this->get_channel_packet(self::CHANNEL_EXEC)) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new \RuntimeException('Unable to request pseudo-terminal'); + } + } + // sending a pty-req SSH_MSG_CHANNEL_REQUEST message is unnecessary and, in fact, in most cases, slows things + // down. the one place where it might be desirable is if you're doing something like \phpseclib3\Net\SSH2::exec('ping localhost &'). + // with a pty-req SSH_MSG_CHANNEL_REQUEST, exec() will return immediately and the ping process will then + // then immediately terminate. without such a request exec() will loop indefinitely. the ping process won't end but + // neither will your script. + // although, in theory, the size of SSH_MSG_CHANNEL_REQUEST could exceed the maximum packet size established by + // SSH_MSG_CHANNEL_OPEN_CONFIRMATION, RFC4254#section-5.1 states that the "maximum packet size" refers to the + // "maximum size of an individual data packet". ie. SSH_MSG_CHANNEL_DATA. RFC4254#section-5.2 corroborates. + $packet = Strings::packSSH2('CNsCs', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_EXEC], 'exec', 1, $command); + $this->send_binary_packet($packet); + $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_REQUEST; + if (!$this->get_channel_packet(self::CHANNEL_EXEC)) { + return \false; + } + $this->channel_status[self::CHANNEL_EXEC] = NET_SSH2_MSG_CHANNEL_DATA; + if ($this->request_pty === \true) { + $this->channel_id_last_interactive = self::CHANNEL_EXEC; + return \true; + } + $output = ''; + while (\true) { + $temp = $this->get_channel_packet(self::CHANNEL_EXEC); + switch (\true) { + case $temp === \true: + return is_callable($callback) ? \true : $output; + case $temp === \false: + return \false; + default: + if (is_callable($callback)) { + if ($callback($temp) === \true) { + $this->close_channel(self::CHANNEL_EXEC); + return \true; + } + } else { + $output .= $temp; + } + } + } + } + /** + * How many channels are currently open? + * + * @return int + */ + public function getOpenChannelCount() + { + return $this->channelCount; + } + /** + * Opens a channel + * + * @param string $channel + * @param bool $skip_extended + * @return bool + */ + protected function openChannel($channel, $skip_extended = \false) + { + if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) { + throw new \RuntimeException('Please close the channel (' . $channel . ') before trying to open it again'); + } + $this->channelCount++; + if ($this->channelCount > 1 && $this->errorOnMultipleChannels) { + throw new \RuntimeException("Ubuntu's OpenSSH from 5.8 to 6.9 doesn't work with multiple channels"); + } + // RFC4254 defines the (client) window size as "bytes the other party can send before it must wait for the window to + // be adjusted". 0x7FFFFFFF is, at 2GB, the max size. technically, it should probably be decremented, but, + // honestly, if you're transferring more than 2GB, you probably shouldn't be using phpseclib, anyway. + // see http://tools.ietf.org/html/rfc4254#section-5.2 for more info + $this->window_size_server_to_client[$channel] = $this->window_size; + // 0x8000 is the maximum max packet size, per http://tools.ietf.org/html/rfc4253#section-6.1, although since PuTTy + // uses 0x4000, that's what will be used here, as well. + $packet_size = 0x4000; + $packet = Strings::packSSH2('CsN3', NET_SSH2_MSG_CHANNEL_OPEN, 'session', $channel, $this->window_size_server_to_client[$channel], $packet_size); + $this->send_binary_packet($packet); + $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_OPEN; + return $this->get_channel_packet($channel, $skip_extended); + } + /** + * Creates an interactive shell + * + * Returns bool(true) if the shell was opened. + * Returns bool(false) if the shell was already open. + * + * @see self::isShellOpen() + * @see self::read() + * @see self::write() + * @return bool + * @throws InsufficientSetupException if not authenticated + * @throws \UnexpectedValueException on receipt of unexpected packets + * @throws \RuntimeException on other errors + */ + public function openShell() + { + if (!$this->isAuthenticated()) { + throw new InsufficientSetupException('Operation disallowed prior to login()'); + } + $this->openChannel(self::CHANNEL_SHELL); + $terminal_modes = pack('C', NET_SSH2_TTY_OP_END); + $packet = Strings::packSSH2( + 'CNsbsN4s', + NET_SSH2_MSG_CHANNEL_REQUEST, + $this->server_channels[self::CHANNEL_SHELL], + 'pty-req', + \true, + // want reply + $this->term, + $this->windowColumns, + $this->windowRows, + 0, + 0, + $terminal_modes + ); + $this->send_binary_packet($packet); + $this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_REQUEST; + if (!$this->get_channel_packet(self::CHANNEL_SHELL)) { + throw new \RuntimeException('Unable to request pty'); + } + $packet = Strings::packSSH2('CNsb', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_SHELL], 'shell', \true); + $this->send_binary_packet($packet); + $response = $this->get_channel_packet(self::CHANNEL_SHELL); + if ($response === \false) { + throw new \RuntimeException('Unable to request shell'); + } + $this->channel_status[self::CHANNEL_SHELL] = NET_SSH2_MSG_CHANNEL_DATA; + $this->channel_id_last_interactive = self::CHANNEL_SHELL; + $this->bitmap |= self::MASK_SHELL; + return \true; + } + /** + * Return the channel to be used with read(), write(), and reset(), if none were specified + * @deprecated for lack of transparency in intended channel target, to be potentially replaced + * with method which guarantees open-ness of all yielded channels and throws + * error for multiple open channels + * @see self::read() + * @see self::write() + * @return int + */ + private function get_interactive_channel() + { + switch (\true) { + case $this->is_channel_status_data(self::CHANNEL_SUBSYSTEM): + return self::CHANNEL_SUBSYSTEM; + case $this->is_channel_status_data(self::CHANNEL_EXEC): + return self::CHANNEL_EXEC; + default: + return self::CHANNEL_SHELL; + } + } + /** + * Indicates the DATA status on the given channel + * + * @param int $channel The channel number to evaluate + * @return bool + */ + private function is_channel_status_data($channel) + { + return isset($this->channel_status[$channel]) && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA; + } + /** + * Return an available open channel + * + * @return int + */ + private function get_open_channel() + { + $channel = self::CHANNEL_EXEC; + do { + if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_OPEN) { + return $channel; + } + } while ($channel++ < self::CHANNEL_SUBSYSTEM); + return \false; + } + /** + * Request agent forwarding of remote server + * + * @return bool + */ + public function requestAgentForwarding() + { + $request_channel = $this->get_open_channel(); + if ($request_channel === \false) { + return \false; + } + $packet = Strings::packSSH2('CNsC', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[$request_channel], 'auth-agent-req@openssh.com', 1); + $this->channel_status[$request_channel] = NET_SSH2_MSG_CHANNEL_REQUEST; + $this->send_binary_packet($packet); + if (!$this->get_channel_packet($request_channel)) { + return \false; + } + $this->channel_status[$request_channel] = NET_SSH2_MSG_CHANNEL_OPEN; + return \true; + } + /** + * Returns the output of an interactive shell + * + * Returns when there's a match for $expect, which can take the form of a string literal or, + * if $mode == self::READ_REGEX, a regular expression. + * + * If not specifying a channel, an open interactive channel will be selected, or, if there are + * no open channels, an interactive shell will be created. If there are multiple open + * interactive channels, a legacy behavior will apply in which channel selection prioritizes + * an active subsystem, the exec pty, and, lastly, the shell. If using multiple interactive + * channels, callers are discouraged from relying on this legacy behavior and should specify + * the intended channel. + * + * @see self::write() + * @param string $expect + * @param int $mode One of the self::READ_* constants + * @param int|null $channel Channel id returned by self::getInteractiveChannelId() + * @return string|bool|null + * @throws \RuntimeException on connection error + * @throws InsufficientSetupException on unexpected channel status, possibly due to closure + */ + public function read($expect = '', $mode = self::READ_SIMPLE, $channel = null) + { + if (!$this->isAuthenticated()) { + throw new InsufficientSetupException('Operation disallowed prior to login()'); + } + $this->curTimeout = $this->timeout; + $this->is_timeout = \false; + if ($channel === null) { + $channel = $this->get_interactive_channel(); + } + if (!$this->is_channel_status_data($channel) && empty($this->channel_buffers[$channel])) { + if ($channel != self::CHANNEL_SHELL) { + throw new InsufficientSetupException('Data is not available on channel'); + } elseif (!$this->openShell()) { + throw new \RuntimeException('Unable to initiate an interactive shell session'); + } + } + if ($mode == self::READ_NEXT) { + return $this->get_channel_packet($channel); + } + $match = $expect; + while (\true) { + if ($mode == self::READ_REGEX) { + preg_match($expect, substr($this->interactiveBuffer, -1024), $matches); + $match = isset($matches[0]) ? $matches[0] : ''; + } + $pos = strlen($match) ? strpos($this->interactiveBuffer, $match) : \false; + if ($pos !== \false) { + return Strings::shift($this->interactiveBuffer, $pos + strlen($match)); + } + $response = $this->get_channel_packet($channel); + if ($response === \true) { + return Strings::shift($this->interactiveBuffer, strlen($this->interactiveBuffer)); + } + $this->interactiveBuffer .= $response; + } + } + /** + * Inputs a command into an interactive shell. + * + * If not specifying a channel, an open interactive channel will be selected, or, if there are + * no open channels, an interactive shell will be created. If there are multiple open + * interactive channels, a legacy behavior will apply in which channel selection prioritizes + * an active subsystem, the exec pty, and, lastly, the shell. If using multiple interactive + * channels, callers are discouraged from relying on this legacy behavior and should specify + * the intended channel. + * + * @see SSH2::read() + * @param string $cmd + * @param int|null $channel Channel id returned by self::getInteractiveChannelId() + * @return void + * @throws \RuntimeException on connection error + * @throws InsufficientSetupException on unexpected channel status, possibly due to closure + */ + public function write($cmd, $channel = null) + { + if (!$this->isAuthenticated()) { + throw new InsufficientSetupException('Operation disallowed prior to login()'); + } + if ($channel === null) { + $channel = $this->get_interactive_channel(); + } + if (!$this->is_channel_status_data($channel)) { + if ($channel != self::CHANNEL_SHELL) { + throw new InsufficientSetupException('Data is not available on channel'); + } elseif (!$this->openShell()) { + throw new \RuntimeException('Unable to initiate an interactive shell session'); + } + } + $this->send_channel_packet($channel, $cmd); + } + /** + * Start a subsystem. + * + * Right now only one subsystem at a time is supported. To support multiple subsystem's stopSubsystem() could accept + * a string that contained the name of the subsystem, but at that point, only one subsystem of each type could be opened. + * To support multiple subsystem's of the same name maybe it'd be best if startSubsystem() generated a new channel id and + * returns that and then that that was passed into stopSubsystem() but that'll be saved for a future date and implemented + * if there's sufficient demand for such a feature. + * + * @see self::stopSubsystem() + * @param string $subsystem + * @return bool + */ + public function startSubsystem($subsystem) + { + $this->openChannel(self::CHANNEL_SUBSYSTEM); + $packet = Strings::packSSH2('CNsCs', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[self::CHANNEL_SUBSYSTEM], 'subsystem', 1, $subsystem); + $this->send_binary_packet($packet); + $this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_REQUEST; + if (!$this->get_channel_packet(self::CHANNEL_SUBSYSTEM)) { + return \false; + } + $this->channel_status[self::CHANNEL_SUBSYSTEM] = NET_SSH2_MSG_CHANNEL_DATA; + $this->channel_id_last_interactive = self::CHANNEL_SUBSYSTEM; + return \true; + } + /** + * Stops a subsystem. + * + * @see self::startSubsystem() + * @return bool + */ + public function stopSubsystem() + { + if ($this->isInteractiveChannelOpen(self::CHANNEL_SUBSYSTEM)) { + $this->close_channel(self::CHANNEL_SUBSYSTEM); + } + return \true; + } + /** + * Closes a channel + * + * If read() timed out you might want to just close the channel and have it auto-restart on the next read() call + * + * If not specifying a channel, an open interactive channel will be selected. If there are + * multiple open interactive channels, a legacy behavior will apply in which channel selection + * prioritizes an active subsystem, the exec pty, and, lastly, the shell. If using multiple + * interactive channels, callers are discouraged from relying on this legacy behavior and + * should specify the intended channel. + * + * @param int|null $channel Channel id returned by self::getInteractiveChannelId() + * @return void + */ + public function reset($channel = null) + { + if ($channel === null) { + $channel = $this->get_interactive_channel(); + } + if ($this->isInteractiveChannelOpen($channel)) { + $this->close_channel($channel); + } + } + /** + * Is timeout? + * + * Did exec() or read() return because they timed out or because they encountered the end? + * + */ + public function isTimeout() + { + return $this->is_timeout; + } + /** + * Disconnect + * + */ + public function disconnect() + { + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + if (isset($this->realtime_log_file) && is_resource($this->realtime_log_file)) { + fclose($this->realtime_log_file); + } + unset(self::$connections[$this->getResourceId()]); + } + /** + * Destructor. + * + * Will be called, automatically, if you're supporting just PHP5. If you're supporting PHP4, you'll need to call + * disconnect(). + * + */ + public function __destruct() + { + $this->disconnect(); + } + /** + * Is the connection still active? + * + * $level has 3x possible values: + * 0 (default): phpseclib takes a passive approach to see if the connection is still active by calling feof() + * on the socket + * 1: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_IGNORE + * packet that doesn't require a response + * 2: phpseclib takes an active approach to see if the connection is still active by sending an SSH_MSG_CHANNEL_OPEN + * packet and imediately trying to close that channel. some routers, in particular, however, will only let you + * open one channel, so this approach could yield false positives + * + * @param int $level + * @return bool + */ + public function isConnected($level = 0) + { + if (!is_int($level) || $level < 0 || $level > 2) { + throw new \InvalidArgumentException('$level must be 0, 1 or 2'); + } + if ($level == 0) { + return $this->bitmap & self::MASK_CONNECTED && is_resource($this->fsock) && !feof($this->fsock); + } + try { + if ($level == 1) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); + } else { + $this->openChannel(self::CHANNEL_KEEP_ALIVE); + $this->close_channel(self::CHANNEL_KEEP_ALIVE); + } + return \true; + } catch (\Exception $e) { + return \false; + } + } + /** + * Have you successfully been logged in? + * + * @return bool + */ + public function isAuthenticated() + { + return (bool) ($this->bitmap & self::MASK_LOGIN); + } + /** + * Is the interactive shell active? + * + * @return bool + */ + public function isShellOpen() + { + return $this->isInteractiveChannelOpen(self::CHANNEL_SHELL); + } + /** + * Is the exec pty active? + * + * @return bool + */ + public function isPTYOpen() + { + return $this->isInteractiveChannelOpen(self::CHANNEL_EXEC); + } + /** + * Is the given interactive channel active? + * + * @param int $channel Channel id returned by self::getInteractiveChannelId() + * @return bool + */ + public function isInteractiveChannelOpen($channel) + { + return $this->isAuthenticated() && $this->is_channel_status_data($channel); + } + /** + * Returns a channel identifier, presently of the last interactive channel opened, regardless of current status. + * Returns 0 if no interactive channel has been opened. + * + * @see self::isInteractiveChannelOpen() + * @return int + */ + public function getInteractiveChannelId() + { + return $this->channel_id_last_interactive; + } + /** + * Pings a server connection, or tries to reconnect if the connection has gone down + * + * Inspired by http://php.net/manual/en/mysqli.ping.php + * + * @return bool + */ + public function ping() + { + if (!$this->isAuthenticated()) { + if (!empty($this->auth)) { + return $this->reconnect(); + } + return \false; + } + try { + $this->openChannel(self::CHANNEL_KEEP_ALIVE); + } catch (\RuntimeException $e) { + return $this->reconnect(); + } + $this->close_channel(self::CHANNEL_KEEP_ALIVE); + return \true; + } + /** + * In situ reconnect method + * + * @return boolean + */ + private function reconnect() + { + $this->reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST); + $this->retry_connect = \true; + $this->connect(); + foreach ($this->auth as $auth) { + $result = $this->login(...$auth); + } + return $result; + } + /** + * Resets a connection for re-use + * + * @param int $reason + */ + protected function reset_connection($reason) + { + $this->disconnect_helper($reason); + $this->decrypt = $this->encrypt = \false; + $this->decrypt_block_size = $this->encrypt_block_size = 8; + $this->hmac_check = $this->hmac_create = \false; + $this->hmac_size = \false; + $this->session_id = \false; + $this->retry_connect = \true; + $this->get_seq_no = $this->send_seq_no = 0; + $this->channel_status = []; + $this->channel_id_last_interactive = 0; + } + /** + * Gets Binary Packets + * + * See '6. Binary Packet Protocol' of rfc4253 for more info. + * + * @see self::_send_binary_packet() + * @param bool $skip_channel_filter + * @return bool|string + */ + private function get_binary_packet($skip_channel_filter = \false) + { + if ($skip_channel_filter) { + if (!is_resource($this->fsock)) { + throw new \InvalidArgumentException('fsock is not a resource.'); + } + $read = [$this->fsock]; + $write = $except = null; + if (!$this->curTimeout) { + if ($this->keepAlive <= 0) { + static::stream_select($read, $write, $except, null); + } else { + if (!static::stream_select($read, $write, $except, $this->keepAlive)) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); + return $this->get_binary_packet(\true); + } + } + } else { + if ($this->curTimeout < 0) { + $this->is_timeout = \true; + return \true; + } + $start = microtime(\true); + if ($this->keepAlive > 0 && $this->keepAlive < $this->curTimeout) { + if (!static::stream_select($read, $write, $except, $this->keepAlive)) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); + $elapsed = microtime(\true) - $start; + $this->curTimeout -= $elapsed; + return $this->get_binary_packet(\true); + } + $elapsed = microtime(\true) - $start; + $this->curTimeout -= $elapsed; + } + $sec = (int) floor($this->curTimeout); + $usec = (int) (1000000 * ($this->curTimeout - $sec)); + // this can return a "stream_select(): unable to select [4]: Interrupted system call" error + if (!static::stream_select($read, $write, $except, $sec, $usec)) { + $this->is_timeout = \true; + return \true; + } + $elapsed = microtime(\true) - $start; + $this->curTimeout -= $elapsed; + } + } + if (!is_resource($this->fsock) || feof($this->fsock)) { + $this->bitmap = 0; + $str = 'Connection closed (by server) prematurely'; + if (isset($elapsed)) { + $str .= ' ' . $elapsed . 's'; + } + throw new ConnectionClosedException($str); + } + $start = microtime(\true); + $sec = (int) floor($this->curTimeout); + $usec = (int) (1000000 * ($this->curTimeout - $sec)); + stream_set_timeout($this->fsock, $sec, $usec); + $raw = stream_get_contents($this->fsock, $this->decrypt_block_size); + if (!strlen($raw)) { + $this->bitmap = 0; + throw new ConnectionClosedException('No data received from server'); + } + if ($this->decrypt) { + switch ($this->decryptName) { + case 'aes128-gcm@openssh.com': + case 'aes256-gcm@openssh.com': + $this->decrypt->setNonce($this->decryptFixedPart . $this->decryptInvocationCounter); + Strings::increment_str($this->decryptInvocationCounter); + $this->decrypt->setAAD($temp = Strings::shift($raw, 4)); + extract(unpack('Npacket_length', $temp)); + /** + * @var integer $packet_length + */ + $raw .= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4); + $stop = microtime(\true); + $tag = stream_get_contents($this->fsock, $this->decrypt_block_size); + $this->decrypt->setTag($tag); + $raw = $this->decrypt->decrypt($raw); + $raw = $temp . $raw; + $remaining_length = 0; + break; + case 'chacha20-poly1305@openssh.com': + // This should be impossible, but we are checking anyway to narrow the type for Psalm. + if (!$this->decrypt instanceof ChaCha20) { + throw new \LogicException('$this->decrypt is not a ' . ChaCha20::class); + } + $nonce = pack('N2', 0, $this->get_seq_no); + $this->lengthDecrypt->setNonce($nonce); + $temp = $this->lengthDecrypt->decrypt($aad = Strings::shift($raw, 4)); + extract(unpack('Npacket_length', $temp)); + /** + * @var integer $packet_length + */ + $raw .= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4); + $stop = microtime(\true); + $tag = stream_get_contents($this->fsock, 16); + $this->decrypt->setNonce($nonce); + $this->decrypt->setCounter(0); + // this is the same approach that's implemented in Salsa20::createPoly1305Key() + // but we don't want to use the same AEAD construction that RFC8439 describes + // for ChaCha20-Poly1305 so we won't rely on it (see Salsa20::poly1305()) + $this->decrypt->setPoly1305Key($this->decrypt->encrypt(str_repeat("\x00", 32))); + $this->decrypt->setAAD($aad); + $this->decrypt->setCounter(1); + $this->decrypt->setTag($tag); + $raw = $this->decrypt->decrypt($raw); + $raw = $temp . $raw; + $remaining_length = 0; + break; + default: + if (!$this->hmac_check instanceof Hash || !$this->hmac_check_etm) { + $raw = $this->decrypt->decrypt($raw); + break; + } + extract(unpack('Npacket_length', $temp = Strings::shift($raw, 4))); + /** + * @var integer $packet_length + */ + $raw .= $this->read_remaining_bytes($packet_length - $this->decrypt_block_size + 4); + $stop = microtime(\true); + $encrypted = $temp . $raw; + $raw = $temp . $this->decrypt->decrypt($raw); + $remaining_length = 0; + } + } + if (strlen($raw) < 5) { + $this->bitmap = 0; + throw new \RuntimeException('Plaintext is too short'); + } + extract(unpack('Npacket_length/Cpadding_length', Strings::shift($raw, 5))); + /** + * @var integer $packet_length + * @var integer $padding_length + */ + if (!isset($remaining_length)) { + $remaining_length = $packet_length + 4 - $this->decrypt_block_size; + } + $buffer = $this->read_remaining_bytes($remaining_length); + if (!isset($stop)) { + $stop = microtime(\true); + } + if (strlen($buffer)) { + $raw .= $this->decrypt ? $this->decrypt->decrypt($buffer) : $buffer; + } + $payload = Strings::shift($raw, $packet_length - $padding_length - 1); + $padding = Strings::shift($raw, $padding_length); + // should leave $raw empty + if ($this->hmac_check instanceof Hash) { + $hmac = stream_get_contents($this->fsock, $this->hmac_size); + if ($hmac === \false || strlen($hmac) != $this->hmac_size) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_MAC_ERROR); + throw new \RuntimeException('Error reading socket'); + } + $reconstructed = !$this->hmac_check_etm ? pack('NCa*', $packet_length, $padding_length, $payload . $padding) : $encrypted; + if (($this->hmac_check->getHash() & "\xff\xff\xff\xff") == 'umac') { + $this->hmac_check->setNonce("\x00\x00\x00\x00" . pack('N', $this->get_seq_no)); + if ($hmac != $this->hmac_check->hash($reconstructed)) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_MAC_ERROR); + throw new \RuntimeException('Invalid UMAC'); + } + } else { + if ($hmac != $this->hmac_check->hash(pack('Na*', $this->get_seq_no, $reconstructed))) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_MAC_ERROR); + throw new \RuntimeException('Invalid HMAC'); + } + } + } + switch ($this->decompress) { + case self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH: + if (!$this->isAuthenticated()) { + break; + } + // fall-through + case self::NET_SSH2_COMPRESSION_ZLIB: + if ($this->regenerate_decompression_context) { + $this->regenerate_decompression_context = \false; + $cmf = ord($payload[0]); + $cm = $cmf & 0xf; + if ($cm != 8) { + // deflate + user_error("Only CM = 8 ('deflate') is supported ({$cm})"); + } + $cinfo = ($cmf & 0xf0) >> 4; + if ($cinfo > 7) { + user_error("CINFO above 7 is not allowed ({$cinfo})"); + } + $windowSize = 1 << $cinfo + 8; + $flg = ord($payload[1]); + //$fcheck = $flg && 0x0F; + if (($cmf << 8 | $flg) % 31) { + user_error('fcheck failed'); + } + $fdict = boolval($flg & 0x20); + $flevel = ($flg & 0xc0) >> 6; + $this->decompress_context = inflate_init(\ZLIB_ENCODING_RAW, ['window' => $cinfo + 8]); + $payload = substr($payload, 2); + } + if ($this->decompress_context) { + $payload = inflate_add($this->decompress_context, $payload, \ZLIB_PARTIAL_FLUSH); + } + } + $this->get_seq_no++; + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SSH2_LOGGING')) { + $current = microtime(\true); + $message_number = isset(self::$message_numbers[ord($payload[0])]) ? self::$message_numbers[ord($payload[0])] : 'UNKNOWN (' . ord($payload[0]) . ')'; + $message_number = '<- ' . $message_number . ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; + $this->append_log($message_number, $payload); + $this->last_packet = $current; + } + return $this->filter($payload, $skip_channel_filter); + } + /** + * Read Remaining Bytes + * + * @see self::get_binary_packet() + * @param int $remaining_length + * @return string + */ + private function read_remaining_bytes($remaining_length) + { + if (!$remaining_length) { + return ''; + } + $adjustLength = \false; + if ($this->decrypt) { + switch (\true) { + case $this->decryptName == 'aes128-gcm@openssh.com': + case $this->decryptName == 'aes256-gcm@openssh.com': + case $this->decryptName == 'chacha20-poly1305@openssh.com': + case $this->hmac_check instanceof Hash && $this->hmac_check_etm: + $remaining_length += $this->decrypt_block_size - 4; + $adjustLength = \true; + } + } + // quoting , + // "implementations SHOULD check that the packet length is reasonable" + // PuTTY uses 0x9000 as the actual max packet size and so to shall we + // don't do this when GCM mode is used since GCM mode doesn't encrypt the length + if ($remaining_length < -$this->decrypt_block_size || $remaining_length > 0x9000 || $remaining_length % $this->decrypt_block_size != 0) { + if (!$this->bad_key_size_fix && self::bad_algorithm_candidate($this->decrypt ? $this->decryptName : '') && !($this->bitmap & SSH2::MASK_LOGIN)) { + $this->bad_key_size_fix = \true; + $this->reset_connection(NET_SSH2_DISCONNECT_KEY_EXCHANGE_FAILED); + return \false; + } + throw new \RuntimeException('Invalid size'); + } + if ($adjustLength) { + $remaining_length -= $this->decrypt_block_size - 4; + } + $buffer = ''; + while ($remaining_length > 0) { + $temp = stream_get_contents($this->fsock, $remaining_length); + if ($temp === \false || feof($this->fsock)) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST); + throw new \RuntimeException('Error reading from socket'); + } + $buffer .= $temp; + $remaining_length -= strlen($temp); + } + return $buffer; + } + /** + * Filter Binary Packets + * + * Because some binary packets need to be ignored... + * + * @see self::_get_binary_packet() + * @param string $payload + * @param bool $skip_channel_filter + * @return string|bool + */ + private function filter($payload, $skip_channel_filter) + { + switch (ord($payload[0])) { + case NET_SSH2_MSG_DISCONNECT: + Strings::shift($payload, 1); + list($reason_code, $message) = Strings::unpackSSH2('Ns', $payload); + $this->errors[] = 'SSH_MSG_DISCONNECT: ' . self::$disconnect_reasons[$reason_code] . "\r\n{$message}"; + $this->bitmap = 0; + return \false; + case NET_SSH2_MSG_IGNORE: + $this->extra_packets++; + $payload = $this->get_binary_packet($skip_channel_filter); + break; + case NET_SSH2_MSG_DEBUG: + $this->extra_packets++; + Strings::shift($payload, 2); + // second byte is "always_display" + list($message) = Strings::unpackSSH2('s', $payload); + $this->errors[] = "SSH_MSG_DEBUG: {$message}"; + $payload = $this->get_binary_packet($skip_channel_filter); + break; + case NET_SSH2_MSG_UNIMPLEMENTED: + return \false; + case NET_SSH2_MSG_KEXINIT: + // this is here for key re-exchanges after the initial key exchange + if ($this->session_id !== \false) { + if (!$this->key_exchange($payload)) { + $this->bitmap = 0; + return \false; + } + $payload = $this->get_binary_packet($skip_channel_filter); + } + } + // see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in + if ($this->bitmap & self::MASK_CONNECTED && !$this->isAuthenticated() && !is_bool($payload) && ord($payload[0]) == NET_SSH2_MSG_USERAUTH_BANNER) { + Strings::shift($payload, 1); + list($this->banner_message) = Strings::unpackSSH2('s', $payload); + $payload = $this->get_binary_packet(); + } + // only called when we've already logged in + if ($this->bitmap & self::MASK_CONNECTED && $this->isAuthenticated()) { + if (is_bool($payload)) { + return $payload; + } + switch (ord($payload[0])) { + case NET_SSH2_MSG_CHANNEL_REQUEST: + if (strlen($payload) == 31) { + extract(unpack('cpacket_type/Nchannel/Nlength', $payload)); + if (substr($payload, 9, $length) == 'keepalive@openssh.com' && isset($this->server_channels[$channel])) { + if (ord(substr($payload, 9 + $length))) { + // want reply + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_SUCCESS, $this->server_channels[$channel])); + } + $payload = $this->get_binary_packet($skip_channel_filter); + } + } + break; + case NET_SSH2_MSG_CHANNEL_DATA: + case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: + case NET_SSH2_MSG_CHANNEL_CLOSE: + case NET_SSH2_MSG_CHANNEL_EOF: + if (!$skip_channel_filter && !empty($this->server_channels)) { + $this->binary_packet_buffer = $payload; + $this->get_channel_packet(\true); + $payload = $this->get_binary_packet(); + } + break; + case NET_SSH2_MSG_GLOBAL_REQUEST: + // see http://tools.ietf.org/html/rfc4254#section-4 + Strings::shift($payload, 1); + list($request_name) = Strings::unpackSSH2('s', $payload); + $this->errors[] = "SSH_MSG_GLOBAL_REQUEST: {$request_name}"; + try { + $this->send_binary_packet(pack('C', NET_SSH2_MSG_REQUEST_FAILURE)); + } catch (\RuntimeException $e) { + return $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + } + $payload = $this->get_binary_packet($skip_channel_filter); + break; + case NET_SSH2_MSG_CHANNEL_OPEN: + // see http://tools.ietf.org/html/rfc4254#section-5.1 + Strings::shift($payload, 1); + list($data, $server_channel) = Strings::unpackSSH2('sN', $payload); + switch ($data) { + case 'auth-agent': + case 'auth-agent@openssh.com': + if (isset($this->agent)) { + $new_channel = self::CHANNEL_AGENT_FORWARD; + list($remote_window_size, $remote_maximum_packet_size) = Strings::unpackSSH2('NN', $payload); + $this->packet_size_client_to_server[$new_channel] = $remote_window_size; + $this->window_size_server_to_client[$new_channel] = $remote_maximum_packet_size; + $this->window_size_client_to_server[$new_channel] = $this->window_size; + $packet_size = 0x4000; + $packet = pack('CN4', NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, $server_channel, $new_channel, $packet_size, $packet_size); + $this->server_channels[$new_channel] = $server_channel; + $this->channel_status[$new_channel] = NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION; + $this->send_binary_packet($packet); + } + break; + default: + $packet = Strings::packSSH2( + 'CN2ss', + NET_SSH2_MSG_CHANNEL_OPEN_FAILURE, + $server_channel, + NET_SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED, + '', + // description + '' + ); + try { + $this->send_binary_packet($packet); + } catch (\RuntimeException $e) { + return $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + } + } + $payload = $this->get_binary_packet($skip_channel_filter); + break; + case NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST: + Strings::shift($payload, 1); + list($channel, $window_size) = Strings::unpackSSH2('NN', $payload); + $this->window_size_client_to_server[$channel] += $window_size; + $payload = $this->bitmap & self::MASK_WINDOW_ADJUST ? \true : $this->get_binary_packet($skip_channel_filter); + } + } + return $payload; + } + /** + * Enable Quiet Mode + * + * Suppress stderr from output + * + */ + public function enableQuietMode() + { + $this->quiet_mode = \true; + } + /** + * Disable Quiet Mode + * + * Show stderr in output + * + */ + public function disableQuietMode() + { + $this->quiet_mode = \false; + } + /** + * Returns whether Quiet Mode is enabled or not + * + * @see self::enableQuietMode() + * @see self::disableQuietMode() + * @return bool + */ + public function isQuietModeEnabled() + { + return $this->quiet_mode; + } + /** + * Enable request-pty when using exec() + * + */ + public function enablePTY() + { + $this->request_pty = \true; + } + /** + * Disable request-pty when using exec() + * + */ + public function disablePTY() + { + if ($this->isPTYOpen()) { + $this->close_channel(self::CHANNEL_EXEC); + } + $this->request_pty = \false; + } + /** + * Returns whether request-pty is enabled or not + * + * @see self::enablePTY() + * @see self::disablePTY() + * @return bool + */ + public function isPTYEnabled() + { + return $this->request_pty; + } + /** + * Gets channel data + * + * Returns the data as a string. bool(true) is returned if: + * + * - the server closes the channel + * - if the connection times out + * - if the channel status is CHANNEL_OPEN and the response was CHANNEL_OPEN_CONFIRMATION + * - if the channel status is CHANNEL_REQUEST and the response was CHANNEL_SUCCESS + * - if the channel status is CHANNEL_CLOSE and the response was CHANNEL_CLOSE + * + * bool(false) is returned if: + * + * - if the channel status is CHANNEL_REQUEST and the response was CHANNEL_FAILURE + * + * @param int $client_channel + * @param bool $skip_extended + * @return mixed + * @throws \RuntimeException on connection error + */ + protected function get_channel_packet($client_channel, $skip_extended = \false) + { + if (!empty($this->channel_buffers[$client_channel])) { + switch ($this->channel_status[$client_channel]) { + case NET_SSH2_MSG_CHANNEL_REQUEST: + foreach ($this->channel_buffers[$client_channel] as $i => $packet) { + switch (ord($packet[0])) { + case NET_SSH2_MSG_CHANNEL_SUCCESS: + case NET_SSH2_MSG_CHANNEL_FAILURE: + unset($this->channel_buffers[$client_channel][$i]); + return substr($packet, 1); + } + } + break; + default: + return substr(array_shift($this->channel_buffers[$client_channel]), 1); + } + } + while (\true) { + if ($this->binary_packet_buffer !== \false) { + $response = $this->binary_packet_buffer; + $this->binary_packet_buffer = \false; + } else { + $response = $this->get_binary_packet(\true); + if ($response === \true && $this->is_timeout) { + if ($client_channel == self::CHANNEL_EXEC && !$this->request_pty) { + $this->close_channel($client_channel); + } + return \true; + } + if ($response === \false) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST); + throw new ConnectionClosedException('Connection closed by server'); + } + } + if ($client_channel == -1 && $response === \true) { + return \true; + } + list($type, $channel) = Strings::unpackSSH2('CN', $response); + // will not be setup yet on incoming channel open request + if (isset($channel) && isset($this->channel_status[$channel]) && isset($this->window_size_server_to_client[$channel])) { + $this->window_size_server_to_client[$channel] -= strlen($response); + // resize the window, if appropriate + if ($this->window_size_server_to_client[$channel] < 0) { + // PuTTY does something more analogous to the following: + //if ($this->window_size_server_to_client[$channel] < 0x3FFFFFFF) { + $packet = pack('CNN', NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST, $this->server_channels[$channel], $this->window_resize); + $this->send_binary_packet($packet); + $this->window_size_server_to_client[$channel] += $this->window_resize; + } + switch ($type) { + case NET_SSH2_MSG_CHANNEL_EXTENDED_DATA: + /* + if ($client_channel == self::CHANNEL_EXEC) { + $this->send_channel_packet($client_channel, chr(0)); + } + */ + // currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR + list($data_type_code, $data) = Strings::unpackSSH2('Ns', $response); + $this->stdErrorLog .= $data; + if ($skip_extended || $this->quiet_mode) { + continue 2; + } + if ($client_channel == $channel && $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA) { + return $data; + } + $this->channel_buffers[$channel][] = chr($type) . $data; + continue 2; + case NET_SSH2_MSG_CHANNEL_REQUEST: + if ($this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_CLOSE) { + continue 2; + } + list($value) = Strings::unpackSSH2('s', $response); + switch ($value) { + case 'exit-signal': + list(, $signal_name, , $error_message) = Strings::unpackSSH2('bsbs', $response); + $this->errors[] = "SSH_MSG_CHANNEL_REQUEST (exit-signal): {$signal_name}"; + if (strlen($error_message)) { + $this->errors[count($this->errors) - 1] .= "\r\n{$error_message}"; + } + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); + $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_EOF; + continue 3; + case 'exit-status': + list(, $this->exit_status) = Strings::unpackSSH2('CN', $response); + // "The client MAY ignore these messages." + // -- http://tools.ietf.org/html/rfc4254#section-6.10 + continue 3; + default: + // "Some systems may not implement signals, in which case they SHOULD ignore this message." + // -- http://tools.ietf.org/html/rfc4254#section-6.9 + continue 3; + } + } + switch ($this->channel_status[$channel]) { + case NET_SSH2_MSG_CHANNEL_OPEN: + switch ($type) { + case NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION: + list($this->server_channels[$channel], $window_size, $this->packet_size_client_to_server[$channel]) = Strings::unpackSSH2('NNN', $response); + if ($window_size < 0) { + $window_size &= 0x7fffffff; + $window_size += 0x80000000; + } + $this->window_size_client_to_server[$channel] = $window_size; + $result = $client_channel == $channel ? \true : $this->get_channel_packet($client_channel, $skip_extended); + $this->on_channel_open(); + return $result; + case NET_SSH2_MSG_CHANNEL_OPEN_FAILURE: + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new \RuntimeException('Unable to open channel'); + default: + if ($client_channel == $channel) { + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new \RuntimeException('Unexpected response to open request'); + } + return $this->get_channel_packet($client_channel, $skip_extended); + } + break; + case NET_SSH2_MSG_CHANNEL_REQUEST: + switch ($type) { + case NET_SSH2_MSG_CHANNEL_SUCCESS: + return \true; + case NET_SSH2_MSG_CHANNEL_FAILURE: + return \false; + case NET_SSH2_MSG_CHANNEL_DATA: + list($data) = Strings::unpackSSH2('s', $response); + $this->channel_buffers[$channel][] = chr($type) . $data; + return $this->get_channel_packet($client_channel, $skip_extended); + default: + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new \RuntimeException('Unable to fulfill channel request'); + } + case NET_SSH2_MSG_CHANNEL_CLOSE: + if ($client_channel == $channel && $type == NET_SSH2_MSG_CHANNEL_CLOSE) { + return \true; + } + return $this->get_channel_packet($client_channel, $skip_extended); + } + } + // ie. $this->channel_status[$channel] == NET_SSH2_MSG_CHANNEL_DATA + switch ($type) { + case NET_SSH2_MSG_CHANNEL_DATA: + /* + if ($channel == self::CHANNEL_EXEC) { + // SCP requires null packets, such as this, be sent. further, in the case of the ssh.com SSH server + // this actually seems to make things twice as fast. more to the point, the message right after + // SSH_MSG_CHANNEL_DATA (usually SSH_MSG_IGNORE) won't block for as long as it would have otherwise. + // in OpenSSH it slows things down but only by a couple thousandths of a second. + $this->send_channel_packet($channel, chr(0)); + } + */ + list($data) = Strings::unpackSSH2('s', $response); + if ($channel == self::CHANNEL_AGENT_FORWARD) { + $agent_response = $this->agent->forwardData($data); + if (!is_bool($agent_response)) { + $this->send_channel_packet($channel, $agent_response); + } + break; + } + if ($client_channel == $channel) { + return $data; + } + $this->channel_buffers[$channel][] = chr($type) . $data; + break; + case NET_SSH2_MSG_CHANNEL_CLOSE: + $this->curTimeout = 5; + $this->close_channel_bitmap($channel); + if ($this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_EOF) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel])); + } + $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; + $this->channelCount--; + if ($client_channel == $channel) { + return \true; + } + // fall-through + case NET_SSH2_MSG_CHANNEL_EOF: + break; + default: + $this->disconnect_helper(NET_SSH2_DISCONNECT_BY_APPLICATION); + throw new \RuntimeException("Error reading channel data ({$type})"); + } + } + } + /** + * Sends Binary Packets + * + * See '6. Binary Packet Protocol' of rfc4253 for more info. + * + * @param string $data + * @param string $logged + * @see self::_get_binary_packet() + * @return void + */ + protected function send_binary_packet($data, $logged = null) + { + if (!is_resource($this->fsock) || feof($this->fsock)) { + $this->bitmap = 0; + throw new ConnectionClosedException('Connection closed prematurely'); + } + if (!isset($logged)) { + $logged = $data; + } + switch ($this->compress) { + case self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH: + if (!$this->isAuthenticated()) { + break; + } + // fall-through + case self::NET_SSH2_COMPRESSION_ZLIB: + if (!$this->regenerate_compression_context) { + $header = ''; + } else { + $this->regenerate_compression_context = \false; + $this->compress_context = deflate_init(\ZLIB_ENCODING_RAW, ['window' => 15]); + $header = "x\x9c"; + } + if ($this->compress_context) { + $data = $header . deflate_add($this->compress_context, $data, \ZLIB_PARTIAL_FLUSH); + } + } + // 4 (packet length) + 1 (padding length) + 4 (minimal padding amount) == 9 + $packet_length = strlen($data) + 9; + if ($this->encrypt && $this->encrypt->usesNonce()) { + $packet_length -= 4; + } + // round up to the nearest $this->encrypt_block_size + $packet_length += ($this->encrypt_block_size - 1) * $packet_length % $this->encrypt_block_size; + // subtracting strlen($data) is obvious - subtracting 5 is necessary because of packet_length and padding_length + $padding_length = $packet_length - strlen($data) - 5; + switch (\true) { + case $this->encrypt && $this->encrypt->usesNonce(): + case $this->hmac_create instanceof Hash && $this->hmac_create_etm: + $padding_length += 4; + $packet_length += 4; + } + $padding = Random::string($padding_length); + // we subtract 4 from packet_length because the packet_length field isn't supposed to include itself + $packet = pack('NCa*', $packet_length - 4, $padding_length, $data . $padding); + $hmac = ''; + if ($this->hmac_create instanceof Hash && !$this->hmac_create_etm) { + if (($this->hmac_create->getHash() & "\xff\xff\xff\xff") == 'umac') { + $this->hmac_create->setNonce("\x00\x00\x00\x00" . pack('N', $this->send_seq_no)); + $hmac = $this->hmac_create->hash($packet); + } else { + $hmac = $this->hmac_create->hash(pack('Na*', $this->send_seq_no, $packet)); + } + } + if ($this->encrypt) { + switch ($this->encryptName) { + case 'aes128-gcm@openssh.com': + case 'aes256-gcm@openssh.com': + $this->encrypt->setNonce($this->encryptFixedPart . $this->encryptInvocationCounter); + Strings::increment_str($this->encryptInvocationCounter); + $this->encrypt->setAAD($temp = $packet & "\xff\xff\xff\xff"); + $packet = $temp . $this->encrypt->encrypt(substr($packet, 4)); + break; + case 'chacha20-poly1305@openssh.com': + // This should be impossible, but we are checking anyway to narrow the type for Psalm. + if (!$this->encrypt instanceof ChaCha20) { + throw new \LogicException('$this->encrypt is not a ' . ChaCha20::class); + } + $nonce = pack('N2', 0, $this->send_seq_no); + $this->encrypt->setNonce($nonce); + $this->lengthEncrypt->setNonce($nonce); + $length = $this->lengthEncrypt->encrypt($packet & "\xff\xff\xff\xff"); + $this->encrypt->setCounter(0); + // this is the same approach that's implemented in Salsa20::createPoly1305Key() + // but we don't want to use the same AEAD construction that RFC8439 describes + // for ChaCha20-Poly1305 so we won't rely on it (see Salsa20::poly1305()) + $this->encrypt->setPoly1305Key($this->encrypt->encrypt(str_repeat("\x00", 32))); + $this->encrypt->setAAD($length); + $this->encrypt->setCounter(1); + $packet = $length . $this->encrypt->encrypt(substr($packet, 4)); + break; + default: + $packet = $this->hmac_create instanceof Hash && $this->hmac_create_etm ? ($packet & "\xff\xff\xff\xff") . $this->encrypt->encrypt(substr($packet, 4)) : $this->encrypt->encrypt($packet); + } + } + if ($this->hmac_create instanceof Hash && $this->hmac_create_etm) { + if (($this->hmac_create->getHash() & "\xff\xff\xff\xff") == 'umac') { + $this->hmac_create->setNonce("\x00\x00\x00\x00" . pack('N', $this->send_seq_no)); + $hmac = $this->hmac_create->hash($packet); + } else { + $hmac = $this->hmac_create->hash(pack('Na*', $this->send_seq_no, $packet)); + } + } + $this->send_seq_no++; + $packet .= $this->encrypt && $this->encrypt->usesNonce() ? $this->encrypt->getTag() : $hmac; + $start = microtime(\true); + $sent = @fputs($this->fsock, $packet); + $stop = microtime(\true); + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SSH2_LOGGING')) { + $current = microtime(\true); + $message_number = isset(self::$message_numbers[ord($logged[0])]) ? self::$message_numbers[ord($logged[0])] : 'UNKNOWN (' . ord($logged[0]) . ')'; + $message_number = '-> ' . $message_number . ' (since last: ' . round($current - $this->last_packet, 4) . ', network: ' . round($stop - $start, 4) . 's)'; + $this->append_log($message_number, $logged); + $this->last_packet = $current; + } + if (strlen($packet) != $sent) { + $this->bitmap = 0; + $message = $sent === \false ? 'Unable to write ' . strlen($packet) . ' bytes' : "Only {$sent} of " . strlen($packet) . " bytes were sent"; + throw new \RuntimeException($message); + } + } + /** + * Logs data packets + * + * Makes sure that only the last 1MB worth of packets will be logged + * + * @param string $message_number + * @param string $message + */ + private function append_log($message_number, $message) + { + $this->append_log_helper(NET_SSH2_LOGGING, $message_number, $message, $this->message_number_log, $this->message_log, $this->log_size, $this->realtime_log_file, $this->realtime_log_wrap, $this->realtime_log_size); + } + /** + * Logs data packet helper + * + * @param int $constant + * @param string $message_number + * @param string $message + * @param array &$message_number_log + * @param array &$message_log + * @param int &$log_size + * @param resource &$realtime_log_file + * @param bool &$realtime_log_wrap + * @param int &$realtime_log_size + */ + protected function append_log_helper($constant, $message_number, $message, array &$message_number_log, array &$message_log, &$log_size, &$realtime_log_file, &$realtime_log_wrap, &$realtime_log_size) + { + // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) + if (strlen($message_number) > 2) { + Strings::shift($message); + } + switch ($constant) { + // useful for benchmarks + case self::LOG_SIMPLE: + $message_number_log[] = $message_number; + break; + case self::LOG_SIMPLE_REALTIME: + echo $message_number; + echo \PHP_SAPI == 'cli' ? "\r\n" : '
'; + @flush(); + @ob_flush(); + break; + // the most useful log for SSH2 + case self::LOG_COMPLEX: + $message_number_log[] = $message_number; + $log_size += strlen($message); + $message_log[] = $message; + while ($log_size > self::LOG_MAX_SIZE) { + $log_size -= strlen(array_shift($message_log)); + array_shift($message_number_log); + } + break; + // dump the output out realtime; packets may be interspersed with non packets, + // passwords won't be filtered out and select other packets may not be correctly + // identified + case self::LOG_REALTIME: + switch (\PHP_SAPI) { + case 'cli': + $start = $stop = "\r\n"; + break; + default: + $start = '
';
+                        $stop = '
'; + } + echo $start . $this->format_log([$message], [$message_number]) . $stop; + @flush(); + @ob_flush(); + break; + // basically the same thing as self::LOG_REALTIME with the caveat that NET_SSH2_LOG_REALTIME_FILENAME + // needs to be defined and that the resultant log file will be capped out at self::LOG_MAX_SIZE. + // the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily + // at the beginning of the file + case self::LOG_REALTIME_FILE: + if (!isset($realtime_log_file)) { + // PHP doesn't seem to like using constants in fopen() + $filename = NET_SSH2_LOG_REALTIME_FILENAME; + $fp = fopen($filename, 'w'); + $realtime_log_file = $fp; + } + if (!is_resource($realtime_log_file)) { + break; + } + $entry = $this->format_log([$message], [$message_number]); + if ($realtime_log_wrap) { + $temp = "<<< START >>>\r\n"; + $entry .= $temp; + fseek($realtime_log_file, ftell($realtime_log_file) - strlen($temp)); + } + $realtime_log_size += strlen($entry); + if ($realtime_log_size > self::LOG_MAX_SIZE) { + fseek($realtime_log_file, 0); + $realtime_log_size = strlen($entry); + $realtime_log_wrap = \true; + } + fputs($realtime_log_file, $entry); + } + } + /** + * Sends channel data + * + * Spans multiple SSH_MSG_CHANNEL_DATAs if appropriate + * + * @param int $client_channel + * @param string $data + * @return void + */ + protected function send_channel_packet($client_channel, $data) + { + while (strlen($data)) { + if (!$this->window_size_client_to_server[$client_channel]) { + $this->bitmap ^= self::MASK_WINDOW_ADJUST; + // using an invalid channel will let the buffers be built up for the valid channels + $this->get_channel_packet(-1); + $this->bitmap ^= self::MASK_WINDOW_ADJUST; + } + /* The maximum amount of data allowed is determined by the maximum + packet size for the channel, and the current window size, whichever + is smaller. + -- http://tools.ietf.org/html/rfc4254#section-5.2 */ + $max_size = min($this->packet_size_client_to_server[$client_channel], $this->window_size_client_to_server[$client_channel]); + $temp = Strings::shift($data, $max_size); + $packet = Strings::packSSH2('CNs', NET_SSH2_MSG_CHANNEL_DATA, $this->server_channels[$client_channel], $temp); + $this->window_size_client_to_server[$client_channel] -= strlen($temp); + $this->send_binary_packet($packet); + } + } + /** + * Closes and flushes a channel + * + * \phpseclib3\Net\SSH2 doesn't properly close most channels. For exec() channels are normally closed by the server + * and for SFTP channels are presumably closed when the client disconnects. This functions is intended + * for SCP more than anything. + * + * @param int $client_channel + * @param bool $want_reply + * @return void + */ + private function close_channel($client_channel, $want_reply = \false) + { + // see http://tools.ietf.org/html/rfc4254#section-5.3 + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$client_channel])); + if (!$want_reply) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + } + $this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE; + $this->channelCount--; + $this->curTimeout = 5; + while (!is_bool($this->get_channel_packet($client_channel))) { + } + if ($want_reply) { + $this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel])); + } + $this->close_channel_bitmap($client_channel); + } + /** + * Maintains execution state bitmap in response to channel closure + * + * @param int $client_channel The channel number to maintain closure status of + * @return void + */ + private function close_channel_bitmap($client_channel) + { + switch ($client_channel) { + case self::CHANNEL_SHELL: + // Shell status has been maintained in the bitmap for backwards + // compatibility sake, but can be removed going forward + if ($this->bitmap & self::MASK_SHELL) { + $this->bitmap &= ~self::MASK_SHELL; + } + break; + } + } + /** + * Disconnect + * + * @param int $reason + * @return false + */ + protected function disconnect_helper($reason) + { + if ($this->bitmap & self::MASK_CONNECTED) { + $data = Strings::packSSH2('CNss', NET_SSH2_MSG_DISCONNECT, $reason, '', ''); + try { + $this->send_binary_packet($data); + } catch (\Exception $e) { + } + } + $this->bitmap = 0; + if (is_resource($this->fsock) && get_resource_type($this->fsock) === 'stream') { + fclose($this->fsock); + } + return \false; + } + /** + * Define Array + * + * Takes any number of arrays whose indices are integers and whose values are strings and defines a bunch of + * named constants from it, using the value as the name of the constant and the index as the value of the constant. + * If any of the constants that would be defined already exists, none of the constants will be defined. + * + * @param mixed[] ...$args + * @access protected + */ + protected static function define_array(...$args) + { + foreach ($args as $arg) { + foreach ($arg as $key => $value) { + if (!defined($value)) { + define($value, $key); + } else { + break 2; + } + } + } + } + /** + * Returns a log of the packets that have been sent and received. + * + * Returns a string if NET_SSH2_LOGGING == self::LOG_COMPLEX, an array if NET_SSH2_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SSH2_LOGGING') + * + * @return array|false|string + */ + public function getLog() + { + if (!defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SSH2_LOGGING')) { + return \false; + } + switch (NET_SSH2_LOGGING) { + case self::LOG_SIMPLE: + return $this->message_number_log; + case self::LOG_COMPLEX: + $log = $this->format_log($this->message_log, $this->message_number_log); + return \PHP_SAPI == 'cli' ? $log : '
' . $log . '
'; + default: + return \false; + } + } + /** + * Formats a log for printing + * + * @param array $message_log + * @param array $message_number_log + * @return string + */ + protected function format_log(array $message_log, array $message_number_log) + { + $output = ''; + for ($i = 0; $i < count($message_log); $i++) { + $output .= $message_number_log[$i] . "\r\n"; + $current_log = $message_log[$i]; + $j = 0; + do { + if (strlen($current_log)) { + $output .= str_pad(dechex($j), 7, '0', \STR_PAD_LEFT) . '0 '; + } + $fragment = Strings::shift($current_log, $this->log_short_width); + $hex = substr(preg_replace_callback('#.#s', function ($matches) { + return $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', \STR_PAD_LEFT); + }, $fragment), strlen($this->log_boundary)); + // replace non ASCII printable characters with dots + // http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters + // also replace < with a . since < messes up the output on web browsers + $raw = preg_replace('#[^\\x20-\\x7E]|<#', '.', $fragment); + $output .= str_pad($hex, $this->log_long_width - $this->log_short_width, ' ') . $raw . "\r\n"; + $j++; + } while (strlen($current_log)); + $output .= "\r\n"; + } + return $output; + } + /** + * Helper function for agent->on_channel_open() + * + * Used when channels are created to inform agent + * of said channel opening. Must be called after + * channel open confirmation received + * + */ + private function on_channel_open() + { + if (isset($this->agent)) { + $this->agent->registerChannelOpen($this); + } + } + /** + * Returns the first value of the intersection of two arrays or false if + * the intersection is empty. The order is defined by the first parameter. + * + * @param array $array1 + * @param array $array2 + * @return mixed False if intersection is empty, else intersected value. + */ + private static function array_intersect_first(array $array1, array $array2) + { + foreach ($array1 as $value) { + if (in_array($value, $array2)) { + return $value; + } + } + return \false; + } + /** + * Returns all errors / debug messages on the SSH layer + * + * If you are looking for messages from the SFTP layer, please see SFTP::getSFTPErrors() + * + * @return string[] + */ + public function getErrors() + { + return $this->errors; + } + /** + * Returns the last error received on the SSH layer + * + * If you are looking for messages from the SFTP layer, please see SFTP::getLastSFTPError() + * + * @return string + */ + public function getLastError() + { + $count = count($this->errors); + if ($count > 0) { + return $this->errors[$count - 1]; + } + } + /** + * Return the server identification. + * + * @return string|false + */ + public function getServerIdentification() + { + $this->connect(); + return $this->server_identifier; + } + /** + * Returns a list of algorithms the server supports + * + * @return array + */ + public function getServerAlgorithms() + { + $this->connect(); + return ['kex' => $this->kex_algorithms, 'hostkey' => $this->server_host_key_algorithms, 'client_to_server' => ['crypt' => $this->encryption_algorithms_client_to_server, 'mac' => $this->mac_algorithms_client_to_server, 'comp' => $this->compression_algorithms_client_to_server, 'lang' => $this->languages_client_to_server], 'server_to_client' => ['crypt' => $this->encryption_algorithms_server_to_client, 'mac' => $this->mac_algorithms_server_to_client, 'comp' => $this->compression_algorithms_server_to_client, 'lang' => $this->languages_server_to_client]]; + } + /** + * Returns a list of KEX algorithms that phpseclib supports + * + * @return array + */ + public static function getSupportedKEXAlgorithms() + { + $kex_algorithms = [ + // Elliptic Curve Diffie-Hellman Key Agreement (ECDH) using + // Curve25519. See doc/curve25519-sha256@libssh.org.txt in the + // libssh repository for more information. + 'curve25519-sha256', + 'curve25519-sha256@libssh.org', + 'ecdh-sha2-nistp256', + // RFC 5656 + 'ecdh-sha2-nistp384', + // RFC 5656 + 'ecdh-sha2-nistp521', + // RFC 5656 + 'diffie-hellman-group-exchange-sha256', + // RFC 4419 + 'diffie-hellman-group-exchange-sha1', + // RFC 4419 + // Diffie-Hellman Key Agreement (DH) using integer modulo prime + // groups. + 'diffie-hellman-group14-sha256', + 'diffie-hellman-group14-sha1', + // REQUIRED + 'diffie-hellman-group15-sha512', + 'diffie-hellman-group16-sha512', + 'diffie-hellman-group17-sha512', + 'diffie-hellman-group18-sha512', + 'diffie-hellman-group1-sha1', + ]; + return $kex_algorithms; + } + /** + * Returns a list of host key algorithms that phpseclib supports + * + * @return array + */ + public static function getSupportedHostKeyAlgorithms() + { + return [ + 'ssh-ed25519', + // https://tools.ietf.org/html/draft-ietf-curdle-ssh-ed25519-02 + 'ecdsa-sha2-nistp256', + // RFC 5656 + 'ecdsa-sha2-nistp384', + // RFC 5656 + 'ecdsa-sha2-nistp521', + // RFC 5656 + 'rsa-sha2-256', + // RFC 8332 + 'rsa-sha2-512', + // RFC 8332 + 'ssh-rsa', + // RECOMMENDED sign Raw RSA Key + 'ssh-dss', + ]; + } + /** + * Returns a list of symmetric key algorithms that phpseclib supports + * + * @return array + */ + public static function getSupportedEncryptionAlgorithms() + { + $algos = [ + // from : + 'aes128-gcm@openssh.com', + 'aes256-gcm@openssh.com', + // from : + 'arcfour256', + 'arcfour128', + //'arcfour', // OPTIONAL the ARCFOUR stream cipher with a 128-bit key + // CTR modes from : + 'aes128-ctr', + // RECOMMENDED AES (Rijndael) in SDCTR mode, with 128-bit key + 'aes192-ctr', + // RECOMMENDED AES with 192-bit key + 'aes256-ctr', + // RECOMMENDED AES with 256-bit key + // from : + // one of the big benefits of chacha20-poly1305 is speed. the problem is... + // libsodium doesn't generate the poly1305 keys in the way ssh does and openssl's PHP bindings don't even + // seem to support poly1305 currently. so even if libsodium or openssl are being used for the chacha20 + // part, pure-PHP has to be used for the poly1305 part and that's gonna cause a big slow down. + // speed-wise it winds up being faster to use AES (when openssl or mcrypt are available) and some HMAC + // (which is always gonna be super fast to compute thanks to the hash extension, which + // "is bundled and compiled into PHP by default") + 'chacha20-poly1305@openssh.com', + 'twofish128-ctr', + // OPTIONAL Twofish in SDCTR mode, with 128-bit key + 'twofish192-ctr', + // OPTIONAL Twofish with 192-bit key + 'twofish256-ctr', + // OPTIONAL Twofish with 256-bit key + 'aes128-cbc', + // RECOMMENDED AES with a 128-bit key + 'aes192-cbc', + // OPTIONAL AES with a 192-bit key + 'aes256-cbc', + // OPTIONAL AES in CBC mode, with a 256-bit key + 'twofish128-cbc', + // OPTIONAL Twofish with a 128-bit key + 'twofish192-cbc', + // OPTIONAL Twofish with a 192-bit key + 'twofish256-cbc', + 'twofish-cbc', + // OPTIONAL alias for "twofish256-cbc" + // (this is being retained for historical reasons) + 'blowfish-ctr', + // OPTIONAL Blowfish in SDCTR mode + 'blowfish-cbc', + // OPTIONAL Blowfish in CBC mode + '3des-ctr', + // RECOMMENDED Three-key 3DES in SDCTR mode + '3des-cbc', + ]; + if (self::$crypto_engine) { + $engines = [self::$crypto_engine]; + } else { + $engines = ['libsodium', 'OpenSSL (GCM)', 'OpenSSL', 'mcrypt', 'Eval', 'PHP']; + } + $ciphers = []; + foreach ($engines as $engine) { + foreach ($algos as $algo) { + $obj = self::encryption_algorithm_to_crypt_instance($algo); + if ($obj instanceof Rijndael) { + $obj->setKeyLength(preg_replace('#[^\\d]#', '', $algo)); + } + switch ($algo) { + case 'chacha20-poly1305@openssh.com': + case 'arcfour128': + case 'arcfour256': + if ($engine != 'Eval') { + continue 2; + } + break; + case 'aes128-gcm@openssh.com': + case 'aes256-gcm@openssh.com': + if ($engine == 'OpenSSL') { + continue 2; + } + $obj->setNonce('dummydummydu'); + } + if ($obj->isValidEngine($engine)) { + $algos = array_diff($algos, [$algo]); + $ciphers[] = $algo; + } + } + } + return $ciphers; + } + /** + * Returns a list of MAC algorithms that phpseclib supports + * + * @return array + */ + public static function getSupportedMACAlgorithms() + { + return [ + 'hmac-sha2-256-etm@openssh.com', + 'hmac-sha2-512-etm@openssh.com', + 'umac-64-etm@openssh.com', + 'umac-128-etm@openssh.com', + 'hmac-sha1-etm@openssh.com', + // from : + 'hmac-sha2-256', + // RECOMMENDED HMAC-SHA256 (digest length = key length = 32) + 'hmac-sha2-512', + // OPTIONAL HMAC-SHA512 (digest length = key length = 64) + // from : + 'umac-64@openssh.com', + 'umac-128@openssh.com', + 'hmac-sha1-96', + // RECOMMENDED first 96 bits of HMAC-SHA1 (digest length = 12, key length = 20) + 'hmac-sha1', + // REQUIRED HMAC-SHA1 (digest length = key length = 20) + 'hmac-md5-96', + // OPTIONAL first 96 bits of HMAC-MD5 (digest length = 12, key length = 16) + 'hmac-md5', + ]; + } + /** + * Returns a list of compression algorithms that phpseclib supports + * + * @return array + */ + public static function getSupportedCompressionAlgorithms() + { + $algos = ['none']; + // REQUIRED no compression + if (function_exists('deflate_init')) { + $algos[] = 'zlib@openssh.com'; + // https://datatracker.ietf.org/doc/html/draft-miller-secsh-compression-delayed + $algos[] = 'zlib'; + } + return $algos; + } + /** + * Return list of negotiated algorithms + * + * Uses the same format as https://www.php.net/ssh2-methods-negotiated + * + * @return array + */ + public function getAlgorithmsNegotiated() + { + $this->connect(); + $compression_map = [self::NET_SSH2_COMPRESSION_NONE => 'none', self::NET_SSH2_COMPRESSION_ZLIB => 'zlib', self::NET_SSH2_COMPRESSION_ZLIB_AT_OPENSSH => 'zlib@openssh.com']; + return ['kex' => $this->kex_algorithm, 'hostkey' => $this->signature_format, 'client_to_server' => ['crypt' => $this->encryptName, 'mac' => $this->hmac_create_name, 'comp' => $compression_map[$this->compress]], 'server_to_client' => ['crypt' => $this->decryptName, 'mac' => $this->hmac_check_name, 'comp' => $compression_map[$this->decompress]]]; + } + /** + * Force multiple channels (even if phpseclib has decided to disable them) + */ + public function forceMultipleChannels() + { + $this->errorOnMultipleChannels = \false; + } + /** + * Allows you to set the terminal + * + * @param string $term + */ + public function setTerminal($term) + { + $this->term = $term; + } + /** + * Accepts an associative array with up to four parameters as described at + * + * + * @param array $methods + */ + public function setPreferredAlgorithms(array $methods) + { + $preferred = $methods; + if (isset($preferred['kex'])) { + $preferred['kex'] = array_intersect($preferred['kex'], static::getSupportedKEXAlgorithms()); + } + if (isset($preferred['hostkey'])) { + $preferred['hostkey'] = array_intersect($preferred['hostkey'], static::getSupportedHostKeyAlgorithms()); + } + $keys = ['client_to_server', 'server_to_client']; + foreach ($keys as $key) { + if (isset($preferred[$key])) { + $a =& $preferred[$key]; + if (isset($a['crypt'])) { + $a['crypt'] = array_intersect($a['crypt'], static::getSupportedEncryptionAlgorithms()); + } + if (isset($a['comp'])) { + $a['comp'] = array_intersect($a['comp'], static::getSupportedCompressionAlgorithms()); + } + if (isset($a['mac'])) { + $a['mac'] = array_intersect($a['mac'], static::getSupportedMACAlgorithms()); + } + } + } + $keys = ['kex', 'hostkey', 'client_to_server/crypt', 'client_to_server/comp', 'client_to_server/mac', 'server_to_client/crypt', 'server_to_client/comp', 'server_to_client/mac']; + foreach ($keys as $key) { + $p = $preferred; + $m = $methods; + $subkeys = explode('/', $key); + foreach ($subkeys as $subkey) { + if (!isset($p[$subkey])) { + continue 2; + } + $p = $p[$subkey]; + $m = $m[$subkey]; + } + if (count($p) != count($m)) { + $diff = array_diff($m, $p); + $msg = count($diff) == 1 ? ' is not a supported algorithm' : ' are not supported algorithms'; + throw new UnsupportedAlgorithmException(implode(', ', $diff) . $msg); + } + } + $this->preferred = $preferred; + } + /** + * Returns the banner message. + * + * Quoting from the RFC, "in some jurisdictions, sending a warning message before + * authentication may be relevant for getting legal protection." + * + * @return string + */ + public function getBannerMessage() + { + return $this->banner_message; + } + /** + * Returns the server public host key. + * + * Caching this the first time you connect to a server and checking the result on subsequent connections + * is recommended. Returns false if the server signature is not signed correctly with the public host key. + * + * @return string|false + * @throws \RuntimeException on badly formatted keys + * @throws \phpseclib3\Exception\NoSupportedAlgorithmsException when the key isn't in a supported format + */ + public function getServerPublicHostKey() + { + if (!($this->bitmap & self::MASK_CONSTRUCTOR)) { + $this->connect(); + } + $signature = $this->signature; + $server_public_host_key = base64_encode($this->server_public_host_key); + if ($this->signature_validated) { + return $this->bitmap ? $this->signature_format . ' ' . $server_public_host_key : \false; + } + $this->signature_validated = \true; + switch ($this->signature_format) { + case 'ssh-ed25519': + case 'ecdsa-sha2-nistp256': + case 'ecdsa-sha2-nistp384': + case 'ecdsa-sha2-nistp521': + $key = EC::loadFormat('OpenSSH', $server_public_host_key)->withSignatureFormat('SSH2'); + switch ($this->signature_format) { + case 'ssh-ed25519': + $hash = 'sha512'; + break; + case 'ecdsa-sha2-nistp256': + $hash = 'sha256'; + break; + case 'ecdsa-sha2-nistp384': + $hash = 'sha384'; + break; + case 'ecdsa-sha2-nistp521': + $hash = 'sha512'; + } + $key = $key->withHash($hash); + break; + case 'ssh-dss': + $key = DSA::loadFormat('OpenSSH', $server_public_host_key)->withSignatureFormat('SSH2')->withHash('sha1'); + break; + case 'ssh-rsa': + case 'rsa-sha2-256': + case 'rsa-sha2-512': + // could be ssh-rsa, rsa-sha2-256, rsa-sha2-512 + // we don't check here because we already checked in key_exchange + // some signatures have the type embedded within the message and some don't + list(, $signature) = Strings::unpackSSH2('ss', $signature); + $key = RSA::loadFormat('OpenSSH', $server_public_host_key)->withPadding(RSA::SIGNATURE_PKCS1); + switch ($this->signature_format) { + case 'rsa-sha2-512': + $hash = 'sha512'; + break; + case 'rsa-sha2-256': + $hash = 'sha256'; + break; + //case 'ssh-rsa': + default: + $hash = 'sha1'; + } + $key = $key->withHash($hash); + break; + default: + $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); + throw new NoSupportedAlgorithmsException('Unsupported signature format'); + } + if (!$key->verify($this->exchange_hash, $signature)) { + return $this->disconnect_helper(NET_SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE); + } + return $this->signature_format . ' ' . $server_public_host_key; + } + /** + * Returns the exit status of an SSH command or false. + * + * @return false|int + */ + public function getExitStatus() + { + if (is_null($this->exit_status)) { + return \false; + } + return $this->exit_status; + } + /** + * Returns the number of columns for the terminal window size. + * + * @return int + */ + public function getWindowColumns() + { + return $this->windowColumns; + } + /** + * Returns the number of rows for the terminal window size. + * + * @return int + */ + public function getWindowRows() + { + return $this->windowRows; + } + /** + * Sets the number of columns for the terminal window size. + * + * @param int $value + */ + public function setWindowColumns($value) + { + $this->windowColumns = $value; + } + /** + * Sets the number of rows for the terminal window size. + * + * @param int $value + */ + public function setWindowRows($value) + { + $this->windowRows = $value; + } + /** + * Sets the number of columns and rows for the terminal window size. + * + * @param int $columns + * @param int $rows + */ + public function setWindowSize($columns = 80, $rows = 24) + { + $this->windowColumns = $columns; + $this->windowRows = $rows; + } + /** + * To String Magic Method + * + * @return string + */ + #[\ReturnTypeWillChange] + public function __toString() + { + return $this->getResourceId(); + } + /** + * Get Resource ID + * + * We use {} because that symbols should not be in URL according to + * {@link http://tools.ietf.org/html/rfc3986#section-2 RFC}. + * It will safe us from any conflicts, because otherwise regexp will + * match all alphanumeric domains. + * + * @return string + */ + public function getResourceId() + { + return '{' . spl_object_hash($this) . '}'; + } + /** + * Return existing connection + * + * @param string $id + * + * @return bool|SSH2 will return false if no such connection + */ + public static function getConnectionByResourceId($id) + { + if (isset(self::$connections[$id])) { + return self::$connections[$id] instanceof \WeakReference ? self::$connections[$id]->get() : self::$connections[$id]; + } + return \false; + } + /** + * Return all excising connections + * + * @return array + */ + public static function getConnections() + { + if (!class_exists('WeakReference')) { + /** @var array */ + return self::$connections; + } + $temp = []; + foreach (self::$connections as $key => $ref) { + $temp[$key] = $ref->get(); + } + return $temp; + } + /* + * Update packet types in log history + * + * @param string $old + * @param string $new + */ + private function updateLogHistory($old, $new) + { + if (defined('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\NET_SSH2_LOGGING') && NET_SSH2_LOGGING == self::LOG_COMPLEX) { + $this->message_number_log[count($this->message_number_log) - 1] = str_replace($old, $new, $this->message_number_log[count($this->message_number_log) - 1]); + } + } + /** + * Return the list of authentication methods that may productively continue authentication. + * + * @see https://tools.ietf.org/html/rfc4252#section-5.1 + * @return array|null + */ + public function getAuthMethodsToContinue() + { + return $this->auth_methods_to_continue; + } + /** + * Enables "smart" multi-factor authentication (MFA) + */ + public function enableSmartMFA() + { + $this->smartMFA = \true; + } + /** + * Disables "smart" multi-factor authentication (MFA) + */ + public function disableSmartMFA() + { + $this->smartMFA = \false; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php new file mode 100644 index 0000000..2975784 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php @@ -0,0 +1,253 @@ + + * login('username', $agent)) { + * exit('Login Failed'); + * } + * + * echo $ssh->exec('pwd'); + * echo $ssh->exec('ls -la'); + * ?> + * + * + * @author Jim Wigginton + * @copyright 2014 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\PublicKeyLoader; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\BadConfigurationException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Net\SSH2; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH\Agent\Identity; +/** + * Pure-PHP ssh-agent client identity factory + * + * requestIdentities() method pumps out \phpseclib3\System\SSH\Agent\Identity objects + * + * @author Jim Wigginton + */ +class Agent +{ + use Common\Traits\ReadBytes; + // Message numbers + // to request SSH1 keys you have to use SSH_AGENTC_REQUEST_RSA_IDENTITIES (1) + const SSH_AGENTC_REQUEST_IDENTITIES = 11; + // this is the SSH2 response; the SSH1 response is SSH_AGENT_RSA_IDENTITIES_ANSWER (2). + const SSH_AGENT_IDENTITIES_ANSWER = 12; + // the SSH1 request is SSH_AGENTC_RSA_CHALLENGE (3) + const SSH_AGENTC_SIGN_REQUEST = 13; + // the SSH1 response is SSH_AGENT_RSA_RESPONSE (4) + const SSH_AGENT_SIGN_RESPONSE = 14; + // Agent forwarding status + // no forwarding requested and not active + const FORWARD_NONE = 0; + // request agent forwarding when opportune + const FORWARD_REQUEST = 1; + // forwarding has been request and is active + const FORWARD_ACTIVE = 2; + /** + * Unused + */ + const SSH_AGENT_FAILURE = 5; + /** + * Socket Resource + * + * @var resource + */ + private $fsock; + /** + * Agent forwarding status + * + * @var int + */ + private $forward_status = self::FORWARD_NONE; + /** + * Buffer for accumulating forwarded authentication + * agent data arriving on SSH data channel destined + * for agent unix socket + * + * @var string + */ + private $socket_buffer = ''; + /** + * Tracking the number of bytes we are expecting + * to arrive for the agent socket on the SSH data + * channel + * + * @var int + */ + private $expected_bytes = 0; + /** + * Default Constructor + * + * @return \phpseclib3\System\SSH\Agent + * @throws \phpseclib3\Exception\BadConfigurationException if SSH_AUTH_SOCK cannot be found + * @throws \RuntimeException on connection errors + */ + public function __construct($address = null) + { + if (!$address) { + switch (\true) { + case isset($_SERVER['SSH_AUTH_SOCK']): + $address = $_SERVER['SSH_AUTH_SOCK']; + break; + case isset($_ENV['SSH_AUTH_SOCK']): + $address = $_ENV['SSH_AUTH_SOCK']; + break; + default: + throw new BadConfigurationException('SSH_AUTH_SOCK not found'); + } + } + if (in_array('unix', stream_get_transports())) { + $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); + if (!$this->fsock) { + throw new \RuntimeException("Unable to connect to ssh-agent (Error {$errno}: {$errstr})"); + } + } else { + if (substr($address, 0, 9) != '\\\\.\\pipe\\' || strpos(substr($address, 9), '\\') !== \false) { + throw new \RuntimeException('Address is not formatted as a named pipe should be'); + } + $this->fsock = fopen($address, 'r+b'); + if (!$this->fsock) { + throw new \RuntimeException('Unable to open address'); + } + } + } + /** + * Request Identities + * + * See "2.5.2 Requesting a list of protocol 2 keys" + * Returns an array containing zero or more \phpseclib3\System\SSH\Agent\Identity objects + * + * @return array + * @throws \RuntimeException on receipt of unexpected packets + */ + public function requestIdentities() + { + if (!$this->fsock) { + return []; + } + $packet = pack('NC', 1, self::SSH_AGENTC_REQUEST_IDENTITIES); + if (strlen($packet) != fputs($this->fsock, $packet)) { + throw new \RuntimeException('Connection closed while requesting identities'); + } + $length = current(unpack('N', $this->readBytes(4))); + $packet = $this->readBytes($length); + list($type, $keyCount) = Strings::unpackSSH2('CN', $packet); + if ($type != self::SSH_AGENT_IDENTITIES_ANSWER) { + throw new \RuntimeException('Unable to request identities'); + } + $identities = []; + for ($i = 0; $i < $keyCount; $i++) { + list($key_blob, $comment) = Strings::unpackSSH2('ss', $packet); + $temp = $key_blob; + list($key_type) = Strings::unpackSSH2('s', $temp); + switch ($key_type) { + case 'ssh-rsa': + case 'ssh-dss': + case 'ssh-ed25519': + case 'ecdsa-sha2-nistp256': + case 'ecdsa-sha2-nistp384': + case 'ecdsa-sha2-nistp521': + $key = PublicKeyLoader::load($key_type . ' ' . base64_encode($key_blob)); + } + // resources are passed by reference by default + if (isset($key)) { + $identity = (new Identity($this->fsock))->withPublicKey($key)->withPublicKeyBlob($key_blob); + $identities[] = $identity; + unset($key); + } + } + return $identities; + } + /** + * Signal that agent forwarding should + * be requested when a channel is opened + * + * @return void + */ + public function startSSHForwarding() + { + if ($this->forward_status == self::FORWARD_NONE) { + $this->forward_status = self::FORWARD_REQUEST; + } + } + /** + * Request agent forwarding of remote server + * + * @param \phpseclib3\Net\SSH2 $ssh + * @return bool + */ + private function request_forwarding(SSH2 $ssh) + { + if (!$ssh->requestAgentForwarding()) { + return \false; + } + $this->forward_status = self::FORWARD_ACTIVE; + return \true; + } + /** + * On successful channel open + * + * This method is called upon successful channel + * open to give the SSH Agent an opportunity + * to take further action. i.e. request agent forwarding + * + * @param \phpseclib3\Net\SSH2 $ssh + */ + public function registerChannelOpen(SSH2 $ssh) + { + if ($this->forward_status == self::FORWARD_REQUEST) { + $this->request_forwarding($ssh); + } + } + /** + * Forward data to SSH Agent and return data reply + * + * @param string $data + * @return string Data from SSH Agent + * @throws \RuntimeException on connection errors + */ + public function forwardData($data) + { + if ($this->expected_bytes > 0) { + $this->socket_buffer .= $data; + $this->expected_bytes -= strlen($data); + } else { + $agent_data_bytes = current(unpack('N', $data)); + $current_data_bytes = strlen($data); + $this->socket_buffer = $data; + if ($current_data_bytes != $agent_data_bytes + 4) { + $this->expected_bytes = $agent_data_bytes + 4 - $current_data_bytes; + return \false; + } + } + if (strlen($this->socket_buffer) != fwrite($this->fsock, $this->socket_buffer)) { + throw new \RuntimeException('Connection closed attempting to forward data to SSH agent'); + } + $this->socket_buffer = ''; + $this->expected_bytes = 0; + $agent_reply_bytes = current(unpack('N', $this->readBytes(4))); + $agent_reply_data = $this->readBytes($agent_reply_bytes); + $agent_reply_data = current(unpack('a*', $agent_reply_data)); + return pack('Na*', $agent_reply_bytes, $agent_reply_data); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php new file mode 100644 index 0000000..651e817 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php @@ -0,0 +1,280 @@ + + * @copyright 2009 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH\Agent; + +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Common\Functions\Strings; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PrivateKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\Common\PublicKey; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\DSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\EC; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Crypt\RSA; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\Exception\UnsupportedAlgorithmException; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH\Agent; +use Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH\Common\Traits\ReadBytes; +/** + * Pure-PHP ssh-agent client identity object + * + * Instantiation should only be performed by \phpseclib3\System\SSH\Agent class. + * This could be thought of as implementing an interface that phpseclib3\Crypt\RSA + * implements. ie. maybe a Net_SSH_Auth_PublicKey interface or something. + * The methods in this interface would be getPublicKey and sign since those are the + * methods phpseclib looks for to perform public key authentication. + * + * @author Jim Wigginton + * @internal + */ +class Identity implements PrivateKey +{ + use ReadBytes; + // Signature Flags + // See https://tools.ietf.org/html/draft-miller-ssh-agent-00#section-5.3 + const SSH_AGENT_RSA2_256 = 2; + const SSH_AGENT_RSA2_512 = 4; + /** + * Key Object + * + * @var PublicKey + * @see self::getPublicKey() + */ + private $key; + /** + * Key Blob + * + * @var string + * @see self::sign() + */ + private $key_blob; + /** + * Socket Resource + * + * @var resource + * @see self::sign() + */ + private $fsock; + /** + * Signature flags + * + * @var int + * @see self::sign() + * @see self::setHash() + */ + private $flags = 0; + /** + * Curve Aliases + * + * @var array + */ + private static $curveAliases = ['secp256r1' => 'nistp256', 'secp384r1' => 'nistp384', 'secp521r1' => 'nistp521', 'Ed25519' => 'Ed25519']; + /** + * Default Constructor. + * + * @param resource $fsock + */ + public function __construct($fsock) + { + $this->fsock = $fsock; + } + /** + * Set Public Key + * + * Called by \phpseclib3\System\SSH\Agent::requestIdentities() + * + * @param \phpseclib3\Crypt\Common\PublicKey $key + */ + public function withPublicKey(PublicKey $key) + { + if ($key instanceof EC) { + if (is_array($key->getCurve()) || !isset(self::$curveAliases[$key->getCurve()])) { + throw new UnsupportedAlgorithmException('The only supported curves are nistp256, nistp384, nistp512 and Ed25519'); + } + } + $new = clone $this; + $new->key = $key; + return $new; + } + /** + * Set Public Key + * + * Called by \phpseclib3\System\SSH\Agent::requestIdentities(). The key blob could be extracted from $this->key + * but this saves a small amount of computation. + * + * @param string $key_blob + */ + public function withPublicKeyBlob($key_blob) + { + $new = clone $this; + $new->key_blob = $key_blob; + return $new; + } + /** + * Get Public Key + * + * Wrapper for $this->key->getPublicKey() + * + * @param string $type optional + * @return mixed + */ + public function getPublicKey($type = 'PKCS8') + { + return $this->key; + } + /** + * Sets the hash + * + * @param string $hash + */ + public function withHash($hash) + { + $new = clone $this; + $hash = strtolower($hash); + if ($this->key instanceof RSA) { + $new->flags = 0; + switch ($hash) { + case 'sha1': + break; + case 'sha256': + $new->flags = self::SSH_AGENT_RSA2_256; + break; + case 'sha512': + $new->flags = self::SSH_AGENT_RSA2_512; + break; + default: + throw new UnsupportedAlgorithmException('The only supported hashes for RSA are sha1, sha256 and sha512'); + } + } + if ($this->key instanceof EC) { + switch ($this->key->getCurve()) { + case 'secp256r1': + $expectedHash = 'sha256'; + break; + case 'secp384r1': + $expectedHash = 'sha384'; + break; + //case 'secp521r1': + //case 'Ed25519': + default: + $expectedHash = 'sha512'; + } + if ($hash != $expectedHash) { + throw new UnsupportedAlgorithmException('The only supported hash for ' . self::$curveAliases[$this->key->getCurve()] . ' is ' . $expectedHash); + } + } + if ($this->key instanceof DSA) { + if ($hash != 'sha1') { + throw new UnsupportedAlgorithmException('The only supported hash for DSA is sha1'); + } + } + return $new; + } + /** + * Sets the padding + * + * Only PKCS1 padding is supported + * + * @param string $padding + */ + public function withPadding($padding) + { + if (!$this->key instanceof RSA) { + throw new UnsupportedAlgorithmException('Only RSA keys support padding'); + } + if ($padding != RSA::SIGNATURE_PKCS1 && $padding != RSA::SIGNATURE_RELAXED_PKCS1) { + throw new UnsupportedAlgorithmException('ssh-agent can only create PKCS1 signatures'); + } + return $this; + } + /** + * Determines the signature padding mode + * + * Valid values are: ASN1, SSH2, Raw + * + * @param string $format + */ + public function withSignatureFormat($format) + { + if ($this->key instanceof RSA) { + throw new UnsupportedAlgorithmException('Only DSA and EC keys support signature format setting'); + } + if ($format != 'SSH2') { + throw new UnsupportedAlgorithmException('Only SSH2-formatted signatures are currently supported'); + } + return $this; + } + /** + * Returns the curve + * + * Returns a string if it's a named curve, an array if not + * + * @return string|array + */ + public function getCurve() + { + if (!$this->key instanceof EC) { + throw new UnsupportedAlgorithmException('Only EC keys have curves'); + } + return $this->key->getCurve(); + } + /** + * Create a signature + * + * See "2.6.2 Protocol 2 private key signature request" + * + * @param string $message + * @return string + * @throws \RuntimeException on connection errors + * @throws \phpseclib3\Exception\UnsupportedAlgorithmException if the algorithm is unsupported + */ + public function sign($message) + { + // the last parameter (currently 0) is for flags and ssh-agent only defines one flag (for ssh-dss): SSH_AGENT_OLD_SIGNATURE + $packet = Strings::packSSH2('CssN', Agent::SSH_AGENTC_SIGN_REQUEST, $this->key_blob, $message, $this->flags); + $packet = Strings::packSSH2('s', $packet); + if (strlen($packet) != fputs($this->fsock, $packet)) { + throw new \RuntimeException('Connection closed during signing'); + } + $length = current(unpack('N', $this->readBytes(4))); + $packet = $this->readBytes($length); + list($type, $signature_blob) = Strings::unpackSSH2('Cs', $packet); + if ($type != Agent::SSH_AGENT_SIGN_RESPONSE) { + throw new \RuntimeException('Unable to retrieve signature'); + } + if (!$this->key instanceof RSA) { + return $signature_blob; + } + list($type, $signature_blob) = Strings::unpackSSH2('ss', $signature_blob); + return $signature_blob; + } + /** + * Returns the private key + * + * @param string $type + * @param array $options optional + * @return string + */ + public function toString($type, array $options = []) + { + throw new \RuntimeException('ssh-agent does not provide a mechanism to get the private key'); + } + /** + * Sets the password + * + * @param string|bool $password + * @return never + */ + public function withPassword($password = \false) + { + throw new \RuntimeException('ssh-agent does not provide a mechanism to get the private key'); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Common/Traits/ReadBytes.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Common/Traits/ReadBytes.php new file mode 100644 index 0000000..2263be4 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/System/SSH/Common/Traits/ReadBytes.php @@ -0,0 +1,36 @@ + + * @copyright 2015 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ +namespace Matomo\Dependencies\SearchEngineKeywordsPerformance\phpseclib3\System\SSH\Common\Traits; + +/** + * ReadBytes trait + * + * @author Jim Wigginton + */ +trait ReadBytes +{ + /** + * Read data + * + * @param int $length + * @throws \RuntimeException on connection errors + */ + public function readBytes($length) + { + $temp = fread($this->fsock, $length); + if (strlen($temp) != $length) { + throw new \RuntimeException("Expected {$length} bytes; got " . strlen($temp)); + } + return $temp; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/bootstrap.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/bootstrap.php new file mode 100644 index 0000000..36adeb5 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/phpseclib/phpseclib/phpseclib/bootstrap.php @@ -0,0 +1,20 @@ +getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * While header names are not case-sensitive, getHeaders() will preserve the + * exact case in which headers were originally specified. + * + * @return string[][] Returns an associative array of the message's headers. Each + * key MUST be a header name, and each value MUST be an array of strings + * for that header. + */ + public function getHeaders() : array; + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader(string $name) : bool; + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader(string $name) : array; + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * concatenated together using a comma. If the header does not appear in + * the message, this method MUST return an empty string. + */ + public function getHeaderLine(string $name) : string; + /** + * Return an instance with the provided value replacing the specified header. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withHeader(string $name, $value) : MessageInterface; + /** + * Return an instance with the specified header appended with the given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withAddedHeader(string $name, $value) : MessageInterface; + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader(string $name) : MessageInterface; + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody() : StreamInterface; + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws \InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body) : MessageInterface; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/psr/http-message/src/RequestInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/psr/http-message/src/RequestInterface.php new file mode 100644 index 0000000..a9617a6 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/psr/http-message/src/RequestInterface.php @@ -0,0 +1,124 @@ +getQuery()` + * or from the `QUERY_STRING` server param. + * + * @return array + */ + public function getQueryParams() : array; + /** + * Return an instance with the specified query string arguments. + * + * These values SHOULD remain immutable over the course of the incoming + * request. They MAY be injected during instantiation, such as from PHP's + * $_GET superglobal, or MAY be derived from some other value such as the + * URI. In cases where the arguments are parsed from the URI, the data + * MUST be compatible with what PHP's parse_str() would return for + * purposes of how duplicate query parameters are handled, and how nested + * sets are handled. + * + * Setting query string arguments MUST NOT change the URI stored by the + * request, nor the values in the server params. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated query string arguments. + * + * @param array $query Array of query string arguments, typically from + * $_GET. + * @return static + */ + public function withQueryParams(array $query) : ServerRequestInterface; + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles() : array; + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles) : ServerRequestInterface; + /** + * Retrieve any parameters provided in the request body. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, this method MUST + * return the contents of $_POST. + * + * Otherwise, this method may return any results of deserializing + * the request body content; as parsing returns structured content, the + * potential types MUST be arrays or objects only. A null value indicates + * the absence of body content. + * + * @return null|array|object The deserialized body parameters, if any. + * These will typically be an array or object. + */ + public function getParsedBody(); + /** + * Return an instance with the specified body parameters. + * + * These MAY be injected during instantiation. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, use this method + * ONLY to inject the contents of $_POST. + * + * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of + * deserializing the request body content. Deserialization/parsing returns + * structured data, and, as such, this method ONLY accepts arrays or objects, + * or a null value if nothing was available to parse. + * + * As an example, if content negotiation determines that the request data + * is a JSON payload, this method could be used to create a request + * instance with the deserialized parameters. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param null|array|object $data The deserialized body data. This will + * typically be in an array or object. + * @return static + * @throws \InvalidArgumentException if an unsupported argument type is + * provided. + */ + public function withParsedBody($data) : ServerRequestInterface; + /** + * Retrieve attributes derived from the request. + * + * The request "attributes" may be used to allow injection of any + * parameters derived from the request: e.g., the results of path + * match operations; the results of decrypting cookies; the results of + * deserializing non-form-encoded message bodies; etc. Attributes + * will be application and request specific, and CAN be mutable. + * + * @return array Attributes derived from the request. + */ + public function getAttributes() : array; + /** + * Retrieve a single derived request attribute. + * + * Retrieves a single derived request attribute as described in + * getAttributes(). If the attribute has not been previously set, returns + * the default value as provided. + * + * This method obviates the need for a hasAttribute() method, as it allows + * specifying a default value to return if the attribute is not found. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute(string $name, $default = null); + /** + * Return an instance with the specified derived request attribute. + * + * This method allows setting a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute(string $name, $value) : ServerRequestInterface; + /** + * Return an instance that removes the specified derived request attribute. + * + * This method allows removing a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute(string $name) : ServerRequestInterface; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/psr/http-message/src/StreamInterface.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/psr/http-message/src/StreamInterface.php new file mode 100644 index 0000000..21d4831 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/psr/http-message/src/StreamInterface.php @@ -0,0 +1,144 @@ + + * [user-info@]host[:port] + * + * + * If the port component is not set or is the standard port for the current + * scheme, it SHOULD NOT be included. + * + * @see https://tools.ietf.org/html/rfc3986#section-3.2 + * @return string The URI authority, in "[user-info@]host[:port]" format. + */ + public function getAuthority() : string; + /** + * Retrieve the user information component of the URI. + * + * If no user information is present, this method MUST return an empty + * string. + * + * If a user is present in the URI, this will return that value; + * additionally, if the password is also present, it will be appended to the + * user value, with a colon (":") separating the values. + * + * The trailing "@" character is not part of the user information and MUST + * NOT be added. + * + * @return string The URI user information, in "username[:password]" format. + */ + public function getUserInfo() : string; + /** + * Retrieve the host component of the URI. + * + * If no host is present, this method MUST return an empty string. + * + * The value returned MUST be normalized to lowercase, per RFC 3986 + * Section 3.2.2. + * + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 + * @return string The URI host. + */ + public function getHost() : string; + /** + * Retrieve the port component of the URI. + * + * If a port is present, and it is non-standard for the current scheme, + * this method MUST return it as an integer. If the port is the standard port + * used with the current scheme, this method SHOULD return null. + * + * If no port is present, and no scheme is present, this method MUST return + * a null value. + * + * If no port is present, but a scheme is present, this method MAY return + * the standard port for that scheme, but SHOULD return null. + * + * @return null|int The URI port. + */ + public function getPort() : ?int; + /** + * Retrieve the path component of the URI. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * Normally, the empty path "" and absolute path "/" are considered equal as + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically + * do this normalization because in contexts with a trimmed base path, e.g. + * the front controller, this difference becomes significant. It's the task + * of the user to handle both "" and "/". + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.3. + * + * As an example, if the value should include a slash ("/") not intended as + * delimiter between path segments, that value MUST be passed in encoded + * form (e.g., "%2F") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.3 + * @return string The URI path. + */ + public function getPath() : string; + /** + * Retrieve the query string of the URI. + * + * If no query string is present, this method MUST return an empty string. + * + * The leading "?" character is not part of the query and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.4. + * + * As an example, if a value in a key/value pair of the query string should + * include an ampersand ("&") not intended as a delimiter between values, + * that value MUST be passed in encoded form (e.g., "%26") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.4 + * @return string The URI query string. + */ + public function getQuery() : string; + /** + * Retrieve the fragment component of the URI. + * + * If no fragment is present, this method MUST return an empty string. + * + * The leading "#" character is not part of the fragment and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.5. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.5 + * @return string The URI fragment. + */ + public function getFragment() : string; + /** + * Return an instance with the specified scheme. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified scheme. + * + * Implementations MUST support the schemes "http" and "https" case + * insensitively, and MAY accommodate other schemes if required. + * + * An empty scheme is equivalent to removing the scheme. + * + * @param string $scheme The scheme to use with the new instance. + * @return static A new instance with the specified scheme. + * @throws \InvalidArgumentException for invalid or unsupported schemes. + */ + public function withScheme(string $scheme) : UriInterface; + /** + * Return an instance with the specified user information. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified user information. + * + * Password is optional, but the user information MUST include the + * user; an empty string for the user is equivalent to removing user + * information. + * + * @param string $user The user name to use for authority. + * @param null|string $password The password associated with $user. + * @return static A new instance with the specified user information. + */ + public function withUserInfo(string $user, ?string $password = null) : UriInterface; + /** + * Return an instance with the specified host. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified host. + * + * An empty host value is equivalent to removing the host. + * + * @param string $host The hostname to use with the new instance. + * @return static A new instance with the specified host. + * @throws \InvalidArgumentException for invalid hostnames. + */ + public function withHost(string $host) : UriInterface; + /** + * Return an instance with the specified port. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified port. + * + * Implementations MUST raise an exception for ports outside the + * established TCP and UDP port ranges. + * + * A null value provided for the port is equivalent to removing the port + * information. + * + * @param null|int $port The port to use with the new instance; a null value + * removes the port information. + * @return static A new instance with the specified port. + * @throws \InvalidArgumentException for invalid ports. + */ + public function withPort(?int $port) : UriInterface; + /** + * Return an instance with the specified path. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified path. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * If the path is intended to be domain-relative rather than path relative then + * it must begin with a slash ("/"). Paths not starting with a slash ("/") + * are assumed to be relative to some base path known to the application or + * consumer. + * + * Users can provide both encoded and decoded path characters. + * Implementations ensure the correct encoding as outlined in getPath(). + * + * @param string $path The path to use with the new instance. + * @return static A new instance with the specified path. + * @throws \InvalidArgumentException for invalid paths. + */ + public function withPath(string $path) : UriInterface; + /** + * Return an instance with the specified query string. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified query string. + * + * Users can provide both encoded and decoded query characters. + * Implementations ensure the correct encoding as outlined in getQuery(). + * + * An empty query string value is equivalent to removing the query string. + * + * @param string $query The query string to use with the new instance. + * @return static A new instance with the specified query string. + * @throws \InvalidArgumentException for invalid query strings. + */ + public function withQuery(string $query) : UriInterface; + /** + * Return an instance with the specified URI fragment. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified URI fragment. + * + * Users can provide both encoded and decoded fragment characters. + * Implementations ensure the correct encoding as outlined in getFragment(). + * + * An empty fragment value is equivalent to removing the fragment. + * + * @param string $fragment The fragment to use with the new instance. + * @return static A new instance with the specified fragment. + */ + public function withFragment(string $fragment) : UriInterface; + /** + * Return the string representation as a URI reference. + * + * Depending on which components of the URI are present, the resulting + * string is either a full URI or relative reference according to RFC 3986, + * Section 4.1. The method concatenates the various components of the URI, + * using the appropriate delimiters: + * + * - If a scheme is present, it MUST be suffixed by ":". + * - If an authority is present, it MUST be prefixed by "//". + * - The path can be concatenated without delimiters. But there are two + * cases where the path has to be adjusted to make the URI reference + * valid as PHP does not allow to throw an exception in __toString(): + * - If the path is rootless and an authority is present, the path MUST + * be prefixed by "/". + * - If the path is starting with more than one "/" and no authority is + * present, the starting slashes MUST be reduced to one. + * - If a query is present, it MUST be prefixed by "?". + * - If a fragment is present, it MUST be prefixed by "#". + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @return string + */ + public function __toString() : string; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/ralouphie/getallheaders/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/ralouphie/getallheaders/LICENSE new file mode 100644 index 0000000..be5540c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/ralouphie/getallheaders/src/getallheaders.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 0000000..9eafec7 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,38 @@ + 'Content-Type', 'CONTENT_LENGTH' => 'Content-Length', 'CONTENT_MD5' => 'Content-Md5'); + foreach ($_SERVER as $key => $value) { + if (\substr($key, 0, 5) === 'HTTP_') { + $key = \substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = \str_replace(' ', '-', \ucwords(\strtolower(\str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . \base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + return $headers; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/symfony/deprecation-contracts/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/symfony/deprecation-contracts/LICENSE new file mode 100644 index 0000000..0ed3a24 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/symfony/deprecation-contracts/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020-present Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/symfony/deprecation-contracts/function.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/symfony/deprecation-contracts/function.php new file mode 100644 index 0000000..4d69d70 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/symfony/deprecation-contracts/function.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +if (!\function_exists('Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\trigger_deprecation')) { + /** + * Triggers a silenced deprecation notice. + * + * @param string $package The name of the Composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string $message The message of the deprecation + * @param mixed ...$args Values to insert in the message using printf() formatting + * + * @author Nicolas Grekas + */ + function trigger_deprecation(string $package, string $version, string $message, ...$args) : void + { + @\trigger_error(($package || $version ? "Since {$package} {$version}: " : '') . ($args ? \vsprintf($message, $args) : $message), \E_USER_DEPRECATED); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/autoload.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/autoload.php new file mode 100644 index 0000000..088f52d --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/autoload.php @@ -0,0 +1,12 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-return array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/LICENSE b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/LICENSE new file mode 100644 index 0000000..f27399a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_classmap.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..3b3aae3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_classmap.php @@ -0,0 +1,581 @@ + $vendorDir . '/composer/InstalledVersions.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\BeforeValidException' => $baseDir . '/firebase/php-jwt/src/BeforeValidException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\CachedKeySet' => $baseDir . '/firebase/php-jwt/src/CachedKeySet.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\ExpiredException' => $baseDir . '/firebase/php-jwt/src/ExpiredException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\JWK' => $baseDir . '/firebase/php-jwt/src/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\JWT' => $baseDir . '/firebase/php-jwt/src/JWT.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\JWTExceptionWithPayloadInterface' => $baseDir . '/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\Key' => $baseDir . '/firebase/php-jwt/src/Key.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\SignatureInvalidException' => $baseDir . '/firebase/php-jwt/src/SignatureInvalidException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AccessToken\\Revoke' => $baseDir . '/google/apiclient/src/AccessToken/Revoke.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AccessToken\\Verify' => $baseDir . '/google/apiclient/src/AccessToken/Verify.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\AuthHandlerFactory' => $baseDir . '/google/apiclient/src/AuthHandler/AuthHandlerFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\Guzzle6AuthHandler' => $baseDir . '/google/apiclient/src/AuthHandler/Guzzle6AuthHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\Guzzle7AuthHandler' => $baseDir . '/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\AccessToken' => $baseDir . '/google/auth/src/AccessToken.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ApplicationDefaultCredentials' => $baseDir . '/google/auth/src/ApplicationDefaultCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CacheTrait' => $baseDir . '/google/auth/src/CacheTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\InvalidArgumentException' => $baseDir . '/google/auth/src/Cache/InvalidArgumentException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\Item' => $baseDir . '/google/auth/src/Cache/Item.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\MemoryCacheItemPool' => $baseDir . '/google/auth/src/Cache/MemoryCacheItemPool.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\SysVCacheItemPool' => $baseDir . '/google/auth/src/Cache/SysVCacheItemPool.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\TypedItem' => $baseDir . '/google/auth/src/Cache/TypedItem.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialSource\\AwsNativeSource' => $baseDir . '/google/auth/src/CredentialSource/AwsNativeSource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialSource\\FileSource' => $baseDir . '/google/auth/src/CredentialSource/FileSource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialSource\\UrlSource' => $baseDir . '/google/auth/src/CredentialSource/UrlSource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialsLoader' => $baseDir . '/google/auth/src/CredentialsLoader.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\AppIdentityCredentials' => $baseDir . '/google/auth/src/Credentials/AppIdentityCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ExternalAccountCredentials' => $baseDir . '/google/auth/src/Credentials/ExternalAccountCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\GCECredentials' => $baseDir . '/google/auth/src/Credentials/GCECredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\IAMCredentials' => $baseDir . '/google/auth/src/Credentials/IAMCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ImpersonatedServiceAccountCredentials' => $baseDir . '/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\InsecureCredentials' => $baseDir . '/google/auth/src/Credentials/InsecureCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ServiceAccountCredentials' => $baseDir . '/google/auth/src/Credentials/ServiceAccountCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => $baseDir . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\UserRefreshCredentials' => $baseDir . '/google/auth/src/Credentials/UserRefreshCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ExternalAccountCredentialSourceInterface' => $baseDir . '/google/auth/src/ExternalAccountCredentialSourceInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\FetchAuthTokenCache' => $baseDir . '/google/auth/src/FetchAuthTokenCache.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\FetchAuthTokenInterface' => $baseDir . '/google/auth/src/FetchAuthTokenInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\GCECache' => $baseDir . '/google/auth/src/GCECache.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\GetQuotaProjectInterface' => $baseDir . '/google/auth/src/GetQuotaProjectInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\GetUniverseDomainInterface' => $baseDir . '/google/auth/src/GetUniverseDomainInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => $baseDir . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\Guzzle7HttpHandler' => $baseDir . '/google/auth/src/HttpHandler/Guzzle7HttpHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\HttpClientCache' => $baseDir . '/google/auth/src/HttpHandler/HttpClientCache.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\HttpHandlerFactory' => $baseDir . '/google/auth/src/HttpHandler/HttpHandlerFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Iam' => $baseDir . '/google/auth/src/Iam.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\IamSignerTrait' => $baseDir . '/google/auth/src/IamSignerTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\AuthTokenMiddleware' => $baseDir . '/google/auth/src/Middleware/AuthTokenMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\ProxyAuthTokenMiddleware' => $baseDir . '/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => $baseDir . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\SimpleMiddleware' => $baseDir . '/google/auth/src/Middleware/SimpleMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\OAuth2' => $baseDir . '/google/auth/src/OAuth2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ProjectIdProviderInterface' => $baseDir . '/google/auth/src/ProjectIdProviderInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ServiceAccountSignerTrait' => $baseDir . '/google/auth/src/ServiceAccountSignerTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\SignBlobInterface' => $baseDir . '/google/auth/src/SignBlobInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\UpdateMetadataInterface' => $baseDir . '/google/auth/src/UpdateMetadataInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\UpdateMetadataTrait' => $baseDir . '/google/auth/src/UpdateMetadataTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Client' => $baseDir . '/google/apiclient/src/Client.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Collection' => $baseDir . '/google/apiclient/src/Collection.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Exception' => $baseDir . '/google/apiclient/src/Exception.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\Batch' => $baseDir . '/google/apiclient/src/Http/Batch.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\MediaFileUpload' => $baseDir . '/google/apiclient/src/Http/MediaFileUpload.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\REST' => $baseDir . '/google/apiclient/src/Http/REST.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Model' => $baseDir . '/google/apiclient/src/Model.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service' => $baseDir . '/google/apiclient/src/Service.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Exception' => $baseDir . '/google/apiclient/src/Service/Exception.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2' => $baseDir . '/google/apiclient-services/src/Oauth2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Resource\\Userinfo' => $baseDir . '/google/apiclient-services/src/Oauth2/Resource/Userinfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Resource\\UserinfoV2' => $baseDir . '/google/apiclient-services/src/Oauth2/Resource/UserinfoV2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Resource\\UserinfoV2Me' => $baseDir . '/google/apiclient-services/src/Oauth2/Resource/UserinfoV2Me.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Tokeninfo' => $baseDir . '/google/apiclient-services/src/Oauth2/Tokeninfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Userinfo' => $baseDir . '/google/apiclient-services/src/Oauth2/Userinfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Resource' => $baseDir . '/google/apiclient/src/Service/Resource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole' => $baseDir . '/google/apiclient-services/src/SearchConsole.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ApiDataRow' => $baseDir . '/google/apiclient-services/src/SearchConsole/ApiDataRow.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ApiDimensionFilter' => $baseDir . '/google/apiclient-services/src/SearchConsole/ApiDimensionFilter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ApiDimensionFilterGroup' => $baseDir . '/google/apiclient-services/src/SearchConsole/ApiDimensionFilterGroup.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\BlockedResource' => $baseDir . '/google/apiclient-services/src/SearchConsole/BlockedResource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Image' => $baseDir . '/google/apiclient-services/src/SearchConsole/Image.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\MobileFriendlyIssue' => $baseDir . '/google/apiclient-services/src/SearchConsole/MobileFriendlyIssue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ResourceIssue' => $baseDir . '/google/apiclient-services/src/SearchConsole/ResourceIssue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\Searchanalytics' => $baseDir . '/google/apiclient-services/src/SearchConsole/Resource/Searchanalytics.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\Sitemaps' => $baseDir . '/google/apiclient-services/src/SearchConsole/Resource/Sitemaps.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\Sites' => $baseDir . '/google/apiclient-services/src/SearchConsole/Resource/Sites.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\UrlTestingTools' => $baseDir . '/google/apiclient-services/src/SearchConsole/Resource/UrlTestingTools.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\UrlTestingToolsMobileFriendlyTest' => $baseDir . '/google/apiclient-services/src/SearchConsole/Resource/UrlTestingToolsMobileFriendlyTest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\RunMobileFriendlyTestRequest' => $baseDir . '/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\RunMobileFriendlyTestResponse' => $baseDir . '/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SearchAnalyticsQueryRequest' => $baseDir . '/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SearchAnalyticsQueryResponse' => $baseDir . '/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SitemapsListResponse' => $baseDir . '/google/apiclient-services/src/SearchConsole/SitemapsListResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SitesListResponse' => $baseDir . '/google/apiclient-services/src/SearchConsole/SitesListResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\TestStatus' => $baseDir . '/google/apiclient-services/src/SearchConsole/TestStatus.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\WmxSite' => $baseDir . '/google/apiclient-services/src/SearchConsole/WmxSite.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\WmxSitemap' => $baseDir . '/google/apiclient-services/src/SearchConsole/WmxSitemap.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\WmxSitemapContent' => $baseDir . '/google/apiclient-services/src/SearchConsole/WmxSitemapContent.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Composer' => $baseDir . '/google/apiclient/src/Task/Composer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Exception' => $baseDir . '/google/apiclient/src/Task/Exception.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Retryable' => $baseDir . '/google/apiclient/src/Task/Retryable.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Runner' => $baseDir . '/google/apiclient/src/Task/Runner.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Utils\\UriTemplate' => $baseDir . '/google/apiclient/src/Utils/UriTemplate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AccessToken_Revoke' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AccessToken_Verify' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_AuthHandlerFactory' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_Guzzle6AuthHandler' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_Guzzle7AuthHandler' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Client' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Collection' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Exception' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_Batch' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_MediaFileUpload' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_REST' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Model' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Exception' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Resource' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Composer' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Exception' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Retryable' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Runner' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Utils_UriTemplate' => $baseDir . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\BodySummarizer' => $baseDir . '/guzzlehttp/guzzle/src/BodySummarizer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\BodySummarizerInterface' => $baseDir . '/guzzlehttp/guzzle/src/BodySummarizerInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Client' => $baseDir . '/guzzlehttp/guzzle/src/Client.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientInterface' => $baseDir . '/guzzlehttp/guzzle/src/ClientInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientTrait' => $baseDir . '/guzzlehttp/guzzle/src/ClientTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\CookieJar' => $baseDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\CookieJarInterface' => $baseDir . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\FileCookieJar' => $baseDir . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\SessionCookieJar' => $baseDir . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\SetCookie' => $baseDir . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\BadResponseException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\ClientException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/ClientException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\ConnectException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/ConnectException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\GuzzleException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\InvalidArgumentException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\RequestException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/RequestException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\ServerException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/ServerException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\TooManyRedirectsException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\TransferException' => $baseDir . '/guzzlehttp/guzzle/src/Exception/TransferException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\HandlerStack' => $baseDir . '/guzzlehttp/guzzle/src/HandlerStack.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlFactory' => $baseDir . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlFactoryInterface' => $baseDir . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlHandler' => $baseDir . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlMultiHandler' => $baseDir . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\EasyHandle' => $baseDir . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\HeaderProcessor' => $baseDir . '/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\MockHandler' => $baseDir . '/guzzlehttp/guzzle/src/Handler/MockHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\Proxy' => $baseDir . '/guzzlehttp/guzzle/src/Handler/Proxy.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\StreamHandler' => $baseDir . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\MessageFormatter' => $baseDir . '/guzzlehttp/guzzle/src/MessageFormatter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\MessageFormatterInterface' => $baseDir . '/guzzlehttp/guzzle/src/MessageFormatterInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Middleware' => $baseDir . '/guzzlehttp/guzzle/src/Middleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Pool' => $baseDir . '/guzzlehttp/guzzle/src/Pool.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\PrepareBodyMiddleware' => $baseDir . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\AggregateException' => $baseDir . '/guzzlehttp/promises/src/AggregateException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\CancellationException' => $baseDir . '/guzzlehttp/promises/src/CancellationException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Coroutine' => $baseDir . '/guzzlehttp/promises/src/Coroutine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Create' => $baseDir . '/guzzlehttp/promises/src/Create.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Each' => $baseDir . '/guzzlehttp/promises/src/Each.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\EachPromise' => $baseDir . '/guzzlehttp/promises/src/EachPromise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\FulfilledPromise' => $baseDir . '/guzzlehttp/promises/src/FulfilledPromise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Is' => $baseDir . '/guzzlehttp/promises/src/Is.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Promise' => $baseDir . '/guzzlehttp/promises/src/Promise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\PromiseInterface' => $baseDir . '/guzzlehttp/promises/src/PromiseInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\PromisorInterface' => $baseDir . '/guzzlehttp/promises/src/PromisorInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\RejectedPromise' => $baseDir . '/guzzlehttp/promises/src/RejectedPromise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\RejectionException' => $baseDir . '/guzzlehttp/promises/src/RejectionException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\TaskQueue' => $baseDir . '/guzzlehttp/promises/src/TaskQueue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\TaskQueueInterface' => $baseDir . '/guzzlehttp/promises/src/TaskQueueInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Utils' => $baseDir . '/guzzlehttp/promises/src/Utils.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\AppendStream' => $baseDir . '/guzzlehttp/psr7/src/AppendStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\BufferStream' => $baseDir . '/guzzlehttp/psr7/src/BufferStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\CachingStream' => $baseDir . '/guzzlehttp/psr7/src/CachingStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\DroppingStream' => $baseDir . '/guzzlehttp/psr7/src/DroppingStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Exception\\MalformedUriException' => $baseDir . '/guzzlehttp/psr7/src/Exception/MalformedUriException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\FnStream' => $baseDir . '/guzzlehttp/psr7/src/FnStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Header' => $baseDir . '/guzzlehttp/psr7/src/Header.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\HttpFactory' => $baseDir . '/guzzlehttp/psr7/src/HttpFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\InflateStream' => $baseDir . '/guzzlehttp/psr7/src/InflateStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\LazyOpenStream' => $baseDir . '/guzzlehttp/psr7/src/LazyOpenStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\LimitStream' => $baseDir . '/guzzlehttp/psr7/src/LimitStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Message' => $baseDir . '/guzzlehttp/psr7/src/Message.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\MessageTrait' => $baseDir . '/guzzlehttp/psr7/src/MessageTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\MimeType' => $baseDir . '/guzzlehttp/psr7/src/MimeType.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\MultipartStream' => $baseDir . '/guzzlehttp/psr7/src/MultipartStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\NoSeekStream' => $baseDir . '/guzzlehttp/psr7/src/NoSeekStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\PumpStream' => $baseDir . '/guzzlehttp/psr7/src/PumpStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Query' => $baseDir . '/guzzlehttp/psr7/src/Query.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Request' => $baseDir . '/guzzlehttp/psr7/src/Request.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Response' => $baseDir . '/guzzlehttp/psr7/src/Response.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Rfc7230' => $baseDir . '/guzzlehttp/psr7/src/Rfc7230.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\ServerRequest' => $baseDir . '/guzzlehttp/psr7/src/ServerRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Stream' => $baseDir . '/guzzlehttp/psr7/src/Stream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $baseDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\StreamWrapper' => $baseDir . '/guzzlehttp/psr7/src/StreamWrapper.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UploadedFile' => $baseDir . '/guzzlehttp/psr7/src/UploadedFile.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Uri' => $baseDir . '/guzzlehttp/psr7/src/Uri.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UriComparator' => $baseDir . '/guzzlehttp/psr7/src/UriComparator.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UriNormalizer' => $baseDir . '/guzzlehttp/psr7/src/UriNormalizer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UriResolver' => $baseDir . '/guzzlehttp/psr7/src/UriResolver.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Utils' => $baseDir . '/guzzlehttp/psr7/src/Utils.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\RedirectMiddleware' => $baseDir . '/guzzlehttp/guzzle/src/RedirectMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\RequestOptions' => $baseDir . '/guzzlehttp/guzzle/src/RequestOptions.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\RetryMiddleware' => $baseDir . '/guzzlehttp/guzzle/src/RetryMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\TransferStats' => $baseDir . '/guzzlehttp/guzzle/src/TransferStats.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Utils' => $baseDir . '/guzzlehttp/guzzle/src/Utils.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base32' => $baseDir . '/paragonie/constant_time_encoding/src/Base32.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base32Hex' => $baseDir . '/paragonie/constant_time_encoding/src/Base32Hex.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64' => $baseDir . '/paragonie/constant_time_encoding/src/Base64.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64DotSlash' => $baseDir . '/paragonie/constant_time_encoding/src/Base64DotSlash.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64DotSlashOrdered' => $baseDir . '/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64UrlSafe' => $baseDir . '/paragonie/constant_time_encoding/src/Base64UrlSafe.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Binary' => $baseDir . '/paragonie/constant_time_encoding/src/Binary.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\EncoderInterface' => $baseDir . '/paragonie/constant_time_encoding/src/EncoderInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Encoding' => $baseDir . '/paragonie/constant_time_encoding/src/Encoding.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Hex' => $baseDir . '/paragonie/constant_time_encoding/src/Hex.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\RFC4648' => $baseDir . '/paragonie/constant_time_encoding/src/RFC4648.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\CacheException' => $baseDir . '/psr/cache/src/CacheException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\CacheItemInterface' => $baseDir . '/psr/cache/src/CacheItemInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\CacheItemPoolInterface' => $baseDir . '/psr/cache/src/CacheItemPoolInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\InvalidArgumentException' => $baseDir . '/psr/cache/src/InvalidArgumentException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\ClientExceptionInterface' => $baseDir . '/psr/http-client/src/ClientExceptionInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\ClientInterface' => $baseDir . '/psr/http-client/src/ClientInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\NetworkExceptionInterface' => $baseDir . '/psr/http-client/src/NetworkExceptionInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\RequestExceptionInterface' => $baseDir . '/psr/http-client/src/RequestExceptionInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\MessageInterface' => $baseDir . '/psr/http-message/src/MessageInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\RequestFactoryInterface' => $baseDir . '/psr/http-factory/src/RequestFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\RequestInterface' => $baseDir . '/psr/http-message/src/RequestInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ResponseFactoryInterface' => $baseDir . '/psr/http-factory/src/ResponseFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ResponseInterface' => $baseDir . '/psr/http-message/src/ResponseInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ServerRequestFactoryInterface' => $baseDir . '/psr/http-factory/src/ServerRequestFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ServerRequestInterface' => $baseDir . '/psr/http-message/src/ServerRequestInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\StreamFactoryInterface' => $baseDir . '/psr/http-factory/src/StreamFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\StreamInterface' => $baseDir . '/psr/http-message/src/StreamInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UploadedFileFactoryInterface' => $baseDir . '/psr/http-factory/src/UploadedFileFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UploadedFileInterface' => $baseDir . '/psr/http-message/src/UploadedFileInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UriFactoryInterface' => $baseDir . '/psr/http-factory/src/UriFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UriInterface' => $baseDir . '/psr/http-message/src/UriInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Common\\Functions\\Strings' => $baseDir . '/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\AES' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Blowfish' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\ChaCha20' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/ChaCha20.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\AsymmetricKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\BlockCipher' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\JWK' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\OpenSSH' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS8' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PuTTY' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Signature\\Raw' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Signature/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\PrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\PublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\StreamCipher' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\SymmetricKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Traits\\Fingerprint' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/Fingerprint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Traits\\PasswordProtected' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/PasswordProtected.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DES' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\Formats\\Keys\\PKCS1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\Formats\\Keys\\PKCS8' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\Parameters' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\PrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\PublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\OpenSSH' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\PKCS1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\PKCS8' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\PuTTY' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\Raw' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\XML' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/XML.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Signature\\ASN1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/ASN1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Signature\\Raw' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Signature\\SSH2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/SSH2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Parameters' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\PrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\PublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Base' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Base.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Binary' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Binary.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\KoblitzPrime' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/KoblitzPrime.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Montgomery' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\TwistedEdwards' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Curve25519' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve25519.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Curve448' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve448.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Ed25519' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed25519.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Ed448' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed448.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP160r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP160t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP192r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP192t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP224r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP224t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP256r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP256t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP320r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP320t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP384r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP384t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP512r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP512t1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistb233' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb233.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistb409' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb409.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk163' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk163.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk233' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk233.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk283' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk283.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk409' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk409.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp192' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp192.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp224' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp224.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp256' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp256.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp384' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp384.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp521' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp521.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistt571' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistt571.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime192v1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime192v2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime192v3' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v3.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime239v1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime239v2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime239v3' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v3.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime256v1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime256v1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp112r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp112r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp128r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp128r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp160k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp160r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp160r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp192k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp192r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp224k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp224r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp256k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp256r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp384r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp384r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp521r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp521r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect113r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect113r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect131r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect131r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect163k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect163r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect163r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect193r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect193r2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect233k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect233r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect239k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect239k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect283k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect283r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect409k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect409r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect571k1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect571r1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\Common' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/Common.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\JWK' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\MontgomeryPrivate' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPrivate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\MontgomeryPublic' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPublic.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\OpenSSH' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\PKCS1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\PKCS8' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\PuTTY' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\XML' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\libsodium' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/libsodium.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\ASN1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/ASN1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\IEEE' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\Raw' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\SSH2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/SSH2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Parameters' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\PrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\PublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Hash' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\PublicKeyLoader' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RC2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RC4' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\JWK' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\MSBLOB' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\OpenSSH' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PKCS1' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PKCS8' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PSS' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PuTTY' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\Raw' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\XML' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/XML.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\PrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\PublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Random' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Rijndael' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Salsa20' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Salsa20.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\TripleDES' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Twofish' => $baseDir . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\BadConfigurationException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/BadConfigurationException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\BadDecryptionException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/BadDecryptionException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\BadModeException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/BadModeException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\ConnectionClosedException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/ConnectionClosedException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\FileNotFoundException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/FileNotFoundException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\InconsistentSetupException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/InconsistentSetupException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\InsufficientSetupException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/InsufficientSetupException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\NoKeyLoadedException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/NoKeyLoadedException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\NoSupportedAlgorithmsException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/NoSupportedAlgorithmsException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnableToConnectException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/UnableToConnectException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedAlgorithmException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedAlgorithmException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedCurveException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedCurveException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedFormatException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedFormatException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedOperationException' => $baseDir . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedOperationException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ANSI' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ANSI.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Element' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AccessDescription' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AccessDescription.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AdministrationDomainName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AdministrationDomainName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AlgorithmIdentifier' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AnotherName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AnotherName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Attribute' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attribute.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AttributeType' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeType.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AttributeTypeAndValue' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AttributeValue' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Attributes' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AuthorityInfoAccessSyntax' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AuthorityKeyIdentifier' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BaseDistance' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BaseDistance.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BasicConstraints' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BasicConstraints.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BuiltInDomainDefinedAttribute' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BuiltInDomainDefinedAttributes' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BuiltInStandardAttributes' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CPSuri' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CPSuri.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CRLDistributionPoints' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CRLNumber' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLNumber.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CRLReason' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLReason.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertPolicyId' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertPolicyId.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Certificate' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Certificate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificateIssuer' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateIssuer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificateList' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateList.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificatePolicies' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificatePolicies.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificateSerialNumber' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificationRequest' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificationRequestInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Characteristic_two' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Characteristic_two.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CountryName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CountryName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Curve' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Curve.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DHParameter' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DHParameter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DSAParams' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAParams.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DSAPrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DSAPublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DigestInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DigestInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DirectoryString' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DirectoryString.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DisplayText' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DisplayText.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DistributionPoint' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPoint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DistributionPointName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPointName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DssSigValue' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DssSigValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ECParameters' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECParameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ECPoint' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPoint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ECPrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EDIPartyName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EDIPartyName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EcdsaSigValue' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EcdsaSigValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EncryptedData' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedData.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EncryptedPrivateKeyInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ExtKeyUsageSyntax' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Extension' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extension.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ExtensionAttribute' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttribute.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ExtensionAttributes' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Extensions' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extensions.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\FieldElement' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldElement.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\FieldID' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldID.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralNames' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralNames.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralSubtree' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtree.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralSubtrees' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtrees.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\HashAlgorithm' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HashAlgorithm.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\HoldInstructionCode' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HoldInstructionCode.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\InvalidityDate' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/InvalidityDate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\IssuerAltName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuerAltName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\IssuingDistributionPoint' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\KeyIdentifier' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\KeyPurposeId' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyPurposeId.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\KeyUsage' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyUsage.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\MaskGenAlgorithm' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Name' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Name.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NameConstraints' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NameConstraints.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NetworkAddress' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NetworkAddress.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NoticeReference' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NoticeReference.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NumericUserIdentifier' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ORAddress' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ORAddress.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OneAsymmetricKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OrganizationName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OrganizationalUnitNames' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OtherPrimeInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OtherPrimeInfos' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBEParameter' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBEParameter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBES2params' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBES2params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBKDF2params' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBKDF2params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBMAC1params' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBMAC1params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PKCS9String' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PKCS9String.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Pentanomial' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Pentanomial.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PersonalName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PersonalName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyInformation' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyInformation.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyMappings' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyMappings.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyQualifierId' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierId.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyQualifierInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PostalAddress' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PostalAddress.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Prime_p' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Prime_p.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateDomainName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateDomainName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateKeyInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateKeyUsagePeriod' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PublicKeyAndChallenge' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PublicKeyInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RC2CBCParameter' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RC2CBCParameter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RDNSequence' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RDNSequence.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RSAPrivateKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RSAPublicKey' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RSASSA_PSS_params' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ReasonFlags' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ReasonFlags.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RelativeDistinguishedName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RevokedCertificate' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RevokedCertificate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SignedPublicKeyAndChallenge' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SpecifiedECDomain' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectAltName' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectAltName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectDirectoryAttributes' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectInfoAccessSyntax' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectPublicKeyInfo' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\TBSCertList' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertList.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\TBSCertificate' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertificate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\TerminalIdentifier' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TerminalIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Time' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Time.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Trinomial' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Trinomial.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\UniqueIdentifier' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UniqueIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\UserNotice' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UserNotice.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Validity' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Validity.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\netscape_ca_policy_url' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\netscape_cert_type' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_cert_type.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\netscape_comment' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_comment.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\X509' => $baseDir . '/phpseclib/phpseclib/phpseclib/File/X509.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\Base' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\BuiltIn' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\DefaultEngine' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\OpenSSL' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\Reductions\\Barrett' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\Reductions\\EvalBarrett' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\Engine' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\GMP' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\GMP\\DefaultEngine' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\OpenSSL' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/OpenSSL.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP32' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP64' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Base' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Base.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\DefaultEngine' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Montgomery' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\OpenSSL' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\Barrett' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\Classic' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\EvalBarrett' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\Montgomery' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\MontgomeryMult' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\PowerOfTwo' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BinaryField' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BinaryField.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BinaryField\\Integer' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/BinaryField/Integer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\Common\\FiniteField' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\Common\\FiniteField\\Integer' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\PrimeField' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/PrimeField.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\PrimeField\\Integer' => $baseDir . '/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Net\\SFTP' => $baseDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Net\\SFTP\\Stream' => $baseDir . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Net\\SSH2' => $baseDir . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\System\\SSH\\Agent' => $baseDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\System\\SSH\\Agent\\Identity' => $baseDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\System\\SSH\\Common\\Traits\\ReadBytes' => $baseDir . '/phpseclib/phpseclib/phpseclib/System/SSH/Common/Traits/ReadBytes.php', +); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_files.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_files.php new file mode 100644 index 0000000..5f98a3c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_files.php @@ -0,0 +1,16 @@ + $baseDir . '/google/apiclient/src/aliases.php', + 'a9ba2bc605f8cc31904f6c788ee13386' => $baseDir . '/google/apiclient-services/autoload.php', + '6fc8d7e61db31927a11bd66a7e02cbbf' => $baseDir . '/guzzlehttp/guzzle/src/functions_include.php', + '9ffe771412935e32de763feba901e2e0' => $baseDir . '/guzzlehttp/promises/src/functions_include.php', + 'c17e09b5491f79542d887522db07b799' => $baseDir . '/phpseclib/phpseclib/phpseclib/bootstrap.php', + '66cfd3a7190309803b5cc0fea03a4cdc' => $baseDir . '/symfony/deprecation-contracts/function.php', + 'c41a84066d147a2d8e4ba7ebd559db66' => $baseDir . '/ralouphie/getallheaders/src/getallheaders.php', +); diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_namespaces.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_namespaces.php new file mode 100644 index 0000000..15a2ff3 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ +register(true); + + $includeFiles = \Composer\Autoload\ComposerStaticInit13b47076bce2931fc82608360376103f::$files; + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire13b47076bce2931fc82608360376103f($fileIdentifier, $file); + } + + return $loader; + } +} + +/** + * @param string $fileIdentifier + * @param string $file + * @return void + */ +function composerRequire13b47076bce2931fc82608360376103f($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + + require $file; + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_static.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_static.php new file mode 100644 index 0000000..976f5c8 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/prefixed/vendor/composer/autoload_static.php @@ -0,0 +1,601 @@ + __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'a9ba2bc605f8cc31904f6c788ee13386' => __DIR__ . '/../..' . '/google/apiclient-services/autoload.php', + '6fc8d7e61db31927a11bd66a7e02cbbf' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/functions_include.php', + '9ffe771412935e32de763feba901e2e0' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/functions_include.php', + 'c17e09b5491f79542d887522db07b799' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', + '66cfd3a7190309803b5cc0fea03a4cdc' => __DIR__ . '/../..' . '/symfony/deprecation-contracts/function.php', + 'c41a84066d147a2d8e4ba7ebd559db66' => __DIR__ . '/../..' . '/ralouphie/getallheaders/src/getallheaders.php', + ); + + public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\BeforeValidException' => __DIR__ . '/../..' . '/firebase/php-jwt/src/BeforeValidException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\CachedKeySet' => __DIR__ . '/../..' . '/firebase/php-jwt/src/CachedKeySet.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\ExpiredException' => __DIR__ . '/../..' . '/firebase/php-jwt/src/ExpiredException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\JWK' => __DIR__ . '/../..' . '/firebase/php-jwt/src/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\JWT' => __DIR__ . '/../..' . '/firebase/php-jwt/src/JWT.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\JWTExceptionWithPayloadInterface' => __DIR__ . '/../..' . '/firebase/php-jwt/src/JWTExceptionWithPayloadInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\Key' => __DIR__ . '/../..' . '/firebase/php-jwt/src/Key.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Firebase\\JWT\\SignatureInvalidException' => __DIR__ . '/../..' . '/firebase/php-jwt/src/SignatureInvalidException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AccessToken\\Revoke' => __DIR__ . '/../..' . '/google/apiclient/src/AccessToken/Revoke.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AccessToken\\Verify' => __DIR__ . '/../..' . '/google/apiclient/src/AccessToken/Verify.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\AuthHandlerFactory' => __DIR__ . '/../..' . '/google/apiclient/src/AuthHandler/AuthHandlerFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\Guzzle6AuthHandler' => __DIR__ . '/../..' . '/google/apiclient/src/AuthHandler/Guzzle6AuthHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\AuthHandler\\Guzzle7AuthHandler' => __DIR__ . '/../..' . '/google/apiclient/src/AuthHandler/Guzzle7AuthHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\AccessToken' => __DIR__ . '/../..' . '/google/auth/src/AccessToken.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ApplicationDefaultCredentials' => __DIR__ . '/../..' . '/google/auth/src/ApplicationDefaultCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CacheTrait' => __DIR__ . '/../..' . '/google/auth/src/CacheTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\InvalidArgumentException' => __DIR__ . '/../..' . '/google/auth/src/Cache/InvalidArgumentException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\Item' => __DIR__ . '/../..' . '/google/auth/src/Cache/Item.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\MemoryCacheItemPool' => __DIR__ . '/../..' . '/google/auth/src/Cache/MemoryCacheItemPool.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\SysVCacheItemPool' => __DIR__ . '/../..' . '/google/auth/src/Cache/SysVCacheItemPool.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Cache\\TypedItem' => __DIR__ . '/../..' . '/google/auth/src/Cache/TypedItem.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialSource\\AwsNativeSource' => __DIR__ . '/../..' . '/google/auth/src/CredentialSource/AwsNativeSource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialSource\\FileSource' => __DIR__ . '/../..' . '/google/auth/src/CredentialSource/FileSource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialSource\\UrlSource' => __DIR__ . '/../..' . '/google/auth/src/CredentialSource/UrlSource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\CredentialsLoader' => __DIR__ . '/../..' . '/google/auth/src/CredentialsLoader.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\AppIdentityCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/AppIdentityCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ExternalAccountCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/ExternalAccountCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\GCECredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/GCECredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\IAMCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/IAMCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ImpersonatedServiceAccountCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/ImpersonatedServiceAccountCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\InsecureCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/InsecureCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ServiceAccountCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/ServiceAccountCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\ServiceAccountJwtAccessCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/ServiceAccountJwtAccessCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Credentials\\UserRefreshCredentials' => __DIR__ . '/../..' . '/google/auth/src/Credentials/UserRefreshCredentials.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ExternalAccountCredentialSourceInterface' => __DIR__ . '/../..' . '/google/auth/src/ExternalAccountCredentialSourceInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\FetchAuthTokenCache' => __DIR__ . '/../..' . '/google/auth/src/FetchAuthTokenCache.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\FetchAuthTokenInterface' => __DIR__ . '/../..' . '/google/auth/src/FetchAuthTokenInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\GCECache' => __DIR__ . '/../..' . '/google/auth/src/GCECache.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\GetQuotaProjectInterface' => __DIR__ . '/../..' . '/google/auth/src/GetQuotaProjectInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\GetUniverseDomainInterface' => __DIR__ . '/../..' . '/google/auth/src/GetUniverseDomainInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\Guzzle6HttpHandler' => __DIR__ . '/../..' . '/google/auth/src/HttpHandler/Guzzle6HttpHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\Guzzle7HttpHandler' => __DIR__ . '/../..' . '/google/auth/src/HttpHandler/Guzzle7HttpHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\HttpClientCache' => __DIR__ . '/../..' . '/google/auth/src/HttpHandler/HttpClientCache.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\HttpHandler\\HttpHandlerFactory' => __DIR__ . '/../..' . '/google/auth/src/HttpHandler/HttpHandlerFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Iam' => __DIR__ . '/../..' . '/google/auth/src/Iam.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\IamSignerTrait' => __DIR__ . '/../..' . '/google/auth/src/IamSignerTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\AuthTokenMiddleware' => __DIR__ . '/../..' . '/google/auth/src/Middleware/AuthTokenMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\ProxyAuthTokenMiddleware' => __DIR__ . '/../..' . '/google/auth/src/Middleware/ProxyAuthTokenMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\ScopedAccessTokenMiddleware' => __DIR__ . '/../..' . '/google/auth/src/Middleware/ScopedAccessTokenMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\Middleware\\SimpleMiddleware' => __DIR__ . '/../..' . '/google/auth/src/Middleware/SimpleMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\OAuth2' => __DIR__ . '/../..' . '/google/auth/src/OAuth2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ProjectIdProviderInterface' => __DIR__ . '/../..' . '/google/auth/src/ProjectIdProviderInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\ServiceAccountSignerTrait' => __DIR__ . '/../..' . '/google/auth/src/ServiceAccountSignerTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\SignBlobInterface' => __DIR__ . '/../..' . '/google/auth/src/SignBlobInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\UpdateMetadataInterface' => __DIR__ . '/../..' . '/google/auth/src/UpdateMetadataInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Auth\\UpdateMetadataTrait' => __DIR__ . '/../..' . '/google/auth/src/UpdateMetadataTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Client' => __DIR__ . '/../..' . '/google/apiclient/src/Client.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Collection' => __DIR__ . '/../..' . '/google/apiclient/src/Collection.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Exception' => __DIR__ . '/../..' . '/google/apiclient/src/Exception.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\Batch' => __DIR__ . '/../..' . '/google/apiclient/src/Http/Batch.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\MediaFileUpload' => __DIR__ . '/../..' . '/google/apiclient/src/Http/MediaFileUpload.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Http\\REST' => __DIR__ . '/../..' . '/google/apiclient/src/Http/REST.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Model' => __DIR__ . '/../..' . '/google/apiclient/src/Model.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service' => __DIR__ . '/../..' . '/google/apiclient/src/Service.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Exception' => __DIR__ . '/../..' . '/google/apiclient/src/Service/Exception.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2' => __DIR__ . '/../..' . '/google/apiclient-services/src/Oauth2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Resource\\Userinfo' => __DIR__ . '/../..' . '/google/apiclient-services/src/Oauth2/Resource/Userinfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Resource\\UserinfoV2' => __DIR__ . '/../..' . '/google/apiclient-services/src/Oauth2/Resource/UserinfoV2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Resource\\UserinfoV2Me' => __DIR__ . '/../..' . '/google/apiclient-services/src/Oauth2/Resource/UserinfoV2Me.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Tokeninfo' => __DIR__ . '/../..' . '/google/apiclient-services/src/Oauth2/Tokeninfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Oauth2\\Userinfo' => __DIR__ . '/../..' . '/google/apiclient-services/src/Oauth2/Userinfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\Resource' => __DIR__ . '/../..' . '/google/apiclient/src/Service/Resource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ApiDataRow' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/ApiDataRow.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ApiDimensionFilter' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/ApiDimensionFilter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ApiDimensionFilterGroup' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/ApiDimensionFilterGroup.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\BlockedResource' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/BlockedResource.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Image' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/Image.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\MobileFriendlyIssue' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/MobileFriendlyIssue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\ResourceIssue' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/ResourceIssue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\Searchanalytics' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/Resource/Searchanalytics.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\Sitemaps' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/Resource/Sitemaps.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\Sites' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/Resource/Sites.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\UrlTestingTools' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/Resource/UrlTestingTools.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\Resource\\UrlTestingToolsMobileFriendlyTest' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/Resource/UrlTestingToolsMobileFriendlyTest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\RunMobileFriendlyTestRequest' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\RunMobileFriendlyTestResponse' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/RunMobileFriendlyTestResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SearchAnalyticsQueryRequest' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SearchAnalyticsQueryResponse' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/SearchAnalyticsQueryResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SitemapsListResponse' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/SitemapsListResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\SitesListResponse' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/SitesListResponse.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\TestStatus' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/TestStatus.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\WmxSite' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/WmxSite.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\WmxSitemap' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/WmxSitemap.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Service\\SearchConsole\\WmxSitemapContent' => __DIR__ . '/../..' . '/google/apiclient-services/src/SearchConsole/WmxSitemapContent.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Composer' => __DIR__ . '/../..' . '/google/apiclient/src/Task/Composer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Exception' => __DIR__ . '/../..' . '/google/apiclient/src/Task/Exception.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Retryable' => __DIR__ . '/../..' . '/google/apiclient/src/Task/Retryable.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Task\\Runner' => __DIR__ . '/../..' . '/google/apiclient/src/Task/Runner.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google\\Utils\\UriTemplate' => __DIR__ . '/../..' . '/google/apiclient/src/Utils/UriTemplate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AccessToken_Revoke' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AccessToken_Verify' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_AuthHandlerFactory' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_Guzzle6AuthHandler' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_AuthHandler_Guzzle7AuthHandler' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Client' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Collection' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Exception' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_Batch' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_MediaFileUpload' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Http_REST' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Model' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Exception' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Service_Resource' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Composer' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Exception' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Retryable' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Task_Runner' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Google_Utils_UriTemplate' => __DIR__ . '/../..' . '/google/apiclient/src/aliases.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\BodySummarizer' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/BodySummarizer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\BodySummarizerInterface' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/BodySummarizerInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Client' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Client.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientInterface' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/ClientInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\ClientTrait' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/ClientTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\CookieJarInterface' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\FileCookieJar' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\SessionCookieJar' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Cookie\\SetCookie' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\BadResponseException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\ClientException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/ClientException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\ConnectException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/ConnectException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\GuzzleException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\InvalidArgumentException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\RequestException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/RequestException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\ServerException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/ServerException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\TooManyRedirectsException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Exception\\TransferException' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Exception/TransferException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\HandlerStack' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/HandlerStack.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlFactory' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlFactoryInterface' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlHandler' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\CurlMultiHandler' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\EasyHandle' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\HeaderProcessor' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\MockHandler' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/MockHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\Proxy' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/Proxy.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Handler\\StreamHandler' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\MessageFormatter' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/MessageFormatter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\MessageFormatterInterface' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/MessageFormatterInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Middleware' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Middleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Pool' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Pool.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\PrepareBodyMiddleware' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\AggregateException' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/AggregateException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\CancellationException' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/CancellationException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Coroutine' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/Coroutine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Create' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/Create.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Each' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/Each.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\EachPromise' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/EachPromise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\FulfilledPromise' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/FulfilledPromise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Is' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/Is.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Promise' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/Promise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\PromiseInterface' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/PromiseInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\PromisorInterface' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/PromisorInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\RejectedPromise' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/RejectedPromise.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\RejectionException' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/RejectionException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\TaskQueue' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/TaskQueue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\TaskQueueInterface' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/TaskQueueInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Promise\\Utils' => __DIR__ . '/../..' . '/guzzlehttp/promises/src/Utils.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\AppendStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/AppendStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/BufferStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/CachingStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/DroppingStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Exception\\MalformedUriException' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Exception/MalformedUriException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/FnStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Header' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Header.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\HttpFactory' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/HttpFactory.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/InflateStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/LazyOpenStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/LimitStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Message' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Message.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\MessageTrait' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/MessageTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\MimeType' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/MimeType.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\MultipartStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/MultipartStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\NoSeekStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/NoSeekStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/PumpStream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Query' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Query.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Request' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Request.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Response' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Response.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Rfc7230' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Rfc7230.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/ServerRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Stream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\StreamWrapper' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/StreamWrapper.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UploadedFile' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/UploadedFile.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Uri' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Uri.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UriComparator' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/UriComparator.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UriNormalizer' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/UriNormalizer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\UriResolver' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/UriResolver.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Psr7\\Utils' => __DIR__ . '/../..' . '/guzzlehttp/psr7/src/Utils.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\RedirectMiddleware' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/RedirectMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\RequestOptions' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/RequestOptions.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\RetryMiddleware' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/RetryMiddleware.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\TransferStats' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/TransferStats.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\GuzzleHttp\\Utils' => __DIR__ . '/../..' . '/guzzlehttp/guzzle/src/Utils.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base32' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Base32.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base32Hex' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Base32Hex.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Base64.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64DotSlash' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Base64DotSlash.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64DotSlashOrdered' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Base64DotSlashOrdered.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Base64UrlSafe' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Base64UrlSafe.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Binary' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Binary.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\EncoderInterface' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/EncoderInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Encoding' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Encoding.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\Hex' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/Hex.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\ParagonIE\\ConstantTime\\RFC4648' => __DIR__ . '/../..' . '/paragonie/constant_time_encoding/src/RFC4648.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\CacheException' => __DIR__ . '/../..' . '/psr/cache/src/CacheException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\CacheItemInterface' => __DIR__ . '/../..' . '/psr/cache/src/CacheItemInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\CacheItemPoolInterface' => __DIR__ . '/../..' . '/psr/cache/src/CacheItemPoolInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Cache\\InvalidArgumentException' => __DIR__ . '/../..' . '/psr/cache/src/InvalidArgumentException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\ClientExceptionInterface' => __DIR__ . '/../..' . '/psr/http-client/src/ClientExceptionInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\ClientInterface' => __DIR__ . '/../..' . '/psr/http-client/src/ClientInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\NetworkExceptionInterface' => __DIR__ . '/../..' . '/psr/http-client/src/NetworkExceptionInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Client\\RequestExceptionInterface' => __DIR__ . '/../..' . '/psr/http-client/src/RequestExceptionInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/../..' . '/psr/http-message/src/MessageInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\RequestFactoryInterface' => __DIR__ . '/../..' . '/psr/http-factory/src/RequestFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/../..' . '/psr/http-message/src/RequestInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ResponseFactoryInterface' => __DIR__ . '/../..' . '/psr/http-factory/src/ResponseFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/../..' . '/psr/http-message/src/ResponseInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ServerRequestFactoryInterface' => __DIR__ . '/../..' . '/psr/http-factory/src/ServerRequestFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/../..' . '/psr/http-message/src/ServerRequestInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\StreamFactoryInterface' => __DIR__ . '/../..' . '/psr/http-factory/src/StreamFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/../..' . '/psr/http-message/src/StreamInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UploadedFileFactoryInterface' => __DIR__ . '/../..' . '/psr/http-factory/src/UploadedFileFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/../..' . '/psr/http-message/src/UploadedFileInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UriFactoryInterface' => __DIR__ . '/../..' . '/psr/http-factory/src/UriFactoryInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\Psr\\Http\\Message\\UriInterface' => __DIR__ . '/../..' . '/psr/http-message/src/UriInterface.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Common\\Functions\\Strings' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Common/Functions/Strings.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\AES' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/AES.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Blowfish' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\ChaCha20' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/ChaCha20.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\AsymmetricKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/AsymmetricKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\BlockCipher' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/BlockCipher.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\JWK' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\OpenSSH' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PKCS8' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Keys\\PuTTY' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Formats\\Signature\\Raw' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Signature/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\PrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\PublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\StreamCipher' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/StreamCipher.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\SymmetricKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/SymmetricKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Traits\\Fingerprint' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/Fingerprint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Common\\Traits\\PasswordProtected' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Common/Traits/PasswordProtected.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DES' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DES.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\Formats\\Keys\\PKCS1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\Formats\\Keys\\PKCS8' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DH/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\Parameters' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DH/Parameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\PrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DH/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DH\\PublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DH/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\OpenSSH' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\PKCS1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\PKCS8' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\PuTTY' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\Raw' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Keys\\XML' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Keys/XML.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Signature\\ASN1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/ASN1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Signature\\Raw' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Formats\\Signature\\SSH2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/Signature/SSH2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\Parameters' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/Parameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\PrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\DSA\\PublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/DSA/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Base' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Base.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Binary' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Binary.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\KoblitzPrime' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/KoblitzPrime.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Montgomery' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Montgomery.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\Prime' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/Prime.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\BaseCurves\\TwistedEdwards' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/BaseCurves/TwistedEdwards.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Curve25519' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve25519.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Curve448' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Curve448.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Ed25519' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed25519.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\Ed448' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/Ed448.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP160r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP160t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP160t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP192r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP192t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP192t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP224r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP224t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP224t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP256r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP256t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP256t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP320r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP320t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP320t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP384r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP384t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP384t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP512r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\brainpoolP512t1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/brainpoolP512t1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistb233' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb233.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistb409' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistb409.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk163' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk163.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk233' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk233.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk283' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk283.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistk409' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistk409.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp192' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp192.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp224' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp224.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp256' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp256.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp384' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp384.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistp521' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistp521.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\nistt571' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/nistt571.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime192v1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime192v2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime192v3' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime192v3.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime239v1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime239v2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime239v3' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime239v3.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\prime256v1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/prime256v1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp112r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp112r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp112r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp128r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp128r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp128r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp160k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp160r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp160r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp160r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp192k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp192r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp192r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp224k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp224r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp224r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp256k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp256r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp256r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp384r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp384r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\secp521r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/secp521r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect113r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect113r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect113r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect131r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect131r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect131r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect163k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect163r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect163r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect163r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect193r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect193r2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect193r2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect233k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect233r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect233r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect239k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect239k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect283k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect283r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect283r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect409k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect409r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect409r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect571k1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571k1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Curves\\sect571r1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Curves/sect571r1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\Common' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/Common.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\JWK' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\MontgomeryPrivate' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPrivate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\MontgomeryPublic' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/MontgomeryPublic.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\OpenSSH' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\PKCS1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\PKCS8' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\PuTTY' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\XML' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/XML.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Keys\\libsodium' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Keys/libsodium.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\ASN1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/ASN1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\IEEE' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\Raw' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Formats\\Signature\\SSH2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/SSH2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\Parameters' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/Parameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\PrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\EC\\PublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/EC/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Hash' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Hash.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\PublicKeyLoader' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/PublicKeyLoader.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RC2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RC4' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RC4.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\JWK' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/JWK.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\MSBLOB' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/MSBLOB.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\OpenSSH' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/OpenSSH.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PKCS1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PKCS8' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PKCS8.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PSS' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PSS.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\PuTTY' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/PuTTY.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\Raw' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/Raw.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\Formats\\Keys\\XML' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/Formats/Keys/XML.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\PrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\RSA\\PublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/RSA/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Random' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Random.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Rijndael' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Rijndael.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Salsa20' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Salsa20.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\TripleDES' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/TripleDES.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Crypt\\Twofish' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Crypt/Twofish.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\BadConfigurationException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/BadConfigurationException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\BadDecryptionException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/BadDecryptionException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\BadModeException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/BadModeException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\ConnectionClosedException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/ConnectionClosedException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\FileNotFoundException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/FileNotFoundException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\InconsistentSetupException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/InconsistentSetupException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\InsufficientSetupException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/InsufficientSetupException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\NoKeyLoadedException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/NoKeyLoadedException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\NoSupportedAlgorithmsException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/NoSupportedAlgorithmsException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnableToConnectException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/UnableToConnectException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedAlgorithmException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedAlgorithmException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedCurveException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedCurveException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedFormatException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedFormatException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Exception\\UnsupportedOperationException' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Exception/UnsupportedOperationException.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ANSI' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ANSI.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Element' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Element.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AccessDescription' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AccessDescription.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AdministrationDomainName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AdministrationDomainName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AlgorithmIdentifier' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AlgorithmIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AnotherName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AnotherName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Attribute' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attribute.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AttributeType' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeType.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AttributeTypeAndValue' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeTypeAndValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AttributeValue' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AttributeValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Attributes' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Attributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AuthorityInfoAccessSyntax' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityInfoAccessSyntax.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\AuthorityKeyIdentifier' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/AuthorityKeyIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BaseDistance' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BaseDistance.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BasicConstraints' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BasicConstraints.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BuiltInDomainDefinedAttribute' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttribute.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BuiltInDomainDefinedAttributes' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInDomainDefinedAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\BuiltInStandardAttributes' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/BuiltInStandardAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CPSuri' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CPSuri.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CRLDistributionPoints' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLDistributionPoints.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CRLNumber' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLNumber.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CRLReason' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CRLReason.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertPolicyId' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertPolicyId.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Certificate' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Certificate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificateIssuer' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateIssuer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificateList' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateList.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificatePolicies' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificatePolicies.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificateSerialNumber' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificateSerialNumber.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificationRequest' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequest.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CertificationRequestInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CertificationRequestInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Characteristic_two' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Characteristic_two.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\CountryName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/CountryName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Curve' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Curve.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DHParameter' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DHParameter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DSAParams' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAParams.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DSAPrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DSAPublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DSAPublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DigestInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DigestInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DirectoryString' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DirectoryString.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DisplayText' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DisplayText.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DistributionPoint' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPoint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DistributionPointName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DistributionPointName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\DssSigValue' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/DssSigValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ECParameters' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECParameters.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ECPoint' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPoint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ECPrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ECPrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EDIPartyName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EDIPartyName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EcdsaSigValue' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EcdsaSigValue.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EncryptedData' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedData.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\EncryptedPrivateKeyInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/EncryptedPrivateKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ExtKeyUsageSyntax' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtKeyUsageSyntax.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Extension' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extension.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ExtensionAttribute' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttribute.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ExtensionAttributes' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ExtensionAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Extensions' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Extensions.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\FieldElement' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldElement.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\FieldID' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/FieldID.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralNames' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralNames.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralSubtree' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtree.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\GeneralSubtrees' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/GeneralSubtrees.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\HashAlgorithm' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HashAlgorithm.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\HoldInstructionCode' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/HoldInstructionCode.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\InvalidityDate' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/InvalidityDate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\IssuerAltName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuerAltName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\IssuingDistributionPoint' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/IssuingDistributionPoint.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\KeyIdentifier' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\KeyPurposeId' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyPurposeId.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\KeyUsage' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/KeyUsage.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\MaskGenAlgorithm' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/MaskGenAlgorithm.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Name' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Name.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NameConstraints' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NameConstraints.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NetworkAddress' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NetworkAddress.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NoticeReference' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NoticeReference.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\NumericUserIdentifier' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/NumericUserIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ORAddress' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ORAddress.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OneAsymmetricKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OneAsymmetricKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OrganizationName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OrganizationalUnitNames' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OrganizationalUnitNames.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OtherPrimeInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\OtherPrimeInfos' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/OtherPrimeInfos.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBEParameter' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBEParameter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBES2params' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBES2params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBKDF2params' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBKDF2params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PBMAC1params' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PBMAC1params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PKCS9String' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PKCS9String.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Pentanomial' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Pentanomial.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PersonalName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PersonalName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyInformation' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyInformation.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyMappings' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyMappings.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyQualifierId' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierId.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PolicyQualifierInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PolicyQualifierInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PostalAddress' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PostalAddress.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Prime_p' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Prime_p.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateDomainName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateDomainName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateKeyInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PrivateKeyUsagePeriod' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PrivateKeyUsagePeriod.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PublicKeyAndChallenge' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyAndChallenge.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\PublicKeyInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/PublicKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RC2CBCParameter' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RC2CBCParameter.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RDNSequence' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RDNSequence.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RSAPrivateKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPrivateKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RSAPublicKey' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSAPublicKey.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RSASSA_PSS_params' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RSASSA_PSS_params.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\ReasonFlags' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/ReasonFlags.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RelativeDistinguishedName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RelativeDistinguishedName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\RevokedCertificate' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/RevokedCertificate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SignedPublicKeyAndChallenge' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SignedPublicKeyAndChallenge.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SpecifiedECDomain' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SpecifiedECDomain.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectAltName' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectAltName.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectDirectoryAttributes' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectDirectoryAttributes.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectInfoAccessSyntax' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectInfoAccessSyntax.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\SubjectPublicKeyInfo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/SubjectPublicKeyInfo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\TBSCertList' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertList.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\TBSCertificate' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TBSCertificate.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\TerminalIdentifier' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/TerminalIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Time' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Time.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Trinomial' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Trinomial.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\UniqueIdentifier' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UniqueIdentifier.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\UserNotice' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/UserNotice.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\Validity' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/Validity.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\netscape_ca_policy_url' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_ca_policy_url.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\netscape_cert_type' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_cert_type.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\ASN1\\Maps\\netscape_comment' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/ASN1/Maps/netscape_comment.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\File\\X509' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/File/X509.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\Base' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Base.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\BuiltIn' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/BuiltIn.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\DefaultEngine' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/DefaultEngine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\OpenSSL' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/OpenSSL.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\Reductions\\Barrett' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/Barrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\BCMath\\Reductions\\EvalBarrett' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/BCMath/Reductions/EvalBarrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\Engine' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/Engine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\GMP' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\GMP\\DefaultEngine' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/GMP/DefaultEngine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\OpenSSL' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/OpenSSL.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP32' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP32.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP64' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP64.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Base' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Base.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\DefaultEngine' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/DefaultEngine.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Montgomery' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Montgomery.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\OpenSSL' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/OpenSSL.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\Barrett' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Barrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\Classic' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Classic.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\EvalBarrett' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/EvalBarrett.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\Montgomery' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/Montgomery.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\MontgomeryMult' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/MontgomeryMult.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BigInteger\\Engines\\PHP\\Reductions\\PowerOfTwo' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP/Reductions/PowerOfTwo.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BinaryField' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BinaryField.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\BinaryField\\Integer' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/BinaryField/Integer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\Common\\FiniteField' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\Common\\FiniteField\\Integer' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/Common/FiniteField/Integer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\PrimeField' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/PrimeField.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Math\\PrimeField\\Integer' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Net\\SFTP' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Net\\SFTP\\Stream' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\Net\\SSH2' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/Net/SSH2.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\System\\SSH\\Agent' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\System\\SSH\\Agent\\Identity' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Agent/Identity.php', + 'Matomo\\Dependencies\\SearchEngineKeywordsPerformance\\phpseclib3\\System\\SSH\\Common\\Traits\\ReadBytes' => __DIR__ . '/../..' . '/phpseclib/phpseclib/phpseclib/System/SSH/Common/Traits/ReadBytes.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->classMap = ComposerStaticInit13b47076bce2931fc82608360376103f::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/scoper-autoload.php b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/scoper-autoload.php new file mode 100644 index 0000000..c761e6f --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vendor/scoper-autoload.php @@ -0,0 +1,26 @@ + [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigurationDescription')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ProviderListDescription')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_1, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.providers, provider => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(_component_Provider, { + key: provider.id, + provider: provider + }, null, 8, ["provider"]); + }), 128)), _hoisted_2])]), + _: 1 + }, 8, ["content-title"]); +} +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?vue&type=template&id=6ea8181b + +// EXTERNAL MODULE: external "CoreHome" +var external_CoreHome_ = __webpack_require__("19dc"); + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?vue&type=template&id=5cbccceb + +const Providervue_type_template_id_5cbccceb_hoisted_1 = ["title"]; +const Providervue_type_template_id_5cbccceb_hoisted_2 = ["src", "alt"]; +const _hoisted_3 = ["innerHTML"]; +const _hoisted_4 = ["innerHTML"]; +const _hoisted_5 = { + key: 0, + class: "experimental" +}; +const _hoisted_6 = ["href"]; +const _hoisted_7 = { + key: 0, + class: "btn" +}; +const _hoisted_8 = { + key: 1, + class: "btn" +}; +function Providervue_type_template_id_5cbccceb_render(_ctx, _cache, $props, $setup, $data, $options) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])({ + keywordprovider: true, + warning: _ctx.hasWarning, + configured: !_ctx.hasWarning && _ctx.provider.is_configured + }) + }, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.provider.logos, (logo, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: index, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`logo ${_ctx.provider.logos.length > 1 ? 'double' : ''}`), + title: _ctx.logoTooltip + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + src: logo, + alt: _ctx.provider.name + }, null, 8, Providervue_type_template_id_5cbccceb_hoisted_2)], 10, Providervue_type_template_id_5cbccceb_hoisted_1); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.provider.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.provider.description) + }, null, 8, _hoisted_3), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("em", { + innerHTML: _ctx.$sanitize(_ctx.provider.note) + }, null, 8, _hoisted_4)]), _ctx.provider.is_experimental ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", _hoisted_5, "experimental")) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("a", { + href: _ctx.configureUrl, + class: "cta" + }, [_ctx.provider.is_configured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("button", _hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ChangeConfiguration')), 1)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("button", _hoisted_8, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_SetupConfiguration')), 1))], 8, _hoisted_6)], 2); +} +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?vue&type=template&id=5cbccceb + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?vue&type=script&lang=ts + + +/* harmony default export */ var Providervue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + provider: { + type: Object, + required: true + } + }, + computed: { + hasWarning() { + const provider = this.provider; + return provider.is_configured && (Object.keys(provider.configured_site_ids).length === 0 || Object.keys(provider.problems.sites).length || Object.keys(provider.problems.accounts).length); + }, + logoTooltip() { + const provider = this.provider; + const isConfiguredWithoutSite = provider.is_configured && Object.keys(provider.configured_site_ids).length === 0; + if (isConfiguredWithoutSite) { + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_ConfigAvailableNoWebsiteConfigured'); + } + if (provider.is_configured) { + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_IntegrationConfigured'); + } + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_IntegrationNotConfigured'); + }, + configureUrl() { + return `?${external_CoreHome_["MatomoUrl"].stringify(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { + action: `configure${this.provider.id}` + }))}`; + } + } +})); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue + + + +Providervue_type_script_lang_ts.render = Providervue_type_template_id_5cbccceb_render + +/* harmony default export */ var Provider = (Providervue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?vue&type=script&lang=ts + + + +/* harmony default export */ var AdminPagevue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + providers: { + type: Array, + required: true + } + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Provider: Provider + } +})); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue + + + +AdminPagevue_type_script_lang_ts.render = render + +/* harmony default export */ var AdminPage = (AdminPagevue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?vue&type=template&id=752192ce + +const Configurationvue_type_template_id_752192ce_hoisted_1 = { + class: "ui-confirm", + id: "confirmRemoveAccountConfig", + ref: "confirmRemoveAccountConfig" +}; +const Configurationvue_type_template_id_752192ce_hoisted_2 = ["value"]; +const Configurationvue_type_template_id_752192ce_hoisted_3 = ["value"]; +const Configurationvue_type_template_id_752192ce_hoisted_4 = { + class: "measurableList" +}; +const Configurationvue_type_template_id_752192ce_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, null, -1); +const Configurationvue_type_template_id_752192ce_hoisted_6 = { + key: 0 +}; +const Configurationvue_type_template_id_752192ce_hoisted_7 = { + colspan: "6" +}; +const Configurationvue_type_template_id_752192ce_hoisted_8 = { + key: 0, + class: "icon-error" +}; +const _hoisted_9 = { + key: 0, + class: "icon-error" +}; +const _hoisted_10 = ["onSubmit"]; +const _hoisted_11 = ["value"]; +const _hoisted_12 = ["value"]; +const _hoisted_13 = ["title"]; +const _hoisted_14 = { + key: 1 +}; +const _hoisted_15 = { + colspan: "6", + align: "right" +}; +const _hoisted_16 = { + key: 2, + class: "configureMeasurableForm" +}; +const _hoisted_17 = { + colspan: "2" +}; +const _hoisted_18 = { + class: "bingAccountAndUrlToAdd" +}; +const _hoisted_19 = { + colspan: "3" +}; +const _hoisted_20 = { + action: "", + method: "post" +}; +const _hoisted_21 = ["value"]; +const _hoisted_22 = ["value"]; +const _hoisted_23 = ["value"]; +const _hoisted_24 = ["value"]; +const _hoisted_25 = { + class: "ui-confirm", + id: "confirmDeleteAccount", + ref: "confirmDeleteAccount" +}; +const _hoisted_26 = ["value"]; +const _hoisted_27 = ["value"]; +const _hoisted_28 = { + class: "accounts" +}; +const _hoisted_29 = ["innerHTML"]; +const _hoisted_30 = { + key: 0, + class: "accounterror" +}; +const _hoisted_31 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const _hoisted_32 = { + key: 1 +}; +const _hoisted_33 = { + key: 0, + class: "accounterror" +}; +const _hoisted_34 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const _hoisted_35 = { + key: 1 +}; +const _hoisted_36 = { + key: 0 +}; +const _hoisted_37 = { + class: "websites-list" +}; +const _hoisted_38 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-success" +}, null, -1); +const _hoisted_39 = { + key: 1 +}; +const _hoisted_40 = { + class: "accounterror" +}; +const _hoisted_41 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const _hoisted_42 = { + key: 2 +}; +const _hoisted_43 = { + class: "websites-list" +}; +const _hoisted_44 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-error" +}, null, -1); +const _hoisted_45 = { + class: "cta" +}; +const _hoisted_46 = ["onSubmit"]; +const _hoisted_47 = ["value"]; +const _hoisted_48 = ["value"]; +const _hoisted_49 = { + type: "submit", + class: "btn" +}; +const _hoisted_50 = { + method: "POST", + action: "" +}; +const _hoisted_51 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "icon-add logo" +}, null, -1); +const _hoisted_52 = ["innerHTML"]; +const _hoisted_53 = { + key: 0, + class: "accounterror" +}; +const _hoisted_54 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const _hoisted_55 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const _hoisted_56 = ["value"]; +const _hoisted_57 = { + class: "cta" +}; +const _hoisted_58 = { + type: "submit", + class: "btn" +}; +const _hoisted_59 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "clear" +}, null, -1); +function Configurationvue_type_template_id_752192ce_render(_ctx, _cache, $props, $setup, $data, $options) { + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_BingConfigurationTitle')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_BingConfigurationDescription')), 1)]), + _: 1 + }, 8, ["content-title"]), Object.keys(_ctx.accounts).length > 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: 0, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`websiteconfiguration ${Object.keys(_ctx.configuredMeasurables).length ? 'configured' : ''}`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_ConfigureMeasurables') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigureMeasurableBelow')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_752192ce_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigRemovalConfirm', _ctx.removeAccountConfigName)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Configurationvue_type_template_id_752192ce_hoisted_2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Configurationvue_type_template_id_752192ce_hoisted_3)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("table", Configurationvue_type_template_id_752192ce_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Measurable')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Mobile_Account')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Goals_URL')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_LastImport')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_CreatedBy')), 1), Configurationvue_type_template_id_752192ce_hoisted_5])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [!Object.keys(_ctx.configuredMeasurables).length ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", Configurationvue_type_template_id_752192ce_hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Configurationvue_type_template_id_752192ce_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_NoWebsiteConfigured')), 1)])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.configuredMeasurablesToDisplay, (config, siteId, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + key: index, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(!_ctx.sitesInfos[siteId].accountValid || !_ctx.sitesInfos[siteId].urlValid ? 'error' : '') + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.sitesInfos[siteId].name) + " ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, "(" + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.sitesInfos[siteId].main_url) + ")", 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [!_ctx.sitesInfos[siteId].accountValid ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_752192ce_hoisted_8)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.apiKeyDisplay), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [!_ctx.sitesInfos[siteId].urlValid ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", _hoisted_9)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.url), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.sitesInfos[siteId].lastRun), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.createdByUser), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "POST", + action: "", + onSubmit: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.removeAccountConfig(siteId, $event), ["prevent"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeConfig", + value: siteId + }, null, 8, _hoisted_11), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeSiteConfigNonce", + value: _ctx.removeBingSiteConfigNonce + }, null, 8, _hoisted_12), config.isDeletionAllowed ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("button", { + key: 0, + type: "submit", + class: "btn-flat icon-delete", + title: _ctx.translate('General_Delete') + }, null, 8, _hoisted_13)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 40, _hoisted_10)])], 2); + }), 128)), _ctx.countOfAccountsWithAccess ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", _hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", { + class: "btn", + onClick: _cache[0] || (_cache[0] = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.isAddingMeasurable = true, ["prevent"])) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AddConfiguration')), 1)])], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isAddingMeasurable]]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.countOfAccountsWithAccess ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", _hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "site", + modelValue: _ctx.currentSiteToAdd, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.currentSiteToAdd = $event), + title: _ctx.translate('CoreHome_ChooseX', _ctx.translate('General_Measurable')) + }, null, 8, ["modelValue", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + modelValue: _ctx.bingAccountAndUrlToAdd, + "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.bingAccountAndUrlToAdd = $event), + title: _ctx.translate('SearchEngineKeywordsPerformance_UrlOfAccount'), + options: _ctx.urlOptions + }, null, 8, ["modelValue", "title", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", _hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", _hoisted_20, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "bingSiteId", + value: _ctx.currentSiteToAdd.id + }, null, 8, _hoisted_21), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "addSiteConfigNonce", + value: _ctx.addBingSiteConfigNonce + }, null, 8, _hoisted_22), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "bingAccountAndUrl", + value: _ctx.bingAccountAndUrlToAdd + }, null, 8, _hoisted_23), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "submit", + class: "btn", + value: _ctx.translate('General_Save') + }, null, 8, _hoisted_24)])])], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isAddingMeasurable]]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])])), [[_directive_content_table]])])]), + _: 1 + }, 8, ["content-title"])], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`accountconfiguration ${Object.keys(_ctx.accounts).length > 0 ? 'configured' : ''}`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_ManageAPIKeys') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_25, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountRemovalConfirm', _ctx.removeAccountName)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, _hoisted_26), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, _hoisted_27)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_28, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.accountsToDisplay, account => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: account.username, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`account ${Object.keys(account.urls).length === 0 || typeof account.hasError === 'string' ? 'invalid' : ''}`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`icon-${Object.keys(account.urls).length === 0 || typeof account.hasError === 'string' ? 'warning' : 'success'} logo`) + }, null, 2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.getDisplayApiKey(account.apiKey)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_AccountAddedBy', account.username, account.created_formatted)) + }, null, 8, _hoisted_29), typeof account.hasError === 'string' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", _hoisted_30, [_hoisted_31, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_BingAccountError', account.hasError)), 1)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_32, [Object.keys(account.urls).length === 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", _hoisted_33, [_hoisted_34, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountNoAccess')), 1)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_35, [Object.values(account.urls).some(isVerified => isVerified) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_36, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AvailableSites')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", _hoisted_37, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(Object.entries(account.urls).filter(([, isVerified]) => isVerified), ([url], index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: index + }, [_hoisted_38, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(url), 1)]); + }), 128))])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_39, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", _hoisted_40, [_hoisted_41, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountNoAccess')), 1)])])), Object.values(account.urls).some(isVerified => !isVerified) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_42, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_UnverifiedSites')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", _hoisted_43, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(Object.entries(account.urls).filter(([, isVerified]) => !isVerified), ([url], index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: index + }, [_hoisted_44, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(url), 1)]); + }), 128))])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]))])), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_45, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "POST", + action: "", + onSubmit: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.removeAccount(account, $event), ["prevent"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "remove", + value: account.apiKey + }, null, 8, _hoisted_47), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeAccountNonce", + value: _ctx.removeBingAccountNonce + }, null, 8, _hoisted_48), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", _hoisted_49, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Remove')), 1)], 40, _hoisted_46)])], 2); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`account add ${_ctx.hasApiKeyError ? 'invalid' : ''}`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", _hoisted_50, [_hoisted_51, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AddAPIKey')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.$sanitize(_ctx.bingApiKeyInstructionText) + }, null, 8, _hoisted_52), _ctx.hasApiKeyError ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", _hoisted_53, [_hoisted_54, _hoisted_55, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_BingAccountError', _ctx.error)), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + "full-width": true, + name: "apikey", + modelValue: _ctx.apiKeyToAdd, + "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => _ctx.apiKeyToAdd = $event), + title: _ctx.translate('SearchEngineKeywordsPerformance_APIKey'), + autocomplete: "off" + }, null, 8, ["modelValue", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "config_nonce", + value: _ctx.formNonce + }, null, 8, _hoisted_56), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_57, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", _hoisted_58, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AddAPIKey')), 1)])])], 2), _hoisted_59])]), + _: 1 + }, 8, ["content-title"])], 2)]); +} +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?vue&type=template&id=752192ce + +// EXTERNAL MODULE: external "CorePluginsAdmin" +var external_CorePluginsAdmin_ = __webpack_require__("a5a2"); + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/utilities.ts +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ +function getDisplayApiKey(apiKey = '') { + return `${apiKey.substr(0, 5)}*****${apiKey.substr(apiKey.length - 5, 5)}`; +} +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?vue&type=script&lang=ts + + + + +/* harmony default export */ var Configurationvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + configuredMeasurables: { + type: Object, + required: true + }, + accounts: { + type: Object, + required: true + }, + sitesInfos: { + type: Object, + required: true + }, + currentSite: { + type: Object, + required: true + }, + urlOptions: { + type: [Object, Array], + required: true + }, + error: String, + apikey: String, + formNonce: String, + addBingSiteConfigNonce: String, + removeBingSiteConfigNonce: String, + removeBingAccountNonce: String, + countOfAccountsWithAccess: Number, + userIsSuperUser: String + }, + data() { + return { + removeAccountConfigName: '', + removeAccountName: '', + isAddingMeasurable: false, + currentSiteToAdd: this.currentSite, + bingAccountAndUrlToAdd: null, + apiKeyToAdd: this.apikey || '' + }; + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"] + }, + directives: { + ContentTable: external_CoreHome_["ContentTable"] + }, + methods: { + removeAccountConfig(siteId, event) { + const siteInfos = this.sitesInfos; + this.removeAccountConfigName = siteInfos[siteId].name; + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig, { + yes() { + event.target.submit(); + } + }); + }, + getDisplayApiKey: getDisplayApiKey, + removeAccount(account, event) { + this.removeAccountName = this.getDisplayApiKey(account.apiKey); + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount, { + yes() { + event.target.submit(); + } + }); + } + }, + computed: { + hasApiKeyError() { + return typeof this.error !== 'undefined' && this.error !== null; + }, + configuredMeasurablesToDisplay() { + const entries = Object.entries(this.configuredMeasurables); + return Object.fromEntries(entries.filter(([, config]) => { + const [account] = config.bingSiteUrl.split('##'); + return !!this.accounts[account]; + }).map(([siteId, config]) => { + const [account, url] = config.bingSiteUrl.split('##'); + const { + apiKey + } = this.accounts[account]; + return [siteId, Object.assign(Object.assign({}, config), {}, { + account, + url, + apiKeyDisplay: this.getDisplayApiKey(apiKey) + })]; + })); + }, + bingApiKeyInstructionText() { + const url = Object(external_CoreHome_["externalRawLink"])('https://matomo.org/faq/reports/import-bing-and-yahoo-search-keywords-into-matomo/'); + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_BingAPIKeyInstruction', '', '', ``, ''); + }, + accountsToDisplay() { + const asArray = Object.entries(this.accounts); + const filtered = asArray.filter(([, value]) => value.hasAccess); + return Object.fromEntries(filtered); + } + } +})); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue + + + +Configurationvue_type_script_lang_ts.render = Configurationvue_type_template_id_752192ce_render + +/* harmony default export */ var Configuration = (Configurationvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?vue&type=template&id=f24fe118 + +const Configurationvue_type_template_id_f24fe118_hoisted_1 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_2 = { + class: "alert alert-warning" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_3 = { + key: 1 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_4 = { + class: "ui-confirm", + id: "confirmRemoveAccountConfig", + ref: "confirmRemoveAccountConfig" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_5 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_6 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_7 = { + class: "measurableList" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_8 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_9 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_10 = { + colspan: "7" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_11 = ["innerHTML"]; +const Configurationvue_type_template_id_f24fe118_hoisted_12 = { + key: 0, + class: "icon-error" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_13 = { + key: 0, + class: "icon-error" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_14 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_15 = ["title"]; +const Configurationvue_type_template_id_f24fe118_hoisted_16 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-info" +}, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_17 = ["title"]; +const Configurationvue_type_template_id_f24fe118_hoisted_18 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-info" +}, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_19 = ["onSubmit"]; +const Configurationvue_type_template_id_f24fe118_hoisted_20 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_21 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_22 = ["title"]; +const Configurationvue_type_template_id_f24fe118_hoisted_23 = { + key: 1, + class: "configureMeasurableForm" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_24 = { + class: "account-select" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_25 = { + colspan: "4" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_26 = { + action: "", + method: "post" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_27 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_28 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_29 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_30 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_31 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_32 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_33 = { + key: 2, + class: "oauthconfiguration" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_34 = { + class: "section-heading" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_35 = { + class: "ui-confirm", + id: "confirmDeleteAccount", + ref: "confirmDeleteAccount" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_36 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_37 = ["value"]; +const Configurationvue_type_template_id_f24fe118_hoisted_38 = { + class: "oauthconfigoptions" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_39 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_40 = { + key: 1 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_41 = { + key: 2 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_42 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_43 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_44 = { + class: "accounts" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_45 = { + class: "logo" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_46 = ["src"]; +const Configurationvue_type_template_id_f24fe118_hoisted_47 = ["innerHTML"]; +const Configurationvue_type_template_id_f24fe118_hoisted_48 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_49 = { + class: "accounterror" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_50 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_51 = { + key: 1 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_52 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_53 = { + class: "accounterror" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_54 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_55 = { + key: 1 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_56 = { + key: 0 +}; +const Configurationvue_type_template_id_f24fe118_hoisted_57 = { + class: "websites-list" +}; +const Configurationvue_type_template_id_f24fe118_hoisted_58 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-success" +}, null, -1); +const Configurationvue_type_template_id_f24fe118_hoisted_59 = { + key: 1, + class: "accounterror" +}; +const _hoisted_60 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const _hoisted_61 = { + key: 2 +}; +const _hoisted_62 = { + class: "websites-list" +}; +const _hoisted_63 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-error" +}, null, -1); +const _hoisted_64 = { + class: "cta" +}; +const _hoisted_65 = ["onSubmit"]; +const _hoisted_66 = ["value"]; +const _hoisted_67 = ["value"]; +const _hoisted_68 = { + type: "submit", + class: "btn" +}; +const _hoisted_69 = { + class: "account add" +}; +const _hoisted_70 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "icon-add logo" +}, null, -1); +const _hoisted_71 = ["innerHTML"]; +const _hoisted_72 = ["innerHTML"]; +const _hoisted_73 = ["innerHTML"]; +const _hoisted_74 = { + class: "cta" +}; +const _hoisted_75 = ["action"]; +const _hoisted_76 = ["value"]; +const _hoisted_77 = { + type: "submit", + class: "btn" +}; +const _hoisted_78 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "clear" +}, null, -1); +const _hoisted_79 = { + key: 3, + class: "clientconfiguration" +}; +const _hoisted_80 = { + class: "section-heading" +}; +const _hoisted_81 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const _hoisted_82 = ["action"]; +const _hoisted_83 = ["value"]; +const _hoisted_84 = { + type: "submit", + class: "btn" +}; +const _hoisted_85 = { + key: 4 +}; +function Configurationvue_type_template_id_f24fe118_render(_ctx, _cache, $props, $setup, $data, $options) { + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _component_Notification = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Notification"); + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + const _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [!_ctx.isClientConfigured && _ctx.isClientConfigurable && !_ctx.userIsSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_GooglePendingConfigurationErrorMessage')), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.isClientConfigured && _ctx.isOAuthConfigured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigureMeasurables')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigureMeasurableBelow')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigRemovalConfirm', _ctx.removeAccountConfigName)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_5), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_6)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("table", Configurationvue_type_template_id_f24fe118_hoisted_7, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Measurable')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_EnabledSearchTypes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Mobile_Account')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Goals_URL')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_LastImport')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_CreatedBy')), 1), Configurationvue_type_template_id_f24fe118_hoisted_8])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [Object.keys(_ctx.configuredMeasurablesToDisplay).length === 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", Configurationvue_type_template_id_f24fe118_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Configurationvue_type_template_id_f24fe118_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_NoWebsiteConfigured')), 1)])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.configuredMeasurablesToDisplay, (config, siteId, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + key: index, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(!_ctx.sitesInfos[siteId].accountValid || !_ctx.sitesInfos[siteId].urlValid ? 'error' : '') + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + innerHTML: _ctx.$sanitize(_ctx.sitesInfos[siteId].name) + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_11), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.googleWebKeywords ? _ctx.translate('SearchEngineKeywordsPerformance_KeywordTypeWeb') : '') + " " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.googleImageKeywords ? _ctx.translate('SearchEngineKeywordsPerformance_KeywordTypeImage') : '') + " " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.googleVideoKeywords ? _ctx.translate('SearchEngineKeywordsPerformance_KeywordTypeVideo') : '') + " " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.googleNewsKeywords ? _ctx.translate('SearchEngineKeywordsPerformance_KeywordTypeNews') : ''), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [!_ctx.sitesInfos[siteId].accountValid ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_f24fe118_hoisted_12)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.accounts[config.account].name), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [!_ctx.sitesInfos[siteId].urlValid ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_f24fe118_hoisted_13)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.url.replaceAll('sc-domain:', '')) + " ", 1), Configurationvue_type_template_id_f24fe118_hoisted_14, /^sc-domain:/.test(config.url) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { + key: 1, + class: "property-type", + title: _ctx.translate('SearchEngineKeywordsPerformance_DomainPropertyInfo') + }, [Configurationvue_type_template_id_f24fe118_hoisted_16, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" (" + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_DomainProperty')) + ") ", 1)], 8, Configurationvue_type_template_id_f24fe118_hoisted_15)) : /^http/.test(config.url) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", { + key: 2, + class: "property-type", + title: _ctx.translate('SearchEngineKeywordsPerformance_URLPrefixPropertyInfo') + }, [Configurationvue_type_template_id_f24fe118_hoisted_18, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" (" + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_URLPrefixProperty')) + ") ", 1)], 8, Configurationvue_type_template_id_f24fe118_hoisted_17)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.sitesInfos[siteId].lastRun), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.createdByUser), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "POST", + action: "", + onSubmit: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.removeAccountConfig(siteId, $event), ["prevent"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeConfig", + value: siteId + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_20), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeSiteConfigNonce", + value: _ctx.removeGoogleSiteConfigNonce + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_21), config.isDeletionAllowed ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("button", { + key: 0, + type: "submit", + class: "btn-flat icon-delete", + title: _ctx.translate('General_Delete') + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_22)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 40, Configurationvue_type_template_id_f24fe118_hoisted_19)])], 2); + }), 128)), _ctx.countOfAccountsWithAccess ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", Configurationvue_type_template_id_f24fe118_hoisted_23, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "site", + "full-width": true, + modelValue: _ctx.currentSiteToAdd, + "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => _ctx.currentSiteToAdd = $event), + title: _ctx.translate('CoreHome_ChooseX', _ctx.translate('General_Measurable')) + }, null, 8, ["modelValue", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "checkbox", + modelValue: _ctx.googleTypesToAdd, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.googleTypesToAdd = $event), + "var-type": "array", + title: "keyword types to fetch", + "full-width": true, + options: _ctx.googleTypeOptions + }, null, 8, ["modelValue", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_24, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + modelValue: _ctx.googleAccountAndUrlToAdd, + "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.googleAccountAndUrlToAdd = $event), + title: _ctx.translate('SearchEngineKeywordsPerformance_UrlOfAccount'), + "full-width": true, + options: _ctx.urlOptions + }, null, 8, ["modelValue", "title", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Configurationvue_type_template_id_f24fe118_hoisted_25, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", Configurationvue_type_template_id_f24fe118_hoisted_26, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "googleSiteId", + value: _ctx.currentSiteToAdd.id + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_27), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "addSiteConfigNonce", + value: _ctx.addGoogleSiteConfigNonce + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_28), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "googleAccountAndUrl", + value: _ctx.googleAccountAndUrlToAdd + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_29), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "googleTypes", + value: _ctx.googleTypesToAdd.length ? _ctx.googleTypesToAdd : 'web' + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_30), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "submit", + class: "btn", + value: _ctx.translate('General_Save') + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_31)])])], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isAddingMeasurable]]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])])), [[_directive_content_table]]), _ctx.countOfAccountsWithAccess ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_32, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", { + id: "addWebsiteBtn", + class: "btn", + onClick: _cache[3] || (_cache[3] = $event => _ctx.isAddingMeasurable = true) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AddConfiguration')), 1)], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isAddingMeasurable]]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.isClientConfigured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_33, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", Configurationvue_type_template_id_f24fe118_hoisted_34, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectGoogleAccounts')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_35, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountRemovalConfirm', _ctx.removeAccountName)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_36), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_37)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_38, [_ctx.isOAuthConfigured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_f24fe118_hoisted_39, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts', _ctx.countOfAccountsWithAccess)), 1)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_f24fe118_hoisted_40, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectFirstAccount')), 1)), _ctx.hasOAuthError ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_f24fe118_hoisted_41, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Notification, { + context: "error", + type: "transient" + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_OAuthError')) + " ", 1), _ctx.hasOAuthError.length > 5 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_f24fe118_hoisted_42, [Configurationvue_type_template_id_f24fe118_hoisted_43, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.hasOAuthError), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), + _: 1 + })])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_44, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.accountsToDisplay, (account, accountId) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: accountId, + class: "account" + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_f24fe118_hoisted_45, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + src: account.picture + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_46)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(account.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_AccountAddedBy', account.username, account.created_formatted)) + }, null, 8, Configurationvue_type_template_id_f24fe118_hoisted_47), typeof account.hasError === 'string' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_48, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", Configurationvue_type_template_id_f24fe118_hoisted_49, [Configurationvue_type_template_id_f24fe118_hoisted_50, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountConnectionValidationError')) + " " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(account.hasError), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ReAddAccountIfPermanentError')), 1)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_51, [Object.keys(account.urls).length === 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_52, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", Configurationvue_type_template_id_f24fe118_hoisted_53, [Configurationvue_type_template_id_f24fe118_hoisted_54, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountNoAccess')), 1)])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_55, [_ctx.accountHasAvailableSites(account) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_f24fe118_hoisted_56, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AvailableSites')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", Configurationvue_type_template_id_f24fe118_hoisted_57, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(Object.entries(account.urls).filter(([, level]) => level !== 'siteUnverifiedUser'), ([url], index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: index + }, [Configurationvue_type_template_id_f24fe118_hoisted_58, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(url.replaceAll('sc-domain:', '')), 1)]); + }), 128))])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_f24fe118_hoisted_59, [_hoisted_60, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountNoAccess')), 1)])), Object.values(account.urls).indexOf('siteUnverifiedUser') !== -1 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_61, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_UnverifiedSites')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", _hoisted_62, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(Object.entries(account.urls).filter(([, accessLevel]) => accessLevel === 'siteUnverifiedUser'), ([url], index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: index + }, [_hoisted_63, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(url.replaceAll('sc-domain:', '')), 1)]); + }), 128))])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]))])), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_64, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "POST", + action: "", + onSubmit: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.removeAccount(account, $event), ["prevent"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "remove", + value: accountId + }, null, 8, _hoisted_66), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeAccountNonce", + value: _ctx.removeGoogleAccountNonce + }, null, 8, _hoisted_67), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", _hoisted_68, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Remove')), 1)], 40, _hoisted_65)])]); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_69, [_hoisted_70, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectAccount')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectAccountDescription', 'Google')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_RequiredAccessTypes')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_GoogleAccountAccessTypeSearchConsoleData')) + }, null, 8, _hoisted_71), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_GoogleAccountAccessTypeProfileInfo')) + }, null, 8, _hoisted_72), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("li", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_GoogleAccountAccessTypeOfflineAccess')) + }, null, 8, _hoisted_73)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_74, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "post", + action: _ctx.forwardToAuthUrl, + id: "clientauthform" + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "auth_nonce", + value: _ctx.authNonce + }, null, 8, _hoisted_76), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", _hoisted_77, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_StartOAuth')), 1)], 8, _hoisted_75)])]), _hoisted_78])])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.isClientConfigurable && _ctx.isClientConfigured && _ctx.userIsSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_79, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", _hoisted_80, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_OAuthClientConfig')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ClientId')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.clientId), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ClientSecret')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.clientSecret), 1)]), _hoisted_81, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + action: _ctx.removeConfigUrl, + method: "POST", + enctype: "multipart/form-data", + id: "removeConfigForm" + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_DeleteUploadedClientConfig')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "config_nonce", + value: _ctx.formNonce + }, null, 8, _hoisted_83), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", _hoisted_84, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Remove')), 1)], 8, _hoisted_82)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.userIsSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_85, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.componentExtensions, (refComponent, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: index + }, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createBlock"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDynamicComponent"])(refComponent), { + "manual-config-nonce": _ctx.configConnectProps.manualConfigNonce, + "base-domain": _ctx.configConnectProps.baseDomain, + "base-url": _ctx.configConnectProps.baseUrl, + "manual-action-url": _ctx.configConnectProps.manualActionUrl, + "primary-text": _ctx.configConnectProps.primaryText, + "radio-options": _ctx.configConnectProps.radioOptions, + "manual-config-text": _ctx.configConnectProps.manualConfigText, + "connect-accounts-url": _ctx.configConnectProps.connectAccountsUrl, + "connect-accounts-btn-text": _ctx.configConnectProps.connectAccountsBtnText, + "auth-url": _ctx.configConnectProps.authUrl, + "unlink-url": _ctx.configConnectProps.unlinkUrl, + strategy: _ctx.configConnectProps.strategy, + "connected-with": _ctx.configConnectProps.connectedWith + }, null, 8, ["manual-config-nonce", "base-domain", "base-url", "manual-action-url", "primary-text", "radio-options", "manual-config-text", "connect-accounts-url", "connect-accounts-btn-text", "auth-url", "unlink-url", "strategy", "connected-with"]))]); + }), 128))])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), + _: 1 + }, 8, ["content-title"])]); +} +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?vue&type=template&id=f24fe118 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?vue&type=script&lang=ts + + + + +/* harmony default export */ var Google_Configurationvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + configuredMeasurables: { + type: Object, + required: true + }, + isClientConfigured: Boolean, + isClientConfigurable: Boolean, + isOAuthConfigured: Boolean, + clientId: String, + clientSecret: String, + accounts: { + type: Object, + required: true + }, + sitesInfos: { + type: Object, + required: true + }, + currentSite: { + type: Object, + required: true + }, + urlOptions: { + type: [Object, Array], + required: true + }, + hasOAuthError: [String, Boolean], + authNonce: { + type: String, + required: true + }, + formNonce: String, + addGoogleSiteConfigNonce: String, + removeGoogleSiteConfigNonce: String, + removeGoogleAccountNonce: String, + countOfAccountsWithAccess: Number, + userIsSuperUser: String, + extensions: Array, + removeConfigUrl: String, + configureConnectionProps: { + type: Object, + required: true + } + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"], + Notification: external_CoreHome_["Notification"] + }, + directives: { + ContentTable: external_CoreHome_["ContentTable"] + }, + data() { + return { + removeAccountConfigName: '', + removeAccountName: '', + isAddingMeasurable: false, + currentSiteToAdd: this.currentSite, + googleAccountAndUrlToAdd: null, + googleTypesToAdd: ['web'], + clientFile: null, + clientText: '' + }; + }, + methods: { + removeAccountConfig(siteId, event) { + const siteInfos = this.sitesInfos; + this.removeAccountConfigName = siteInfos[siteId].name; + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig, { + yes() { + event.target.submit(); + } + }); + }, + removeAccount(account, event) { + this.removeAccountName = account.name; + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount, { + yes() { + event.target.submit(); + } + }); + }, + accountHasAvailableSites(account) { + const siteAccessLevels = ['siteOwner', 'siteFullUser', 'siteRestrictedUser']; + return Object.values(account.urls).some(siteAccess => siteAccessLevels.indexOf(siteAccess) !== -1); + } + }, + computed: { + configuredMeasurablesToDisplay() { + const entries = Object.entries(this.configuredMeasurables); + return Object.fromEntries(entries.filter(([, config]) => { + const [account] = config.googleSearchConsoleUrl.split('##'); + return !!this.accounts[account]; + }).map(([siteId, config]) => { + const [account, url] = config.googleSearchConsoleUrl.split('##'); + const { + apiKey + } = this.accounts[account]; + return [siteId, Object.assign(Object.assign({}, config), {}, { + account, + url, + apiKeyDisplay: getDisplayApiKey(apiKey) + })]; + })); + }, + accountsToDisplay() { + const asArray = Object.entries(this.accounts); + const filtered = asArray.filter(([, value]) => value.hasAccess); + return Object.fromEntries(filtered); + }, + googleTypeOptions() { + return { + web: Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_KeywordTypeWeb'), + image: Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_KeywordTypeImage'), + video: Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_KeywordTypeVideo'), + news: Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_KeywordTypeNews') + }; + }, + forwardToAuthUrl() { + return `?${external_CoreHome_["MatomoUrl"].stringify(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { + action: 'forwardToAuth' + }))}`; + }, + visitOAuthHowTo() { + const link = Object(external_CoreHome_["externalRawLink"])('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-oauth-client-config'); + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_VisitOAuthHowTo', ``, '', 'Google'); + }, + componentExtensions() { + const entries = this.extensions; + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["markRaw"])(entries.map(ref => Object(external_CoreHome_["useExternalPluginComponent"])(ref.plugin, ref.component))); + }, + configConnectProps() { + return this.configureConnectionProps; + } + } +})); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue + + + +Google_Configurationvue_type_script_lang_ts.render = Configurationvue_type_template_id_f24fe118_render + +/* harmony default export */ var Google_Configuration = (Google_Configurationvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?vue&type=template&id=a80179ac + +const Configurationvue_type_template_id_a80179ac_hoisted_1 = { + class: "ui-confirm", + id: "confirmRemoveAccountConfig", + ref: "confirmRemoveAccountConfig" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_2 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_3 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_4 = { + class: "measurableList" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_6 = ["innerHTML"]; +const Configurationvue_type_template_id_a80179ac_hoisted_7 = { + key: 0, + class: "icon-error" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_8 = { + key: 0, + class: "icon-error" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_9 = ["onSubmit"]; +const Configurationvue_type_template_id_a80179ac_hoisted_10 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_11 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_12 = ["title"]; +const Configurationvue_type_template_id_a80179ac_hoisted_13 = { + key: 0 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_14 = { + colspan: "6", + align: "right" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_15 = { + key: 1, + class: "configureMeasurableForm" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_16 = { + colspan: "2" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_17 = { + class: "account-select" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_18 = { + colspan: "3" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_19 = { + action: "", + method: "post" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_20 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_21 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_22 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_23 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_24 = { + class: "ui-confirm", + id: "confirmDeleteAccount", + ref: "confirmDeleteAccount" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_25 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_26 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_27 = { + class: "oauthconfigoptions" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_28 = { + key: 0 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_29 = { + key: 1 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_30 = { + key: 2 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_31 = { + key: 0 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_32 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_33 = { + class: "accounts" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_34 = { + class: "logo" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_35 = ["src"]; +const Configurationvue_type_template_id_a80179ac_hoisted_36 = ["innerHTML"]; +const Configurationvue_type_template_id_a80179ac_hoisted_37 = { + key: 0 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_38 = { + class: "accounterror" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_39 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_40 = { + key: 1 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_41 = { + key: 0, + class: "accounterror" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_42 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_43 = { + key: 1 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_44 = { + key: 0 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_45 = { + class: "websites-list" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_46 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-success" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_47 = { + key: 1, + class: "accounterror" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_48 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_49 = { + key: 2 +}; +const Configurationvue_type_template_id_a80179ac_hoisted_50 = { + class: "websites-list" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_51 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-error" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_52 = { + key: 2, + class: "accounterror" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_53 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_54 = { + key: 3, + class: "accounterror" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_55 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-warning" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_56 = ["innerHTML"]; +const Configurationvue_type_template_id_a80179ac_hoisted_57 = ["innerHTML"]; +const Configurationvue_type_template_id_a80179ac_hoisted_58 = { + class: "cta" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_59 = ["action"]; +const Configurationvue_type_template_id_a80179ac_hoisted_60 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_61 = { + type: "submit", + class: "btn" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_62 = ["onSubmit"]; +const Configurationvue_type_template_id_a80179ac_hoisted_63 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_64 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_65 = { + type: "submit", + class: "btn" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_66 = { + class: "account add" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_67 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "icon-add logo" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_68 = { + class: "cta" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_69 = ["action"]; +const Configurationvue_type_template_id_a80179ac_hoisted_70 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_71 = { + type: "submit", + class: "btn" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_72 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "clear" +}, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_73 = { + key: 3, + class: "clientconfighelp" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_74 = ["innerHTML"]; +const Configurationvue_type_template_id_a80179ac_hoisted_75 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_76 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const Configurationvue_type_template_id_a80179ac_hoisted_77 = { + method: "post", + action: "", + id: "clientconfigform" +}; +const Configurationvue_type_template_id_a80179ac_hoisted_78 = ["value"]; +const Configurationvue_type_template_id_a80179ac_hoisted_79 = { + type: "submit", + class: "btn" +}; +function Configurationvue_type_template_id_a80179ac_render(_ctx, _cache, $props, $setup, $data, $options) { + const _component_ContentBlock = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ContentBlock"); + const _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + const _component_Notification = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Notification"); + const _directive_content_table = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveDirective"])("content-table"); + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_YandexConfigurationTitle')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_YandexConfigurationDescription')), 1)]), + _: 1 + }, 8, ["content-title"]), _ctx.isClientConfigured && _ctx.isOAuthConfigured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: 0, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(Object.keys(_ctx.configuredMeasurables).length ? 'configured' : '') + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_ConfigureMeasurables') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => { + var _ctx$currentSiteToAdd; + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigureMeasurableBelow')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigRemovalConfirm', _ctx.removeAccountConfigName)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_2), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_3)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("table", Configurationvue_type_template_id_a80179ac_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("thead", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tr", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Measurable')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Mobile_Account')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('Goals_URL')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_LastImport')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("th", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_CreatedBy')), 1), Configurationvue_type_template_id_a80179ac_hoisted_5])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("tbody", null, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.configuredMeasurablesToDisplay, (config, siteId, index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", { + key: index, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(!_ctx.sitesInfos[siteId].accountValid || !_ctx.sitesInfos[siteId].urlValid ? 'error' : '') + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", { + innerHTML: _ctx.$sanitize(_ctx.sitesInfos[siteId].name) + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_6), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [!_ctx.sitesInfos[siteId].accountValid ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_a80179ac_hoisted_7)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.accounts[config.account].name), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [!_ctx.sitesInfos[siteId].urlValid ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_a80179ac_hoisted_8)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.hostUrl || config.host), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.sitesInfos[siteId].lastRun), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(config.createdByUser), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "POST", + action: "", + onSubmit: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.removeAccountConfig(siteId, $event), ["prevent"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeConfig", + value: siteId + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_10), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeSiteConfigNonce", + value: _ctx.removeYandexSiteConfigNonce + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_11), config.isDeletionAllowed ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("button", { + key: 0, + type: "submit", + class: "btn-flat icon-delete", + title: _ctx.translate('General_Delete') + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_12)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)], 40, Configurationvue_type_template_id_a80179ac_hoisted_9)])], 2); + }), 128)), _ctx.countOfAccountsWithAccess ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", Configurationvue_type_template_id_a80179ac_hoisted_13, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Configurationvue_type_template_id_a80179ac_hoisted_14, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", { + class: "btn", + onClick: _cache[0] || (_cache[0] = $event => _ctx.isAddingMeasurable = true) + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AddConfiguration')), 1)])], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isAddingMeasurable]]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.countOfAccountsWithAccess ? Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])((Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("tr", Configurationvue_type_template_id_a80179ac_hoisted_15, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "site", + "full-width": true, + modelValue: _ctx.currentSiteToAdd, + "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.currentSiteToAdd = $event), + title: _ctx.translate('CoreHome_ChooseX', _ctx.translate('General_Measurable')) + }, null, 8, ["modelValue", "title"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Configurationvue_type_template_id_a80179ac_hoisted_16, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_17, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + modelValue: _ctx.yandexAccountAndHostIdToAdd, + "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => _ctx.yandexAccountAndHostIdToAdd = $event), + title: _ctx.translate('SearchEngineKeywordsPerformance_UrlOfAccount'), + "full-width": true, + options: _ctx.urlOptions + }, null, 8, ["modelValue", "title", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("td", Configurationvue_type_template_id_a80179ac_hoisted_18, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", Configurationvue_type_template_id_a80179ac_hoisted_19, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "yandexSiteId", + value: (_ctx$currentSiteToAdd = _ctx.currentSiteToAdd) === null || _ctx$currentSiteToAdd === void 0 ? void 0 : _ctx$currentSiteToAdd.id + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_20), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "addSiteConfigNonce", + value: _ctx.addYandexSiteConfigNonce + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_21), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "yandexAccountAndHostId", + value: _ctx.yandexAccountAndHostIdToAdd + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_22), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "submit", + class: "btn", + value: _ctx.translate('General_Save') + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_23)])])], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isAddingMeasurable]]) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)])])), [[_directive_content_table]])]; + }), + _: 1 + }, 8, ["content-title"])], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.isClientConfigured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: 1, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`oauthconfiguration ${_ctx.isOAuthConfigured ? 'configured' : ''} yandex`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_ConnectYandexAccounts') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_24, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h2", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountRemovalConfirm', _ctx.removeAccountName)), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "yes", + type: "button", + value: _ctx.translate('General_Yes') + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_25), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + role: "no", + type: "button", + value: _ctx.translate('General_No') + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_26)], 512), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_27, [_ctx.isOAuthConfigured ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_28, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts', _ctx.countOfAccountsWithAccess)), 1)) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_29, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectFirstAccount')), 1)), _ctx.hasOAuthError ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_30, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Notification, { + context: "error" + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_OAuthError')) + " ", 1), typeof _ctx.hasOAuthError === 'string' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("span", Configurationvue_type_template_id_a80179ac_hoisted_31, [Configurationvue_type_template_id_a80179ac_hoisted_32, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.hasOAuthError), 1)])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]), + _: 1 + })])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_33, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(_ctx.accountsToDisplay, (account, accountId) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: accountId, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`account ${Object.keys(account.urls).length === 0 || typeof account.hasError === 'string' ? 'invalid' : ''}`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_34, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("img", { + src: account.picture + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_35)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(account.name), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_AccountAddedBy', account.username, account.created_formatted)) + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_36), typeof account.hasError === 'string' ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_a80179ac_hoisted_37, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", Configurationvue_type_template_id_a80179ac_hoisted_38, [Configurationvue_type_template_id_a80179ac_hoisted_39, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountConnectionValidationError')) + " " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(account.hasError), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ReAuthenticateIfPermanentError')), 1)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_a80179ac_hoisted_40, [Object.keys(account.urls).length === 0 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_41, [Configurationvue_type_template_id_a80179ac_hoisted_42, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountNoAccess')), 1)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_a80179ac_hoisted_43, [Object.values(account.urls).some(hostdata => hostdata.verified) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_a80179ac_hoisted_44, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AvailableSites')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", Configurationvue_type_template_id_a80179ac_hoisted_45, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(Object.entries(account.urls).filter(([, hostdata]) => hostdata.verified), ([url], index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: index + }, [Configurationvue_type_template_id_a80179ac_hoisted_46, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(url), 1)]); + }), 128))])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_47, [Configurationvue_type_template_id_a80179ac_hoisted_48, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_AccountNoAccess')), 1)])), Object.values(account.urls).some(hostdata => !hostdata.verified) ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_a80179ac_hoisted_49, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_UnverifiedSites')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("ul", Configurationvue_type_template_id_a80179ac_hoisted_50, [(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["renderList"])(Object.entries(account.urls).filter(([, hostdata]) => !hostdata.verified), ([url], index) => { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("li", { + key: index + }, [Configurationvue_type_template_id_a80179ac_hoisted_51, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(url), 1)]); + }), 128))])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]))])), account.authDaysAgo >= 180 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_52, [Configurationvue_type_template_id_a80179ac_hoisted_53, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_OAuthAccessTimedOut')), 1)])) : account.authDaysAgo >= 150 ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", Configurationvue_type_template_id_a80179ac_hoisted_54, [Configurationvue_type_template_id_a80179ac_hoisted_55, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_OAuthAccessWillTimeOutSoon', 180 - account.authDaysAgo)) + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_56)])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("p", { + key: 4, + innerHTML: _ctx.$sanitize(_ctx.translate('SearchEngineKeywordsPerformance_OAuthAccessWillTimeOut', 180, 180 - account.authDaysAgo)) + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_57)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_58, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "post", + action: _ctx.forwardToYandexAuthUrl + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "auth_nonce", + value: _ctx.auth_nonce + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_60), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", Configurationvue_type_template_id_a80179ac_hoisted_61, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_Reauthenticate')), 1)], 8, Configurationvue_type_template_id_a80179ac_hoisted_59), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "POST", + action: "", + onSubmit: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withModifiers"])($event => _ctx.removeAccount(account, $event), ["prevent"]) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "remove", + value: accountId + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_63), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "removeAccountNonce", + value: _ctx.removeYandexAccountNonce + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_64), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", Configurationvue_type_template_id_a80179ac_hoisted_65, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Remove')), 1)], 40, Configurationvue_type_template_id_a80179ac_hoisted_62)])], 2); + }), 128)), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_66, [Configurationvue_type_template_id_a80179ac_hoisted_67, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("h3", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectAccount')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectAccountDescription', 'Yandex')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConnectAccountYandex', '180')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", Configurationvue_type_template_id_a80179ac_hoisted_68, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", { + method: "post", + action: _ctx.forwardToYandexAuthUrl, + id: "clientauthform" + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "auth_nonce", + value: _ctx.auth_nonce + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_70), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", Configurationvue_type_template_id_a80179ac_hoisted_71, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_StartOAuth')), 1)], 8, Configurationvue_type_template_id_a80179ac_hoisted_69)])]), Configurationvue_type_template_id_a80179ac_hoisted_72])])]), + _: 1 + }, 8, ["content-title"])], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.isClientConfigured && _ctx.userIsSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: 2, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(`clientconfiguration ${_ctx.isClientConfigured ? 'configured' : ''}`) + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_OAuthClientConfig') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ClientId')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.clientId), 1)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ClientSecret')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.clientSecret), 1)])]), + _: 1 + }, 8, ["content-title"])], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.userIsSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", Configurationvue_type_template_id_a80179ac_hoisted_73, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_HowToGetOAuthClientConfig') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", { + innerHTML: _ctx.visitOAuthHowTo + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_74), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_OAuthExampleText')) + " ", 1), Configurationvue_type_template_id_a80179ac_hoisted_75, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_YandexFieldUrlToAppSite')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.baseDomain) + " ", 1), Configurationvue_type_template_id_a80179ac_hoisted_76, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_YandexFieldCallbackUri')) + ":", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.baseDomainUrl) + "?module=SearchEngineKeywordsPerformance&action=processYandexAuthCode ", 1)])]), + _: 1 + }, 8, ["content-title"])])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), _ctx.userIsSuperUser ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", { + key: 4, + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(!_ctx.isClientConfigured ? 'clientconfiguration' : '') + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ContentBlock, { + "content-title": _ctx.translate('SearchEngineKeywordsPerformance_SetUpOAuthClientConfig') + }, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(() => [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", Configurationvue_type_template_id_a80179ac_hoisted_77, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ProvideYandexClientConfig')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "clientid", + modelValue: _ctx.clientIdToUse, + "onUpdate:modelValue": _cache[3] || (_cache[3] = $event => _ctx.clientIdToUse = $event), + title: _ctx.translate('SearchEngineKeywordsPerformance_ClientId'), + autocomplete: "off" + }, null, 8, ["modelValue", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "text", + name: "clientsecret", + modelValue: _ctx.clientSecretToUse, + "onUpdate:modelValue": _cache[4] || (_cache[4] = $event => _ctx.clientSecretToUse = $event), + title: _ctx.translate('SearchEngineKeywordsPerformance_ClientSecret'), + autocomplete: "off" + }, null, 8, ["modelValue", "title"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "config_nonce", + value: _ctx.formNonce + }, null, 8, Configurationvue_type_template_id_a80179ac_hoisted_78), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", Configurationvue_type_template_id_a80179ac_hoisted_79, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Save')), 1)])]), + _: 1 + }, 8, ["content-title"])], 2)) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true)]); +} +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?vue&type=template&id=a80179ac + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?vue&type=script&lang=ts + + + + +/* harmony default export */ var Yandex_Configurationvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + isClientConfigured: Boolean, + isClientConfigurable: Boolean, + isOAuthConfigured: Boolean, + clientId: String, + clientSecret: String, + configuredMeasurables: { + type: Object, + required: true + }, + sitesInfos: { + type: Object, + required: true + }, + currentSite: { + type: Object, + required: true + }, + urlOptions: { + type: [Object, Array], + required: true + }, + hasOAuthError: [String, Boolean], + accounts: { + type: Object, + required: true + }, + auth_nonce: { + type: String, + required: true + }, + formNonce: { + type: String, + required: true + }, + addYandexSiteConfigNonce: { + type: String, + required: true + }, + removeYandexSiteConfigNonce: { + type: String, + required: true + }, + removeYandexAccountNonce: { + type: String, + required: true + }, + countOfAccountsWithAccess: Number, + userIsSuperUser: String, + baseDomain: String, + baseDomainUrl: String + }, + components: { + ContentBlock: external_CoreHome_["ContentBlock"], + Field: external_CorePluginsAdmin_["Field"], + Notification: external_CoreHome_["Notification"] + }, + directives: { + ContentTable: external_CoreHome_["ContentTable"] + }, + data() { + return { + removeAccountConfigName: '', + removeAccountName: '', + isAddingMeasurable: false, + currentSiteToAdd: this.currentSite, + yandexAccountAndHostIdToAdd: null, + clientIdToUse: '', + clientSecretToUse: '' + }; + }, + methods: { + removeAccountConfig(siteId, event) { + const siteInfos = this.sitesInfos; + this.removeAccountConfigName = siteInfos[siteId].name; + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig, { + yes() { + event.target.submit(); + } + }); + }, + removeAccount(account, event) { + this.removeAccountName = account.name; + external_CoreHome_["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount, { + yes() { + event.target.submit(); + } + }); + } + }, + computed: { + configuredMeasurablesToDisplay() { + const entries = Object.entries(this.configuredMeasurables); + return Object.fromEntries(entries.filter(([, config]) => { + const [account] = config.yandexAccountAndHostId.split('##'); + return !!this.accounts[account]; + }).map(([siteId, config]) => { + const [account, host] = config.yandexAccountAndHostId.split('##'); + const accountInfo = this.accounts[account]; + const { + apiKey + } = accountInfo; + const hostUrlPair = Object.entries(accountInfo.urls).find(([, data]) => data.host_id === host); + const hostUrl = hostUrlPair === null || hostUrlPair === void 0 ? void 0 : hostUrlPair[0]; + return [siteId, Object.assign(Object.assign({}, config), {}, { + account, + host, + hostUrl, + apiKeyDisplay: getDisplayApiKey(apiKey) + })]; + })); + }, + forwardToYandexAuthUrl() { + return `?${external_CoreHome_["MatomoUrl"].stringify(Object.assign(Object.assign({}, external_CoreHome_["MatomoUrl"].urlParsed.value), {}, { + action: 'forwardToYandexAuth' + }))}`; + }, + visitOAuthHowTo() { + const link = Object(external_CoreHome_["externalRawLink"])('https://matomo.org/faq/reports/import-yandex-search-keywords-into-matomo/'); + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_VisitOAuthHowTo', ``, '', 'Yandex'); + }, + accountsToDisplay() { + const asArray = Object.entries(this.accounts); + const filtered = asArray.filter(([, value]) => value.hasAccess); + return Object.fromEntries(filtered); + } + } +})); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue + + + +Yandex_Configurationvue_type_script_lang_ts.render = Configurationvue_type_template_id_a80179ac_render + +/* harmony default export */ var Yandex_Configuration = (Yandex_Configurationvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?vue&type=template&id=9e9de9fe + +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_1 = { + class: "form-group row" +}; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_2 = { + class: "col s12" +}; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_3 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_4 = ["innerHTML"]; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_5 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_6 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_7 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("br", null, null, -1); +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_8 = { + class: "form-group row" +}; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_9 = { + class: "col s12 m6" +}; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_10 = { + id: "configFileUploadForm", + action: "", + method: "POST", + enctype: "multipart/form-data" +}; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_11 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + id: "client", + name: "client" +}, null, -1); +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_12 = ["value"]; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_13 = ["disabled"]; +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_14 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-upload" +}, null, -1); +const ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_15 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + class: "icon-upload" +}, null, -1); +function ConfigureConnectionvue_type_template_id_9e9de9fe_render(_ctx, _cache, $props, $setup, $data, $options) { + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigureTheImporterLabel1')), 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_ConfigureTheImporterLabel2')), 1), ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_3, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", { + innerHTML: _ctx.$sanitize(_ctx.setupGoogleAnalyticsImportFaq) + }, null, 8, ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_4)]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", null, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_OAuthExampleText')), 1), ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_5, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_GoogleAuthorizedJavaScriptOrigin')) + ": ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.baseDomain), 1), ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_6, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("strong", null, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_GoogleAuthorizedRedirectUri')) + ": ", 1), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.baseUrl) + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.redirectUri), 1), ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_7])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_8, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_9, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("form", ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_10, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "file", + id: "clientfile", + name: "clientfile", + accept: ".json", + onChange: _cache[0] || (_cache[0] = (...args) => _ctx.processFileChange && _ctx.processFileChange(...args)), + style: { + "display": "none" + } + }, null, 32), ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_11, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("input", { + type: "hidden", + name: "config_nonce", + value: _ctx.manualConfigNonce + }, null, 8, ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_12), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("button", { + type: "button", + class: "btn", + onClick: _cache[1] || (_cache[1] = $event => _ctx.selectConfigFile()), + disabled: _ctx.isUploadButtonDisabled + }, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, [ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_14, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('General_Upload')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isUploadButtonDisabled]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("span", null, [ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_15, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(" " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('SearchEngineKeywordsPerformance_Uploading')), 1)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.isUploadButtonDisabled]])], 8, ConfigureConnectionvue_type_template_id_9e9de9fe_hoisted_13)])])])], 64); +} +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?vue&type=template&id=9e9de9fe + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--15-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--1-1!./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?vue&type=script&lang=ts + + +/* harmony default export */ var ConfigureConnectionvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + data() { + return { + redirectUri: '?module=SearchEngineKeywordsPerformance&action=processAuthCode', + isSelectingFile: false, + isUploading: false + }; + }, + props: { + manualConfigNonce: { + type: String, + required: true + }, + baseDomain: { + type: String, + required: true + }, + baseUrl: { + type: String, + required: true + } + }, + methods: { + selectConfigFile() { + this.isSelectingFile = true; + const fileInput = document.getElementById('clientfile'); + if (fileInput) { + fileInput.click(); + } + }, + processFileChange() { + const fileInput = document.getElementById('clientfile'); + const configFileUploadForm = document.getElementById('configFileUploadForm'); + if (fileInput && fileInput.value && configFileUploadForm) { + this.isUploading = true; + configFileUploadForm.submit(); + } + }, + checkForCancel() { + // If we're not in currently selecting a file or if we're uploading, there's no point checking + if (!this.isSelectingFile || this.isUploading) { + return; + } + // Check if the file is empty and change back from selecting status + const fileInput = document.getElementById('clientfile'); + if (fileInput && !fileInput.value) { + this.isSelectingFile = false; + } + } + }, + computed: { + setupGoogleAnalyticsImportFaq() { + const url = Object(external_CoreHome_["externalRawLink"])('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-search-console-and-verify-your-website'); + return Object(external_CoreHome_["translate"])('SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3', ``, ''); + }, + isUploadButtonDisabled() { + return this.isSelectingFile || this.isUploading; + } + }, + mounted() { + document.body.onfocus = this.checkForCancel; + } +})); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue + + + +ConfigureConnectionvue_type_script_lang_ts.render = ConfigureConnectionvue_type_template_id_9e9de9fe_render + +/* harmony default export */ var ConfigureConnection = (ConfigureConnectionvue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/SearchEngineKeywordsPerformance/vue/src/index.ts +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + + + + + +// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js + + + + +/***/ }) + +/******/ }); +}); +//# sourceMappingURL=SearchEngineKeywordsPerformance.umd.js.map \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.js.map b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.js.map new file mode 100644 index 0000000..4f62202 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://SearchEngineKeywordsPerformance/webpack/universalModuleDefinition","webpack://SearchEngineKeywordsPerformance/webpack/bootstrap","webpack://SearchEngineKeywordsPerformance/external \"CoreHome\"","webpack://SearchEngineKeywordsPerformance/external {\"commonjs\":\"vue\",\"commonjs2\":\"vue\",\"root\":\"Vue\"}","webpack://SearchEngineKeywordsPerformance/external \"CorePluginsAdmin\"","webpack://SearchEngineKeywordsPerformance/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?0cda","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?de4d","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?5e9b","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?c499","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?4699","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?24f7","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/utilities.ts","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?89ee","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?cde0","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?7cb0","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?9d47","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?2f52","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?02a3","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?a7b5","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?beba","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?a3d0","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?4d5f","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?411d","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?520e","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/index.ts","webpack://SearchEngineKeywordsPerformance/./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,mD;;;;;;;ACAA,mD;;;;;;;ACAA,kD;;;;;;;;;;;;;;;;;;;ACAA;;AAEA;AACA;AACA,MAAM,KAAuC,EAAE,yBAQ5C;;AAEH;AACA;AACA,IAAI,qBAAuB;AAC3B;AACA;;AAEA;AACe,sDAAI;;;;;;;;ECEV,KAAK,EAAC;AAAkB;gCAQ3B,4EAAyB;EAApB,KAAK,EAAC;AAAO;;;;+EAftB,qEAiBe;IAhBZ,eAAa,EAAE,cAAS;;8EAEzB,MAAkF,CAAlF,4EAAkF,oFAA5E,cAAS,mEAEf,4EAAiF,oFAA3E,cAAS,kEAEf,4EASM,OATN,UASM,I,0EARJ,4EAKW,qIAJU,cAAS,EAArB,QAAQ;mFADjB,qEAKW;QAHR,GAAG,EAAE,QAAQ,CAAC,EAAE;QAChB,QAAQ,EAAE;;eAIb,UAAyB,C;;;;;;;;;;;;;;;;;ECIxB,KAAK,EAAC;;;;;EAGC,KAAK,EAAC;;;;EAGN,KAAK,EAAC;;;+EAzBlB,4EA6BM;IA5BH,KAAK;;eAAgD,eAAU;mBAAqB,eAAU,IAAI,aAAQ,CAAC;;iFAM5G,4EAOM,qIANoB,aAAQ,CAAC,KAAK,GAA9B,IAAI,EAAE,KAAK;iFADrB,4EAOM;MALH,GAAG,EAAE,KAAK;MACV,KAAK,kFAAU,aAAQ,CAAC,KAAK,CAAC,MAAM;MACpC,KAAK,EAAE;QAER,4EAAsC;MAAhC,GAAG,EAAE,IAAI;MAAG,GAAG,EAAE,aAAQ,CAAC;;aAElC,4EAA4B,qFAArB,aAAQ,CAAC,IAAI,OACpB,4EAAgD;IAA7C,SAAwC,EAAhC,cAAS,CAAC,aAAQ,CAAC,WAAW;2BACzC,4EAAkD,YAA/C,4EAA2C;IAAvC,SAAiC,EAAzB,cAAS,CAAC,aAAQ,CAAC,IAAI;6BAER,aAAQ,CAAC,eAAe,I,sEAAtD,4EAAwE,KAAxE,UAAwE,EAAhB,cAAY,K,uFAEpE,4EAOI;IAPA,IAAI,EAAE,iBAAY;IAAE,KAAK,EAAC;MACF,aAAQ,CAAC,aAAa,I,sEAAhD,4EAES,UAFT,UAES,2EADJ,cAAS,iE,sEAEd,4EAES,UAFT,UAES,2EADJ,cAAS,6D;;;;;ACzCkB;AACU;AAcjC,4IAAe,CAAC;EAC7B,KAAK,EAAE;IACL,QAAQ,EAAE;MACR,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;IACX;GACF;EACD,QAAQ,EAAE;IACR,UAAU;MACR,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoB;MAC1C,OAAO,QAAQ,CAAC,aAAa,KACvB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,MAAM,KAAK,CAAC,IACrD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,IAC3C,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;IACxD,CAAC;IACD,WAAW;MACT,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAoB;MAC1C,MAAM,uBAAuB,GAAG,QAAQ,CAAC,aAAa,IACjD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,MAAM,KAAK,CAAC;MAE3D,IAAI,uBAAuB,EAAE;QAC3B,OAAO,uCAAS,CAAC,oEAAoE,CAAC;MACvF;MAED,IAAI,QAAQ,CAAC,aAAa,EAAE;QAC1B,OAAO,uCAAS,CAAC,uDAAuD,CAAC;MAC1E;MAED,OAAO,uCAAS,CAAC,0DAA0D,CAAC;IAC9E,CAAC;IACD,YAAY;MACV,OAAO,IAAI,+BAAS,CAAC,SAAS,iCACzB,+BAAS,CAAC,SAAS,CAAC,KAAK;QAC5B,MAAM,EAAE,YAAY,IAAI,CAAC,QAAQ,CAAC,EAAE;MAAE,EACvC,CAAC,EAAE;IACN;EACD;CACF,CAAC,E;;ACrD+f,C;;ACA5b;AACV;AACL;AACtD,+BAAM,UAAU,4CAAM;;AAEP,4E;;ACJuB;AACE;AACF;AAEvB,6IAAe,CAAC;EAC7B,KAAK,EAAE;IACL,SAAS,EAAE;MACT,IAAI,EAAE,KAAK;MACX,QAAQ,EAAE;IACX;GACF;EACD,UAAU,EAAE;IACV,gDAAY;IACZ,kBAAQ;EACT;CACF,CAAC,E;;AChBggB,C;;ACA5b;AACV;AACL;AACvD,gCAAM,UAAU,MAAM;;AAEP,8E;;;;EC8BF,KAAK,EAAC,YAAY;EAAC,EAAE,EAAC,4BAA4B;EAAC,GAAG,EAAC;;;;;EAUnC,KAAK,EAAC;AAAgB;0EAQzC,4EAAS;;;;;EAKL,OAAO,EAAC;AAAG;;;EAiBP,KAAK,EAAC;;;;EAIN,KAAK,EAAC;;;;;;;;;;EAuBV,OAAO,EAAC,GAAG;EAAC,KAAK,EAAC;;;;EASpB,KAAK,EAAC;;;EASJ,OAAO,EAAC;AAAG;;EACR,KAAK,EAAC;AAAwB;;EASjC,OAAO,EAAC;AAAG;;EACP,MAAM,EAAC,EAAE;EAAC,MAAM,EAAC;;;;;;;EAoB1B,KAAK,EAAC,YAAY;EAAC,EAAE,EAAC,sBAAsB;EAAC,GAAG,EAAC;;;;;EAWjD,KAAK,EAAC;AAAU;;;;EAoBd,KAAK,EAAC;;iCACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;;EAIvB,KAAK,EAAC;;iCACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;;;;EAOpB,KAAK,EAAC;AAAe;iCAOrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;EAK3B,KAAK,EAAC;AAAc;iCACrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;EAQxB,KAAK,EAAC;AAAe;iCAOrB,4EAAgC;EAA1B,KAAK,EAAC;AAAY;;EAO7B,KAAK,EAAC;AAAK;;;;;EAQJ,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;;EAM1B,MAAM,EAAC,MAAM;EAAC,MAAM,EAAC;;iCACzB,4EAAiC;EAA5B,KAAK,EAAC;AAAe;;;;EAMvB,KAAK,EAAC;;iCACP,4EAAM;iCACN,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;EAevB,KAAK,EAAC;AAAK;;EACN,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;iCAOlC,4EAAyB;EAApB,KAAK,EAAC;AAAO;;;;;+EApQ1B,4EAwQM,cAvQJ,qEAMe;IALZ,eAAa,EAAE,cAAS;;8EAEzB,MAAkF,CAAlF,4EAAkF,qFAA3E,cAAS,iE,yEAAkE,GAElF,4EAAG,cAAS,sE;;4BAIN,MAAM,CAAC,IAAI,CAAC,aAAQ,EAAE,MAAM,Q,sEADpC,4EAsHM;;IApHH,KAAK,kGAA0B,MAAM,CAAC,IAAI,CAAC,0BAAqB,EAAE,MAAM,G;MAGzE,qEAgHe;IA/GZ,eAAa,EAAE,cAAS;;8EAEzB,MAAkF,CAAlF,4EAAkF,oFAA5E,cAAS,mEAEf,4EAOM,OAPN,oDAOM,GANJ,4EAGS,qFAHF,cAAS,C,wDAAkF,4B,QAIlG,4EAAmE;MAA5D,IAAI,EAAC,KAAK;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;uEACjD,4EAAiE;MAA1D,IAAI,EAAC,IAAI;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;8EAGlD,4EAiGM,c,+IAhGJ,4EA+FQ,SA/FR,oDA+FQ,GA9FN,4EASQ,gBARR,4EAOK,aANH,4EAA8C,qFAAvC,cAAS,6BAChB,4EAA0C,qFAAnC,cAAS,yBAChB,4EAAqC,qFAA9B,cAAS,oBAChB,4EAAsE,qFAA/D,cAAS,qDAChB,4EAAqE,qFAA9D,cAAS,oDAChB,oDAAS,C,KAGX,4EAmFQ,gB,CAlFG,MAAM,CAAC,IAAI,CAAC,0BAAqB,EAAE,MAAM,I,sEAApD,4EAMK,6DALH,4EAIK,MAJL,oDAIK,GAHH,4EAES,yFADJ,cAAS,6D,yKAIlB,4EAoCK,qIAnC+B,mCAA8B,GAAxD,MAAM,EAAE,MAAM,EAAE,KAAK;mFAD/B,4EAoCK;QAlCF,GAAG,EAAE,KAAK;QACV,KAAK,2EAAG,eAAU,CAAC,MAAM,EAAE,YAAY,KAAK,eAAU,CAAC,MAAM,EAAE,QAAQ,G;UAGxE,4EAEK,a,kJADA,eAAU,CAAC,MAAM,EAAE,IAAI,IAAG,GAAC,kFAAgD,cAA1C,GAAC,4EAAG,eAAU,CAAC,MAAM,EAAE,QAAQ,IAAG,GAAC,K,GAGzE,4EAGK,a,CAF6B,eAAU,CAAC,MAAM,EAAE,YAAY,I,sEAA/D,4EAAwE,QAAxE,oDAAwE,K,gKAAA,GACxE,4EAAG,MAAM,CAAC,aAAa,M,GAEzB,4EAEK,a,CAD6B,eAAU,CAAC,MAAM,EAAE,QAAQ,I,sEAA3D,4EAAoE,QAApE,UAAoE,K,yOAAG,MAAM,CAAC,GAAG,M,GAEnF,4EAAyC,qFAAlC,eAAU,CAAC,MAAM,EAAE,OAAO,OACjC,4EAAmC,qFAA5B,MAAM,CAAC,aAAa,OAC3B,4EAgBK,aAfH,4EAcO;QAbL,MAAM,EAAC,MAAM;QACb,MAAM,EAAC,EAAE;QACR,QAAM,mFAAU,wBAAmB,CAAC,MAAM,EAAE,MAAM;UAEnD,4EAAyD;QAAlD,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,cAAc;QAAE,KAAK,EAAE;gCACjD,4EAC0C;QADnC,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,uBAAuB;QACzC,KAAK,EAAE;gCAKP,MAAM,CAAC,iBAAiB,I,sEAJhC,4EAKU;;QAJR,IAAI,EAAC,QAAQ;QACb,KAAK,EAAC,sBAAsB;QAC3B,KAAK,EAAE,cAAS;;eAMc,8BAAyB,G,+IAAhE,4EASK,oBARH,4EAOK,MAPL,WAOK,GANH,4EAKS;MAJP,KAAK,EAAC,KAAK;MACV,OAAK,6GAAU,uBAAkB;gFAE/B,cAAS,0D,sEANL,uBAAkB,E,2FAWO,8BAAyB,G,+IAD/D,4EA2BK,MA3BL,WA2BK,GAzBH,4EAMK,aALH,qEAIE;MAHA,SAAS,EAAC,MAAM;kBACP,qBAAgB;iEAAhB,qBAAgB;MACxB,KAAK,EAAE,cAAS,qBAAqB,cAAS;4CAGnD,4EASK,MATL,WASK,GARH,4EAOM,OAPN,WAOM,GANJ,qEAKE;MAJA,SAAS,EAAC,QAAQ;kBACT,2BAAsB;iEAAtB,2BAAsB;MAC9B,KAAK,EAAE,cAAS;MAChB,OAAO,EAAE;yDAIhB,4EAOK,MAPL,WAOK,GANH,4EAKO,QALP,WAKO,GAJL,4EAAoE;MAA7D,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,YAAY;MAAE,KAAK,EAAE,qBAAgB,CAAC;8BAChE,4EAA+E;MAAxE,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,oBAAoB;MAAE,KAAK,EAAE;8BACvD,4EAA8E;MAAvE,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,mBAAmB;MAAE,KAAK,EAAE;8BACtD,4EAAsE;MAA/D,IAAI,EAAC,QAAQ;MAAC,KAAK,EAAC,KAAK;MAAE,KAAK,EAAE,cAAS;oGAvB5C,uBAAkB,E;;0HAiCtC,4EAsIM;IArIH,KAAK,kGAA0B,MAAM,CAAC,IAAI,CAAC,aAAQ,EAAE,MAAM;MAE5D,qEAkIe;IAjIZ,eAAa,EAAE,cAAS;;8EAEzB,MASM,CATN,4EASM,OATN,WASM,GARJ,4EAKK,qFAJA,cAAS,C,yDAAuF,sB,QAKrG,4EAAmE;MAA5D,IAAI,EAAC,KAAK;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;8BACjD,4EAAiE;MAA1D,IAAI,EAAC,IAAI;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;qCAGlD,4EAmHM,OAnHN,WAmHM,I,0EAlHJ,4EA8EM,qIA7Ec,sBAAiB,EAA5B,OAAO;mFADhB,4EA8EM;QA5EH,GAAG,EAAE,OAAO,CAAC,QAAQ;QACrB,KAAK,qFAAa,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,U,OAA+B,OAAO,CAAC,QAAQ;UAGlG,4EAGO;QAFJ,KAAK,kFAAU,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,U,OAAiC,OAAO,CAAC,QAAQ;mBAInG,4EAA+C,qFAAxC,qBAAgB,CAAC,OAAO,CAAC,MAAM,QAEtC,4EAIQ;QAJL,SAIA,EAJQ,cAAS,CAAC,cAAS,C,kDAAgF,OAAO,CAAC,QAAQ,EAAgB,OAAO,CAAC,iB;uCAMjH,OAAO,CAAC,QAAQ,iB,sEAArD,4EAGI,KAHJ,WAGI,GAFF,WAAkC,E,yEAAA,GAClC,4EAAG,cAAS,qDAAqD,OAAO,CAAC,QAAQ,O,4EAEnF,4EA0CM,qBAzC0B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,U,sEAA9D,4EAGI,KAHJ,WAGI,GAFF,WAAkC,E,yEAAA,GAClC,4EAAG,cAAS,yD,4EAEd,4EAoCM,qBAnCO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAE,UAAU,IAAK,UAAU,K,sEAAtE,4EAaM,qBAZJ,4EAAwE,oFAAlE,cAAS,yDAEf,4EASK,MATL,WASK,I,0EARH,4EAOK,qIANsB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,C,IAA8B,UAAU,MAAM,U,KAAjG,GAAG,GAAG,KAAK;qFADtB,4EAOK;UAHF,GAAG,EAAE;QAAK,IAEX,WAAkC,E,yEAAA,GAAC,4EAAG,GAAG,M;8FAI/C,4EAKM,qBAJJ,4EAGI,KAHJ,WAGI,GAFF,WAAkC,E,yEAAA,GAClC,4EAAG,cAAS,yD,MAIL,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAE,UAAU,KAAM,UAAU,K,sEAAvE,4EAaM,qBAZJ,4EAAyE,oFAAnE,cAAS,0DAEf,4EASK,MATL,WASK,I,0EARH,4EAOK,qIANsB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,C,IAA8B,UAAU,OAAO,U,KAAlG,GAAG,GAAG,KAAK;qFADtB,4EAOK;UAHF,GAAG,EAAE;QAAK,IAEX,WAAgC,E,yEAAA,GAAC,4EAAG,GAAG,M;oHAOjD,4EAUM,OAVN,WAUM,GATJ,4EAQO;QAPL,MAAM,EAAC,MAAM;QACb,MAAM,EAAC,EAAE;QACR,QAAM,mFAAU,kBAAa,CAAC,OAAO,EAAE,MAAM;UAE9C,4EAA2D;QAApD,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,QAAQ;QAAE,KAAK,EAAE,OAAO,CAAC;gCACnD,4EAA+E;QAAxE,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,oBAAoB;QAAE,KAAK,EAAE;gCACvD,4EAA4E,UAA5E,WAA4E,2EAAvC,cAAS,wB;eAKpD,4EA+BM;MA/BA,KAAK,yFAAiB,mBAAc;QACxC,4EA6BO,QA7BP,WA6BO,GA5BL,WAAiC,EAEjC,4EAAqE,qFAA9D,cAAS,oDAEhB,4EAA2D;MAArD,SAA6C,EAArC,cAAS,CAAC,8BAAyB;8BAEnB,mBAAc,I,sEAA5C,4EAII,KAJJ,WAII,GAHF,WAAM,EACN,WAAkC,E,yEAAA,GAClC,4EAAG,cAAS,qDAAqD,UAAK,O,4FAGxE,qEAOE;MANA,SAAS,EAAC,MAAM;MACf,YAAU,EAAE,IAAI;MACjB,IAAI,EAAC,QAAQ;kBACJ,gBAAW;iEAAX,gBAAW;MACnB,KAAK,EAAE,cAAS;MACjB,YAAY,EAAC;0CAGf,4EAA8D;MAAvD,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,cAAc;MAAE,KAAK,EAAE;8BAEjD,4EAIM,OAJN,WAIM,GAHJ,4EAES,UAFT,WAES,2EADJ,cAAS,mD,UAMpB,WAAyB,C;;;;;;;;;;ACpRnC;;;;;;;;;;;;;AAaG;AAEG,SAAU,gBAAgB,CAAC,MAAM,GAAG,EAAE;EAC1C,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE;AAC5E,C;;AChBsC;AASpB;AACuB;AACO;AAoBjC,iJAAe,CAAC;EAC7B,KAAK,EAAE;IACL,qBAAqB,EAAE;MACrB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,QAAQ,EAAE;MACR,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,WAAW,EAAE;MACX,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;MACrB,QAAQ,EAAE;KACX;IACD,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;IACjB,sBAAsB,EAAE,MAAM;IAC9B,yBAAyB,EAAE,MAAM;IACjC,sBAAsB,EAAE,MAAM;IAC9B,yBAAyB,EAAE,MAAM;IACjC,eAAe,EAAE;GAClB;EACD,IAAI;IACF,OAAO;MACL,uBAAuB,EAAE,EAAE;MAC3B,iBAAiB,EAAE,EAAE;MACrB,kBAAkB,EAAE,KAAK;MACzB,gBAAgB,EAAE,IAAI,CAAC,WAAsB;MAC7C,sBAAsB,EAAE,IAAI;MAC5B,WAAW,EAAE,IAAI,CAAC,MAAM,IAAI;KAC7B;EACH,CAAC;EACD,UAAU,EAAE;IACV,gDAAY;IACZ,0CAAK;GACN;EACD,UAAU,EAAE;IACV,gDAAY;GACb;EACD,OAAO,EAAE;IACP,mBAAmB,CAAC,MAAqB,EAAE,KAAY;MACrD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAyC;MAChE,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI;MAErD,4BAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,0BAAyC,EAAE;QAC/E,GAAG;UACA,KAAK,CAAC,MAA0B,CAAC,MAAM,EAAE;QAC5C;OACD,CAAC;IACJ,CAAC;IACD,kCAAgB;IAChB,aAAa,CAAC,OAAoB,EAAE,KAAY;MAC9C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC;MAC9D,4BAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAmC,EAAE;QACzE,GAAG;UACA,KAAK,CAAC,MAA0B,CAAC,MAAM,EAAE;QAC5C;OACD,CAAC;IACJ;GACD;EACD,QAAQ,EAAE;IACR,cAAc;MACZ,OAAO,OAAO,IAAI,CAAC,KAAK,KAAK,WAAW,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI;IACjE,CAAC;IACD,8BAA8B;MAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAC5B,IAAI,CAAC,qBAAoE,CAC1E;MAED,OAAO,MAAM,CAAC,WAAW,CACvB,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAI;QAC5B,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;QAChD,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;MACjC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,KAAI;QAC1B,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;QACrD,MAAM;UAAE;QAAM,CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAEzC,OAAO,CACL,MAAM,kCAED,MAAM;UACT,OAAO;UACP,GAAG;UACH,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM;QAAC,GAE/C;MACH,CAAC,CAAC,CACH;IACH,CAAC;IACD,yBAAyB;MACvB,MAAM,GAAG,GAAG,6CAAe,CAAC,mFAAmF,CAAC;MAChH,OAAO,uCAAS,CACd,uDAAuD,EACvD,oFAAoF,EACpF,MAAM,EACN,YAAY,GAAG,8CAA8C,EAC7D,MAAM,CACP;IACH,CAAC;IACD,iBAAiB;MACf,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;MAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;MAE/D,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IACrC;EACD;CACF,CAAC,E;;ACnJogB,C;;ACA5b;AACV;AACL;AAC3D,oCAAM,UAAU,iDAAM;;AAEP,sF;;;;;;;ECkBF,KAAK,EAAC;AAAqB;;;;;EAWzB,KAAK,EAAC,YAAY;EAAC,EAAE,EAAC,4BAA4B;EAAC,GAAG,EAAC;;;;;EASrC,KAAK,EAAC;AAAgB;0EASzC,4EAAS;;;;;EAKL,OAAO,EAAC;AAAG;;;;EA4BP,KAAK,EAAC;;;;EAIN,KAAK,EAAC;;2EACkC,4EAAM;;2EAMlD,4EAA+B;EAAzB,KAAK,EAAC;AAAW;;2EAQvB,4EAA+B;EAAzB,KAAK,EAAC;AAAW;;;;;;;EAwBzB,KAAK,EAAC;;;EAqBD,KAAK,EAAC;AAAgB;;EAUzB,OAAO,EAAC;AAAG;;EACP,MAAM,EAAC,EAAE;EAAC,MAAM,EAAC;;;;;;;;;;;;EA4B/B,KAAK,EAAC;;;EAEF,KAAK,EAAC;AAAiB;;EAGtB,KAAK,EAAC,YAAY;EAAC,EAAE,EAAC,sBAAsB;EAAC,GAAG,EAAC;;;;;EASjD,KAAK,EAAC;AAAoB;;;;;;;;;;;;;2EAcvB,4EAAM;;EAMP,KAAK,EAAC;AAAU;;EAMZ,KAAK,EAAC;AAAM;;;;;;;EAaZ,KAAK,EAAC;AAAc;2EACrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;;;;EAavB,KAAK,EAAC;AAAc;2EACrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;;;;EAQtB,KAAK,EAAC;AAAe;2EAOrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;EAI7B,KAAK,EAAC;;iCACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;EAMtB,KAAK,EAAC;AAAe;iCAOrB,4EAAgC;EAA1B,KAAK,EAAC;AAAY;;EAO7B,KAAK,EAAC;AAAK;;;;;EAQJ,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;;EAK7B,KAAK,EAAC;AAAa;iCAEtB,4EAAiC;EAA5B,KAAK,EAAC;AAAe;;;;;EA4BrB,KAAK,EAAC;AAAK;;;;EAOJ,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;iCAOlC,4EAAyB;EAApB,KAAK,EAAC;AAAO;;;EAOtB,KAAK,EAAC;;;EAGF,KAAK,EAAC;AAAiB;iCAU3B,4EAAM;;;;EAOI,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;;;;;;;;;+EA5WpC,4EAqYM,cApYJ,qEAmYe;IAlYZ,eAAa,EAAE,cAAS;;8EAEzB,MAMM,C,CALG,uBAAkB,IAAI,yBAAoB,KAAK,oBAAe,I,sEADvE,4EAMM,8DAHJ,4EAEM,OAFN,oDAEM,2EADD,cAAS,gF,4FAKR,uBAAkB,IAAI,sBAAiB,I,sEAD/C,4EA4JM,8DAzJF,4EAAgF,qFAAzE,cAAS,+DAChB,4EAAkF,oFAA5E,cAAS,mEAEf,4EAOM,OAPN,oDAOM,GANJ,4EAGS,qFAHF,cAAS,C,wDAAsF,4B,QAItG,4EAAmE;MAA5D,IAAI,EAAC,KAAK;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;uEACjD,4EAAiE;MAA1D,IAAI,EAAC,IAAI;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;6NAGlD,4EAmIM,SAnIN,oDAmIM,GAlIJ,4EAUQ,gBATR,4EAQK,aAPH,4EAA8C,qFAAvC,cAAS,6BAChB,4EAA8E,qFAAvE,cAAS,6DAChB,4EAA0C,qFAAnC,cAAS,yBAChB,4EAAqC,qFAA9B,cAAS,oBAChB,4EAAsE,qFAA/D,cAAS,qDAChB,4EAAqE,qFAA9D,cAAS,oDAChB,oDAAS,C,KAGX,4EAsHM,gBArHI,MAAM,CAAC,IAAI,CAAC,mCAA8B,EAAE,MAAM,U,sEAA5D,4EAMK,6DALH,4EAIK,MAJL,qDAIK,GAHH,4EAES,yFADJ,cAAS,6D,yKAIlB,4EAgEK,qIA/D+B,mCAA8B,GAAxD,MAAM,EAAE,MAAM,EAAE,KAAK;mFAD/B,4EAgEK;QA9DF,GAAG,EAAE,KAAK;QACV,KAAK,2EAAG,eAAU,CAAC,MAAM,EAAE,YAAY,KAAK,eAAU,CAAC,MAAM,EAAE,QAAQ,G;UAGxE,4EAAqD;QAAjD,SAA2C,EAAnC,cAAS,CAAC,eAAU,CAAC,MAAM,EAAE,IAAI;0EAC7C,4EAaK,qFAZA,MAAM,CAAC,iBAAiB,GAAqB,cAAS,qD,MAEhD,GACT,4EAAG,MAAM,CAAC,mBAAmB,GAAqB,cAAS,uD,MAElD,GACT,4EAAG,MAAM,CAAC,mBAAmB,GAAqB,cAAS,uD,MAElD,GACT,4EAAG,MAAM,CAAC,kBAAkB,GAAqB,cAAS,sD,SAI5D,4EAGK,a,CAF6B,eAAU,CAAC,MAAM,EAAE,YAAY,I,sEAA/D,4EAAwE,QAAxE,qDAAwE,K,gKAAA,GACxE,4EAAG,aAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,M,GAElC,4EAmBK,a,CAlB6B,eAAU,CAAC,MAAM,EAAE,QAAQ,I,sEAA3D,4EAAoE,QAApE,qDAAoE,K,gKAAA,GACpE,4EAAG,MAAM,CAAC,GAAG,CAAC,UAAU,sBAAqB,GAAC,2DAAM,E,cAE9B,IAAI,CAAC,MAAM,CAAC,GAAG,K,sEADrC,4EAOO;;QALL,KAAK,EAAC,eAAe;QACpB,KAAK,EAAE,cAAS;UAEjB,qDAA+B,E,yEAAA,IAC9B,4EAAG,cAAS,sDAAqD,IACpE,K,uEAEqB,IAAI,CAAC,MAAM,CAAC,GAAG,K,sEADpC,4EAOO;;QALL,KAAK,EAAC,eAAe;QACpB,KAAK,EAAE,cAAS;UAEjB,qDAA+B,E,yEAAA,IAC9B,4EAAG,cAAS,yDAAwD,IACvE,K,wJAEF,4EAAyC,qFAAlC,eAAU,CAAC,MAAM,EAAE,OAAO,OACjC,4EAAmC,qFAA5B,MAAM,CAAC,aAAa,OAC3B,4EAgBK,aAfH,4EAcO;QAbL,MAAM,EAAC,MAAM;QACb,MAAM,EAAC,EAAE;QACR,QAAM,mFAAU,wBAAmB,CAAC,MAAM,EAAE,MAAM;UAEnD,4EAAyD;QAAlD,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,cAAc;QAAE,KAAK,EAAE;0EACjD,4EAC4C;QADrC,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,uBAAuB;QACzC,KAAK,EAAE;0EAKP,MAAM,CAAC,iBAAiB,I,sEAJhC,4EAKU;;QAJR,IAAI,EAAC,QAAQ;QACb,KAAK,EAAC,sBAAsB;QAC3B,KAAK,EAAE,cAAS;;eAOa,8BAAyB,G,+IAD/D,4EA4CK,MA5CL,qDA4CK,GA1CH,4EAOK,aANH,qEAKE;MAJA,SAAS,EAAC,MAAM;MACf,YAAU,EAAE,IAAI;kBACR,qBAAgB;iEAAhB,qBAAgB;MACxB,KAAK,EAAE,cAAS,qBAAqB,cAAS;4CAGnD,4EASK,aARH,qEAOE;MANA,SAAS,EAAC,UAAU;kBACX,qBAAgB;iEAAhB,qBAAgB;MACzB,UAAQ,EAAC,OAAO;MAChB,KAAK,EAAC,wBAAwB;MAC7B,YAAU,EAAE,IAAI;MAChB,OAAO,EAAE;8CAGd,4EAUK,aATH,4EAQM,OARN,qDAQM,GAPJ,qEAME;MALA,SAAS,EAAC,QAAQ;kBACT,6BAAwB;iEAAxB,6BAAwB;MAChC,KAAK,EAAE,cAAS;MAChB,YAAU,EAAE,IAAI;MAChB,OAAO,EAAE;yDAIhB,4EAYK,MAZL,qDAYK,GAXH,4EAUO,QAVP,qDAUO,GATL,4EAAuE;MAAhE,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,cAAc;MAAE,KAAK,EAAE,qBAAgB,CAAC;wEAClE,4EAAkF;MAA3E,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,oBAAoB;MAAE,KAAK,EAAE;wEACvD,4EAAkF;MAA3E,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,qBAAqB;MAAE,KAAK,EAAE;wEACxD,4EAIE;MAHA,IAAI,EAAC,QAAQ;MACb,IAAI,EAAC,aAAa;MACjB,KAAK,EAAE,qBAAgB,CAAC,MAAM,GAAG,qBAAgB;wEAEpD,4EAAsE;MAA/D,IAAI,EAAC,QAAQ;MAAC,KAAK,EAAC,KAAK;MAAE,KAAK,EAAE,cAAS;8IAxC5C,uBAAkB,E,+HA8CM,8BAAyB,G,+IAAjE,4EAQM,+DAPJ,4EAMS;MALP,EAAE,EAAC,eAAe;MAClB,KAAK,EAAC,KAAK;MACV,OAAK,sCAAE,uBAAkB;gFAEvB,cAAS,0D,oEANF,uBAAkB,E,sLAY1B,uBAAkB,I,sEAD1B,4EA2KM,OA3KN,qDA2KM,GAvKJ,4EACkE,MADlE,qDACkE,2EADnC,cAAS,C,+DAGxC,4EAOM,OAPN,qDAOM,GANJ,4EAGS,qFAHF,cAAS,C,yDAAmF,sB,QAInG,4EAAmE;MAA5D,IAAI,EAAC,KAAK;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;wEACjD,4EAAiE;MAA1D,IAAI,EAAC,IAAI;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;+EAGlD,4EA0JM,OA1JN,qDA0JM,GAxJK,sBAAiB,I,sEAA1B,4EAKI,qIAJC,cAAS,C,8DAA4F,8B,iFAK1G,4EAAoF,qIAAvE,cAAS,+DAEb,kBAAa,I,sEAAtB,4EAQI,6DAPF,qEAMe;MAND,OAAO,EAAC,OAAO;MAAC,IAAI,EAAC;;gFACjC,MAA6D,C,kJAA1D,cAAS,kDAAiD,GAC7D,MAAY,kBAAa,CAAC,MAAM,Q,sEAAhC,4EAGO,gEAFL,qDAAM,E,yEAAA,GACN,4EAAG,kBAAa,M;;mGAKtB,4EAoIM,OApIN,qDAoIM,I,0EAnIJ,4EAoFM,qIAnF2B,sBAAiB,GAAxC,OAAO,EAAE,SAAS;mFAD5B,4EAoFM;QAlFH,GAAG,EAAE,SAAS;QACf,KAAK,EAAC;UAEN,4EAEM,OAFN,qDAEM,GADJ,4EAA4B;QAAtB,GAAG,EAAE,OAAO,CAAC;4EAGrB,4EAA2B,qFAApB,OAAO,CAAC,IAAI,OAEnB,4EAIK;QAJF,SAIA,EAJQ,cAAS,CAAC,cAAS,C,kDAAoF,OAAO,CAAC,QAAQ,EAAkB,OAAO,CAAC,iB;iFAM1I,OAAO,CAAC,QAAQ,iB,sEAAlC,4EAYM,+DAXJ,4EAMI,KANJ,qDAMI,GALF,qDAAkC,E,yEAAA,GAClC,4EAAG,cAAS,C,uEAER,GACJ,4EAAG,OAAO,CAAC,QAAQ,M,GAGrB,4EAEI,oFADC,cAAS,sE,4EAGhB,4EAyCM,+DAxCO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,U,sEAA3C,4EAKM,+DAJJ,4EAGI,KAHJ,qDAGI,GAFF,qDAAkC,E,yEAAA,GAClC,4EAAG,cAAS,yD,8EAGhB,4EAiCM,+DAhCO,6BAAwB,CAAC,OAAO,K,sEAA3C,4EAaM,+DAZJ,4EAAwE,oFAAlE,cAAS,yDAEf,4EASK,MATL,qDASK,I,0EARH,4EAOK,qIANsB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,C,IAAgC,KAAK,MAAM,KAAK,yB,KAAnG,GAAG,GAAG,KAAK;qFADtB,4EAOK;UAHF,GAAG,EAAE;QAAK,IAEX,qDAAkC,E,yEAAA,GAAC,4EAAG,GAAG,CAAC,UAAU,wB;8FAI1D,4EAGI,KAHJ,qDAGI,GAFF,WAAkC,E,yEAAA,GAClC,4EAAG,cAAS,yD,IAEH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,iC,sEAA9C,4EAaM,qBAZJ,4EAAyE,oFAAnE,cAAS,0DAEf,4EASK,MATL,WASK,I,0EARH,4EAOK,qIANsB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,C,IAAgC,WAAW,MAAM,WAAW,yB,KAA/G,GAAG,GAAG,KAAK;qFADtB,4EAOK;UAHF,GAAG,EAAE;QAAK,IAEX,WAAgC,E,yEAAA,GAAC,4EAAG,GAAG,CAAC,UAAU,wB;oHAO5D,4EAUM,OAVN,WAUM,GATJ,4EAQO;QAPL,MAAM,EAAC,MAAM;QACb,MAAM,EAAC,EAAE;QACR,QAAM,mFAAU,kBAAa,CAAC,OAAO,EAAE,MAAM;UAE9C,4EAAsD;QAA/C,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,QAAQ;QAAE,KAAK,EAAE;gCAC3C,4EAAiF;QAA1E,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,oBAAoB;QAAE,KAAK,EAAE;gCACvD,4EAA4E,UAA5E,WAA4E,2EAAvC,cAAS,wB;eAKpD,4EA0CM,OA1CN,WA0CM,GAxCJ,WAAiC,EAEjC,4EAA0E,qFAAnE,cAAS,yDAEhB,4EAKI,oFAJC,cAAS,C,6EAMd,4EAA6E,oFAAvE,cAAS,8DAEf,4EAaK,aAZH,4EAIM;MAJF,SAGC,EAHO,cAAS,CAAoB,cAAS,C;8BAKlD,4EAEQ;MAFJ,SAEF,EAFU,cAAS,CAAoB,cAAS,sE;8BAGlD,4EAGa;MAHT,SAGG,EAHK,cAAS,CAAoB,cAAS,C;gCAMpD,4EAWM,OAXN,WAWM,GAVJ,4EASO;MARL,MAAM,EAAC,MAAM;MACZ,MAAM,EAAE,qBAAgB;MACzB,EAAE,EAAC;QAEH,4EAA4D;MAArD,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,YAAY;MAAE,KAAK,EAAE;8BAC/C,4EAES,UAFT,WAES,2EADJ,cAAS,oD,uBAMpB,WAAyB,C,gGAQvB,yBAAoB,IAAI,uBAAkB,IAAI,oBAAe,I,sEAFrE,4EAuBM,OAvBN,WAuBM,GAnBJ,4EAC0E,MAD1E,WAC0E,2EAAtE,cAAS,4DACb,4EAGI,YAFF,4EAA6E,yFAAlE,cAAS,gDAA+C,GAAC,M,yEAAS,GAC7E,4EAAG,aAAQ,M,GAEb,4EAGI,YAFF,4EAAiF,yFAAtE,cAAS,oDAAmD,GAAC,M,yEAAS,GACjF,4EAAG,iBAAY,M,GAEjB,WAAM,EACN,4EAOO;MAPA,MAAM,EAAE,oBAAe;MAAE,MAAM,EAAC,MAAM;MACvC,OAAO,EAAC,qBAAqB;MAAC,EAAE,EAAC;QACrC,4EAAqF,oFAA/E,cAAS,kEAAiE,GAAC,MAEjF,4EAA8D;MAAvD,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,cAAc;MAAE,KAAK,EAAE;8BAEjD,4EAA4E,UAA5E,WAA4E,2EAAvC,cAAS,wB,8GAI1C,oBAAe,I,sEADvB,4EAoBM,sB,0EAjBJ,4EAgBM,qIAhB+B,wBAAmB,GAA3C,YAAY,EAAE,KAAK;mFAAhC,4EAgBM;QAhBqD,GAAG,EAAE;MAAK,K,sEACnE,qEAcsD,iFAb/C,YAAY;QAChB,qBAAmB,EAAE,uBAAkB,CAAC,iBAAiB;QACzD,aAAW,EAAE,uBAAkB,CAAC,UAAU;QAC1C,UAAQ,EAAE,uBAAkB,CAAC,OAAO;QACpC,mBAAiB,EAAE,uBAAkB,CAAC,eAAe;QACrD,cAAY,EAAE,uBAAkB,CAAC,WAAW;QAC5C,eAAa,EAAE,uBAAkB,CAAC,YAAY;QAC9C,oBAAkB,EAAE,uBAAkB,CAAC,gBAAgB;QACvD,sBAAoB,EAAE,uBAAkB,CAAC,kBAAkB;QAC3D,2BAAyB,EAAE,uBAAkB,CAAC,sBAAsB;QACpE,UAAQ,EAAE,uBAAkB,CAAC,OAAO;QACpC,YAAU,EAAE,uBAAkB,CAAC,SAAS;QACxC,QAAQ,EAAE,uBAAkB,CAAC,QAAQ;QACrC,gBAAc,EAAE,uBAAkB,CAAC;;;;;;;;;AC7YnC;AAYK;AACuB;AACO;AAiDjC,wJAAe,CAAC;EAC7B,KAAK,EAAE;IACL,qBAAqB,EAAE;MACrB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,kBAAkB,EAAE,OAAO;IAC3B,oBAAoB,EAAE,OAAO;IAC7B,iBAAiB,EAAE,OAAO;IAC1B,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,MAAM;IACpB,QAAQ,EAAE;MACR,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,WAAW,EAAE;MACX,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;MACrB,QAAQ,EAAE;KACX;IACD,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IAChC,SAAS,EAAE;MACT,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,SAAS,EAAE,MAAM;IACjB,wBAAwB,EAAE,MAAM;IAChC,2BAA2B,EAAE,MAAM;IACnC,wBAAwB,EAAE,MAAM;IAChC,yBAAyB,EAAE,MAAM;IACjC,eAAe,EAAE,MAAM;IACvB,UAAU,EAAE,KAAK;IACjB,eAAe,EAAE,MAAM;IACvB,wBAAwB,EAAE;MACxB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;IACX;GACF;EACD,UAAU,EAAE;IACV,gDAAY;IACZ,0CAAK;IACL,gDAAY;GACb;EACD,UAAU,EAAE;IACV,gDAAY;GACb;EACD,IAAI;IACF,OAAO;MACL,uBAAuB,EAAE,EAAE;MAC3B,iBAAiB,EAAE,EAAE;MACrB,kBAAkB,EAAE,KAAK;MACzB,gBAAgB,EAAE,IAAI,CAAC,WAAsB;MAC7C,wBAAwB,EAAE,IAAI;MAC9B,gBAAgB,EAAE,CAAC,KAAK,CAAC;MACzB,UAAU,EAAE,IAAI;MAChB,UAAU,EAAE;KACb;EACH,CAAC;EACD,OAAO,EAAE;IACP,mBAAmB,CAAC,MAAqB,EAAE,KAAY;MACrD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAyC;MAChE,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI;MAErD,4BAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,0BAAyC,EAAE;QAC/E,GAAG;UACA,KAAK,CAAC,MAA0B,CAAC,MAAM,EAAE;QAC5C;OACD,CAAC;IACJ,CAAC;IACD,aAAa,CAAC,OAAsB,EAAE,KAAY;MAChD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,IAAI;MAErC,4BAAM,CAAC,MAAM,CAAC,YAAY,CACxB,IAAI,CAAC,KAAK,CAAC,oBAAmC,EAC9C;QACE,GAAG;UACA,KAAK,CAAC,MAA0B,CAAC,MAAM,EAAE;QAC5C;OACD,CACF;IACH,CAAC;IACD,wBAAwB,CAAC,OAAsB;MAC7C,MAAM,gBAAgB,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,oBAAoB,CAAC;MAC5E,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CACpC,UAAU,IAAK,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAC5D;IACH;GACD;EACD,QAAQ,EAAE;IACR,8BAA8B;MAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAC5B,IAAI,CAAC,qBAAsE,CAC5E;MAED,OAAO,MAAM,CAAC,WAAW,CACvB,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAI;QAC5B,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3D,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;MACjC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,KAAI;QAC1B,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;QAChE,MAAM;UAAE;QAAM,CAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QAEzC,OAAO,CACL,MAAM,kCAED,MAAM;UACT,OAAO;UACP,GAAG;UACH,aAAa,EAAE,gBAAgB,CAAC,MAAM;QAAC,GAE1C;MACH,CAAC,CAAC,CACH;IACH,CAAC;IACD,iBAAiB;MACf,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;MAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;MAE/D,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IACrC,CAAC;IACD,iBAAiB;MACf,OAAO;QACL,GAAG,EAAE,uCAAS,CAAC,gDAAgD,CAAC;QAChE,KAAK,EAAE,uCAAS,CAAC,kDAAkD,CAAC;QACpE,KAAK,EAAE,uCAAS,CAAC,kDAAkD,CAAC;QACpE,IAAI,EAAE,uCAAS,CAAC,iDAAiD;OAClE;IACH,CAAC;IACD,gBAAgB;MACd,OAAO,IAAI,+BAAS,CAAC,SAAS,iCACzB,+BAAS,CAAC,SAAS,CAAC,KAAK;QAC5B,MAAM,EAAE;MAAe,EACxB,CAAC,EAAE;IACN,CAAC;IACD,eAAe;MACb,MAAM,IAAI,GAAG,6CAAe,CAAC,kHAAkH,CAAC;MAChJ,OAAO,uCAAS,CACd,iDAAiD,EACjD,4BAA4B,IAAI,8BAA8B,EAC9D,MAAM,EACN,QAAQ,CACT;IACH,CAAC;IACD,mBAAmB;MACjB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAuC;MAE5D,OAAO,gEAAO,CAAC,OAAO,CAAC,GAAG,CAAE,GAAG,IAAK,wDAA0B,CAAC,GAAG,CAAC,MAAM,EACvE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,kBAAkB;MAChB,OAAO,IAAI,CAAC,wBAAoD;IAClE;EACD;CACF,CAAC,E;;ACnOogB,C;;ACA5b;AACV;AACL;AAC3D,2CAAM,UAAU,iDAAM;;AAEP,oG;;;;EC6BF,KAAK,EAAC,YAAY;EAAC,EAAE,EAAC,4BAA4B;EAAC,GAAG,EAAC;;;;;EAWrC,KAAK,EAAC;AAAgB;0EAQzC,4EAAS;;;;EAYD,KAAK,EAAC;;;;EAIN,KAAK,EAAC;;;;;;;;;;EAwBV,OAAO,EAAC,GAAG;EAAC,KAAK,EAAC;;;;EASpB,KAAK,EAAC;;;EAUJ,OAAO,EAAC;AAAG;;EACR,KAAK,EAAC;AAAgB;;EAUzB,OAAO,EAAC;AAAG;;EACP,MAAM,EAAC,EAAE;EAAC,MAAM,EAAC;;;;;;;EAyBxB,KAAK,EAAC,YAAY;EAAC,EAAE,EAAC,sBAAsB;EAAC,GAAG,EAAC;;;;;EAWjD,KAAK,EAAC;AAAoB;;;;;;;;;;;;;2EAavB,4EAAM;;EAMP,KAAK,EAAC;AAAU;;EAQZ,KAAK,EAAC;AAAM;;;;;;;EAaZ,KAAK,EAAC;AAAc;2EACrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;;EAWzB,KAAK,EAAC;;2EACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;;;;EAOpB,KAAK,EAAC;AAAe;2EAOrB,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;EAI7B,KAAK,EAAC;;2EACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;;EAMtB,KAAK,EAAC;AAAe;2EAOrB,4EAAgC;EAA1B,KAAK,EAAC;AAAY;;;EAO/B,KAAK,EAAC;;2EACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;EAGzB,KAAK,EAAC;;2EACP,4EAAkC;EAA5B,KAAK,EAAC;AAAc;;;;EAYvB,KAAK,EAAC;AAAK;;;;EAGJ,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;;;;;EAWpB,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;;EAK7B,KAAK,EAAC;AAAa;2EACtB,4EAAiC;EAA5B,KAAK,EAAC;AAAe;;EAarB,KAAK,EAAC;AAAK;;;;EAGJ,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;2EAOlC,4EAAyB;EAApB,KAAK,EAAC;AAAO;;;EA2BxB,KAAK,EAAC;;;2EAMkE,4EAAI;2EAGxC,4EAAI;;EAehC,MAAM,EAAC,MAAM;EAAC,MAAM,EAAC,EAAE;EAAC,EAAE,EAAC;;;;EAqBvB,IAAI,EAAC,QAAQ;EAAC,KAAK,EAAC;;;;;;;+EAhXpC,4EAoXM,cAnXJ,qEAMe;IALZ,eAAa,EAAE,cAAS;;8EAEzB,MAAoF,CAApF,4EAAoF,qFAA7E,cAAS,mE,yEAAoE,GAEpF,4EAAG,cAAS,wE;;4BAIN,uBAAkB,IAAI,sBAAiB,I,sEAD/C,4EAkHM;;IAhHH,KAAK,0EAAE,MAAM,CAAC,IAAI,CAAC,0BAAqB,EAAE,MAAM;MAEjD,qEA6Ge;IA5GZ,eAAa,EAAE,cAAS;;8EAEzB;MAAA;MAAA,OAAkF,CAAlF,4EAAkF,oFAA5E,cAAS,mEAEf,4EASM,OATN,oDASM,GARJ,4EAKK,qFAJA,cAAS,C,wDAAsF,4B,QAKpG,4EAAmE;QAA5D,IAAI,EAAC,KAAK;QAAC,IAAI,EAAC,QAAQ;QAAE,KAAK,EAAE,cAAS;yEACjD,4EAAiE;QAA1D,IAAI,EAAC,IAAI;QAAC,IAAI,EAAC,QAAQ;QAAE,KAAK,EAAE,cAAS;+NAGlD,4EA4FQ,SA5FR,oDA4FQ,GA3FN,4EASQ,gBARR,4EAOK,aANH,4EAA8C,qFAAvC,cAAS,6BAChB,4EAA0C,qFAAnC,cAAS,yBAChB,4EAAqC,qFAA9B,cAAS,oBAChB,4EAAsE,qFAA/D,cAAS,qDAChB,4EAAqE,qFAA9D,cAAS,oDAChB,oDAAS,C,KAGX,4EAgFQ,iB,0EA/ER,4EAkCK,qIAjC+B,mCAA8B,GAAxD,MAAM,EAAE,MAAM,EAAE,KAAK;qFAD/B,4EAkCK;UAhCF,GAAG,EAAE,KAAK;UACV,KAAK,2EAAG,eAAU,CAAC,MAAM,EAAE,YAAY,KAAK,eAAU,CAAC,MAAM,EAAE,QAAQ;YAExE,4EAAqD;UAAjD,SAA2C,EAAnC,cAAS,CAAC,eAAU,CAAC,MAAM,EAAE,IAAI;2EAE7C,4EAGK,a,CAF6B,eAAU,CAAC,MAAM,EAAE,YAAY,I,sEAA/D,4EAAwE,QAAxE,oDAAwE,K,gKAAA,GACxE,4EAAG,aAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,M,GAElC,4EAGK,a,CAF6B,eAAU,CAAC,MAAM,EAAE,QAAQ,I,sEAA3D,4EAAoE,QAApE,oDAAoE,K,gKAAA,GACpE,4EAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,M,GAElC,4EAAyC,qFAAlC,eAAU,CAAC,MAAM,EAAE,OAAO,OACjC,4EAAmC,qFAA5B,MAAM,CAAC,aAAa,OAC3B,4EAgBK,aAfH,4EAcO;UAbL,MAAM,EAAC,MAAM;UACb,MAAM,EAAC,EAAE;UACR,QAAM,mFAAU,wBAAmB,CAAC,MAAM,EAAE,MAAM;YAEnD,4EAAyD;UAAlD,IAAI,EAAC,QAAQ;UAAC,IAAI,EAAC,cAAc;UAAE,KAAK,EAAE;4EACjD,4EAC4C;UADrC,IAAI,EAAC,QAAQ;UAAC,IAAI,EAAC,uBAAuB;UACzC,KAAK,EAAE;4EAKP,MAAM,CAAC,iBAAiB,I,sEAJhC,4EAKU;;UAJR,IAAI,EAAC,QAAQ;UACb,KAAK,EAAC,sBAAsB;UAC3B,KAAK,EAAE,cAAS;;iBAMc,8BAAyB,G,+IAAhE,4EASK,8DARH,4EAOK,MAPL,qDAOK,GANH,4EAKS;QAJP,KAAK,EAAC,KAAK;QACV,OAAK,sCAAE,uBAAkB;kFAEvB,cAAS,0D,sEANL,uBAAkB,E,2FAWO,8BAAyB,G,+IAD/D,4EAiCK,MAjCL,qDAiCK,GA/BH,4EAOK,aANH,qEAKE;QAJA,SAAS,EAAC,MAAM;QACf,YAAU,EAAE,IAAI;oBACR,qBAAgB;mEAAhB,qBAAgB;QACxB,KAAK,EAAE,cAAS,qBAAqB,cAAS;8CAGnD,4EAUK,MAVL,qDAUK,GATH,4EAQM,OARN,qDAQM,GAPJ,qEAME;QALA,SAAS,EAAC,QAAQ;oBACT,gCAA2B;mEAA3B,gCAA2B;QACnC,KAAK,EAAE,cAAS;QAChB,YAAU,EAAE,IAAI;QAChB,OAAO,EAAE;2DAIhB,4EAWK,MAXL,qDAWK,GAVH,4EASO,QATP,qDASO,GARL,4EAAwE;QAAjE,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,cAAc;QAAE,KAAK,2BAAE,qBAAgB,0DAAhB,sBAAkB;0EACnE,4EAAkF;QAA3E,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,oBAAoB;QAAE,KAAK,EAAE;0EACvD,4EAIE;QAHA,IAAI,EAAC,QAAQ;QACb,IAAI,EAAC,wBAAwB;QAC5B,KAAK,EAAE;0EAEV,4EAAsE;QAA/D,IAAI,EAAC,QAAQ;QAAC,KAAK,EAAC,KAAK;QAAE,KAAK,EAAE,cAAS;gJA7B5C,uBAAkB,E;;;0HAuC5B,uBAAkB,I,sEAD1B,4EAgLM;;IA9KH,KAAK,gGAAwB,sBAAiB;MAE/C,qEA2Ke;IA1KZ,eAAa,EAAE,cAAS;;8EAGzB,MASM,CATN,4EASM,OATN,qDASM,GARJ,4EAKK,qFAJA,cAAS,C,yDAAuF,sB,QAKrG,4EAAmE;MAA5D,IAAI,EAAC,KAAK;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;wEACjD,4EAAiE;MAA1D,IAAI,EAAC,IAAI;MAAC,IAAI,EAAC,QAAQ;MAAE,KAAK,EAAE,cAAS;+EAGlD,4EA2JM,OA3JN,qDA2JM,GAzJK,sBAAiB,I,sEAA1B,4EAIU,qIAHL,cAAS,C,8DAA6F,8B,iFAI3G,4EAAoF,qIAAvE,cAAS,+DAEb,kBAAa,I,sEAAtB,4EAQI,6DAPF,qEAMe;MAND,OAAO,EAAC;IAAO;gFAC3B,MAA6D,C,kJAA1D,cAAS,kDAAiD,GAC7D,M,OAAmB,kBAAa,iB,sEAAhC,4EAGO,gEAFL,qDAAM,E,yEAAA,GACN,4EAAG,kBAAa,M;;mGAKtB,4EAsIM,OAtIN,qDAsIM,I,0EArIJ,4EA0GM,qIAzG2B,sBAAiB,GAAxC,OAAO,EAAE,SAAS;mFAD5B,4EA0GM;QAxGH,GAAG,EAAE,SAAS;QACd,KAAK,qFAAa,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,U,OAAiC,OAAO,CAAC,QAAQ;UAIpG,4EAEM,OAFN,qDAEM,GADJ,4EAA4B;QAAtB,GAAG,EAAE,OAAO,CAAC;4EAGrB,4EAA2B,qFAApB,OAAO,CAAC,IAAI,OAEnB,4EAIK;QAJF,SAIA,EAJQ,cAAS,CAAC,cAAS,C,kDAAoF,OAAO,CAAC,QAAQ,EAAkB,OAAO,CAAC,iB;iFAM1I,OAAO,CAAC,QAAQ,iB,sEAAlC,4EAWM,+DAVJ,4EAKI,KALJ,qDAKI,GAJF,qDAAkC,E,yEAAA,GAClC,4EAAG,cAAS,C,uEAER,GAAC,4EAAG,OAAO,CAAC,QAAQ,M,GAG1B,4EAEI,oFADC,cAAS,wE,4EAGhB,4EAuCM,+DAtC0B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,U,sEAA9D,4EAGI,KAHJ,qDAGI,GAFF,qDAAkC,E,yEAAA,GAClC,4EAAG,cAAS,yD,4EAEd,4EAiCM,+DAhCO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAE,QAAQ,IAAK,QAAQ,CAAC,QAAQ,K,sEAA3E,4EAaM,+DAZJ,4EAAwE,oFAAlE,cAAS,yDAEf,4EASK,MATL,qDASK,I,0EARH,4EAOK,qIANsB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,C,IAAgC,QAAQ,MAAM,QAAQ,CAAC,Q,KAA1G,GAAG,GAAG,KAAK;qFADtB,4EAOK;UAHF,GAAG,EAAE;QAAK,IAEX,qDAAkC,E,yEAAA,GAAC,4EAAG,GAAG,M;8FAI/C,4EAGI,KAHJ,qDAGI,GAFF,qDAAkC,E,yEAAA,GAClC,4EAAG,cAAS,yD,IAEH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAE,QAAQ,KAAM,QAAQ,CAAC,QAAQ,K,sEAA5E,4EAaM,+DAZJ,4EAAyE,oFAAnE,cAAS,0DAEf,4EASK,MATL,qDASK,I,0EARH,4EAOK,qIANsB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,C,IAAgC,QAAQ,OAAO,QAAQ,CAAC,Q,KAA3G,GAAG,GAAG,KAAK;qFADtB,4EAOK;UAHF,GAAG,EAAE;QAAK,IAEX,qDAAgC,E,yEAAA,GAAC,4EAAG,GAAG,M;oHAOnB,OAAO,CAAC,WAAW,W,sEAAjD,4EAGI,KAHJ,qDAGI,GAFF,qDAAkC,E,yEAAA,GAClC,4EAAG,cAAS,6D,KAEqB,OAAO,CAAC,WAAW,W,sEAAtD,4EAMI,KANJ,qDAMI,GALF,qDAAkC,EAClC,4EAGK;QAHC,SAGH,EAHW,cAAS,CAAC,cAAS,C,oEAA0G,OAAO,CAAC,W;qJAKrJ,4EAIK;;QAJK,SAIP,EAJe,cAAS,CAAC,cAAS,C,qEAAuH,OAAO,CAAC,W;2EAMpK,4EAgBM,OAhBN,qDAgBM,GAfJ,4EAKO;QALD,MAAM,EAAC,MAAM;QAAE,MAAM,EAAE;UAC3B,4EAA6D;QAAtD,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,YAAY;QAAE,KAAK,EAAE;0EAC/C,4EAES,UAFT,qDAES,2EADJ,cAAS,wD,6DAGhB,4EAQO;QAPL,MAAM,EAAC,MAAM;QACb,MAAM,EAAC,EAAE;QACR,QAAM,mFAAU,kBAAa,CAAC,OAAO,EAAE,MAAM;UAE9C,4EAAsD;QAA/C,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,QAAQ;QAAE,KAAK,EAAE;0EAC3C,4EAAiF;QAA1E,IAAI,EAAC,QAAQ;QAAC,IAAI,EAAC,oBAAoB;QAAE,KAAK,EAAE;0EACvD,4EAA4E,UAA5E,qDAA4E,2EAAvC,cAAS,wB;eAKpD,4EAsBM,OAtBN,qDAsBM,GArBJ,qDAAiC,EAEjC,4EAA0E,qFAAnE,cAAS,yDAEhB,4EAKI,oFAJC,cAAS,C,6EAMd,4EAAqF,oFAA/E,cAAS,sEAEf,4EAOM,OAPN,qDAOM,GANJ,4EAKO;MALD,MAAM,EAAC,MAAM;MAAE,MAAM,EAAE,2BAAsB;MAAE,EAAE,EAAC;QACtD,4EAA6D;MAAtD,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,YAAY;MAAE,KAAK,EAAE;wEAC/C,4EAES,UAFT,qDAES,2EADJ,cAAS,oD,iEAMpB,qDAAyB,C;;0HAQzB,uBAAkB,IAAI,oBAAe,I,sEAD7C,4EAgBM;;IAdH,KAAK,iGAAyB,uBAAkB;MAEjD,qEAWe;IAVZ,eAAa,EAAE,cAAS;;8EAEzB,MAGI,CAHJ,4EAGI,YAFF,4EAA6E,yFAAlE,cAAS,gDAA+C,GAAC,M,yEAAS,GAC7E,4EAAG,aAAQ,M,GAEb,4EAGI,YAFF,4EAAiF,yFAAtE,cAAS,oDAAmD,GAAC,M,yEAAS,GACjF,4EAAG,iBAAY,M;;0HAMb,oBAAe,I,sEADvB,4EAkBM,OAlBN,qDAkBM,GAfJ,qEAce;IAbZ,eAAa,EAAE,cAAS;;8EAEzB,MAAgC,CAAhC,4EAAgC;MAA7B,SAAwB,EAAhB;IAAe,oEAC1B,4EASI,Y,kJARC,cAAS,wDAAuD,GAAC,2DAAI,EACxE,4EAEc,yFADV,cAAS,+DACT,GAAC,M,yEAAS,GAAC,4EAAG,eAAU,IAAG,GAAC,2DAAI,EACpC,4EAEc,yFADV,cAAS,8DACT,GAAC,M,yEAAS,GACd,4EAAG,kBAAa,IAAG,uEACrB,K;;uHAKI,oBAAe,I,sEADvB,4EA8BM;;IA5BH,KAAK,2EAAG,uBAAkB;MAC3B,qEA0Be;IAzBZ,eAAa,EAAE,cAAS;;8EAEzB,MAsBO,CAtBP,4EAsBO,QAtBP,qDAsBO,GArBL,4EAAmF,oFAA7E,cAAS,oEAEf,qEAME;MALA,SAAS,EAAC,MAAM;MAChB,IAAI,EAAC,UAAU;kBACN,kBAAa;iEAAb,kBAAa;MACrB,KAAK,EAAE,cAAS;MACjB,YAAY,EAAC;0CAGf,qEAME;MALA,SAAS,EAAC,MAAM;MAChB,IAAI,EAAC,cAAc;kBACV,sBAAiB;iEAAjB,sBAAiB;MACzB,KAAK,EAAE,cAAS;MACjB,YAAY,EAAC;0CAGf,4EAA8D;MAAvD,IAAI,EAAC,QAAQ;MAAC,IAAI,EAAC,cAAc;MAAE,KAAK,EAAE;wEAEjD,4EAA0E,UAA1E,qDAA0E,2EAArC,cAAS,sB;;;;;;;AC/XlB;AAWpB;AACuB;AACO;AAsBjC,wJAAe,CAAC;EAC7B,KAAK,EAAE;IACL,kBAAkB,EAAE,OAAO;IAC3B,oBAAoB,EAAE,OAAO;IAC7B,iBAAiB,EAAE,OAAO;IAC1B,QAAQ,EAAE,MAAM;IAChB,YAAY,EAAE,MAAM;IACpB,qBAAqB,EAAE;MACrB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,WAAW,EAAE;MACX,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;MACrB,QAAQ,EAAE;KACX;IACD,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;IAChC,QAAQ,EAAE;MACR,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,SAAS,EAAE;MACT,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,wBAAwB,EAAE;MACxB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,2BAA2B,EAAE;MAC3B,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,wBAAwB,EAAE;MACxB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,yBAAyB,EAAE,MAAM;IACjC,eAAe,EAAE,MAAM;IACvB,UAAU,EAAE,MAAM;IAClB,aAAa,EAAE;GAChB;EACD,UAAU,EAAE;IACV,gDAAY;IACZ,0CAAK;IACL,gDAAY;GACb;EACD,UAAU,EAAE;IACV,gDAAY;GACb;EACD,IAAI;IACF,OAAO;MACL,uBAAuB,EAAE,EAAE;MAC3B,iBAAiB,EAAE,EAAE;MACrB,kBAAkB,EAAE,KAAK;MACzB,gBAAgB,EAAE,IAAI,CAAC,WAAsB;MAC7C,2BAA2B,EAAE,IAAI;MACjC,aAAa,EAAE,EAAE;MACjB,iBAAiB,EAAE;KACpB;EACH,CAAC;EACD,OAAO,EAAE;IACP,mBAAmB,CAAC,MAAqB,EAAE,KAAY;MACrD,MAAM,SAAS,GAAG,IAAI,CAAC,UAAyC;MAChE,IAAI,CAAC,uBAAuB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI;MAErD,4BAAM,CAAC,MAAM,CAAC,YAAY,CACxB,IAAI,CAAC,KAAK,CAAC,0BAAyC,EACpD;QACE,GAAG;UACA,KAAK,CAAC,MAA0B,CAAC,MAAM,EAAE;QAC5C;OACD,CACF;IACH,CAAC;IACD,aAAa,CAAC,OAAsB,EAAE,KAAY;MAChD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,IAAI;MAErC,4BAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAmC,EAAE;QACzE,GAAG;UACA,KAAK,CAAC,MAA0B,CAAC,MAAM,EAAE;QAC5C;OACD,CAAC;IACJ;GACD;EACD,QAAQ,EAAE;IACR,8BAA8B;MAC5B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAC5B,IAAI,CAAC,qBAAsE,CAC5E;MAED,OAAO,MAAM,CAAC,WAAW,CACvB,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAI;QAC5B,MAAM,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;QAC3D,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;MACjC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,KAAI;QAC1B,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,MAAM,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;QACjE,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAkB;QAC3D,MAAM;UAAE;QAAM,CAAE,GAAG,WAAW;QAE9B,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CACvD,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,KAAK,IAAI,CACpC;QACD,MAAM,OAAO,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,CAAC,CAAC;QAEhC,OAAO,CACL,MAAM,kCAED,MAAM;UACT,OAAO;UACP,IAAI;UACJ,OAAO;UACP,aAAa,EAAE,gBAAgB,CAAC,MAAM;QAAC,GAE1C;MACH,CAAC,CAAC,CACH;IACH,CAAC;IACD,sBAAsB;MACpB,OAAO,IAAI,+BAAS,CAAC,SAAS,iCACzB,+BAAS,CAAC,SAAS,CAAC,KAAK;QAC5B,MAAM,EAAE;MAAqB,EAC9B,CAAC,EAAE;IACN,CAAC;IACD,eAAe;MACb,MAAM,IAAI,GAAG,6CAAe,CAAC,2EAA2E,CAAC;MACzG,OAAO,uCAAS,CACd,iDAAiD,EACjD,4BAA4B,IAAI,8BAA8B,EAC9D,MAAM,EACN,QAAQ,CACT;IACH,CAAC;IACD,iBAAiB;MACf,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;MAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;MAE/D,OAAO,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;IACrC;EACD;CACF,CAAC,E;;AC3LogB,C;;ACA5b;AACV;AACL;AAC3D,2CAAM,UAAU,iDAAM;;AAEP,oG;;;;ECER,KAAK,EAAC;AAAgB;;EACpB,KAAK,EAAC;AAAS;gFAG6D,4EAAM;;gFAIhB,4EAAM;gFAG/C,4EAAM;gFAGQ,4EAAM;;EAI/C,KAAK,EAAC;AAAgB;;EACpB,KAAK,EAAC;AAAY;;EACf,EAAE,EAAC,sBAAsB;EAAC,MAAM,EAAC,EAAE;EAAC,MAAM,EAAC,MAAM;EACjD,OAAO,EAAC;;iFAIZ,4EAAiD;EAA1C,IAAI,EAAC,QAAQ;EAAC,EAAE,EAAC,QAAQ;EAAC,IAAI,EAAC;;;;iFAOlC,4EAAiC;EAA3B,KAAK,EAAC;AAAa;iFAEzB,4EAA2B;EAArB,KAAK,EAAC;AAAa;;6NAlCnC,4EAiBM,OAjBN,0DAiBM,GAhBJ,4EAeM,OAfN,0DAeM,GAdJ,4EAAoF,oFAA9E,cAAS,qEACf,4EAGI,Y,kJAFC,cAAS,qEAAiE,0DAAM,EACnF,4EAA+D;IAAzD,SAAiD,EAAzC,cAAS,CAAC,kCAA6B;6EAEvD,4EAQI,Y,kJAPC,cAAS,2DAAuD,0DAAM,EACzE,4EAES,yFADJ,cAAS,wEAAuE,IACrF,M,yEAAS,GAAC,4EAAG,eAAU,OAAG,0DAAM,EAChC,4EAES,yFADJ,cAAS,mEAAkE,IAChF,M,yEAAS,GAAC,4EAAG,YAAO,6EAAM,gBAAW,OAAG,0DAAM,C,OAIpD,4EAqBM,OArBN,0DAqBM,GApBJ,4EAmBM,OAnBN,0DAmBM,GAlBJ,4EAiBO,QAjBP,2DAiBO,GAfL,4EAC6D;IADtD,IAAI,EAAC,MAAM;IAAC,EAAE,EAAC,YAAY;IAAC,IAAI,EAAC,YAAY;IAAC,MAAM,EAAC,OAAO;IACvD,QAAM,yCAAE,yDAAiB;IAAE,KAAoB,EAApB;MAAA;IAAA;gBAEvC,2DAAiD,EAEjD,4EAAsE;IAA/D,IAAI,EAAC,QAAQ;IAAC,IAAI,EAAC,cAAc;IAAE,KAAK,EAAE;4EAEjD,4EAOS;IAPD,IAAI,EAAC,QAAQ;IAAC,KAAK,EAAC,KAAK;IAAE,OAAK,sCAAE,qBAAgB;IACjD,QAAQ,EAAE;8EACjB,4EAC4E,eAA1E,2DAAiC,E,yEAAA,GAAC,4EAAG,cAAS,wB,mEADjC,2BAAsB,E,2EAErC,4EAEO,eADL,2DAA2B,E,yEAAA,GAAC,4EAAG,cAAS,mD,kEAD5B,2BAAsB,E;;;;;ACvCR;AAIpB;AAEH,uJAAe,CAAC;EAC7B,IAAI;IACF,OAAO;MACL,WAAW,EAAE,gEAAgE;MAC7E,eAAe,EAAE,KAAK;MACtB,WAAW,EAAE;KACd;EACH,CAAC;EACD,KAAK,EAAE;IACL,iBAAiB,EAAE;MACjB,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,UAAU,EAAE;MACV,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;KACX;IACD,OAAO,EAAE;MACP,IAAI,EAAE,MAAM;MACZ,QAAQ,EAAE;IACX;GACF;EACD,OAAO,EAAE;IACP,gBAAgB;MACd,IAAI,CAAC,eAAe,GAAG,IAAI;MAC3B,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC;MACvD,IAAI,SAAS,EAAE;QACb,SAAS,CAAC,KAAK,EAAE;MAClB;IACH,CAAC;IACD,iBAAiB;MACf,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAqB;MAC3E,MAAM,oBAAoB,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAoB;MAC/F,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,IAAI,oBAAoB,EAAE;QACxD,IAAI,CAAC,WAAW,GAAG,IAAI;QACvB,oBAAoB,CAAC,MAAM,EAAE;MAC9B;IACH,CAAC;IACD,cAAc;MACZ;MACA,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW,EAAE;QAC7C;MACD;MAED;MACA,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAqB;MAC3E,IAAI,SAAS,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;QACjC,IAAI,CAAC,eAAe,GAAG,KAAK;MAC7B;IACH;GACD;EACD,QAAQ,EAAE;IACR,6BAA6B;MAC3B,MAAM,GAAG,GAAG,6CAAe,CAAC,qIAAqI,CAAC;MAClK,OAAO,uCAAS,CACd,4DAA4D,EAC5D,YAAY,GAAG,8CAA8C,EAC7D,MAAM,CACP;IACH,CAAC;IACD,sBAAsB;MACpB,OAAO,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,WAAW;IACjD;GACD;EACD,OAAO;IACL,QAAQ,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc;EAC7C;CACD,CAAC,E;;AC1E0gB,C;;ACA5b;AACV;AACL;AACjE,0CAAM,UAAU,uDAAM;;AAEP,kG;;ACLf;;;;;;;;;;;;;AAaG;AAE0D;AACW;AACI;AACA;;;AClBpD;AACF","file":"SearchEngineKeywordsPerformance.umd.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"CoreHome\"), require(\"vue\"), require(\"CorePluginsAdmin\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"CoreHome\", , \"CorePluginsAdmin\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SearchEngineKeywordsPerformance\"] = factory(require(\"CoreHome\"), require(\"vue\"), require(\"CorePluginsAdmin\"));\n\telse\n\t\troot[\"SearchEngineKeywordsPerformance\"] = factory(root[\"CoreHome\"], root[\"Vue\"], root[\"CorePluginsAdmin\"]);\n})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__19dc__, __WEBPACK_EXTERNAL_MODULE__8bbf__, __WEBPACK_EXTERNAL_MODULE_a5a2__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"plugins/SearchEngineKeywordsPerformance/vue/dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"fae3\");\n","module.exports = __WEBPACK_EXTERNAL_MODULE__19dc__;","module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__;","module.exports = __WEBPACK_EXTERNAL_MODULE_a5a2__;","// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n var currentScript = window.document.currentScript\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n var getCurrentScript = require('@soda/get-current-script')\n currentScript = getCurrentScript()\n\n // for backward compatibility, because previously we directly included the polyfill\n if (!('currentScript' in document)) {\n Object.defineProperty(document, 'currentScript', { get: getCurrentScript })\n }\n }\n\n var src = currentScript && currentScript.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/)\n if (src) {\n __webpack_public_path__ = src[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","\n\n\n\n\n","\n\n\n\n\n","\nimport { defineComponent } from 'vue';\nimport { translate, MatomoUrl } from 'CoreHome';\n\ninterface Provider {\n id: string;\n is_configured: boolean;\n configured_site_ids: (string|number)[];\n problems: {\n sites: unknown[];\n accounts: [];\n };\n is_experimental: boolean;\n logos: string[];\n}\n\nexport default defineComponent({\n props: {\n provider: {\n type: Object,\n required: true,\n },\n },\n computed: {\n hasWarning() {\n const provider = this.provider as Provider;\n return provider.is_configured\n && (Object.keys(provider.configured_site_ids).length === 0\n || Object.keys(provider.problems.sites).length\n || Object.keys(provider.problems.accounts).length);\n },\n logoTooltip() {\n const provider = this.provider as Provider;\n const isConfiguredWithoutSite = provider.is_configured\n && Object.keys(provider.configured_site_ids).length === 0;\n\n if (isConfiguredWithoutSite) {\n return translate('SearchEngineKeywordsPerformance_ConfigAvailableNoWebsiteConfigured');\n }\n\n if (provider.is_configured) {\n return translate('SearchEngineKeywordsPerformance_IntegrationConfigured');\n }\n\n return translate('SearchEngineKeywordsPerformance_IntegrationNotConfigured');\n },\n configureUrl() {\n return `?${MatomoUrl.stringify({\n ...MatomoUrl.urlParsed.value,\n action: `configure${this.provider.id}`,\n })}`;\n },\n },\n});\n","export { default } from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Provider.vue?vue&type=script&lang=ts\"; export * from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Provider.vue?vue&type=script&lang=ts\"","import { render } from \"./Provider.vue?vue&type=template&id=5cbccceb\"\nimport script from \"./Provider.vue?vue&type=script&lang=ts\"\nexport * from \"./Provider.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\nimport { defineComponent } from 'vue';\nimport { ContentBlock } from 'CoreHome';\nimport Provider from './Provider.vue';\n\nexport default defineComponent({\n props: {\n providers: {\n type: Array,\n required: true,\n },\n },\n components: {\n ContentBlock,\n Provider,\n },\n});\n","export { default } from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./AdminPage.vue?vue&type=script&lang=ts\"; export * from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./AdminPage.vue?vue&type=script&lang=ts\"","import { render } from \"./AdminPage.vue?vue&type=template&id=6ea8181b\"\nimport script from \"./AdminPage.vue?vue&type=script&lang=ts\"\nexport * from \"./AdminPage.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","/**\n * Copyright (C) InnoCraft Ltd - All rights reserved.\n *\n * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd.\n * The intellectual and technical concepts contained herein are protected by trade secret\n * or copyright law. Redistribution of this information or reproduction of this material is\n * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.\n *\n * You shall use this code only in accordance with the license agreement obtained from\n * InnoCraft Ltd.\n *\n * @link https://www.innocraft.com/\n * @license For license details see https://www.innocraft.com/license\n */\n\nexport function getDisplayApiKey(apiKey = ''): string {\n return `${apiKey.substr(0, 5)}*****${apiKey.substr(apiKey.length - 5, 5)}`;\n}\n","\nimport { defineComponent } from 'vue';\nimport {\n Matomo,\n ContentBlock,\n ContentTable,\n SiteRef,\n translate,\n Site,\n externalRawLink,\n} from 'CoreHome';\nimport { Field } from 'CorePluginsAdmin';\nimport { getDisplayApiKey } from '../utilities';\n\ninterface BingConfigState {\n removeAccountConfigName: string;\n removeAccountName: string;\n isAddingMeasurable: boolean;\n currentSiteToAdd: SiteRef;\n bingAccountAndUrlToAdd: string|null;\n apiKeyToAdd: string;\n}\n\ninterface BingAccount {\n name: string;\n apiKey: string;\n}\n\ninterface ConfiguredBingInfo {\n bingSiteUrl: string;\n}\n\nexport default defineComponent({\n props: {\n configuredMeasurables: {\n type: Object,\n required: true,\n },\n accounts: {\n type: Object,\n required: true,\n },\n sitesInfos: {\n type: Object,\n required: true,\n },\n currentSite: {\n type: Object,\n required: true,\n },\n urlOptions: {\n type: [Object, Array],\n required: true,\n },\n error: String,\n apikey: String,\n formNonce: String,\n addBingSiteConfigNonce: String,\n removeBingSiteConfigNonce: String,\n removeBingAccountNonce: String,\n countOfAccountsWithAccess: Number,\n userIsSuperUser: String,\n },\n data(): BingConfigState {\n return {\n removeAccountConfigName: '',\n removeAccountName: '',\n isAddingMeasurable: false,\n currentSiteToAdd: this.currentSite as SiteRef,\n bingAccountAndUrlToAdd: null,\n apiKeyToAdd: this.apikey || '',\n };\n },\n components: {\n ContentBlock,\n Field,\n },\n directives: {\n ContentTable,\n },\n methods: {\n removeAccountConfig(siteId: string|number, event: Event) {\n const siteInfos = this.sitesInfos as Record;\n this.removeAccountConfigName = siteInfos[siteId].name;\n\n Matomo.helper.modalConfirm(this.$refs.confirmRemoveAccountConfig as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n getDisplayApiKey,\n removeAccount(account: BingAccount, event: Event) {\n this.removeAccountName = this.getDisplayApiKey(account.apiKey);\n Matomo.helper.modalConfirm(this.$refs.confirmDeleteAccount as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n },\n computed: {\n hasApiKeyError() {\n return typeof this.error !== 'undefined' && this.error !== null;\n },\n configuredMeasurablesToDisplay() {\n const entries = Object.entries(\n this.configuredMeasurables as Record,\n );\n\n return Object.fromEntries(\n entries.filter(([, config]) => {\n const [account] = config.bingSiteUrl.split('##');\n return !!this.accounts[account];\n }).map(([siteId, config]) => {\n const [account, url] = config.bingSiteUrl.split('##');\n const { apiKey } = this.accounts[account];\n\n return [\n siteId,\n {\n ...config,\n account,\n url,\n apiKeyDisplay: this.getDisplayApiKey(apiKey),\n },\n ];\n }),\n );\n },\n bingApiKeyInstructionText() {\n const url = externalRawLink('https://matomo.org/faq/reports/import-bing-and-yahoo-search-keywords-into-matomo/');\n return translate(\n 'SearchEngineKeywordsPerformance_BingAPIKeyInstruction',\n '',\n '',\n ``,\n '',\n );\n },\n accountsToDisplay() {\n const asArray = Object.entries(this.accounts);\n const filtered = asArray.filter(([, value]) => value.hasAccess);\n\n return Object.fromEntries(filtered);\n },\n },\n});\n","export { default } from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Configuration.vue?vue&type=script&lang=ts\"; export * from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Configuration.vue?vue&type=script&lang=ts\"","import { render } from \"./Configuration.vue?vue&type=template&id=752192ce\"\nimport script from \"./Configuration.vue?vue&type=script&lang=ts\"\nexport * from \"./Configuration.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","\nimport {\n defineComponent,\n markRaw,\n} from 'vue';\nimport {\n ContentBlock,\n ContentTable,\n Matomo,\n SiteRef,\n translate,\n Notification,\n MatomoUrl,\n Site,\n useExternalPluginComponent,\n externalRawLink,\n} from 'CoreHome';\nimport { Field } from 'CorePluginsAdmin';\nimport { getDisplayApiKey } from '../utilities';\n\ninterface GoogleConfigState {\n removeAccountConfigName: string;\n removeAccountName: string;\n isAddingMeasurable: boolean;\n currentSiteToAdd: SiteRef;\n googleAccountAndUrlToAdd: string|null;\n googleTypesToAdd: string[];\n clientFile: unknown;\n clientText: string;\n}\n\ninterface GoogleAccount {\n name: string;\n apiKey: string;\n urls: Record;\n}\n\ninterface ConfiguredGoogleInfo {\n googleSearchConsoleUrl: string;\n}\n\ninterface ComponentExtension {\n plugin: string;\n component: string;\n}\n\ninterface ConfigureConnectionRadioOption {\n connectAccounts: string;\n manual: string;\n}\n\ninterface ConfigureConnectionProps {\n baseDomain: string;\n baseUrl: string;\n manualConfigNonce: string;\n manualActionUrl: string;\n primaryText: string;\n radioOptions: ConfigureConnectionRadioOption[];\n manualConfigText: string;\n connectAccountsUrl: string;\n connectAccountsBtnText: string;\n authUrl: string;\n unlinkUrl: string;\n strategy: string;\n connectedWith: string;\n}\n\nexport default defineComponent({\n props: {\n configuredMeasurables: {\n type: Object,\n required: true,\n },\n isClientConfigured: Boolean,\n isClientConfigurable: Boolean,\n isOAuthConfigured: Boolean,\n clientId: String,\n clientSecret: String,\n accounts: {\n type: Object,\n required: true,\n },\n sitesInfos: {\n type: Object,\n required: true,\n },\n currentSite: {\n type: Object,\n required: true,\n },\n urlOptions: {\n type: [Object, Array],\n required: true,\n },\n hasOAuthError: [String, Boolean],\n authNonce: {\n type: String,\n required: true,\n },\n formNonce: String,\n addGoogleSiteConfigNonce: String,\n removeGoogleSiteConfigNonce: String,\n removeGoogleAccountNonce: String,\n countOfAccountsWithAccess: Number,\n userIsSuperUser: String,\n extensions: Array,\n removeConfigUrl: String,\n configureConnectionProps: {\n type: Object,\n required: true,\n },\n },\n components: {\n ContentBlock,\n Field,\n Notification,\n },\n directives: {\n ContentTable,\n },\n data(): GoogleConfigState {\n return {\n removeAccountConfigName: '',\n removeAccountName: '',\n isAddingMeasurable: false,\n currentSiteToAdd: this.currentSite as SiteRef,\n googleAccountAndUrlToAdd: null,\n googleTypesToAdd: ['web'],\n clientFile: null,\n clientText: '',\n };\n },\n methods: {\n removeAccountConfig(siteId: string|number, event: Event) {\n const siteInfos = this.sitesInfos as Record;\n this.removeAccountConfigName = siteInfos[siteId].name;\n\n Matomo.helper.modalConfirm(this.$refs.confirmRemoveAccountConfig as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n removeAccount(account: GoogleAccount, event: Event) {\n this.removeAccountName = account.name;\n\n Matomo.helper.modalConfirm(\n this.$refs.confirmDeleteAccount as HTMLElement,\n {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n },\n );\n },\n accountHasAvailableSites(account: GoogleAccount) {\n const siteAccessLevels = ['siteOwner', 'siteFullUser', 'siteRestrictedUser'];\n return Object.values(account.urls).some(\n (siteAccess) => siteAccessLevels.indexOf(siteAccess) !== -1,\n );\n },\n },\n computed: {\n configuredMeasurablesToDisplay() {\n const entries = Object.entries(\n this.configuredMeasurables as Record,\n );\n\n return Object.fromEntries(\n entries.filter(([, config]) => {\n const [account] = config.googleSearchConsoleUrl.split('##');\n return !!this.accounts[account];\n }).map(([siteId, config]) => {\n const [account, url] = config.googleSearchConsoleUrl.split('##');\n const { apiKey } = this.accounts[account];\n\n return [\n siteId,\n {\n ...config,\n account,\n url,\n apiKeyDisplay: getDisplayApiKey(apiKey),\n },\n ];\n }),\n );\n },\n accountsToDisplay() {\n const asArray = Object.entries(this.accounts);\n const filtered = asArray.filter(([, value]) => value.hasAccess);\n\n return Object.fromEntries(filtered);\n },\n googleTypeOptions() {\n return {\n web: translate('SearchEngineKeywordsPerformance_KeywordTypeWeb'),\n image: translate('SearchEngineKeywordsPerformance_KeywordTypeImage'),\n video: translate('SearchEngineKeywordsPerformance_KeywordTypeVideo'),\n news: translate('SearchEngineKeywordsPerformance_KeywordTypeNews'),\n };\n },\n forwardToAuthUrl() {\n return `?${MatomoUrl.stringify({\n ...MatomoUrl.urlParsed.value,\n action: 'forwardToAuth',\n })}`;\n },\n visitOAuthHowTo() {\n const link = externalRawLink('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-oauth-client-config');\n return translate(\n 'SearchEngineKeywordsPerformance_VisitOAuthHowTo',\n ``,\n '',\n 'Google',\n );\n },\n componentExtensions() {\n const entries = this.extensions as Array;\n\n return markRaw(entries.map((ref) => useExternalPluginComponent(ref.plugin,\n ref.component)));\n },\n configConnectProps() {\n return this.configureConnectionProps as ConfigureConnectionProps;\n },\n },\n});\n","export { default } from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Configuration.vue?vue&type=script&lang=ts\"; export * from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Configuration.vue?vue&type=script&lang=ts\"","import { render } from \"./Configuration.vue?vue&type=template&id=f24fe118\"\nimport script from \"./Configuration.vue?vue&type=script&lang=ts\"\nexport * from \"./Configuration.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","\nimport { defineComponent } from 'vue';\nimport {\n Matomo,\n ContentBlock,\n ContentTable,\n SiteRef,\n Notification,\n MatomoUrl,\n translate,\n Site,\n externalRawLink,\n} from 'CoreHome';\nimport { Field } from 'CorePluginsAdmin';\nimport { getDisplayApiKey } from '../utilities';\n\ninterface YandexConfigState {\n removeAccountConfigName: string;\n removeAccountName: string;\n isAddingMeasurable: boolean;\n currentSiteToAdd: SiteRef;\n yandexAccountAndHostIdToAdd: string|null;\n clientIdToUse: string;\n clientSecretToUse: string;\n}\n\ninterface YandexAccount {\n name: string;\n apiKey: string;\n urls: Record;\n}\n\ninterface ConfiguredYandexInfo {\n yandexAccountAndHostId: string;\n}\n\nexport default defineComponent({\n props: {\n isClientConfigured: Boolean,\n isClientConfigurable: Boolean,\n isOAuthConfigured: Boolean,\n clientId: String,\n clientSecret: String,\n configuredMeasurables: {\n type: Object,\n required: true,\n },\n sitesInfos: {\n type: Object,\n required: true,\n },\n currentSite: {\n type: Object,\n required: true,\n },\n urlOptions: {\n type: [Object, Array],\n required: true,\n },\n hasOAuthError: [String, Boolean],\n accounts: {\n type: Object,\n required: true,\n },\n auth_nonce: {\n type: String,\n required: true,\n },\n formNonce: {\n type: String,\n required: true,\n },\n addYandexSiteConfigNonce: {\n type: String,\n required: true,\n },\n removeYandexSiteConfigNonce: {\n type: String,\n required: true,\n },\n removeYandexAccountNonce: {\n type: String,\n required: true,\n },\n countOfAccountsWithAccess: Number,\n userIsSuperUser: String,\n baseDomain: String,\n baseDomainUrl: String,\n },\n components: {\n ContentBlock,\n Field,\n Notification,\n },\n directives: {\n ContentTable,\n },\n data(): YandexConfigState {\n return {\n removeAccountConfigName: '',\n removeAccountName: '',\n isAddingMeasurable: false,\n currentSiteToAdd: this.currentSite as SiteRef,\n yandexAccountAndHostIdToAdd: null,\n clientIdToUse: '',\n clientSecretToUse: '',\n };\n },\n methods: {\n removeAccountConfig(siteId: string|number, event: Event) {\n const siteInfos = this.sitesInfos as Record;\n this.removeAccountConfigName = siteInfos[siteId].name;\n\n Matomo.helper.modalConfirm(\n this.$refs.confirmRemoveAccountConfig as HTMLElement,\n {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n },\n );\n },\n removeAccount(account: YandexAccount, event: Event) {\n this.removeAccountName = account.name;\n\n Matomo.helper.modalConfirm(this.$refs.confirmDeleteAccount as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n },\n computed: {\n configuredMeasurablesToDisplay() {\n const entries = Object.entries(\n this.configuredMeasurables as Record,\n );\n\n return Object.fromEntries(\n entries.filter(([, config]) => {\n const [account] = config.yandexAccountAndHostId.split('##');\n return !!this.accounts[account];\n }).map(([siteId, config]) => {\n const [account, host] = config.yandexAccountAndHostId.split('##');\n const accountInfo = this.accounts[account] as YandexAccount;\n const { apiKey } = accountInfo;\n\n const hostUrlPair = Object.entries(accountInfo.urls).find(\n ([, data]) => data.host_id === host,\n );\n const hostUrl = hostUrlPair?.[0];\n\n return [\n siteId,\n {\n ...config,\n account,\n host,\n hostUrl,\n apiKeyDisplay: getDisplayApiKey(apiKey),\n },\n ];\n }),\n );\n },\n forwardToYandexAuthUrl() {\n return `?${MatomoUrl.stringify({\n ...MatomoUrl.urlParsed.value,\n action: 'forwardToYandexAuth',\n })}`;\n },\n visitOAuthHowTo() {\n const link = externalRawLink('https://matomo.org/faq/reports/import-yandex-search-keywords-into-matomo/');\n return translate(\n 'SearchEngineKeywordsPerformance_VisitOAuthHowTo',\n ``,\n '',\n 'Yandex',\n );\n },\n accountsToDisplay() {\n const asArray = Object.entries(this.accounts);\n const filtered = asArray.filter(([, value]) => value.hasAccess);\n\n return Object.fromEntries(filtered);\n },\n },\n});\n","export { default } from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Configuration.vue?vue&type=script&lang=ts\"; export * from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./Configuration.vue?vue&type=script&lang=ts\"","import { render } from \"./Configuration.vue?vue&type=template&id=a80179ac\"\nimport script from \"./Configuration.vue?vue&type=script&lang=ts\"\nexport * from \"./Configuration.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","\nimport { defineComponent } from 'vue';\nimport {\n translate,\n externalRawLink,\n} from 'CoreHome';\n\nexport default defineComponent({\n data() {\n return {\n redirectUri: '?module=SearchEngineKeywordsPerformance&action=processAuthCode',\n isSelectingFile: false,\n isUploading: false,\n };\n },\n props: {\n manualConfigNonce: {\n type: String,\n required: true,\n },\n baseDomain: {\n type: String,\n required: true,\n },\n baseUrl: {\n type: String,\n required: true,\n },\n },\n methods: {\n selectConfigFile() {\n this.isSelectingFile = true;\n const fileInput = document.getElementById('clientfile');\n if (fileInput) {\n fileInput.click();\n }\n },\n processFileChange() {\n const fileInput = document.getElementById('clientfile') as HTMLInputElement;\n const configFileUploadForm = document.getElementById('configFileUploadForm') as HTMLFormElement;\n if (fileInput && fileInput.value && configFileUploadForm) {\n this.isUploading = true;\n configFileUploadForm.submit();\n }\n },\n checkForCancel() {\n // If we're not in currently selecting a file or if we're uploading, there's no point checking\n if (!this.isSelectingFile || this.isUploading) {\n return;\n }\n\n // Check if the file is empty and change back from selecting status\n const fileInput = document.getElementById('clientfile') as HTMLInputElement;\n if (fileInput && !fileInput.value) {\n this.isSelectingFile = false;\n }\n },\n },\n computed: {\n setupGoogleAnalyticsImportFaq() {\n const url = externalRawLink('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-search-console-and-verify-your-website');\n return translate(\n 'SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3',\n ``,\n '',\n );\n },\n isUploadButtonDisabled() {\n return this.isSelectingFile || this.isUploading;\n },\n },\n mounted() {\n document.body.onfocus = this.checkForCancel;\n },\n});\n","export { default } from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./ConfigureConnection.vue?vue&type=script&lang=ts\"; export * from \"-!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--15-0!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader/index.js??ref--15-2!../../../../../node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--1-0!../../../../../node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/index.js??ref--1-1!./ConfigureConnection.vue?vue&type=script&lang=ts\"","import { render } from \"./ConfigureConnection.vue?vue&type=template&id=9e9de9fe\"\nimport script from \"./ConfigureConnection.vue?vue&type=script&lang=ts\"\nexport * from \"./ConfigureConnection.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","/**\n * Copyright (C) InnoCraft Ltd - All rights reserved.\n *\n * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd.\n * The intellectual and technical concepts contained herein are protected by trade secret\n * or copyright law. Redistribution of this information or reproduction of this material is\n * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.\n *\n * You shall use this code only in accordance with the license agreement obtained from\n * InnoCraft Ltd.\n *\n * @link https://www.innocraft.com/\n * @license For license details see https://www.innocraft.com/license\n */\n\nexport { default as AdminPage } from './Admin/AdminPage.vue';\nexport { default as BingConfiguration } from './Bing/Configuration.vue';\nexport { default as GoogleConfiguration } from './Google/Configuration.vue';\nexport { default as YandexConfiguration } from './Yandex/Configuration.vue';\nexport { default as ConfigureConnection } from './Configure/ConfigureConnection.vue';\n","import './setPublicPath'\nexport * from '~entry'\n"],"sourceRoot":""} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.min.js b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.min.js new file mode 100644 index 0000000..176e218 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.min.js @@ -0,0 +1,30 @@ +(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],t):"object"===typeof exports?exports["SearchEngineKeywordsPerformance"]=t(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):e["SearchEngineKeywordsPerformance"]=t(e["CoreHome"],e["Vue"],e["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(e,t,n){return function(e){var t={};function n(c){if(t[c])return t[c].exports;var o=t[c]={i:c,l:!1,exports:{}};return e[c].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,c){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(n.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(c,o,function(t){return e[t]}.bind(null,o));return c},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="plugins/SearchEngineKeywordsPerformance/vue/dist/",n(n.s="fae3")}({"19dc":function(t,n){t.exports=e},"8bbf":function(e,n){e.exports=t},a5a2:function(e,t){e.exports=n},fae3:function(e,t,n){"use strict";if(n.r(t),n.d(t,"AdminPage",(function(){return N})),n.d(t,"BingConfiguration",(function(){return _e})),n.d(t,"GoogleConfiguration",(function(){return mn})),n.d(t,"YandexConfiguration",(function(){return Fc})),n.d(t,"ConfigureConnection",(function(){return ro})),"undefined"!==typeof window){var c=window.document.currentScript,o=c&&c.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);o&&(n.p=o[1])}var r=n("8bbf");const l={class:"keywordproviders"},a=Object(r["createElementVNode"])("div",{class:"clear"},null,-1);function i(e,t,n,c,o,i){const s=Object(r["resolveComponent"])("Provider"),d=Object(r["resolveComponent"])("ContentBlock");return Object(r["openBlock"])(),Object(r["createBlock"])(d,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigurationDescription")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ProviderListDescription")),1),Object(r["createElementVNode"])("div",l,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.providers,e=>(Object(r["openBlock"])(),Object(r["createBlock"])(s,{key:e.id,provider:e},null,8,["provider"]))),128)),a])]),_:1},8,["content-title"])}var s=n("19dc");const d=["title"],u=["src","alt"],b=["innerHTML"],m=["innerHTML"],O={key:0,class:"experimental"},j=["href"],p={key:0,class:"btn"},g={key:1,class:"btn"};function y(e,t,n,c,o,l){return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{class:Object(r["normalizeClass"])({keywordprovider:!0,warning:e.hasWarning,configured:!e.hasWarning&&e.provider.is_configured})},[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.provider.logos,(t,n)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:Object(r["normalizeClass"])("logo "+(e.provider.logos.length>1?"double":"")),title:e.logoTooltip},[Object(r["createElementVNode"])("img",{src:t,alt:e.provider.name},null,8,u)],10,d))),128)),Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.provider.name),1),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.provider.description)},null,8,b),Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("em",{innerHTML:e.$sanitize(e.provider.note)},null,8,m)]),e.provider.is_experimental?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",O,"experimental")):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("a",{href:e.configureUrl,class:"cta"},[e.provider.is_configured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",p,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ChangeConfiguration")),1)):(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",g,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_SetupConfiguration")),1))],8,j)],2)}var f=Object(r["defineComponent"])({props:{provider:{type:Object,required:!0}},computed:{hasWarning(){const e=this.provider;return e.is_configured&&(0===Object.keys(e.configured_site_ids).length||Object.keys(e.problems.sites).length||Object.keys(e.problems.accounts).length)},logoTooltip(){const e=this.provider,t=e.is_configured&&0===Object.keys(e.configured_site_ids).length;return t?Object(s["translate"])("SearchEngineKeywordsPerformance_ConfigAvailableNoWebsiteConfigured"):e.is_configured?Object(s["translate"])("SearchEngineKeywordsPerformance_IntegrationConfigured"):Object(s["translate"])("SearchEngineKeywordsPerformance_IntegrationNotConfigured")},configureUrl(){return"?"+s["MatomoUrl"].stringify(Object.assign(Object.assign({},s["MatomoUrl"].urlParsed.value),{},{action:"configure"+this.provider.id}))}}});f.render=y;var E=f,h=Object(r["defineComponent"])({props:{providers:{type:Array,required:!0}},components:{ContentBlock:s["ContentBlock"],Provider:E}});h.render=i;var N=h;const V={class:"ui-confirm",id:"confirmRemoveAccountConfig",ref:"confirmRemoveAccountConfig"},S=["value"],v=["value"],k={class:"measurableList"},C=Object(r["createElementVNode"])("th",null,null,-1),A={key:0},w={colspan:"6"},B={key:0,class:"icon-error"},D={key:0,class:"icon-error"},_=["onSubmit"],T=["value"],P=["value"],K=["title"],x={key:1},U={colspan:"6",align:"right"},M={key:2,class:"configureMeasurableForm"},I={colspan:"2"},L={class:"bingAccountAndUrlToAdd"},F={colspan:"3"},G={action:"",method:"post"},H=["value"],q=["value"],R=["value"],z=["value"],$={class:"ui-confirm",id:"confirmDeleteAccount",ref:"confirmDeleteAccount"},Y=["value"],W=["value"],X={class:"accounts"},J=["innerHTML"],Q={key:0,class:"accounterror"},Z=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),ee={key:1},te={key:0,class:"accounterror"},ne=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),ce={key:1},oe={key:0},re={class:"websites-list"},le=Object(r["createElementVNode"])("span",{class:"icon-success"},null,-1),ae={key:1},ie={class:"accounterror"},se=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),de={key:2},ue={class:"websites-list"},be=Object(r["createElementVNode"])("span",{class:"icon-error"},null,-1),me={class:"cta"},Oe=["onSubmit"],je=["value"],pe=["value"],ge={type:"submit",class:"btn"},ye={method:"POST",action:""},fe=Object(r["createElementVNode"])("div",{class:"icon-add logo"},null,-1),Ee=["innerHTML"],he={key:0,class:"accounterror"},Ne=Object(r["createElementVNode"])("br",null,null,-1),Ve=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),Se=["value"],ve={class:"cta"},ke={type:"submit",class:"btn"},Ce=Object(r["createElementVNode"])("div",{class:"clear"},null,-1);function Ae(e,t,n,c,o,l){const a=Object(r["resolveComponent"])("ContentBlock"),i=Object(r["resolveComponent"])("Field"),s=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingConfigurationTitle")),1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingConfigurationDescription")),1)]),_:1},8,["content-title"]),Object.keys(e.accounts).length>0?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:0,class:Object(r["normalizeClass"])("websiteconfiguration "+(Object.keys(e.configuredMeasurables).length?"configured":""))},[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurables")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurableBelow")),1),Object(r["createElementVNode"])("div",V,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigRemovalConfirm",e.removeAccountConfigName)),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,S),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,v)],512),Object(r["createElementVNode"])("div",null,[Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("table",k,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Measurable")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Mobile_Account")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Goals_URL")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_LastImport")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CreatedBy")),1),C])]),Object(r["createElementVNode"])("tbody",null,[Object.keys(e.configuredMeasurables).length?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",A,[Object(r["createElementVNode"])("td",w,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_NoWebsiteConfigured")),1)])])),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.configuredMeasurablesToDisplay,(t,n,c)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:c,class:Object(r["normalizeClass"])(e.sitesInfos[n].accountValid&&e.sitesInfos[n].urlValid?"":"error")},[Object(r["createElementVNode"])("td",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.sitesInfos[n].name)+" ",1),Object(r["createElementVNode"])("span",null,"("+Object(r["toDisplayString"])(e.sitesInfos[n].main_url)+")",1)]),Object(r["createElementVNode"])("td",null,[e.sitesInfos[n].accountValid?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",B)),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(t.apiKeyDisplay),1)]),Object(r["createElementVNode"])("td",null,[e.sitesInfos[n].urlValid?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",D)),Object(r["createTextVNode"])(Object(r["toDisplayString"])(t.url),1)]),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.sitesInfos[n].lastRun),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.createdByUser),1),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(r["withModifiers"])(t=>e.removeAccountConfig(n,t),["prevent"])},[Object(r["createElementVNode"])("input",{type:"hidden",name:"removeConfig",value:n},null,8,T),Object(r["createElementVNode"])("input",{type:"hidden",name:"removeSiteConfigNonce",value:e.removeBingSiteConfigNonce},null,8,P),t.isDeletionAllowed?(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",{key:0,type:"submit",class:"btn-flat icon-delete",title:e.translate("General_Delete")},null,8,K)):Object(r["createCommentVNode"])("",!0)],40,_)])],2))),128)),e.countOfAccountsWithAccess?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",x,[Object(r["createElementVNode"])("td",U,[Object(r["createElementVNode"])("button",{class:"btn",onClick:t[0]||(t[0]=Object(r["withModifiers"])(t=>e.isAddingMeasurable=!0,["prevent"]))},Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddConfiguration")),1)])],512)),[[r["vShow"],!e.isAddingMeasurable]]):Object(r["createCommentVNode"])("",!0),e.countOfAccountsWithAccess?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",M,[Object(r["createElementVNode"])("td",null,[Object(r["createVNode"])(i,{uicontrol:"site",modelValue:e.currentSiteToAdd,"onUpdate:modelValue":t[1]||(t[1]=t=>e.currentSiteToAdd=t),title:e.translate("CoreHome_ChooseX",e.translate("General_Measurable"))},null,8,["modelValue","title"])]),Object(r["createElementVNode"])("td",I,[Object(r["createElementVNode"])("div",L,[Object(r["createVNode"])(i,{uicontrol:"select",modelValue:e.bingAccountAndUrlToAdd,"onUpdate:modelValue":t[2]||(t[2]=t=>e.bingAccountAndUrlToAdd=t),title:e.translate("SearchEngineKeywordsPerformance_UrlOfAccount"),options:e.urlOptions},null,8,["modelValue","title","options"])])]),Object(r["createElementVNode"])("td",F,[Object(r["createElementVNode"])("form",G,[Object(r["createElementVNode"])("input",{type:"hidden",name:"bingSiteId",value:e.currentSiteToAdd.id},null,8,H),Object(r["createElementVNode"])("input",{type:"hidden",name:"addSiteConfigNonce",value:e.addBingSiteConfigNonce},null,8,q),Object(r["createElementVNode"])("input",{type:"hidden",name:"bingAccountAndUrl",value:e.bingAccountAndUrlToAdd},null,8,R),Object(r["createElementVNode"])("input",{type:"submit",class:"btn",value:e.translate("General_Save")},null,8,z)])])],512)),[[r["vShow"],e.isAddingMeasurable]]):Object(r["createCommentVNode"])("",!0)])])),[[s]])])]),_:1},8,["content-title"])],2)):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",{class:Object(r["normalizeClass"])("accountconfiguration "+(Object.keys(e.accounts).length>0?"configured":""))},[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_ManageAPIKeys")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("div",$,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountRemovalConfirm",e.removeAccountName)),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Y),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,W)],512),Object(r["createElementVNode"])("div",X,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.accountsToDisplay,t=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:t.username,class:Object(r["normalizeClass"])("account "+(0===Object.keys(t.urls).length||"string"===typeof t.hasError?"invalid":""))},[Object(r["createElementVNode"])("div",{class:Object(r["normalizeClass"])(`icon-${0===Object.keys(t.urls).length||"string"===typeof t.hasError?"warning":"success"} logo`)},null,2),Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.getDisplayApiKey(t.apiKey)),1),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_AccountAddedBy",t.username,t.created_formatted))},null,8,J),"string"===typeof t.hasError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",Q,[Z,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingAccountError",t.hasError)),1)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ee,[0===Object.keys(t.urls).length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",te,[ne,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ce,[Object.values(t.urls).some(e=>e)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",oe,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AvailableSites")),1),Object(r["createElementVNode"])("ul",re,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(Object.entries(t.urls).filter(([,e])=>e),([e],t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t},[le,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e),1)]))),128))])])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ae,[Object(r["createElementVNode"])("p",ie,[se,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])])),Object.values(t.urls).some(e=>!e)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",de,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_UnverifiedSites")),1),Object(r["createElementVNode"])("ul",ue,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(Object.entries(t.urls).filter(([,e])=>!e),([e],t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t},[be,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e),1)]))),128))])])):Object(r["createCommentVNode"])("",!0)]))])),Object(r["createElementVNode"])("div",me,[Object(r["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(r["withModifiers"])(n=>e.removeAccount(t,n),["prevent"])},[Object(r["createElementVNode"])("input",{type:"hidden",name:"remove",value:t.apiKey},null,8,je),Object(r["createElementVNode"])("input",{type:"hidden",name:"removeAccountNonce",value:e.removeBingAccountNonce},null,8,pe),Object(r["createElementVNode"])("button",ge,Object(r["toDisplayString"])(e.translate("General_Remove")),1)],40,Oe)])],2))),128)),Object(r["createElementVNode"])("div",{class:Object(r["normalizeClass"])("account add "+(e.hasApiKeyError?"invalid":""))},[Object(r["createElementVNode"])("form",ye,[fe,Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddAPIKey")),1),Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.bingApiKeyInstructionText)},null,8,Ee),e.hasApiKeyError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",he,[Ne,Ve,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_BingAccountError",e.error)),1)])):Object(r["createCommentVNode"])("",!0),Object(r["createVNode"])(i,{uicontrol:"text","full-width":!0,name:"apikey",modelValue:e.apiKeyToAdd,"onUpdate:modelValue":t[3]||(t[3]=t=>e.apiKeyToAdd=t),title:e.translate("SearchEngineKeywordsPerformance_APIKey"),autocomplete:"off"},null,8,["modelValue","title"]),Object(r["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.formNonce},null,8,Se),Object(r["createElementVNode"])("div",ve,[Object(r["createElementVNode"])("button",ke,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddAPIKey")),1)])])],2),Ce])]),_:1},8,["content-title"])],2)])}var we=n("a5a2"); +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */function Be(e=""){return`${e.substr(0,5)}*****${e.substr(e.length-5,5)}`}var De=Object(r["defineComponent"])({props:{configuredMeasurables:{type:Object,required:!0},accounts:{type:Object,required:!0},sitesInfos:{type:Object,required:!0},currentSite:{type:Object,required:!0},urlOptions:{type:[Object,Array],required:!0},error:String,apikey:String,formNonce:String,addBingSiteConfigNonce:String,removeBingSiteConfigNonce:String,removeBingAccountNonce:String,countOfAccountsWithAccess:Number,userIsSuperUser:String},data(){return{removeAccountConfigName:"",removeAccountName:"",isAddingMeasurable:!1,currentSiteToAdd:this.currentSite,bingAccountAndUrlToAdd:null,apiKeyToAdd:this.apikey||""}},components:{ContentBlock:s["ContentBlock"],Field:we["Field"]},directives:{ContentTable:s["ContentTable"]},methods:{removeAccountConfig(e,t){const n=this.sitesInfos;this.removeAccountConfigName=n[e].name,s["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig,{yes(){t.target.submit()}})},getDisplayApiKey:Be,removeAccount(e,t){this.removeAccountName=this.getDisplayApiKey(e.apiKey),s["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount,{yes(){t.target.submit()}})}},computed:{hasApiKeyError(){return"undefined"!==typeof this.error&&null!==this.error},configuredMeasurablesToDisplay(){const e=Object.entries(this.configuredMeasurables);return Object.fromEntries(e.filter(([,e])=>{const[t]=e.bingSiteUrl.split("##");return!!this.accounts[t]}).map(([e,t])=>{const[n,c]=t.bingSiteUrl.split("##"),{apiKey:o}=this.accounts[n];return[e,Object.assign(Object.assign({},t),{},{account:n,url:c,apiKeyDisplay:this.getDisplayApiKey(o)})]}))},bingApiKeyInstructionText(){const e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-bing-and-yahoo-search-keywords-into-matomo/");return Object(s["translate"])("SearchEngineKeywordsPerformance_BingAPIKeyInstruction",'',"",``,"")},accountsToDisplay(){const e=Object.entries(this.accounts),t=e.filter(([,e])=>e.hasAccess);return Object.fromEntries(t)}}});De.render=Ae;var _e=De;const Te={key:0},Pe={class:"alert alert-warning"},Ke={key:1},xe={class:"ui-confirm",id:"confirmRemoveAccountConfig",ref:"confirmRemoveAccountConfig"},Ue=["value"],Me=["value"],Ie={class:"measurableList"},Le=Object(r["createElementVNode"])("th",null,null,-1),Fe={key:0},Ge={colspan:"7"},He=["innerHTML"],qe={key:0,class:"icon-error"},Re={key:0,class:"icon-error"},ze=Object(r["createElementVNode"])("br",null,null,-1),$e=["title"],Ye=Object(r["createElementVNode"])("span",{class:"icon-info"},null,-1),We=["title"],Xe=Object(r["createElementVNode"])("span",{class:"icon-info"},null,-1),Je=["onSubmit"],Qe=["value"],Ze=["value"],et=["title"],tt={key:1,class:"configureMeasurableForm"},nt={class:"account-select"},ct={colspan:"4"},ot={action:"",method:"post"},rt=["value"],lt=["value"],at=["value"],it=["value"],st=["value"],dt={key:0},ut={key:2,class:"oauthconfiguration"},bt={class:"section-heading"},mt={class:"ui-confirm",id:"confirmDeleteAccount",ref:"confirmDeleteAccount"},Ot=["value"],jt=["value"],pt={class:"oauthconfigoptions"},gt={key:0},yt={key:1},ft={key:2},Et={key:0},ht=Object(r["createElementVNode"])("br",null,null,-1),Nt={class:"accounts"},Vt={class:"logo"},St=["src"],vt=["innerHTML"],kt={key:0},Ct={class:"accounterror"},At=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),wt={key:1},Bt={key:0},Dt={class:"accounterror"},_t=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),Tt={key:1},Pt={key:0},Kt={class:"websites-list"},xt=Object(r["createElementVNode"])("span",{class:"icon-success"},null,-1),Ut={key:1,class:"accounterror"},Mt=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),It={key:2},Lt={class:"websites-list"},Ft=Object(r["createElementVNode"])("span",{class:"icon-error"},null,-1),Gt={class:"cta"},Ht=["onSubmit"],qt=["value"],Rt=["value"],zt={type:"submit",class:"btn"},$t={class:"account add"},Yt=Object(r["createElementVNode"])("div",{class:"icon-add logo"},null,-1),Wt=["innerHTML"],Xt=["innerHTML"],Jt=["innerHTML"],Qt={class:"cta"},Zt=["action"],en=["value"],tn={type:"submit",class:"btn"},nn=Object(r["createElementVNode"])("div",{class:"clear"},null,-1),cn={key:3,class:"clientconfiguration"},on={class:"section-heading"},rn=Object(r["createElementVNode"])("br",null,null,-1),ln=["action"],an=["value"],sn={type:"submit",class:"btn"},dn={key:4};function un(e,t,n,c,o,l){const a=Object(r["resolveComponent"])("Field"),i=Object(r["resolveComponent"])("Notification"),s=Object(r["resolveComponent"])("ContentBlock"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createVNode"])(s,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(r["withCtx"])(()=>[e.isClientConfigured||!e.isClientConfigurable||e.userIsSuperUser?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Te,[Object(r["createElementVNode"])("div",Pe,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_GooglePendingConfigurationErrorMessage")),1)])),e.isClientConfigured&&e.isOAuthConfigured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Ke,[Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurables")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurableBelow")),1),Object(r["createElementVNode"])("div",xe,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigRemovalConfirm",e.removeAccountConfigName)),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ue),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,Me)],512),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("table",Ie,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Measurable")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_EnabledSearchTypes")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Mobile_Account")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Goals_URL")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_LastImport")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CreatedBy")),1),Le])]),Object(r["createElementVNode"])("tbody",null,[0===Object.keys(e.configuredMeasurablesToDisplay).length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",Fe,[Object(r["createElementVNode"])("td",Ge,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_NoWebsiteConfigured")),1)])])):Object(r["createCommentVNode"])("",!0),(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.configuredMeasurablesToDisplay,(t,n,c)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:c,class:Object(r["normalizeClass"])(e.sitesInfos[n].accountValid&&e.sitesInfos[n].urlValid?"":"error")},[Object(r["createElementVNode"])("td",{innerHTML:e.$sanitize(e.sitesInfos[n].name)},null,8,He),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.googleWebKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeWeb"):"")+" "+Object(r["toDisplayString"])(t.googleImageKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeImage"):"")+" "+Object(r["toDisplayString"])(t.googleVideoKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeVideo"):"")+" "+Object(r["toDisplayString"])(t.googleNewsKeywords?e.translate("SearchEngineKeywordsPerformance_KeywordTypeNews"):""),1),Object(r["createElementVNode"])("td",null,[e.sitesInfos[n].accountValid?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",qe)),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.accounts[t.account].name),1)]),Object(r["createElementVNode"])("td",null,[e.sitesInfos[n].urlValid?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Re)),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(t.url.replaceAll("sc-domain:",""))+" ",1),ze,/^sc-domain:/.test(t.url)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:1,class:"property-type",title:e.translate("SearchEngineKeywordsPerformance_DomainPropertyInfo")},[Ye,Object(r["createTextVNode"])(" ("+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_DomainProperty"))+") ",1)],8,$e)):/^http/.test(t.url)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",{key:2,class:"property-type",title:e.translate("SearchEngineKeywordsPerformance_URLPrefixPropertyInfo")},[Xe,Object(r["createTextVNode"])(" ("+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_URLPrefixProperty"))+") ",1)],8,We)):Object(r["createCommentVNode"])("",!0)]),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.sitesInfos[n].lastRun),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.createdByUser),1),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(r["withModifiers"])(t=>e.removeAccountConfig(n,t),["prevent"])},[Object(r["createElementVNode"])("input",{type:"hidden",name:"removeConfig",value:n},null,8,Qe),Object(r["createElementVNode"])("input",{type:"hidden",name:"removeSiteConfigNonce",value:e.removeGoogleSiteConfigNonce},null,8,Ze),t.isDeletionAllowed?(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",{key:0,type:"submit",class:"btn-flat icon-delete",title:e.translate("General_Delete")},null,8,et)):Object(r["createCommentVNode"])("",!0)],40,Je)])],2))),128)),e.countOfAccountsWithAccess?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",tt,[Object(r["createElementVNode"])("td",null,[Object(r["createVNode"])(a,{uicontrol:"site","full-width":!0,modelValue:e.currentSiteToAdd,"onUpdate:modelValue":t[0]||(t[0]=t=>e.currentSiteToAdd=t),title:e.translate("CoreHome_ChooseX",e.translate("General_Measurable"))},null,8,["modelValue","title"])]),Object(r["createElementVNode"])("td",null,[Object(r["createVNode"])(a,{uicontrol:"checkbox",modelValue:e.googleTypesToAdd,"onUpdate:modelValue":t[1]||(t[1]=t=>e.googleTypesToAdd=t),"var-type":"array",title:"keyword types to fetch","full-width":!0,options:e.googleTypeOptions},null,8,["modelValue","options"])]),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("div",nt,[Object(r["createVNode"])(a,{uicontrol:"select",modelValue:e.googleAccountAndUrlToAdd,"onUpdate:modelValue":t[2]||(t[2]=t=>e.googleAccountAndUrlToAdd=t),title:e.translate("SearchEngineKeywordsPerformance_UrlOfAccount"),"full-width":!0,options:e.urlOptions},null,8,["modelValue","title","options"])])]),Object(r["createElementVNode"])("td",ct,[Object(r["createElementVNode"])("form",ot,[Object(r["createElementVNode"])("input",{type:"hidden",name:"googleSiteId",value:e.currentSiteToAdd.id},null,8,rt),Object(r["createElementVNode"])("input",{type:"hidden",name:"addSiteConfigNonce",value:e.addGoogleSiteConfigNonce},null,8,lt),Object(r["createElementVNode"])("input",{type:"hidden",name:"googleAccountAndUrl",value:e.googleAccountAndUrlToAdd},null,8,at),Object(r["createElementVNode"])("input",{type:"hidden",name:"googleTypes",value:e.googleTypesToAdd.length?e.googleTypesToAdd:"web"},null,8,it),Object(r["createElementVNode"])("input",{type:"submit",class:"btn",value:e.translate("General_Save")},null,8,st)])])],512)),[[r["vShow"],e.isAddingMeasurable]]):Object(r["createCommentVNode"])("",!0)])])),[[d]]),e.countOfAccountsWithAccess?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("div",dt,[Object(r["createElementVNode"])("button",{id:"addWebsiteBtn",class:"btn",onClick:t[3]||(t[3]=t=>e.isAddingMeasurable=!0)},Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddConfiguration")),1)],512)),[[r["vShow"],!e.isAddingMeasurable]]):Object(r["createCommentVNode"])("",!0)])):Object(r["createCommentVNode"])("",!0),e.isClientConfigured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ut,[Object(r["createElementVNode"])("h3",bt,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectGoogleAccounts")),1),Object(r["createElementVNode"])("div",mt,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountRemovalConfirm",e.removeAccountName)),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Ot),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,jt)],512),Object(r["createElementVNode"])("div",pt,[e.isOAuthConfigured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",gt,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts",e.countOfAccountsWithAccess)),1)):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",yt,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectFirstAccount")),1)),e.hasOAuthError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",ft,[Object(r["createVNode"])(i,{context:"error",type:"transient"},{default:Object(r["withCtx"])(()=>[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthError"))+" ",1),e.hasOAuthError.length>5?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",Et,[ht,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.hasOAuthError),1)])):Object(r["createCommentVNode"])("",!0)]),_:1})])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",Nt,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.accountsToDisplay,(t,n)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:"account"},[Object(r["createElementVNode"])("div",Vt,[Object(r["createElementVNode"])("img",{src:t.picture},null,8,St)]),Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_AccountAddedBy",t.username,t.created_formatted))},null,8,vt),"string"===typeof t.hasError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",kt,[Object(r["createElementVNode"])("p",Ct,[At,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountConnectionValidationError"))+" "+Object(r["toDisplayString"])(t.hasError),1)]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ReAddAccountIfPermanentError")),1)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",wt,[0===Object.keys(t.urls).length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Bt,[Object(r["createElementVNode"])("p",Dt,[_t,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Tt,[e.accountHasAvailableSites(t)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Pt,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AvailableSites")),1),Object(r["createElementVNode"])("ul",Kt,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(Object.entries(t.urls).filter(([,e])=>"siteUnverifiedUser"!==e),([e],t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t},[xt,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.replaceAll("sc-domain:","")),1)]))),128))])])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",Ut,[Mt,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])),-1!==Object.values(t.urls).indexOf("siteUnverifiedUser")?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",It,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_UnverifiedSites")),1),Object(r["createElementVNode"])("ul",Lt,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(Object.entries(t.urls).filter(([,e])=>"siteUnverifiedUser"===e),([e],t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t},[Ft,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.replaceAll("sc-domain:","")),1)]))),128))])])):Object(r["createCommentVNode"])("",!0)]))])),Object(r["createElementVNode"])("div",Gt,[Object(r["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(r["withModifiers"])(n=>e.removeAccount(t,n),["prevent"])},[Object(r["createElementVNode"])("input",{type:"hidden",name:"remove",value:n},null,8,qt),Object(r["createElementVNode"])("input",{type:"hidden",name:"removeAccountNonce",value:e.removeGoogleAccountNonce},null,8,Rt),Object(r["createElementVNode"])("button",zt,Object(r["toDisplayString"])(e.translate("General_Remove")),1)],40,Ht)])]))),128)),Object(r["createElementVNode"])("div",$t,[Yt,Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccount")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccountDescription","Google")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_RequiredAccessTypes")),1),Object(r["createElementVNode"])("ul",null,[Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_GoogleAccountAccessTypeSearchConsoleData"))},null,8,Wt),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_GoogleAccountAccessTypeProfileInfo"))},null,8,Xt),Object(r["createElementVNode"])("li",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_GoogleAccountAccessTypeOfflineAccess"))},null,8,Jt)]),Object(r["createElementVNode"])("div",Qt,[Object(r["createElementVNode"])("form",{method:"post",action:e.forwardToAuthUrl,id:"clientauthform"},[Object(r["createElementVNode"])("input",{type:"hidden",name:"auth_nonce",value:e.authNonce},null,8,en),Object(r["createElementVNode"])("button",tn,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_StartOAuth")),1)],8,Zt)])]),nn])])])):Object(r["createCommentVNode"])("",!0),e.isClientConfigurable&&e.isClientConfigured&&e.userIsSuperUser?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",cn,[Object(r["createElementVNode"])("h3",on,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthClientConfig")),1),Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientId"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.clientId),1)]),Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientSecret"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.clientSecret),1)]),rn,Object(r["createElementVNode"])("form",{action:e.removeConfigUrl,method:"POST",enctype:"multipart/form-data",id:"removeConfigForm"},[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_DeleteUploadedClientConfig"))+":",1),Object(r["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.formNonce},null,8,an),Object(r["createElementVNode"])("button",sn,Object(r["toDisplayString"])(e.translate("General_Remove")),1)],8,ln)])):Object(r["createCommentVNode"])("",!0),e.userIsSuperUser?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",dn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.componentExtensions,(t,n)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n},[(Object(r["openBlock"])(),Object(r["createBlock"])(Object(r["resolveDynamicComponent"])(t),{"manual-config-nonce":e.configConnectProps.manualConfigNonce,"base-domain":e.configConnectProps.baseDomain,"base-url":e.configConnectProps.baseUrl,"manual-action-url":e.configConnectProps.manualActionUrl,"primary-text":e.configConnectProps.primaryText,"radio-options":e.configConnectProps.radioOptions,"manual-config-text":e.configConnectProps.manualConfigText,"connect-accounts-url":e.configConnectProps.connectAccountsUrl,"connect-accounts-btn-text":e.configConnectProps.connectAccountsBtnText,"auth-url":e.configConnectProps.authUrl,"unlink-url":e.configConnectProps.unlinkUrl,strategy:e.configConnectProps.strategy,"connected-with":e.configConnectProps.connectedWith},null,8,["manual-config-nonce","base-domain","base-url","manual-action-url","primary-text","radio-options","manual-config-text","connect-accounts-url","connect-accounts-btn-text","auth-url","unlink-url","strategy","connected-with"]))]))),128))])):Object(r["createCommentVNode"])("",!0)]),_:1},8,["content-title"])])}var bn=Object(r["defineComponent"])({props:{configuredMeasurables:{type:Object,required:!0},isClientConfigured:Boolean,isClientConfigurable:Boolean,isOAuthConfigured:Boolean,clientId:String,clientSecret:String,accounts:{type:Object,required:!0},sitesInfos:{type:Object,required:!0},currentSite:{type:Object,required:!0},urlOptions:{type:[Object,Array],required:!0},hasOAuthError:[String,Boolean],authNonce:{type:String,required:!0},formNonce:String,addGoogleSiteConfigNonce:String,removeGoogleSiteConfigNonce:String,removeGoogleAccountNonce:String,countOfAccountsWithAccess:Number,userIsSuperUser:String,extensions:Array,removeConfigUrl:String,configureConnectionProps:{type:Object,required:!0}},components:{ContentBlock:s["ContentBlock"],Field:we["Field"],Notification:s["Notification"]},directives:{ContentTable:s["ContentTable"]},data(){return{removeAccountConfigName:"",removeAccountName:"",isAddingMeasurable:!1,currentSiteToAdd:this.currentSite,googleAccountAndUrlToAdd:null,googleTypesToAdd:["web"],clientFile:null,clientText:""}},methods:{removeAccountConfig(e,t){const n=this.sitesInfos;this.removeAccountConfigName=n[e].name,s["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig,{yes(){t.target.submit()}})},removeAccount(e,t){this.removeAccountName=e.name,s["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount,{yes(){t.target.submit()}})},accountHasAvailableSites(e){const t=["siteOwner","siteFullUser","siteRestrictedUser"];return Object.values(e.urls).some(e=>-1!==t.indexOf(e))}},computed:{configuredMeasurablesToDisplay(){const e=Object.entries(this.configuredMeasurables);return Object.fromEntries(e.filter(([,e])=>{const[t]=e.googleSearchConsoleUrl.split("##");return!!this.accounts[t]}).map(([e,t])=>{const[n,c]=t.googleSearchConsoleUrl.split("##"),{apiKey:o}=this.accounts[n];return[e,Object.assign(Object.assign({},t),{},{account:n,url:c,apiKeyDisplay:Be(o)})]}))},accountsToDisplay(){const e=Object.entries(this.accounts),t=e.filter(([,e])=>e.hasAccess);return Object.fromEntries(t)},googleTypeOptions(){return{web:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeWeb"),image:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeImage"),video:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeVideo"),news:Object(s["translate"])("SearchEngineKeywordsPerformance_KeywordTypeNews")}},forwardToAuthUrl(){return"?"+s["MatomoUrl"].stringify(Object.assign(Object.assign({},s["MatomoUrl"].urlParsed.value),{},{action:"forwardToAuth"}))},visitOAuthHowTo(){const e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-oauth-client-config");return Object(s["translate"])("SearchEngineKeywordsPerformance_VisitOAuthHowTo",``,"","Google")},componentExtensions(){const e=this.extensions;return Object(r["markRaw"])(e.map(e=>Object(s["useExternalPluginComponent"])(e.plugin,e.component)))},configConnectProps(){return this.configureConnectionProps}}});bn.render=un;var mn=bn;const On={class:"ui-confirm",id:"confirmRemoveAccountConfig",ref:"confirmRemoveAccountConfig"},jn=["value"],pn=["value"],gn={class:"measurableList"},yn=Object(r["createElementVNode"])("th",null,null,-1),fn=["innerHTML"],En={key:0,class:"icon-error"},hn={key:0,class:"icon-error"},Nn=["onSubmit"],Vn=["value"],Sn=["value"],vn=["title"],kn={key:0},Cn={colspan:"6",align:"right"},An={key:1,class:"configureMeasurableForm"},wn={colspan:"2"},Bn={class:"account-select"},Dn={colspan:"3"},_n={action:"",method:"post"},Tn=["value"],Pn=["value"],Kn=["value"],xn=["value"],Un={class:"ui-confirm",id:"confirmDeleteAccount",ref:"confirmDeleteAccount"},Mn=["value"],In=["value"],Ln={class:"oauthconfigoptions"},Fn={key:0},Gn={key:1},Hn={key:2},qn={key:0},Rn=Object(r["createElementVNode"])("br",null,null,-1),zn={class:"accounts"},$n={class:"logo"},Yn=["src"],Wn=["innerHTML"],Xn={key:0},Jn={class:"accounterror"},Qn=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),Zn={key:1},ec={key:0,class:"accounterror"},tc=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),nc={key:1},cc={key:0},oc={class:"websites-list"},rc=Object(r["createElementVNode"])("span",{class:"icon-success"},null,-1),lc={key:1,class:"accounterror"},ac=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),ic={key:2},sc={class:"websites-list"},dc=Object(r["createElementVNode"])("span",{class:"icon-error"},null,-1),uc={key:2,class:"accounterror"},bc=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),mc={key:3,class:"accounterror"},Oc=Object(r["createElementVNode"])("span",{class:"icon-warning"},null,-1),jc=["innerHTML"],pc=["innerHTML"],gc={class:"cta"},yc=["action"],fc=["value"],Ec={type:"submit",class:"btn"},hc=["onSubmit"],Nc=["value"],Vc=["value"],Sc={type:"submit",class:"btn"},vc={class:"account add"},kc=Object(r["createElementVNode"])("div",{class:"icon-add logo"},null,-1),Cc={class:"cta"},Ac=["action"],wc=["value"],Bc={type:"submit",class:"btn"},Dc=Object(r["createElementVNode"])("div",{class:"clear"},null,-1),_c={key:3,class:"clientconfighelp"},Tc=["innerHTML"],Pc=Object(r["createElementVNode"])("br",null,null,-1),Kc=Object(r["createElementVNode"])("br",null,null,-1),xc={method:"post",action:"",id:"clientconfigform"},Uc=["value"],Mc={type:"submit",class:"btn"};function Ic(e,t,n,c,o,l){const a=Object(r["resolveComponent"])("ContentBlock"),i=Object(r["resolveComponent"])("Field"),s=Object(r["resolveComponent"])("Notification"),d=Object(r["resolveDirective"])("content-table");return Object(r["openBlock"])(),Object(r["createElementBlock"])("div",null,[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_SearchEngineKeywordsPerformance")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexConfigurationTitle")),1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexConfigurationDescription")),1)]),_:1},8,["content-title"]),e.isClientConfigured&&e.isOAuthConfigured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:0,class:Object(r["normalizeClass"])(Object.keys(e.configuredMeasurables).length?"configured":"")},[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurables")},{default:Object(r["withCtx"])(()=>{var n;return[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureMeasurableBelow")),1),Object(r["createElementVNode"])("div",On,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigRemovalConfirm",e.removeAccountConfigName)),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,jn),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,pn)],512),Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("table",gn,[Object(r["createElementVNode"])("thead",null,[Object(r["createElementVNode"])("tr",null,[Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("General_Measurable")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Mobile_Account")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("Goals_URL")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_LastImport")),1),Object(r["createElementVNode"])("th",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CreatedBy")),1),yn])]),Object(r["createElementVNode"])("tbody",null,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.configuredMeasurablesToDisplay,(t,n,c)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",{key:c,class:Object(r["normalizeClass"])(e.sitesInfos[n].accountValid&&e.sitesInfos[n].urlValid?"":"error")},[Object(r["createElementVNode"])("td",{innerHTML:e.$sanitize(e.sitesInfos[n].name)},null,8,fn),Object(r["createElementVNode"])("td",null,[e.sitesInfos[n].accountValid?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",En)),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.accounts[t.account].name),1)]),Object(r["createElementVNode"])("td",null,[e.sitesInfos[n].urlValid?Object(r["createCommentVNode"])("",!0):(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",hn)),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(t.hostUrl||t.host),1)]),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(e.sitesInfos[n].lastRun),1),Object(r["createElementVNode"])("td",null,Object(r["toDisplayString"])(t.createdByUser),1),Object(r["createElementVNode"])("td",null,[Object(r["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(r["withModifiers"])(t=>e.removeAccountConfig(n,t),["prevent"])},[Object(r["createElementVNode"])("input",{type:"hidden",name:"removeConfig",value:n},null,8,Vn),Object(r["createElementVNode"])("input",{type:"hidden",name:"removeSiteConfigNonce",value:e.removeYandexSiteConfigNonce},null,8,Sn),t.isDeletionAllowed?(Object(r["openBlock"])(),Object(r["createElementBlock"])("button",{key:0,type:"submit",class:"btn-flat icon-delete",title:e.translate("General_Delete")},null,8,vn)):Object(r["createCommentVNode"])("",!0)],40,Nn)])],2))),128)),e.countOfAccountsWithAccess?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",kn,[Object(r["createElementVNode"])("td",Cn,[Object(r["createElementVNode"])("button",{class:"btn",onClick:t[0]||(t[0]=t=>e.isAddingMeasurable=!0)},Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AddConfiguration")),1)])],512)),[[r["vShow"],!e.isAddingMeasurable]]):Object(r["createCommentVNode"])("",!0),e.countOfAccountsWithAccess?Object(r["withDirectives"])((Object(r["openBlock"])(),Object(r["createElementBlock"])("tr",An,[Object(r["createElementVNode"])("td",null,[Object(r["createVNode"])(i,{uicontrol:"site","full-width":!0,modelValue:e.currentSiteToAdd,"onUpdate:modelValue":t[1]||(t[1]=t=>e.currentSiteToAdd=t),title:e.translate("CoreHome_ChooseX",e.translate("General_Measurable"))},null,8,["modelValue","title"])]),Object(r["createElementVNode"])("td",wn,[Object(r["createElementVNode"])("div",Bn,[Object(r["createVNode"])(i,{uicontrol:"select",modelValue:e.yandexAccountAndHostIdToAdd,"onUpdate:modelValue":t[2]||(t[2]=t=>e.yandexAccountAndHostIdToAdd=t),title:e.translate("SearchEngineKeywordsPerformance_UrlOfAccount"),"full-width":!0,options:e.urlOptions},null,8,["modelValue","title","options"])])]),Object(r["createElementVNode"])("td",Dn,[Object(r["createElementVNode"])("form",_n,[Object(r["createElementVNode"])("input",{type:"hidden",name:"yandexSiteId",value:null===(n=e.currentSiteToAdd)||void 0===n?void 0:n.id},null,8,Tn),Object(r["createElementVNode"])("input",{type:"hidden",name:"addSiteConfigNonce",value:e.addYandexSiteConfigNonce},null,8,Pn),Object(r["createElementVNode"])("input",{type:"hidden",name:"yandexAccountAndHostId",value:e.yandexAccountAndHostIdToAdd},null,8,Kn),Object(r["createElementVNode"])("input",{type:"submit",class:"btn",value:e.translate("General_Save")},null,8,xn)])])],512)),[[r["vShow"],e.isAddingMeasurable]]):Object(r["createCommentVNode"])("",!0)])])),[[d]])]}),_:1},8,["content-title"])],2)):Object(r["createCommentVNode"])("",!0),e.isClientConfigured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:1,class:Object(r["normalizeClass"])(`oauthconfiguration ${e.isOAuthConfigured?"configured":""} yandex`)},[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_ConnectYandexAccounts")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("div",Un,[Object(r["createElementVNode"])("h2",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountRemovalConfirm",e.removeAccountName)),1),Object(r["createElementVNode"])("input",{role:"yes",type:"button",value:e.translate("General_Yes")},null,8,Mn),Object(r["createElementVNode"])("input",{role:"no",type:"button",value:e.translate("General_No")},null,8,In)],512),Object(r["createElementVNode"])("div",Ln,[e.isOAuthConfigured?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",Fn,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_CurrentlyConnectedAccounts",e.countOfAccountsWithAccess)),1)):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",Gn,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectFirstAccount")),1)),e.hasOAuthError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",Hn,[Object(r["createVNode"])(s,{context:"error"},{default:Object(r["withCtx"])(()=>[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthError"))+" ",1),"string"===typeof e.hasOAuthError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("span",qn,[Rn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.hasOAuthError),1)])):Object(r["createCommentVNode"])("",!0)]),_:1})])):Object(r["createCommentVNode"])("",!0),Object(r["createElementVNode"])("div",zn,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(e.accountsToDisplay,(t,n)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:n,class:Object(r["normalizeClass"])("account "+(0===Object.keys(t.urls).length||"string"===typeof t.hasError?"invalid":""))},[Object(r["createElementVNode"])("div",$n,[Object(r["createElementVNode"])("img",{src:t.picture},null,8,Yn)]),Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(t.name),1),Object(r["createElementVNode"])("p",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_AccountAddedBy",t.username,t.created_formatted))},null,8,Wn),"string"===typeof t.hasError?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Xn,[Object(r["createElementVNode"])("p",Jn,[Qn,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountConnectionValidationError"))+" "+Object(r["toDisplayString"])(t.hasError),1)]),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ReAuthenticateIfPermanentError")),1)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",Zn,[0===Object.keys(t.urls).length?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",ec,[tc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",nc,[Object.values(t.urls).some(e=>e.verified)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",cc,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AvailableSites")),1),Object(r["createElementVNode"])("ul",oc,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(Object.entries(t.urls).filter(([,e])=>e.verified),([e],t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t},[rc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e),1)]))),128))])])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",lc,[ac,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_AccountNoAccess")),1)])),Object.values(t.urls).some(e=>!e.verified)?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",ic,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_UnverifiedSites")),1),Object(r["createElementVNode"])("ul",sc,[(Object(r["openBlock"])(!0),Object(r["createElementBlock"])(r["Fragment"],null,Object(r["renderList"])(Object.entries(t.urls).filter(([,e])=>!e.verified),([e],t)=>(Object(r["openBlock"])(),Object(r["createElementBlock"])("li",{key:t},[dc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e),1)]))),128))])])):Object(r["createCommentVNode"])("",!0)]))])),t.authDaysAgo>=180?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",uc,[bc,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthAccessTimedOut")),1)])):t.authDaysAgo>=150?(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",mc,[Oc,Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_OAuthAccessWillTimeOutSoon",180-t.authDaysAgo))},null,8,jc)])):(Object(r["openBlock"])(),Object(r["createElementBlock"])("p",{key:4,innerHTML:e.$sanitize(e.translate("SearchEngineKeywordsPerformance_OAuthAccessWillTimeOut",180,180-t.authDaysAgo))},null,8,pc)),Object(r["createElementVNode"])("div",gc,[Object(r["createElementVNode"])("form",{method:"post",action:e.forwardToYandexAuthUrl},[Object(r["createElementVNode"])("input",{type:"hidden",name:"auth_nonce",value:e.auth_nonce},null,8,fc),Object(r["createElementVNode"])("button",Ec,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_Reauthenticate")),1)],8,yc),Object(r["createElementVNode"])("form",{method:"POST",action:"",onSubmit:Object(r["withModifiers"])(n=>e.removeAccount(t,n),["prevent"])},[Object(r["createElementVNode"])("input",{type:"hidden",name:"remove",value:n},null,8,Nc),Object(r["createElementVNode"])("input",{type:"hidden",name:"removeAccountNonce",value:e.removeYandexAccountNonce},null,8,Vc),Object(r["createElementVNode"])("button",Sc,Object(r["toDisplayString"])(e.translate("General_Remove")),1)],40,hc)])],2))),128)),Object(r["createElementVNode"])("div",vc,[kc,Object(r["createElementVNode"])("h3",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccount")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccountDescription","Yandex")),1),Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConnectAccountYandex","180")),1),Object(r["createElementVNode"])("div",Cc,[Object(r["createElementVNode"])("form",{method:"post",action:e.forwardToYandexAuthUrl,id:"clientauthform"},[Object(r["createElementVNode"])("input",{type:"hidden",name:"auth_nonce",value:e.auth_nonce},null,8,wc),Object(r["createElementVNode"])("button",Bc,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_StartOAuth")),1)],8,Ac)])]),Dc])])]),_:1},8,["content-title"])],2)):Object(r["createCommentVNode"])("",!0),e.isClientConfigured&&e.userIsSuperUser?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:2,class:Object(r["normalizeClass"])("clientconfiguration "+(e.isClientConfigured?"configured":""))},[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_OAuthClientConfig")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientId"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.clientId),1)]),Object(r["createElementVNode"])("p",null,[Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ClientSecret"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.clientSecret),1)])]),_:1},8,["content-title"])],2)):Object(r["createCommentVNode"])("",!0),e.userIsSuperUser?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",_c,[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_HowToGetOAuthClientConfig")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("p",{innerHTML:e.visitOAuthHowTo},null,8,Tc),Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthExampleText"))+" ",1),Pc,Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexFieldUrlToAppSite"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.baseDomain)+" ",1),Kc,Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_YandexFieldCallbackUri"))+":",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.baseDomainUrl)+"?module=SearchEngineKeywordsPerformance&action=processYandexAuthCode ",1)])]),_:1},8,["content-title"])])):Object(r["createCommentVNode"])("",!0),e.userIsSuperUser?(Object(r["openBlock"])(),Object(r["createElementBlock"])("div",{key:4,class:Object(r["normalizeClass"])(e.isClientConfigured?"":"clientconfiguration")},[Object(r["createVNode"])(a,{"content-title":e.translate("SearchEngineKeywordsPerformance_SetUpOAuthClientConfig")},{default:Object(r["withCtx"])(()=>[Object(r["createElementVNode"])("form",xc,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ProvideYandexClientConfig")),1),Object(r["createVNode"])(i,{uicontrol:"text",name:"clientid",modelValue:e.clientIdToUse,"onUpdate:modelValue":t[3]||(t[3]=t=>e.clientIdToUse=t),title:e.translate("SearchEngineKeywordsPerformance_ClientId"),autocomplete:"off"},null,8,["modelValue","title"]),Object(r["createVNode"])(i,{uicontrol:"text",name:"clientsecret",modelValue:e.clientSecretToUse,"onUpdate:modelValue":t[4]||(t[4]=t=>e.clientSecretToUse=t),title:e.translate("SearchEngineKeywordsPerformance_ClientSecret"),autocomplete:"off"},null,8,["modelValue","title"]),Object(r["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.formNonce},null,8,Uc),Object(r["createElementVNode"])("button",Mc,Object(r["toDisplayString"])(e.translate("General_Save")),1)])]),_:1},8,["content-title"])],2)):Object(r["createCommentVNode"])("",!0)])}var Lc=Object(r["defineComponent"])({props:{isClientConfigured:Boolean,isClientConfigurable:Boolean,isOAuthConfigured:Boolean,clientId:String,clientSecret:String,configuredMeasurables:{type:Object,required:!0},sitesInfos:{type:Object,required:!0},currentSite:{type:Object,required:!0},urlOptions:{type:[Object,Array],required:!0},hasOAuthError:[String,Boolean],accounts:{type:Object,required:!0},auth_nonce:{type:String,required:!0},formNonce:{type:String,required:!0},addYandexSiteConfigNonce:{type:String,required:!0},removeYandexSiteConfigNonce:{type:String,required:!0},removeYandexAccountNonce:{type:String,required:!0},countOfAccountsWithAccess:Number,userIsSuperUser:String,baseDomain:String,baseDomainUrl:String},components:{ContentBlock:s["ContentBlock"],Field:we["Field"],Notification:s["Notification"]},directives:{ContentTable:s["ContentTable"]},data(){return{removeAccountConfigName:"",removeAccountName:"",isAddingMeasurable:!1,currentSiteToAdd:this.currentSite,yandexAccountAndHostIdToAdd:null,clientIdToUse:"",clientSecretToUse:""}},methods:{removeAccountConfig(e,t){const n=this.sitesInfos;this.removeAccountConfigName=n[e].name,s["Matomo"].helper.modalConfirm(this.$refs.confirmRemoveAccountConfig,{yes(){t.target.submit()}})},removeAccount(e,t){this.removeAccountName=e.name,s["Matomo"].helper.modalConfirm(this.$refs.confirmDeleteAccount,{yes(){t.target.submit()}})}},computed:{configuredMeasurablesToDisplay(){const e=Object.entries(this.configuredMeasurables);return Object.fromEntries(e.filter(([,e])=>{const[t]=e.yandexAccountAndHostId.split("##");return!!this.accounts[t]}).map(([e,t])=>{const[n,c]=t.yandexAccountAndHostId.split("##"),o=this.accounts[n],{apiKey:r}=o,l=Object.entries(o.urls).find(([,e])=>e.host_id===c),a=null===l||void 0===l?void 0:l[0];return[e,Object.assign(Object.assign({},t),{},{account:n,host:c,hostUrl:a,apiKeyDisplay:Be(r)})]}))},forwardToYandexAuthUrl(){return"?"+s["MatomoUrl"].stringify(Object.assign(Object.assign({},s["MatomoUrl"].urlParsed.value),{},{action:"forwardToYandexAuth"}))},visitOAuthHowTo(){const e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-yandex-search-keywords-into-matomo/");return Object(s["translate"])("SearchEngineKeywordsPerformance_VisitOAuthHowTo",``,"","Yandex")},accountsToDisplay(){const e=Object.entries(this.accounts),t=e.filter(([,e])=>e.hasAccess);return Object.fromEntries(t)}}});Lc.render=Ic;var Fc=Lc;const Gc={class:"form-group row"},Hc={class:"col s12"},qc=Object(r["createElementVNode"])("br",null,null,-1),Rc=["innerHTML"],zc=Object(r["createElementVNode"])("br",null,null,-1),$c=Object(r["createElementVNode"])("br",null,null,-1),Yc=Object(r["createElementVNode"])("br",null,null,-1),Wc={class:"form-group row"},Xc={class:"col s12 m6"},Jc={id:"configFileUploadForm",action:"",method:"POST",enctype:"multipart/form-data"},Qc=Object(r["createElementVNode"])("input",{type:"hidden",id:"client",name:"client"},null,-1),Zc=["value"],eo=["disabled"],to=Object(r["createElementVNode"])("span",{class:"icon-upload"},null,-1),no=Object(r["createElementVNode"])("span",{class:"icon-upload"},null,-1);function co(e,t,n,c,o,l){return Object(r["openBlock"])(),Object(r["createElementBlock"])(r["Fragment"],null,[Object(r["createElementVNode"])("div",Gc,[Object(r["createElementVNode"])("div",Hc,[Object(r["createElementVNode"])("p",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureTheImporterLabel1")),1),Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_ConfigureTheImporterLabel2")),1),qc,Object(r["createElementVNode"])("span",{innerHTML:e.$sanitize(e.setupGoogleAnalyticsImportFaq)},null,8,Rc)]),Object(r["createElementVNode"])("p",null,[Object(r["createTextVNode"])(Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_OAuthExampleText")),1),zc,Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_GoogleAuthorizedJavaScriptOrigin"))+": ",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.baseDomain),1),$c,Object(r["createElementVNode"])("strong",null,Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_GoogleAuthorizedRedirectUri"))+": ",1),Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.baseUrl)+Object(r["toDisplayString"])(e.redirectUri),1),Yc])])]),Object(r["createElementVNode"])("div",Wc,[Object(r["createElementVNode"])("div",Xc,[Object(r["createElementVNode"])("form",Jc,[Object(r["createElementVNode"])("input",{type:"file",id:"clientfile",name:"clientfile",accept:".json",onChange:t[0]||(t[0]=(...t)=>e.processFileChange&&e.processFileChange(...t)),style:{display:"none"}},null,32),Qc,Object(r["createElementVNode"])("input",{type:"hidden",name:"config_nonce",value:e.manualConfigNonce},null,8,Zc),Object(r["createElementVNode"])("button",{type:"button",class:"btn",onClick:t[1]||(t[1]=t=>e.selectConfigFile()),disabled:e.isUploadButtonDisabled},[Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[to,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("General_Upload")),1)],512),[[r["vShow"],!e.isUploadButtonDisabled]]),Object(r["withDirectives"])(Object(r["createElementVNode"])("span",null,[no,Object(r["createTextVNode"])(" "+Object(r["toDisplayString"])(e.translate("SearchEngineKeywordsPerformance_Uploading")),1)],512),[[r["vShow"],e.isUploadButtonDisabled]])],8,eo)])])])],64)}var oo=Object(r["defineComponent"])({data(){return{redirectUri:"?module=SearchEngineKeywordsPerformance&action=processAuthCode",isSelectingFile:!1,isUploading:!1}},props:{manualConfigNonce:{type:String,required:!0},baseDomain:{type:String,required:!0},baseUrl:{type:String,required:!0}},methods:{selectConfigFile(){this.isSelectingFile=!0;const e=document.getElementById("clientfile");e&&e.click()},processFileChange(){const e=document.getElementById("clientfile"),t=document.getElementById("configFileUploadForm");e&&e.value&&t&&(this.isUploading=!0,t.submit())},checkForCancel(){if(!this.isSelectingFile||this.isUploading)return;const e=document.getElementById("clientfile");e&&!e.value&&(this.isSelectingFile=!1)}},computed:{setupGoogleAnalyticsImportFaq(){const e=Object(s["externalRawLink"])("https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-search-console-and-verify-your-website");return Object(s["translate"])("SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3",``,"")},isUploadButtonDisabled(){return this.isSelectingFile||this.isUploading}},mounted(){document.body.onfocus=this.checkForCancel}});oo.render=co;var ro=oo; +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */}})})); +//# sourceMappingURL=SearchEngineKeywordsPerformance.umd.min.js.map \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.min.js.map b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.min.js.map new file mode 100644 index 0000000..4430a08 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/SearchEngineKeywordsPerformance.umd.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://SearchEngineKeywordsPerformance/webpack/universalModuleDefinition","webpack://SearchEngineKeywordsPerformance/webpack/bootstrap","webpack://SearchEngineKeywordsPerformance/external \"CoreHome\"","webpack://SearchEngineKeywordsPerformance/external {\"commonjs\":\"vue\",\"commonjs2\":\"vue\",\"root\":\"Vue\"}","webpack://SearchEngineKeywordsPerformance/external \"CorePluginsAdmin\"","webpack://SearchEngineKeywordsPerformance/./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?0cda","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/Provider.vue?5e9b","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?c499","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Admin/AdminPage.vue?24f7","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/utilities.ts","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?89ee","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Bing/Configuration.vue?7cb0","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?9d47","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Google/Configuration.vue?02a3","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?a7b5","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Yandex/Configuration.vue?a3d0","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?4d5f","webpack://SearchEngineKeywordsPerformance/./plugins/SearchEngineKeywordsPerformance/vue/src/Configure/ConfigureConnection.vue?520e"],"names":["root","factory","exports","module","require","define","amd","self","this","__WEBPACK_EXTERNAL_MODULE__19dc__","__WEBPACK_EXTERNAL_MODULE__8bbf__","__WEBPACK_EXTERNAL_MODULE_a5a2__","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","window","currentScript","document","src","match","class","content-title","translate","providers","provider","id","logos","logo","index","length","title","logoTooltip","alt","$sanitize","description","note","is_experimental","href","configureUrl","is_configured","props","type","required","computed","keys","configured_site_ids","problems","sites","accounts","isConfiguredWithoutSite","stringify","urlParsed","action","render","Array","components","ContentBlock","Provider","ref","colspan","align","method","configuredMeasurables","role","configuredMeasurablesToDisplay","config","siteId","sitesInfos","accountValid","urlValid","main_url","apiKeyDisplay","url","lastRun","createdByUser","removeAccountConfig","$event","removeBingSiteConfigNonce","isDeletionAllowed","countOfAccountsWithAccess","isAddingMeasurable","uicontrol","currentSiteToAdd","bingAccountAndUrlToAdd","options","urlOptions","addBingSiteConfigNonce","accountsToDisplay","account","username","urls","getDisplayApiKey","apiKey","hasError","values","some","isVerified","entries","filter","removeAccount","removeBingAccountNonce","hasApiKeyError","bingApiKeyInstructionText","error","full-width","apiKeyToAdd","autocomplete","formNonce","substr","currentSite","String","apikey","Number","userIsSuperUser","removeAccountConfigName","removeAccountName","Field","directives","ContentTable","methods","event","siteInfos","helper","modalConfirm","$refs","confirmRemoveAccountConfig","target","submit","confirmDeleteAccount","fromEntries","bingSiteUrl","split","map","asArray","filtered","hasAccess","isClientConfigured","isClientConfigurable","isOAuthConfigured","googleWebKeywords","googleImageKeywords","googleVideoKeywords","googleNewsKeywords","replaceAll","test","removeGoogleSiteConfigNonce","googleTypesToAdd","var-type","googleTypeOptions","googleAccountAndUrlToAdd","addGoogleSiteConfigNonce","hasOAuthError","context","accountId","picture","accountHasAvailableSites","indexOf","removeGoogleAccountNonce","forwardToAuthUrl","authNonce","clientId","clientSecret","removeConfigUrl","enctype","componentExtensions","refComponent","manual-config-nonce","configConnectProps","manualConfigNonce","base-domain","baseDomain","base-url","baseUrl","manual-action-url","manualActionUrl","primary-text","primaryText","radio-options","radioOptions","manual-config-text","manualConfigText","connect-accounts-url","connectAccountsUrl","connect-accounts-btn-text","connectAccountsBtnText","auth-url","authUrl","unlink-url","unlinkUrl","strategy","connected-with","connectedWith","Boolean","extensions","configureConnectionProps","Notification","clientFile","clientText","siteAccessLevels","siteAccess","googleSearchConsoleUrl","web","image","video","news","link","plugin","component","hostUrl","host","removeYandexSiteConfigNonce","yandexAccountAndHostIdToAdd","addYandexSiteConfigNonce","hostdata","verified","authDaysAgo","forwardToYandexAuthUrl","auth_nonce","removeYandexAccountNonce","visitOAuthHowTo","baseDomainUrl","clientIdToUse","clientSecretToUse","yandexAccountAndHostId","accountInfo","hostUrlPair","find","data","host_id","setupGoogleAnalyticsImportFaq","redirectUri","accept","processFileChange","style","selectConfigFile","disabled","isUploadButtonDisabled","isSelectingFile","isUploading","fileInput","getElementById","click","configFileUploadForm","body","onfocus","checkForCancel"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,kBAAZC,SAA0C,kBAAXC,OACxCA,OAAOD,QAAUD,EAAQG,QAAQ,YAAaA,QAAQ,OAAQA,QAAQ,qBAC7C,oBAAXC,QAAyBA,OAAOC,IAC9CD,OAAO,CAAC,WAAY,CAAE,oBAAqBJ,GACjB,kBAAZC,QACdA,QAAQ,mCAAqCD,EAAQG,QAAQ,YAAaA,QAAQ,OAAQA,QAAQ,qBAElGJ,EAAK,mCAAqCC,EAAQD,EAAK,YAAaA,EAAK,OAAQA,EAAK,sBARxF,CASoB,qBAATO,KAAuBA,KAAOC,MAAO,SAASC,EAAmCC,EAAmCC,GAC/H,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUZ,QAGnC,IAAIC,EAASS,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHd,QAAS,IAUV,OANAe,EAAQH,GAAUI,KAAKf,EAAOD,QAASC,EAAQA,EAAOD,QAASW,GAG/DV,EAAOa,GAAI,EAGJb,EAAOD,QA0Df,OArDAW,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASnB,EAASoB,EAAMC,GAC3CV,EAAoBW,EAAEtB,EAASoB,IAClCG,OAAOC,eAAexB,EAASoB,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAS3B,GACX,qBAAX4B,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAexB,EAAS4B,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAexB,EAAS,aAAc,CAAE8B,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,kBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFAxB,EAAoBgB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOnB,EAAoBQ,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRvB,EAAoB2B,EAAI,SAASrC,GAChC,IAAIoB,EAASpB,GAAUA,EAAOgC,WAC7B,WAAwB,OAAOhC,EAAO,YACtC,WAA8B,OAAOA,GAEtC,OADAU,EAAoBQ,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRV,EAAoBW,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG7B,EAAoBgC,EAAI,oDAIjBhC,EAAoBA,EAAoBiC,EAAI,Q,uBClFrD3C,EAAOD,QAAUO,G,qBCAjBN,EAAOD,QAAUQ,G,mBCAjBP,EAAOD,QAAUS,G,kCCEjB,G,mQAAsB,qBAAXoC,OAAwB,CACjC,IAAIC,EAAgBD,OAAOE,SAASD,cAWhCE,EAAMF,GAAiBA,EAAcE,IAAIC,MAAM,2BAC/CD,IACF,IAA0BA,EAAI,IAKnB,I,qBCENE,MAAM,oB,EAQT,gCAAyB,OAApBA,MAAM,SAAO,S,0JAftB,yBAiBe,GAhBZC,gBAAe,EAAAC,UAAU,oE,8BAE1B,IAAkF,CAAlF,gCAAkF,sCAA5E,EAAAA,UAAU,6DAAD,GAEf,gCAAiF,sCAA3E,EAAAA,UAAU,4DAAD,GAEf,gCASM,MATN,EASM,E,2BARJ,gCAKW,2CAJU,EAAAC,UAAZC,I,yBADT,yBAKW,GAHRlB,IAAKkB,EAASC,GACdD,SAAUA,G,6BAIb,M,qHCICJ,MAAM,gB,oBAGCA,MAAM,O,SAGNA,MAAM,O,wDAzBlB,gCA6BM,OA5BHA,MAAK,6B,2BAAgD,a,YAA+B,cAAc,WAAS,iB,6BAM5G,gCAOM,2CANoB,EAAAI,SAASE,MAAK,CAA9BC,EAAMC,K,yBADhB,gCAOM,OALHtB,IAAKsB,EACLR,MAAK,qCAAU,EAAAI,SAASE,MAAMG,OAAS,EAAI,SAAW,KACtDC,MAAO,EAAAC,a,CAER,gCAAsC,OAAhCb,IAAKS,EAAOK,IAAK,EAAAR,SAASlC,M,yBAElC,gCAA4B,uCAArB,EAAAkC,SAASlC,MAAI,GACpB,gCAAgD,KAA7C,UAAQ,EAAA2C,UAAU,EAAAT,SAASU,c,UAC9B,gCAAkD,UAA/C,gCAA2C,MAAvC,UAAQ,EAAAD,UAAU,EAAAT,SAASW,O,YAEJ,EAAAX,SAASY,iB,yBAAvC,gCAAwE,IAAxE,EAAwD,iB,uCAExD,gCAOI,KAPAC,KAAM,EAAAC,aAAclB,MAAM,O,CACF,EAAAI,SAASe,e,yBAAnC,gCAES,SAFT,EAES,6BADJ,EAAAjB,UAAU,wDAAD,K,yBAEd,gCAES,SAFT,EAES,6BADJ,EAAAA,UAAU,uDAAD,K,SC1BL,mCAAgB,CAC7BkB,MAAO,CACLhB,SAAU,CACRiB,KAAMhD,OACNiD,UAAU,IAGdC,SAAU,CACR,aACE,MAAMnB,EAAWhD,KAAKgD,SACtB,OAAOA,EAASe,gBAC2C,IAArD9C,OAAOmD,KAAKpB,EAASqB,qBAAqBhB,QACzCpC,OAAOmD,KAAKpB,EAASsB,SAASC,OAAOlB,QACrCpC,OAAOmD,KAAKpB,EAASsB,SAASE,UAAUnB,SAEjD,cACE,MAAML,EAAWhD,KAAKgD,SAChByB,EAA0BzB,EAASe,eACiB,IAArD9C,OAAOmD,KAAKpB,EAASqB,qBAAqBhB,OAE/C,OAAIoB,EACK,uBAAU,sEAGfzB,EAASe,cACJ,uBAAU,yDAGZ,uBAAU,6DAEnB,eACE,MAAO,IAAI,eAAUW,UAAU,OAAD,wBACzB,eAAUC,UAAUnD,OAAK,IAC5BoD,OAAQ,YAAY5E,KAAKgD,SAASC,UC9C1C,EAAO4B,OAAS,EAED,QCAA,+BAAgB,CAC7Bb,MAAO,CACLjB,UAAW,CACTkB,KAAMa,MACNZ,UAAU,IAGda,WAAY,CACVC,aAAA,kBACAC,cCXJ,EAAOJ,OAASA,EAED,Q,SC8BFjC,MAAM,aAAaK,GAAG,6BAA6BiC,IAAI,8B,2BAUnCtC,MAAM,kB,EAQzB,gCAAS,mB,aAKLuC,QAAQ,K,SAiBJvC,MAAM,c,SAINA,MAAM,c,gEAuBVuC,QAAQ,IAAIC,MAAM,S,SASpBxC,MAAM,2B,GASJuC,QAAQ,K,GACLvC,MAAM,0B,GASTuC,QAAQ,K,GACJP,OAAO,GAAGS,OAAO,Q,mDAoB1BzC,MAAM,aAAaK,GAAG,uBAAuBiC,IAAI,wB,2BAWjDtC,MAAM,Y,yBAoBJA,MAAM,gB,EACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,qBAIvBA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,0BAOpBA,MAAM,iB,GAON,gCAAkC,QAA5BA,MAAM,gBAAc,S,eAK3BA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,eAQxBA,MAAM,iB,GAON,gCAAgC,QAA1BA,MAAM,cAAY,S,IAO7BA,MAAM,O,8CAQCqB,KAAK,SAASrB,MAAM,O,IAM1ByC,OAAO,OAAOT,OAAO,I,GACzB,gCAAiC,OAA5BhC,MAAM,iBAAe,S,2BAMvBA,MAAM,gB,GACP,gCAAM,mB,GACN,gCAAkC,QAA5BA,MAAM,gBAAc,S,iBAevBA,MAAM,O,IACDqB,KAAK,SAASrB,MAAM,O,GAOlC,gCAAyB,OAApBA,MAAM,SAAO,S,yMApQ1B,gCAwQM,YAvQJ,yBAMe,GALZC,gBAAe,EAAAC,UAAU,oE,8BAE1B,IAAkF,CAAlF,gCAAkF,uCAA3E,EAAAA,UAAU,2DAAD,G,6BAAkE,IAElF,6BAAG,EAAAA,UAAU,iEAAD,K,0BAIN7B,OAAOmD,KAAK,EAAAI,UAAUnB,OAAS,G,yBADvC,gCAsHM,O,MApHHT,MAAK,qDAA0B3B,OAAOmD,KAAK,EAAAkB,uBAAuBjC,O,oBAGnE,yBAgHe,GA/GZR,gBAAe,EAAAC,UAAU,yD,8BAE1B,IAAkF,CAAlF,gCAAkF,sCAA5E,EAAAA,UAAU,6DAAD,GAEf,gCAOM,MAPN,EAOM,CANJ,gCAGS,uCAHF,EAAAA,U,uDAA2F,4B,GAIlG,gCAAmE,SAA5DyC,KAAK,MAAMtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,gB,UAClD,gCAAiE,SAA1DyC,KAAK,KAAKtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,e,gBAGnD,gCAiGM,Y,sDAhGJ,gCA+FQ,QA/FR,EA+FQ,CA9FN,gCASQ,cARR,gCAOK,WANH,gCAA8C,uCAAvC,EAAAA,UAAU,uBAAD,GAChB,gCAA0C,uCAAnC,EAAAA,UAAU,mBAAD,GAChB,gCAAqC,uCAA9B,EAAAA,UAAU,cAAD,GAChB,gCAAsE,uCAA/D,EAAAA,UAAU,+CAAD,GAChB,gCAAqE,uCAA9D,EAAAA,UAAU,8CAAD,GAChB,MAGF,gCAmFQ,cAlFG7B,OAAOmD,KAAK,EAAAkB,uBAAuBjC,O,iEAA9C,gCAMK,QALH,gCAIK,KAJL,EAIK,CAHH,gCAES,2CADJ,EAAAP,UAAU,wDAAD,S,2BAIlB,gCAoCK,2CAnC+B,EAAA0C,+BAA8B,CAAxDC,EAAQC,EAAQtC,K,yBAD1B,gCAoCK,MAlCFtB,IAAKsB,EACLR,MAAK,4BAAG,EAAA+C,WAAWD,GAAQE,cAAiB,EAAAD,WAAWD,GAAQG,S,cAGhE,gCAEK,W,0DADA,EAAAF,WAAWD,GAAQ5E,MAAO,IAAC,mCAAgD,YAA1C,IAAC,6BAAG,EAAA6E,WAAWD,GAAQI,UAAW,IAAC,KAGzE,gCAGK,WAF6B,EAAAH,WAAWD,GAAQE,a,iEAAnD,gCAAwE,OAAxE,I,6BAAwE,IACxE,6BAAGH,EAAOM,eAAa,KAEzB,gCAEK,WAD6B,EAAAJ,WAAWD,GAAQG,S,iEAAnD,gCAAoE,OAApE,I,0DAAuEJ,EAAOO,KAAG,KAEnF,gCAAyC,uCAAlC,EAAAL,WAAWD,GAAQO,SAAO,GACjC,gCAAmC,uCAA5BR,EAAOS,eAAa,GAC3B,gCAgBK,WAfH,gCAcO,QAbLb,OAAO,OACPT,OAAO,GACN,SAAM,8BAAU,EAAAuB,oBAAoBT,EAAQU,GAAM,c,CAEnD,gCAAyD,SAAlDnC,KAAK,SAASnD,KAAK,eAAgBU,MAAOkE,G,UACjD,gCAC0C,SADnCzB,KAAK,SAASnD,KAAK,wBAClBU,MAAO,EAAA6E,2B,UAKPZ,EAAOa,mB,yBAJf,gCAKU,U,MAJRrC,KAAK,SACLrB,MAAM,uBACLU,MAAO,EAAAR,UAAU,mB,uEAMa,EAAAyD,0B,sDAAvC,gCASK,QARH,gCAOK,KAPL,EAOK,CANH,gCAKS,UAJP3D,MAAM,MACL,QAAK,0CAAU,EAAA4D,oBAAqB,EAAH,e,6BAE/B,EAAA1D,UAAU,qDAAD,M,oBANL,EAAA0D,sB,uCAWyB,EAAAD,0B,sDADtC,gCA2BK,KA3BL,EA2BK,CAzBH,gCAMK,WALH,yBAIE,GAHAE,UAAU,O,WACD,EAAAC,iB,qCAAA,EAAAA,iBAAgB,GACxBpD,MAAO,EAAAR,UAAU,mBAAoB,EAAAA,UAAU,wB,iCAGpD,gCASK,KATL,EASK,CARH,gCAOM,MAPN,EAOM,CANJ,yBAKE,GAJA2D,UAAU,S,WACD,EAAAE,uB,qCAAA,EAAAA,uBAAsB,GAC9BrD,MAAO,EAAAR,UAAU,gDACjB8D,QAAS,EAAAC,Y,6CAIhB,gCAOK,KAPL,EAOK,CANH,gCAKO,OALP,EAKO,CAJL,gCAAoE,SAA7D5C,KAAK,SAASnD,KAAK,aAAcU,MAAO,EAAAkF,iBAAiBzD,I,UAChE,gCAA+E,SAAxEgB,KAAK,SAASnD,KAAK,qBAAsBU,MAAO,EAAAsF,wB,UACvD,gCAA8E,SAAvE7C,KAAK,SAASnD,KAAK,oBAAqBU,MAAO,EAAAmF,wB,UACtD,gCAAsE,SAA/D1C,KAAK,SAASrB,MAAM,MAAOpB,MAAO,EAAAsB,UAAU,iB,kCAvB7C,EAAA0D,sB,6HAiCpB,gCAsIM,OArIH5D,MAAK,qDAA0B3B,OAAOmD,KAAK,EAAAI,UAAUnB,OAAS,EAAI,aAAe,M,CAElF,yBAkIe,GAjIZR,gBAAe,EAAAC,UAAU,kD,8BAE1B,IASM,CATN,gCASM,MATN,EASM,CARJ,gCAKK,uCAJA,EAAAA,U,wDAAgG,sB,GAKrG,gCAAmE,SAA5DyC,KAAK,MAAMtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,gB,UAClD,gCAAiE,SAA1DyC,KAAK,KAAKtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,e,gBAGnD,gCAmHM,MAnHN,EAmHM,E,2BAlHJ,gCA8EM,2CA7Ec,EAAAiE,kBAAXC,I,yBADT,gCA8EM,OA5EHlF,IAAKkF,EAAQC,SACbrE,MAAK,wCAAkD,IAArC3B,OAAOmD,KAAK4C,EAAQE,MAAM7D,QAAqD,kBAAhB,EAAQ,SAAQ,gB,CAGlG,gCAGO,OAFJT,MAAK,oCAA+C,IAArC3B,OAAOmD,KAAK4C,EAAQE,MAAM7D,QAAuD,kBAAhB,EAAQ,SAAQ,6B,QAInG,gCAA+C,uCAAxC,EAAA8D,iBAAiBH,EAAQI,SAAM,GAEtC,gCAIQ,KAJL,UAAQ,EAAA3D,UAAU,EAAAX,U,iDAAyF,EAAQ,SAAwB,EAAQ,qB,UAM5F,kBAArBkE,EAAQK,U,yBAA7C,gCAGI,IAHJ,EAGI,CAFF,E,6BAAkC,IAClC,6BAAG,EAAAvE,UAAU,mDAAoDkE,EAAQK,WAAQ,O,yBAEnF,gCA0CM,UAzC+D,IAArCpG,OAAOmD,KAAK4C,EAAQE,MAAM7D,Q,yBAAxD,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAP,UAAU,oDAAD,O,yBAEd,gCAoCM,UAnCO7B,OAAOqG,OAAON,EAAQE,MAAMK,KAAMC,GAAeA,I,yBAA5D,gCAaM,UAZJ,gCAAwE,sCAAlE,EAAA1E,UAAU,mDAAD,GAEf,gCASK,KATL,GASK,E,2BARH,gCAOK,2CANsB7B,OAAOwG,QAAQT,EAAQE,MAAMQ,O,GAAoC,KAAgB,G,EAAjG1B,GAAM5C,K,yBADjB,gCAOK,MAHFtB,IAAKsB,GAAK,CAEX,G,6BAAkC,IAAC,6BAAG4C,GAAG,O,qCAI/C,gCAKM,UAJJ,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAlD,UAAU,oDAAD,QAIL7B,OAAOqG,OAAON,EAAQE,MAAMK,KAAMC,IAAgBA,I,yBAA7D,gCAaM,UAZJ,gCAAyE,sCAAnE,EAAA1E,UAAU,oDAAD,GAEf,gCASK,KATL,GASK,E,2BARH,gCAOK,2CANsB7B,OAAOwG,QAAQT,EAAQE,MAAMQ,O,GAAoC,MAAiB,G,EAAlG1B,GAAM5C,K,yBADjB,gCAOK,MAHFtB,IAAKsB,GAAK,CAEX,G,6BAAgC,IAAC,6BAAG4C,GAAG,O,wDAOjD,gCAUM,MAVN,GAUM,CATJ,gCAQO,QAPLX,OAAO,OACPT,OAAO,GACN,SAAM,8BAAU,EAAA+C,cAAcX,EAASZ,GAAM,c,CAE9C,gCAA2D,SAApDnC,KAAK,SAASnD,KAAK,SAAUU,MAAOwF,EAAQI,Q,WACnD,gCAA+E,SAAxEnD,KAAK,SAASnD,KAAK,qBAAsBU,MAAO,EAAAoG,wB,WACvD,gCAA4E,SAA5E,GAA4E,6BAAvC,EAAA9E,UAAU,mBAAD,I,qBAKpD,gCA+BM,OA/BAF,MAAK,4CAAiB,EAAAiF,eAAiB,UAAY,M,CACvD,gCA6BO,OA7BP,GA6BO,CA5BL,GAEA,gCAAqE,uCAA9D,EAAA/E,UAAU,8CAAD,GAEhB,gCAA2D,QAArD,UAAQ,EAAAW,UAAU,EAAAqE,4B,WAEM,EAAAD,gB,yBAA9B,gCAII,IAJJ,GAII,CAHF,GACA,G,6BAAkC,IAClC,6BAAG,EAAA/E,UAAU,mDAAoD,EAAAiF,QAAK,M,uCAGxE,yBAOE,GANAtB,UAAU,OACTuB,cAAY,EACblH,KAAK,S,WACI,EAAAmH,Y,qCAAA,EAAAA,YAAW,GACnB3E,MAAO,EAAAR,UAAU,0CAClBoF,aAAa,O,+BAGf,gCAA8D,SAAvDjE,KAAK,SAASnD,KAAK,eAAgBU,MAAO,EAAA2G,W,WAEjD,gCAIM,MAJN,GAIM,CAHJ,gCAES,SAFT,GAES,6BADJ,EAAArF,UAAU,8CAAD,Q,GAMpB,O;;;;;;;;;;;;;;GCrQJ,SAAUqE,GAAiBC,EAAS,IACxC,MAAO,GAAGA,EAAOgB,OAAO,EAAG,UAAUhB,EAAOgB,OAAOhB,EAAO/D,OAAS,EAAG,KCgBzD,oCAAgB,CAC7BW,MAAO,CACLsB,sBAAuB,CACrBrB,KAAMhD,OACNiD,UAAU,GAEZM,SAAU,CACRP,KAAMhD,OACNiD,UAAU,GAEZyB,WAAY,CACV1B,KAAMhD,OACNiD,UAAU,GAEZmE,YAAa,CACXpE,KAAMhD,OACNiD,UAAU,GAEZ2C,WAAY,CACV5C,KAAM,CAAChD,OAAQ6D,OACfZ,UAAU,GAEZ6D,MAAOO,OACPC,OAAQD,OACRH,UAAWG,OACXxB,uBAAwBwB,OACxBjC,0BAA2BiC,OAC3BV,uBAAwBU,OACxB/B,0BAA2BiC,OAC3BC,gBAAiBH,QAEnB,OACE,MAAO,CACLI,wBAAyB,GACzBC,kBAAmB,GACnBnC,oBAAoB,EACpBE,iBAAkB1G,KAAKqI,YACvB1B,uBAAwB,KACxBsB,YAAajI,KAAKuI,QAAU,KAGhCxD,WAAY,CACVC,aAAA,kBACA4D,MAAA,aAEFC,WAAY,CACVC,aAAA,mBAEFC,QAAS,CACP,oBAAoBrD,EAAuBsD,GACzC,MAAMC,EAAYjJ,KAAK2F,WACvB3F,KAAK0I,wBAA0BO,EAAUvD,GAAQ5E,KAEjD,YAAOoI,OAAOC,aAAanJ,KAAKoJ,MAAMC,2BAA2C,CAC/E,MACGL,EAAMM,OAA2BC,aAIxCpC,oBACA,cAAcH,EAAsBgC,GAClChJ,KAAK2I,kBAAoB3I,KAAKmH,iBAAiBH,EAAQI,QACvD,YAAO8B,OAAOC,aAAanJ,KAAKoJ,MAAMI,qBAAqC,CACzE,MACGR,EAAMM,OAA2BC,cAK1CpF,SAAU,CACR,iBACE,MAA6B,qBAAfnE,KAAK+H,OAAwC,OAAf/H,KAAK+H,OAEnD,iCACE,MAAMN,EAAUxG,OAAOwG,QACrBzH,KAAKsF,uBAGP,OAAOrE,OAAOwI,YACZhC,EAAQC,OAAO,EAAE,CAAEjC,MACjB,MAAOuB,GAAWvB,EAAOiE,YAAYC,MAAM,MAC3C,QAAS3J,KAAKwE,SAASwC,KACtB4C,IAAI,EAAElE,EAAQD,MACf,MAAOuB,EAAShB,GAAOP,EAAOiE,YAAYC,MAAM,OAC1C,OAAEvC,GAAWpH,KAAKwE,SAASwC,GAEjC,MAAO,CACLtB,EAAM,+BAEDD,GAAM,IACTuB,UACAhB,MACAD,cAAe/F,KAAKmH,iBAAiBC,UAM/C,4BACE,MAAMpB,EAAM,6BAAgB,qFAC5B,OAAO,uBACL,wDACA,qFACA,OACA,YAAYA,gDACZ,SAGJ,oBACE,MAAM6D,EAAU5I,OAAOwG,QAAQzH,KAAKwE,UAC9BsF,EAAWD,EAAQnC,OAAO,EAAE,CAAElG,KAAWA,EAAMuI,WAErD,OAAO9I,OAAOwI,YAAYK,OC7IhC,GAAOjF,OAAS,GAED,U,qBCkBFjC,MAAM,uB,eAWJA,MAAM,aAAaK,GAAG,6BAA6BiC,IAAI,8B,8BASrCtC,MAAM,kB,GASzB,gCAAS,mB,eAKLuC,QAAQ,K,2BA4BJvC,MAAM,c,UAINA,MAAM,c,GACkC,gCAAM,mB,gBAMlD,gCAA+B,QAAzBA,MAAM,aAAW,S,gBAQvB,gCAA+B,QAAzBA,MAAM,aAAW,S,iEAwBzBA,MAAM,2B,IAqBDA,MAAM,kB,IAUTuC,QAAQ,K,IACJP,OAAO,GAAGS,OAAO,Q,sFA4B/BzC,MAAM,sB,IAEFA,MAAM,mB,IAGLA,MAAM,aAAaK,GAAG,uBAAuBiC,IAAI,wB,8BASjDtC,MAAM,sB,+CAcH,gCAAM,mB,IAMPA,MAAM,Y,IAMFA,MAAM,Q,2CAaNA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,0BAavBA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,0BAQtBA,MAAM,iB,GAON,gCAAkC,QAA5BA,MAAM,gBAAc,S,UAI7BA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,eAMtBA,MAAM,iB,GAON,gCAAgC,QAA1BA,MAAM,cAAY,S,IAO7BA,MAAM,O,8CAQCqB,KAAK,SAASrB,MAAM,O,IAK7BA,MAAM,e,GAET,gCAAiC,OAA5BA,MAAM,iBAAe,S,uDA4BrBA,MAAM,O,+BAOCqB,KAAK,SAASrB,MAAM,O,GAOlC,gCAAyB,OAApBA,MAAM,SAAO,S,UAOtBA,MAAM,uB,IAGFA,MAAM,mB,GAUV,gCAAM,mB,+BAOIqB,KAAK,SAASrB,MAAM,O,oQA5WpC,gCAqYM,YApYJ,yBAmYe,GAlYZC,gBAAe,EAAAC,UAAU,oE,8BAE1B,IAMM,CALG,EAAAkH,qBAAsB,EAAAC,sBAAyB,EAAAxB,gB,iEADxD,gCAMM,UAHJ,gCAEM,MAFN,GAEM,6BADD,EAAA3F,UAAU,2EAAD,MAKR,EAAAkH,oBAAsB,EAAAE,mB,yBAD9B,gCA4JM,UAzJF,gCAAgF,uCAAzE,EAAApH,UAAU,yDAAD,GAChB,gCAAkF,sCAA5E,EAAAA,UAAU,6DAAD,GAEf,gCAOM,MAPN,GAOM,CANJ,gCAGS,uCAHF,EAAAA,U,uDAA+F,4B,GAItG,gCAAmE,SAA5DyC,KAAK,MAAMtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,gB,WAClD,gCAAiE,SAA1DyC,KAAK,KAAKtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,e,uEAGnD,gCAmIM,QAnIN,GAmIM,CAlIJ,gCAUQ,cATR,gCAQK,WAPH,gCAA8C,uCAAvC,EAAAA,UAAU,uBAAD,GAChB,gCAA8E,uCAAvE,EAAAA,UAAU,uDAAD,GAChB,gCAA0C,uCAAnC,EAAAA,UAAU,mBAAD,GAChB,gCAAqC,uCAA9B,EAAAA,UAAU,cAAD,GAChB,gCAAsE,uCAA/D,EAAAA,UAAU,+CAAD,GAChB,gCAAqE,uCAA9D,EAAAA,UAAU,8CAAD,GAChB,OAGF,gCAsHM,cArH2D,IAAvD7B,OAAOmD,KAAK,EAAAoB,gCAAgCnC,Q,yBAAtD,gCAMK,SALH,gCAIK,KAJL,GAIK,CAHH,gCAES,2CADJ,EAAAP,UAAU,wDAAD,Q,mEAIlB,gCAgEK,2CA/D+B,EAAA0C,+BAA8B,CAAxDC,EAAQC,EAAQtC,K,yBAD1B,gCAgEK,MA9DFtB,IAAKsB,EACLR,MAAK,4BAAG,EAAA+C,WAAWD,GAAQE,cAAiB,EAAAD,WAAWD,GAAQG,S,cAGhE,gCAAqD,MAAjD,UAAQ,EAAApC,UAAU,EAAAkC,WAAWD,GAAQ5E,O,WACzC,gCAaK,uCAZA2E,EAAO0E,kBAAsC,YAAS,kD,IAEhD,IACT,6BAAG1E,EAAO2E,oBAAwC,YAAS,oD,IAElD,IACT,6BAAG3E,EAAO4E,oBAAwC,YAAS,oD,IAElD,IACT,6BAAG5E,EAAO6E,mBAAuC,YAAS,mD,OAI5D,gCAGK,WAF6B,EAAA3E,WAAWD,GAAQE,a,iEAAnD,gCAAwE,OAAxE,K,6BAAwE,IACxE,6BAAG,EAAApB,SAASiB,EAAOuB,SAASlG,MAAI,KAElC,gCAmBK,WAlB6B,EAAA6E,WAAWD,GAAQG,S,iEAAnD,gCAAoE,OAApE,K,6BAAoE,IACpE,6BAAGJ,EAAOO,IAAIuE,WAAW,aAAc,KAAM,IAAC,M,cAExBC,KAAK/E,EAAOO,M,yBADlC,gCAOO,Q,MALLpD,MAAM,gBACLU,MAAO,EAAAR,UAAU,uD,CAElB,G,6BAA+B,KAC9B,6BAAG,EAAAA,UAAU,mDAAoD,KACpE,I,eAEqB0H,KAAK/E,EAAOO,M,yBADjC,gCAOO,Q,MALLpD,MAAM,gBACLU,MAAO,EAAAR,UAAU,0D,CAElB,G,6BAA+B,KAC9B,6BAAG,EAAAA,UAAU,sDAAuD,KACvE,I,gDAEF,gCAAyC,uCAAlC,EAAA6C,WAAWD,GAAQO,SAAO,GACjC,gCAAmC,uCAA5BR,EAAOS,eAAa,GAC3B,gCAgBK,WAfH,gCAcO,QAbLb,OAAO,OACPT,OAAO,GACN,SAAM,8BAAU,EAAAuB,oBAAoBT,EAAQU,GAAM,c,CAEnD,gCAAyD,SAAlDnC,KAAK,SAASnD,KAAK,eAAgBU,MAAOkE,G,WACjD,gCAC4C,SADrCzB,KAAK,SAASnD,KAAK,wBAClBU,MAAO,EAAAiJ,6B,WAKPhF,EAAOa,mB,yBAJf,gCAKU,U,MAJRrC,KAAK,SACLrB,MAAM,uBACLU,MAAO,EAAAR,UAAU,mB,yEAOY,EAAAyD,0B,sDADtC,gCA4CK,KA5CL,GA4CK,CA1CH,gCAOK,WANH,yBAKE,GAJAE,UAAU,OACTuB,cAAY,E,WACJ,EAAAtB,iB,qCAAA,EAAAA,iBAAgB,GACxBpD,MAAO,EAAAR,UAAU,mBAAoB,EAAAA,UAAU,wB,iCAGpD,gCASK,WARH,yBAOE,GANA2D,UAAU,W,WACD,EAAAiE,iB,qCAAA,EAAAA,iBAAgB,GACzBC,WAAS,QACTrH,MAAM,yBACL0E,cAAY,EACZpB,QAAS,EAAAgE,mB,mCAGd,gCAUK,WATH,gCAQM,MARN,GAQM,CAPJ,yBAME,GALAnE,UAAU,S,WACD,EAAAoE,yB,qCAAA,EAAAA,yBAAwB,GAChCvH,MAAO,EAAAR,UAAU,gDACjBkF,cAAY,EACZpB,QAAS,EAAAC,Y,6CAIhB,gCAYK,KAZL,GAYK,CAXH,gCAUO,OAVP,GAUO,CATL,gCAAuE,SAAhE5C,KAAK,SAASnD,KAAK,eAAgBU,MAAO,EAAAkF,iBAAiBzD,I,WAClE,gCAAkF,SAA3EgB,KAAK,SAASnD,KAAK,qBAAsBU,MAAO,EAAAsJ,0B,WACvD,gCAAkF,SAA3E7G,KAAK,SAASnD,KAAK,sBAAuBU,MAAO,EAAAqJ,0B,WACxD,gCAIE,SAHA5G,KAAK,SACLnD,KAAK,cACJU,MAAO,EAAAkJ,iBAAiBrH,OAAS,EAAAqH,iBAAmB,O,WAEvD,gCAAsE,SAA/DzG,KAAK,SAASrB,MAAM,MAAOpB,MAAO,EAAAsB,UAAU,iB,mCAxC7C,EAAA0D,sB,mDA8CwB,EAAAD,0B,sDAAxC,gCAQM,UAPJ,gCAMS,UALPtD,GAAG,gBACHL,MAAM,MACL,QAAK,eAAE,EAAA4D,oBAAqB,I,6BAE1B,EAAA1D,UAAU,qDAAD,I,oBANF,EAAA0D,sB,iFAYR,EAAAwD,oB,yBADR,gCA2KM,MA3KN,GA2KM,CAvKJ,gCACkE,KADlE,GACkE,6BADnC,EAAAlH,U,6DAG/B,gCAOM,MAPN,GAOM,CANJ,gCAGS,uCAHF,EAAAA,U,wDAA4F,sB,GAInG,gCAAmE,SAA5DyC,KAAK,MAAMtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,gB,WAClD,gCAAiE,SAA1DyC,KAAK,KAAKtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,e,iBAGnD,gCA0JM,MA1JN,GA0JM,CAxJK,EAAAoH,mB,yBAAT,gCAKI,oCAJC,EAAApH,U,6DAAqG,8B,8BAK1G,gCAAoF,oCAAvE,EAAAA,UAAU,wDAAD,IAEb,EAAAiI,e,yBAAT,gCAQI,QAPF,yBAMe,GANDC,QAAQ,QAAQ/G,KAAK,a,8BACjC,IAA6D,C,0DAA1D,EAAAnB,UAAU,+CAAgD,IAC7D,GAAY,EAAAiI,cAAc1H,OAAS,G,yBAAnC,gCAGO,WAFL,G,6BAAM,IACN,6BAAG,EAAA0H,eAAa,M,yFAKtB,gCAoIM,MApIN,GAoIM,E,2BAnIJ,gCAoFM,2CAnF2B,EAAAhE,kBAAiB,CAAxCC,EAASiE,K,yBADnB,gCAoFM,OAlFHnJ,IAAKmJ,EACNrI,MAAM,W,CAEN,gCAEM,MAFN,GAEM,CADJ,gCAA4B,OAAtBF,IAAKsE,EAAQkE,S,aAGrB,gCAA2B,uCAApBlE,EAAQlG,MAAI,GAEnB,gCAIK,KAJF,UAAQ,EAAA2C,UAAU,EAAAX,U,iDAA6F,EAAQ,SAA0B,EAAQ,qB,WAMrH,kBAArBkE,EAAQK,U,yBAA1B,gCAYM,UAXJ,gCAMI,IANJ,GAMI,CALF,G,6BAAkC,IAClC,6BAAG,EAAAvE,U,qEAEC,IACJ,6BAAGkE,EAAQK,UAAQ,KAGrB,gCAEI,sCADC,EAAAvE,UAAU,iEAAD,O,yBAGhB,gCAyCM,UAxC4C,IAArC7B,OAAOmD,KAAK4C,EAAQE,MAAM7D,Q,yBAArC,gCAKM,UAJJ,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAP,UAAU,oDAAD,S,yBAGhB,gCAiCM,UAhCO,EAAAqI,yBAAyBnE,I,yBAApC,gCAaM,UAZJ,gCAAwE,sCAAlE,EAAAlE,UAAU,mDAAD,GAEf,gCASK,KATL,GASK,E,2BARH,gCAOK,2CANsB7B,OAAOwG,QAAQT,EAAQE,MAAMQ,O,GAAsC,KAAgB,uBAAL,G,EAA9F1B,GAAM5C,K,yBADjB,gCAOK,MAHFtB,IAAKsB,GAAK,CAEX,G,6BAAkC,IAAC,6BAAG4C,EAAIuE,WAAW,aAAc,KAAf,O,qCAI1D,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAzH,UAAU,oDAAD,OAE4D,IAA/D7B,OAAOqG,OAAON,EAAQE,MAAMkE,QAAQ,uB,yBAA/C,gCAaM,UAZJ,gCAAyE,sCAAnE,EAAAtI,UAAU,oDAAD,GAEf,gCASK,KATL,GASK,E,2BARH,gCAOK,2CANsB7B,OAAOwG,QAAQT,EAAQE,MAAMQ,O,GAAsC,KAA4B,uBAAX,G,EAApG1B,GAAM5C,K,yBADjB,gCAOK,MAHFtB,IAAKsB,GAAK,CAEX,G,6BAAgC,IAAC,6BAAG4C,EAAIuE,WAAW,aAAc,KAAf,O,wDAO5D,gCAUM,MAVN,GAUM,CATJ,gCAQO,QAPLlF,OAAO,OACPT,OAAO,GACN,SAAM,8BAAU,EAAA+C,cAAcX,EAASZ,GAAM,c,CAE9C,gCAAsD,SAA/CnC,KAAK,SAASnD,KAAK,SAAUU,MAAOyJ,G,WAC3C,gCAAiF,SAA1EhH,KAAK,SAASnD,KAAK,qBAAsBU,MAAO,EAAA6J,0B,WACvD,gCAA4E,SAA5E,GAA4E,6BAAvC,EAAAvI,UAAU,mBAAD,I,mBAKpD,gCA0CM,MA1CN,GA0CM,CAxCJ,GAEA,gCAA0E,uCAAnE,EAAAA,UAAU,mDAAD,GAEhB,gCAKI,sCAJC,EAAAA,U,0EAML,gCAA6E,sCAAvE,EAAAA,UAAU,wDAAD,GAEf,gCAaK,WAZH,gCAIM,MAJF,UAAQ,EAAAW,UAA6B,Y,yFAKzC,gCAEQ,MAFJ,UAAQ,EAAAA,UAA6B,YAAS,wE,WAGlD,gCAGa,MAHT,UAAQ,EAAAA,UAA6B,Y,uFAM3C,gCAWM,MAXN,GAWM,CAVJ,gCASO,QARL4B,OAAO,OACNT,OAAQ,EAAA0G,iBACTrI,GAAG,kB,CAEH,gCAA4D,SAArDgB,KAAK,SAASnD,KAAK,aAAcU,MAAO,EAAA+J,W,WAC/C,gCAES,SAFT,GAES,6BADJ,EAAAzI,UAAU,+CAAD,I,UAMpB,U,uCAQE,EAAAmH,sBAAwB,EAAAD,oBAAsB,EAAAvB,iB,yBAFtD,gCAuBM,MAvBN,GAuBM,CAnBJ,gCAC0E,KAD1E,GAC0E,6BAAtE,EAAA3F,UAAU,sDAAD,GACb,gCAGI,UAFF,gCAA6E,2CAAlE,EAAAA,UAAU,6CAA8C,IAAC,G,6BAAS,IAC7E,6BAAG,EAAA0I,UAAQ,KAEb,gCAGI,UAFF,gCAAiF,2CAAtE,EAAA1I,UAAU,iDAAkD,IAAC,G,6BAAS,IACjF,6BAAG,EAAA2I,cAAY,KAEjB,GACA,gCAOO,QAPA7G,OAAQ,EAAA8G,gBAAiBrG,OAAO,OACjCsG,QAAQ,sBAAsB1I,GAAG,oB,CACrC,gCAAqF,sCAA/E,EAAAH,UAAU,+DAAgE,IAAC,GAEjF,gCAA8D,SAAvDmB,KAAK,SAASnD,KAAK,eAAgBU,MAAO,EAAA2G,W,WAEjD,gCAA4E,SAA5E,GAA4E,6BAAvC,EAAArF,UAAU,mBAAD,I,gDAI1C,EAAA2F,iB,yBADR,gCAoBM,W,2BAjBJ,gCAgBM,2CAhB+B,EAAAmD,oBAAmB,CAA3CC,EAAczI,K,yBAA3B,gCAgBM,OAhBqDtB,IAAKsB,GAAK,E,yBACnE,yBAcsD,qCAb/CyI,GAAY,CAChBC,sBAAqB,EAAAC,mBAAmBC,kBACxCC,cAAa,EAAAF,mBAAmBG,WAChCC,WAAU,EAAAJ,mBAAmBK,QAC7BC,oBAAmB,EAAAN,mBAAmBO,gBACtCC,eAAc,EAAAR,mBAAmBS,YACjCC,gBAAe,EAAAV,mBAAmBW,aAClCC,qBAAoB,EAAAZ,mBAAmBa,iBACvCC,uBAAsB,EAAAd,mBAAmBe,mBACzCC,4BAA2B,EAAAhB,mBAAmBiB,uBAC9CC,WAAU,EAAAlB,mBAAmBmB,QAC7BC,aAAY,EAAApB,mBAAmBqB,UAC/BC,SAAU,EAAAtB,mBAAmBsB,SAC7BC,iBAAgB,EAAAvB,mBAAmBwB,e,2TC9UjC,oCAAgB,CAC7BvJ,MAAO,CACLsB,sBAAuB,CACrBrB,KAAMhD,OACNiD,UAAU,GAEZ8F,mBAAoBwD,QACpBvD,qBAAsBuD,QACtBtD,kBAAmBsD,QACnBhC,SAAUlD,OACVmD,aAAcnD,OACd9D,SAAU,CACRP,KAAMhD,OACNiD,UAAU,GAEZyB,WAAY,CACV1B,KAAMhD,OACNiD,UAAU,GAEZmE,YAAa,CACXpE,KAAMhD,OACNiD,UAAU,GAEZ2C,WAAY,CACV5C,KAAM,CAAChD,OAAQ6D,OACfZ,UAAU,GAEZ6G,cAAe,CAACzC,OAAQkF,SACxBjC,UAAW,CACTtH,KAAMqE,OACNpE,UAAU,GAEZiE,UAAWG,OACXwC,yBAA0BxC,OAC1BmC,4BAA6BnC,OAC7B+C,yBAA0B/C,OAC1B/B,0BAA2BiC,OAC3BC,gBAAiBH,OACjBmF,WAAY3I,MACZ4G,gBAAiBpD,OACjBoF,yBAA0B,CACxBzJ,KAAMhD,OACNiD,UAAU,IAGda,WAAY,CACVC,aAAA,kBACA4D,MAAA,YACA+E,aAAA,mBAEF9E,WAAY,CACVC,aAAA,mBAEF,OACE,MAAO,CACLJ,wBAAyB,GACzBC,kBAAmB,GACnBnC,oBAAoB,EACpBE,iBAAkB1G,KAAKqI,YACvBwC,yBAA0B,KAC1BH,iBAAkB,CAAC,OACnBkD,WAAY,KACZC,WAAY,KAGhB9E,QAAS,CACP,oBAAoBrD,EAAuBsD,GACzC,MAAMC,EAAYjJ,KAAK2F,WACvB3F,KAAK0I,wBAA0BO,EAAUvD,GAAQ5E,KAEjD,YAAOoI,OAAOC,aAAanJ,KAAKoJ,MAAMC,2BAA2C,CAC/E,MACGL,EAAMM,OAA2BC,aAIxC,cAAcvC,EAAwBgC,GACpChJ,KAAK2I,kBAAoB3B,EAAQlG,KAEjC,YAAOoI,OAAOC,aACZnJ,KAAKoJ,MAAMI,qBACX,CACE,MACGR,EAAMM,OAA2BC,aAK1C,yBAAyBvC,GACvB,MAAM8G,EAAmB,CAAC,YAAa,eAAgB,sBACvD,OAAO7M,OAAOqG,OAAON,EAAQE,MAAMK,KAChCwG,IAAyD,IAA1CD,EAAiB1C,QAAQ2C,MAI/C5J,SAAU,CACR,iCACE,MAAMsD,EAAUxG,OAAOwG,QACrBzH,KAAKsF,uBAGP,OAAOrE,OAAOwI,YACZhC,EAAQC,OAAO,EAAE,CAAEjC,MACjB,MAAOuB,GAAWvB,EAAOuI,uBAAuBrE,MAAM,MACtD,QAAS3J,KAAKwE,SAASwC,KACtB4C,IAAI,EAAElE,EAAQD,MACf,MAAOuB,EAAShB,GAAOP,EAAOuI,uBAAuBrE,MAAM,OACrD,OAAEvC,GAAWpH,KAAKwE,SAASwC,GAEjC,MAAO,CACLtB,EAAM,+BAEDD,GAAM,IACTuB,UACAhB,MACAD,cAAeoB,GAAiBC,UAM1C,oBACE,MAAMyC,EAAU5I,OAAOwG,QAAQzH,KAAKwE,UAC9BsF,EAAWD,EAAQnC,OAAO,EAAE,CAAElG,KAAWA,EAAMuI,WAErD,OAAO9I,OAAOwI,YAAYK,IAE5B,oBACE,MAAO,CACLmE,IAAK,uBAAU,kDACfC,MAAO,uBAAU,oDACjBC,MAAO,uBAAU,oDACjBC,KAAM,uBAAU,qDAGpB,mBACE,MAAO,IAAI,eAAU1J,UAAU,OAAD,wBACzB,eAAUC,UAAUnD,OAAK,IAC5BoD,OAAQ,oBAGZ,kBACE,MAAMyJ,EAAO,6BAAgB,oHAC7B,OAAO,uBACL,kDACA,4BAA4BA,gCAC5B,OACA,WAGJ,sBACE,MAAM5G,EAAUzH,KAAKyN,WAErB,OAAO,qBAAQhG,EAAQmC,IAAK1E,GAAQ,wCAA2BA,EAAIoJ,OACjEpJ,EAAIqJ,cAER,qBACE,OAAOvO,KAAK0N,6BC7NlB,GAAO7I,OAAS,GAED,U,UC6BFjC,MAAM,aAAaK,GAAG,6BAA6BiC,IAAI,8B,8BAWrCtC,MAAM,kB,GAQzB,gCAAS,mB,2BAYDA,MAAM,c,UAINA,MAAM,c,sEAwBVuC,QAAQ,IAAIC,MAAM,S,UASpBxC,MAAM,2B,IAUJuC,QAAQ,K,IACLvC,MAAM,kB,IAUTuC,QAAQ,K,IACJP,OAAO,GAAGS,OAAO,Q,wDAyBxBzC,MAAM,aAAaK,GAAG,uBAAuBiC,IAAI,wB,8BAWjDtC,MAAM,sB,+CAaH,gCAAM,mB,IAMPA,MAAM,Y,IAQFA,MAAM,Q,2CAaNA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,qBAWzBA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,0BAOpBA,MAAM,iB,GAON,gCAAkC,QAA5BA,MAAM,gBAAc,S,UAI7BA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,eAMtBA,MAAM,iB,GAON,gCAAgC,QAA1BA,MAAM,cAAY,S,UAO/BA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,UAGzBA,MAAM,gB,GACP,gCAAkC,QAA5BA,MAAM,gBAAc,S,sCAYvBA,MAAM,O,+BAGCqB,KAAK,SAASrB,MAAM,O,8CAWpBqB,KAAK,SAASrB,MAAM,O,IAK7BA,MAAM,e,GACT,gCAAiC,OAA5BA,MAAM,iBAAe,S,IAarBA,MAAM,O,+BAGCqB,KAAK,SAASrB,MAAM,O,GAOlC,gCAAyB,OAApBA,MAAM,SAAO,S,UA2BxBA,MAAM,oB,oBAMkE,gCAAI,mB,GAGxC,gCAAI,mB,IAehCyC,OAAO,OAAOT,OAAO,GAAG3B,GAAG,oB,iBAqBvBgB,KAAK,SAASrB,MAAM,O,yPAhXpC,gCAoXM,YAnXJ,yBAMe,GALZC,gBAAe,EAAAC,UAAU,oE,8BAE1B,IAAoF,CAApF,gCAAoF,uCAA7E,EAAAA,UAAU,6DAAD,G,6BAAoE,IAEpF,6BAAG,EAAAA,UAAU,mEAAD,K,0BAIN,EAAAkH,oBAAsB,EAAAE,mB,yBAD9B,gCAkHM,O,MAhHHtH,MAAK,4BAAE3B,OAAOmD,KAAK,EAAAkB,uBAAuBjC,OAAS,aAAe,K,CAEnE,yBA6Ge,GA5GZR,gBAAe,EAAAC,UAAU,yD,8BAE1B,iBAAkF,CAAlF,gCAAkF,sCAA5E,EAAAA,UAAU,6DAAD,GAEf,gCASM,MATN,GASM,CARJ,gCAKK,uCAJA,EAAAA,U,uDAA+F,4B,GAKpG,gCAAmE,SAA5DyC,KAAK,MAAMtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,gB,WAClD,gCAAiE,SAA1DyC,KAAK,KAAKtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,e,uEAGnD,gCA4FQ,QA5FR,GA4FQ,CA3FN,gCASQ,cARR,gCAOK,WANH,gCAA8C,uCAAvC,EAAAA,UAAU,uBAAD,GAChB,gCAA0C,uCAAnC,EAAAA,UAAU,mBAAD,GAChB,gCAAqC,uCAA9B,EAAAA,UAAU,cAAD,GAChB,gCAAsE,uCAA/D,EAAAA,UAAU,+CAAD,GAChB,gCAAqE,uCAA9D,EAAAA,UAAU,8CAAD,GAChB,OAGF,gCAgFQ,e,2BA/ER,gCAkCK,2CAjC+B,EAAA0C,+BAA8B,CAAxDC,EAAQC,EAAQtC,K,yBAD1B,gCAkCK,MAhCFtB,IAAKsB,EACLR,MAAK,4BAAG,EAAA+C,WAAWD,GAAQE,cAAiB,EAAAD,WAAWD,GAAQG,SAAqB,GAAV,U,CAE3E,gCAAqD,MAAjD,UAAQ,EAAApC,UAAU,EAAAkC,WAAWD,GAAQ5E,O,WAEzC,gCAGK,WAF6B,EAAA6E,WAAWD,GAAQE,a,iEAAnD,gCAAwE,OAAxE,K,6BAAwE,IACxE,6BAAG,EAAApB,SAASiB,EAAOuB,SAASlG,MAAI,KAElC,gCAGK,WAF6B,EAAA6E,WAAWD,GAAQG,S,iEAAnD,gCAAoE,OAApE,K,6BAAoE,IACpE,6BAAGJ,EAAO+I,SAAW/I,EAAOgJ,MAAI,KAElC,gCAAyC,uCAAlC,EAAA9I,WAAWD,GAAQO,SAAO,GACjC,gCAAmC,uCAA5BR,EAAOS,eAAa,GAC3B,gCAgBK,WAfH,gCAcO,QAbLb,OAAO,OACPT,OAAO,GACN,SAAM,8BAAU,EAAAuB,oBAAoBT,EAAQU,GAAM,c,CAEnD,gCAAyD,SAAlDnC,KAAK,SAASnD,KAAK,eAAgBU,MAAOkE,G,WACjD,gCAC4C,SADrCzB,KAAK,SAASnD,KAAK,wBAClBU,MAAO,EAAAkN,6B,WAKPjJ,EAAOa,mB,yBAJf,gCAKU,U,MAJRrC,KAAK,SACLrB,MAAM,uBACLU,MAAO,EAAAR,UAAU,mB,yEAMa,EAAAyD,0B,sDAAvC,gCASK,SARH,gCAOK,KAPL,GAOK,CANH,gCAKS,UAJP3D,MAAM,MACL,QAAK,eAAE,EAAA4D,oBAAqB,I,6BAE1B,EAAA1D,UAAU,qDAAD,M,oBANL,EAAA0D,sB,uCAWyB,EAAAD,0B,sDADtC,gCAiCK,KAjCL,GAiCK,CA/BH,gCAOK,WANH,yBAKE,GAJAE,UAAU,OACTuB,cAAY,E,WACJ,EAAAtB,iB,qCAAA,EAAAA,iBAAgB,GACxBpD,MAAO,EAAAR,UAAU,mBAAoB,EAAAA,UAAU,wB,iCAGpD,gCAUK,KAVL,GAUK,CATH,gCAQM,MARN,GAQM,CAPJ,yBAME,GALA2D,UAAU,S,WACD,EAAAkI,4B,qCAAA,EAAAA,4BAA2B,GACnCrL,MAAO,EAAAR,UAAU,gDACjBkF,cAAY,EACZpB,QAAS,EAAAC,Y,6CAIhB,gCAWK,KAXL,GAWK,CAVH,gCASO,OATP,GASO,CARL,gCAAwE,SAAjE5C,KAAK,SAASnD,KAAK,eAAgBU,MAAuB,QAAlB,EAAE,EAAAkF,wBAAgB,aAAhB,EAAkBzD,I,WACnE,gCAAkF,SAA3EgB,KAAK,SAASnD,KAAK,qBAAsBU,MAAO,EAAAoN,0B,WACvD,gCAIE,SAHA3K,KAAK,SACLnD,KAAK,yBACJU,MAAO,EAAAmN,6B,WAEV,gCAAsE,SAA/D1K,KAAK,SAASrB,MAAM,MAAOpB,MAAO,EAAAsB,UAAU,iB,mCA7B7C,EAAA0D,sB,4HAuCV,EAAAwD,oB,yBADR,gCAgLM,O,MA9KHpH,MAAK,kDAAwB,EAAAsH,kBAAoB,aAAe,c,CAEjE,yBA2Ke,GA1KZrH,gBAAe,EAAAC,UAAU,0D,8BAG1B,IASM,CATN,gCASM,MATN,GASM,CARJ,gCAKK,uCAJA,EAAAA,U,wDAAgG,sB,GAKrG,gCAAmE,SAA5DyC,KAAK,MAAMtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,gB,WAClD,gCAAiE,SAA1DyC,KAAK,KAAKtB,KAAK,SAAUzC,MAAO,EAAAsB,UAAU,e,iBAGnD,gCA2JM,MA3JN,GA2JM,CAzJK,EAAAoH,mB,yBAAT,gCAIU,oCAHL,EAAApH,U,6DAAsG,8B,8BAI3G,gCAAoF,oCAAvE,EAAAA,UAAU,wDAAD,IAEb,EAAAiI,e,yBAAT,gCAQI,QAPF,yBAMe,GANDC,QAAQ,SAAO,C,6BAC3B,IAA6D,C,0DAA1D,EAAAlI,UAAU,+CAAgD,IAC7D,GAAqC,kBAAlB,EAAAiI,e,yBAAnB,gCAGO,WAFL,G,6BAAM,IACN,6BAAG,EAAAA,eAAa,M,yFAKtB,gCAsIM,MAtIN,GAsIM,E,2BArIJ,gCA0GM,2CAzG2B,EAAAhE,kBAAiB,CAAxCC,EAASiE,K,yBADnB,gCA0GM,OAxGHnJ,IAAKmJ,EACLrI,MAAK,wCAAkD,IAArC3B,OAAOmD,KAAK4C,EAAQE,MAAM7D,QAAuD,kBAAhB,EAAQ,SAAQ,gB,CAIpG,gCAEM,MAFN,GAEM,CADJ,gCAA4B,OAAtBX,IAAKsE,EAAQkE,S,aAGrB,gCAA2B,uCAApBlE,EAAQlG,MAAI,GAEnB,gCAIK,KAJF,UAAQ,EAAA2C,UAAU,EAAAX,U,iDAA6F,EAAQ,SAA0B,EAAQ,qB,WAMrH,kBAArBkE,EAAQK,U,yBAA1B,gCAWM,UAVJ,gCAKI,IALJ,GAKI,CAJF,G,6BAAkC,IAClC,6BAAG,EAAAvE,U,qEAEC,IAAC,6BAAGkE,EAAQK,UAAQ,KAG1B,gCAEI,sCADC,EAAAvE,UAAU,mEAAD,O,yBAGhB,gCAuCM,UAtC+D,IAArC7B,OAAOmD,KAAK4C,EAAQE,MAAM7D,Q,yBAAxD,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAP,UAAU,oDAAD,O,yBAEd,gCAiCM,UAhCO7B,OAAOqG,OAAON,EAAQE,MAAMK,KAAMsH,GAAaA,EAASC,W,yBAAnE,gCAaM,UAZJ,gCAAwE,sCAAlE,EAAAhM,UAAU,mDAAD,GAEf,gCASK,KATL,GASK,E,2BARH,gCAOK,2CANsB7B,OAAOwG,QAAQT,EAAQE,MAAMQ,O,GAAsC,KAAc,EAAS,U,EAA1G1B,GAAM5C,K,yBADjB,gCAOK,MAHFtB,IAAKsB,GAAK,CAEX,G,6BAAkC,IAAC,6BAAG4C,GAAG,O,qCAI/C,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAlD,UAAU,oDAAD,MAEH7B,OAAOqG,OAAON,EAAQE,MAAMK,KAAMsH,IAAcA,EAASC,W,yBAApE,gCAaM,UAZJ,gCAAyE,sCAAnE,EAAAhM,UAAU,oDAAD,GAEf,gCASK,KATL,GASK,E,2BARH,gCAOK,2CANsB7B,OAAOwG,QAAQT,EAAQE,MAAMQ,O,GAAsC,MAAe,EAAS,U,EAA3G1B,GAAM5C,K,yBADjB,gCAOK,MAHFtB,IAAKsB,GAAK,CAEX,G,6BAAgC,IAAC,6BAAG4C,GAAG,O,wDAOnBgB,EAAQ+H,aAAe,K,yBAArD,gCAGI,IAHJ,GAGI,CAFF,G,6BAAkC,IAClC,6BAAG,EAAAjM,UAAU,wDAAD,MAEqBkE,EAAQ+H,aAAe,K,yBAA1D,gCAMI,IANJ,GAMI,CALF,GACA,gCAGK,QAHC,UAAQ,EAAAtL,UAAU,EAAAX,U,iEAAmH,EAAQ,e,wCAKrJ,gCAIK,K,MAJK,UAAQ,EAAAW,UAAU,EAAAX,U,iEAAgI,EAAQ,e,YAMpK,gCAgBM,MAhBN,GAgBM,CAfJ,gCAKO,QALDuC,OAAO,OAAQT,OAAQ,EAAAoK,wB,CAC3B,gCAA6D,SAAtD/K,KAAK,SAASnD,KAAK,aAAcU,MAAO,EAAAyN,Y,WAC/C,gCAES,SAFT,GAES,6BADJ,EAAAnM,UAAU,mDAAD,I,MAGhB,gCAQO,QAPLuC,OAAO,OACPT,OAAO,GACN,SAAM,8BAAU,EAAA+C,cAAcX,EAASZ,GAAM,c,CAE9C,gCAAsD,SAA/CnC,KAAK,SAASnD,KAAK,SAAUU,MAAOyJ,G,WAC3C,gCAAiF,SAA1EhH,KAAK,SAASnD,KAAK,qBAAsBU,MAAO,EAAA0N,0B,WACvD,gCAA4E,SAA5E,GAA4E,6BAAvC,EAAApM,UAAU,mBAAD,I,qBAKpD,gCAsBM,MAtBN,GAsBM,CArBJ,GAEA,gCAA0E,uCAAnE,EAAAA,UAAU,mDAAD,GAEhB,gCAKI,sCAJC,EAAAA,U,0EAML,gCAAqF,sCAA/E,EAAAA,UAAU,uDAAwD,QAAzD,GAEf,gCAOM,MAPN,GAOM,CANJ,gCAKO,QALDuC,OAAO,OAAQT,OAAQ,EAAAoK,uBAAwB/L,GAAG,kB,CACtD,gCAA6D,SAAtDgB,KAAK,SAASnD,KAAK,aAAcU,MAAO,EAAAyN,Y,WAC/C,gCAES,SAFT,GAES,6BADJ,EAAAnM,UAAU,+CAAD,I,UAMpB,S,sEAQA,EAAAkH,oBAAsB,EAAAvB,iB,yBAD9B,gCAgBM,O,MAdH7F,MAAK,oDAAyB,EAAAoH,mBAAqB,aAAe,M,CAEnE,yBAWe,GAVZnH,gBAAe,EAAAC,UAAU,sD,8BAE1B,IAGI,CAHJ,gCAGI,UAFF,gCAA6E,2CAAlE,EAAAA,UAAU,6CAA8C,IAAC,G,6BAAS,IAC7E,6BAAG,EAAA0I,UAAQ,KAEb,gCAGI,UAFF,gCAAiF,2CAAtE,EAAA1I,UAAU,iDAAkD,IAAC,G,6BAAS,IACjF,6BAAG,EAAA2I,cAAY,O,sEAMb,EAAAhD,iB,yBADR,gCAkBM,MAlBN,GAkBM,CAfJ,yBAce,GAbZ5F,gBAAe,EAAAC,UAAU,8D,8BAE1B,IAAgC,CAAhC,gCAAgC,KAA7B,UAAQ,EAAAqM,iBAAe,WAC1B,gCASI,U,0DARC,EAAArM,UAAU,qDAAsD,IAAC,MACpE,gCAEc,2CADV,EAAAA,UAAU,4DACV,IAAC,G,6BAAS,IAAC,6BAAG,EAAAoJ,YAAa,IAAC,MAChC,gCAEc,2CADV,EAAApJ,UAAU,2DACV,IAAC,G,6BAAS,IACd,6BAAG,EAAAsM,eAAgB,wEACrB,O,oEAKI,EAAA3G,iB,yBADR,gCA8BM,O,MA5BH7F,MAAK,4BAAG,EAAAoH,mBAA6C,GAAxB,wB,CAC9B,yBA0Be,GAzBZnH,gBAAe,EAAAC,UAAU,2D,8BAE1B,IAsBO,CAtBP,gCAsBO,OAtBP,GAsBO,CArBL,gCAAmF,sCAA7E,EAAAA,UAAU,8DAAD,GAEf,yBAME,GALA2D,UAAU,OACV3F,KAAK,W,WACI,EAAAuO,c,qCAAA,EAAAA,cAAa,GACrB/L,MAAO,EAAAR,UAAU,4CAClBoF,aAAa,O,+BAGf,yBAME,GALAzB,UAAU,OACV3F,KAAK,e,WACI,EAAAwO,kB,qCAAA,EAAAA,kBAAiB,GACzBhM,MAAO,EAAAR,UAAU,gDAClBoF,aAAa,O,+BAGf,gCAA8D,SAAvDjE,KAAK,SAASnD,KAAK,eAAgBU,MAAO,EAAA2G,W,WAEjD,gCAA0E,SAA1E,GAA0E,6BAArC,EAAArF,UAAU,iBAAD,O,wEC5VzC,oCAAgB,CAC7BkB,MAAO,CACLgG,mBAAoBwD,QACpBvD,qBAAsBuD,QACtBtD,kBAAmBsD,QACnBhC,SAAUlD,OACVmD,aAAcnD,OACdhD,sBAAuB,CACrBrB,KAAMhD,OACNiD,UAAU,GAEZyB,WAAY,CACV1B,KAAMhD,OACNiD,UAAU,GAEZmE,YAAa,CACXpE,KAAMhD,OACNiD,UAAU,GAEZ2C,WAAY,CACV5C,KAAM,CAAChD,OAAQ6D,OACfZ,UAAU,GAEZ6G,cAAe,CAACzC,OAAQkF,SACxBhJ,SAAU,CACRP,KAAMhD,OACNiD,UAAU,GAEZ+K,WAAY,CACVhL,KAAMqE,OACNpE,UAAU,GAEZiE,UAAW,CACTlE,KAAMqE,OACNpE,UAAU,GAEZ0K,yBAA0B,CACxB3K,KAAMqE,OACNpE,UAAU,GAEZwK,4BAA6B,CAC3BzK,KAAMqE,OACNpE,UAAU,GAEZgL,yBAA0B,CACxBjL,KAAMqE,OACNpE,UAAU,GAEZqC,0BAA2BiC,OAC3BC,gBAAiBH,OACjB4D,WAAY5D,OACZ8G,cAAe9G,QAEjBvD,WAAY,CACVC,aAAA,kBACA4D,MAAA,YACA+E,aAAA,mBAEF9E,WAAY,CACVC,aAAA,mBAEF,OACE,MAAO,CACLJ,wBAAyB,GACzBC,kBAAmB,GACnBnC,oBAAoB,EACpBE,iBAAkB1G,KAAKqI,YACvBsG,4BAA6B,KAC7BU,cAAe,GACfC,kBAAmB,KAGvBvG,QAAS,CACP,oBAAoBrD,EAAuBsD,GACzC,MAAMC,EAAYjJ,KAAK2F,WACvB3F,KAAK0I,wBAA0BO,EAAUvD,GAAQ5E,KAEjD,YAAOoI,OAAOC,aACZnJ,KAAKoJ,MAAMC,2BACX,CACE,MACGL,EAAMM,OAA2BC,aAK1C,cAAcvC,EAAwBgC,GACpChJ,KAAK2I,kBAAoB3B,EAAQlG,KAEjC,YAAOoI,OAAOC,aAAanJ,KAAKoJ,MAAMI,qBAAqC,CACzE,MACGR,EAAMM,OAA2BC,cAK1CpF,SAAU,CACR,iCACE,MAAMsD,EAAUxG,OAAOwG,QACrBzH,KAAKsF,uBAGP,OAAOrE,OAAOwI,YACZhC,EAAQC,OAAO,EAAE,CAAEjC,MACjB,MAAOuB,GAAWvB,EAAO8J,uBAAuB5F,MAAM,MACtD,QAAS3J,KAAKwE,SAASwC,KACtB4C,IAAI,EAAElE,EAAQD,MACf,MAAOuB,EAASyH,GAAQhJ,EAAO8J,uBAAuB5F,MAAM,MACtD6F,EAAcxP,KAAKwE,SAASwC,IAC5B,OAAEI,GAAWoI,EAEbC,EAAcxO,OAAOwG,QAAQ+H,EAAYtI,MAAMwI,KACnD,EAAE,CAAEC,KAAUA,EAAKC,UAAYnB,GAE3BD,EAAqB,OAAXiB,QAAW,IAAXA,OAAW,EAAXA,EAAc,GAE9B,MAAO,CACL/J,EAAM,+BAEDD,GAAM,IACTuB,UACAyH,OACAD,UACAzI,cAAeoB,GAAiBC,UAM1C,yBACE,MAAO,IAAI,eAAU1C,UAAU,OAAD,wBACzB,eAAUC,UAAUnD,OAAK,IAC5BoD,OAAQ,0BAGZ,kBACE,MAAMyJ,EAAO,6BAAgB,6EAC7B,OAAO,uBACL,kDACA,4BAA4BA,gCAC5B,OACA,WAGJ,oBACE,MAAMxE,EAAU5I,OAAOwG,QAAQzH,KAAKwE,UAC9BsF,EAAWD,EAAQnC,OAAO,EAAE,CAAElG,KAAWA,EAAMuI,WAErD,OAAO9I,OAAOwI,YAAYK,OCrLhC,GAAOjF,OAAS,GAED,U,UCERjC,MAAM,kB,IACJA,MAAM,W,GAGsE,gCAAM,mB,oBAIhB,gCAAM,mB,GAG/C,gCAAM,mB,GAGQ,gCAAM,mB,IAI/CA,MAAM,kB,IACJA,MAAM,c,IACHK,GAAG,uBAAuB2B,OAAO,GAAGS,OAAO,OAC3CsG,QAAQ,uB,GAIZ,gCAAiD,SAA1C1H,KAAK,SAAShB,GAAG,SAASnC,KAAK,U,yCAOlC,gCAAiC,QAA3B8B,MAAM,eAAa,S,GAEzB,gCAA2B,QAArBA,MAAM,eAAa,S,6GAlCnC,gCAiBM,MAjBN,GAiBM,CAhBJ,gCAeM,MAfN,GAeM,CAdJ,gCAAoF,sCAA9E,EAAAE,UAAU,+DAAD,GACf,gCAGI,U,0DAFC,EAAAA,UAAU,+DAAD,GAAiE,GAC7E,gCAA+D,QAAzD,UAAQ,EAAAW,UAAU,EAAAoM,gC,aAE1B,gCAQI,U,0DAPC,EAAA/M,UAAU,qDAAD,GAAuD,GACnE,gCAES,2CADJ,EAAAA,UAAU,qEAAsE,KACrF,G,6BAAS,IAAC,6BAAG,EAAAoJ,YAAU,GAAG,GAC1B,gCAES,2CADJ,EAAApJ,UAAU,gEAAiE,KAChF,G,6BAAS,IAAC,6BAAG,EAAAsJ,SAAO,6BAAM,EAAA0D,aAAW,GAAG,SAI9C,gCAqBM,MArBN,GAqBM,CApBJ,gCAmBM,MAnBN,GAmBM,CAlBJ,gCAiBO,OAjBP,GAiBO,CAfL,gCAC6D,SADtD7L,KAAK,OAAOhB,GAAG,aAAanC,KAAK,aAAaiP,OAAO,QAChD,SAAM,oBAAE,EAAAC,mBAAA,EAAAA,qBAAA,IAAmBC,MAAA,kB,SAEvC,GAEA,gCAAsE,SAA/DhM,KAAK,SAASnD,KAAK,eAAgBU,MAAO,EAAAwK,mB,WAEjD,gCAOS,UAPD/H,KAAK,SAASrB,MAAM,MAAO,QAAK,eAAE,EAAAsN,oBACjCC,SAAU,EAAAC,wB,6BACjB,gCAC4E,aAA1E,G,6BAAiC,IAAC,6BAAG,EAAAtN,UAAU,mBAAD,I,mBADjC,EAAAsN,0B,4BAEf,gCAEO,aADL,G,6BAA2B,IAAC,6BAAG,EAAAtN,UAAU,8CAAD,I,kBAD5B,EAAAsN,2B,iBCjCT,oCAAgB,CAC7B,OACE,MAAO,CACLN,YAAa,iEACbO,iBAAiB,EACjBC,aAAa,IAGjBtM,MAAO,CACLgI,kBAAmB,CACjB/H,KAAMqE,OACNpE,UAAU,GAEZgI,WAAY,CACVjI,KAAMqE,OACNpE,UAAU,GAEZkI,QAAS,CACPnI,KAAMqE,OACNpE,UAAU,IAGd6E,QAAS,CACP,mBACE/I,KAAKqQ,iBAAkB,EACvB,MAAME,EAAY9N,SAAS+N,eAAe,cACtCD,GACFA,EAAUE,SAGd,oBACE,MAAMF,EAAY9N,SAAS+N,eAAe,cACpCE,EAAuBjO,SAAS+N,eAAe,wBACjDD,GAAaA,EAAU/O,OAASkP,IAClC1Q,KAAKsQ,aAAc,EACnBI,EAAqBnH,WAGzB,iBAEE,IAAKvJ,KAAKqQ,iBAAmBrQ,KAAKsQ,YAChC,OAIF,MAAMC,EAAY9N,SAAS+N,eAAe,cACtCD,IAAcA,EAAU/O,QAC1BxB,KAAKqQ,iBAAkB,KAI7BlM,SAAU,CACR,gCACE,MAAM6B,EAAM,6BAAgB,uIAC5B,OAAO,uBACL,6DACA,YAAYA,gDACZ,SAGJ,yBACE,OAAOhG,KAAKqQ,iBAAmBrQ,KAAKsQ,cAGxC,UACE7N,SAASkO,KAAKC,QAAU5Q,KAAK6Q,kBCrEjC,GAAOhM,OAAS,GAED","file":"SearchEngineKeywordsPerformance.umd.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"CoreHome\"), require(\"vue\"), require(\"CorePluginsAdmin\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"CoreHome\", , \"CorePluginsAdmin\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SearchEngineKeywordsPerformance\"] = factory(require(\"CoreHome\"), require(\"vue\"), require(\"CorePluginsAdmin\"));\n\telse\n\t\troot[\"SearchEngineKeywordsPerformance\"] = factory(root[\"CoreHome\"], root[\"Vue\"], root[\"CorePluginsAdmin\"]);\n})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__19dc__, __WEBPACK_EXTERNAL_MODULE__8bbf__, __WEBPACK_EXTERNAL_MODULE_a5a2__) {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"plugins/SearchEngineKeywordsPerformance/vue/dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"fae3\");\n","module.exports = __WEBPACK_EXTERNAL_MODULE__19dc__;","module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__;","module.exports = __WEBPACK_EXTERNAL_MODULE_a5a2__;","// This file is imported into lib/wc client bundles.\n\nif (typeof window !== 'undefined') {\n var currentScript = window.document.currentScript\n if (process.env.NEED_CURRENTSCRIPT_POLYFILL) {\n var getCurrentScript = require('@soda/get-current-script')\n currentScript = getCurrentScript()\n\n // for backward compatibility, because previously we directly included the polyfill\n if (!('currentScript' in document)) {\n Object.defineProperty(document, 'currentScript', { get: getCurrentScript })\n }\n }\n\n var src = currentScript && currentScript.src.match(/(.+\\/)[^/]+\\.js(\\?.*)?$/)\n if (src) {\n __webpack_public_path__ = src[1] // eslint-disable-line\n }\n}\n\n// Indicate to webpack that this file can be concatenated\nexport default null\n","\n\n\n\n\n","\n\n\n\n\n","\nimport { defineComponent } from 'vue';\nimport { translate, MatomoUrl } from 'CoreHome';\n\ninterface Provider {\n id: string;\n is_configured: boolean;\n configured_site_ids: (string|number)[];\n problems: {\n sites: unknown[];\n accounts: [];\n };\n is_experimental: boolean;\n logos: string[];\n}\n\nexport default defineComponent({\n props: {\n provider: {\n type: Object,\n required: true,\n },\n },\n computed: {\n hasWarning() {\n const provider = this.provider as Provider;\n return provider.is_configured\n && (Object.keys(provider.configured_site_ids).length === 0\n || Object.keys(provider.problems.sites).length\n || Object.keys(provider.problems.accounts).length);\n },\n logoTooltip() {\n const provider = this.provider as Provider;\n const isConfiguredWithoutSite = provider.is_configured\n && Object.keys(provider.configured_site_ids).length === 0;\n\n if (isConfiguredWithoutSite) {\n return translate('SearchEngineKeywordsPerformance_ConfigAvailableNoWebsiteConfigured');\n }\n\n if (provider.is_configured) {\n return translate('SearchEngineKeywordsPerformance_IntegrationConfigured');\n }\n\n return translate('SearchEngineKeywordsPerformance_IntegrationNotConfigured');\n },\n configureUrl() {\n return `?${MatomoUrl.stringify({\n ...MatomoUrl.urlParsed.value,\n action: `configure${this.provider.id}`,\n })}`;\n },\n },\n});\n","import { render } from \"./Provider.vue?vue&type=template&id=5cbccceb\"\nimport script from \"./Provider.vue?vue&type=script&lang=ts\"\nexport * from \"./Provider.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\nimport { defineComponent } from 'vue';\nimport { ContentBlock } from 'CoreHome';\nimport Provider from './Provider.vue';\n\nexport default defineComponent({\n props: {\n providers: {\n type: Array,\n required: true,\n },\n },\n components: {\n ContentBlock,\n Provider,\n },\n});\n","import { render } from \"./AdminPage.vue?vue&type=template&id=6ea8181b\"\nimport script from \"./AdminPage.vue?vue&type=script&lang=ts\"\nexport * from \"./AdminPage.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","/**\n * Copyright (C) InnoCraft Ltd - All rights reserved.\n *\n * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd.\n * The intellectual and technical concepts contained herein are protected by trade secret\n * or copyright law. Redistribution of this information or reproduction of this material is\n * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd.\n *\n * You shall use this code only in accordance with the license agreement obtained from\n * InnoCraft Ltd.\n *\n * @link https://www.innocraft.com/\n * @license For license details see https://www.innocraft.com/license\n */\n\nexport function getDisplayApiKey(apiKey = ''): string {\n return `${apiKey.substr(0, 5)}*****${apiKey.substr(apiKey.length - 5, 5)}`;\n}\n","\nimport { defineComponent } from 'vue';\nimport {\n Matomo,\n ContentBlock,\n ContentTable,\n SiteRef,\n translate,\n Site,\n externalRawLink,\n} from 'CoreHome';\nimport { Field } from 'CorePluginsAdmin';\nimport { getDisplayApiKey } from '../utilities';\n\ninterface BingConfigState {\n removeAccountConfigName: string;\n removeAccountName: string;\n isAddingMeasurable: boolean;\n currentSiteToAdd: SiteRef;\n bingAccountAndUrlToAdd: string|null;\n apiKeyToAdd: string;\n}\n\ninterface BingAccount {\n name: string;\n apiKey: string;\n}\n\ninterface ConfiguredBingInfo {\n bingSiteUrl: string;\n}\n\nexport default defineComponent({\n props: {\n configuredMeasurables: {\n type: Object,\n required: true,\n },\n accounts: {\n type: Object,\n required: true,\n },\n sitesInfos: {\n type: Object,\n required: true,\n },\n currentSite: {\n type: Object,\n required: true,\n },\n urlOptions: {\n type: [Object, Array],\n required: true,\n },\n error: String,\n apikey: String,\n formNonce: String,\n addBingSiteConfigNonce: String,\n removeBingSiteConfigNonce: String,\n removeBingAccountNonce: String,\n countOfAccountsWithAccess: Number,\n userIsSuperUser: String,\n },\n data(): BingConfigState {\n return {\n removeAccountConfigName: '',\n removeAccountName: '',\n isAddingMeasurable: false,\n currentSiteToAdd: this.currentSite as SiteRef,\n bingAccountAndUrlToAdd: null,\n apiKeyToAdd: this.apikey || '',\n };\n },\n components: {\n ContentBlock,\n Field,\n },\n directives: {\n ContentTable,\n },\n methods: {\n removeAccountConfig(siteId: string|number, event: Event) {\n const siteInfos = this.sitesInfos as Record;\n this.removeAccountConfigName = siteInfos[siteId].name;\n\n Matomo.helper.modalConfirm(this.$refs.confirmRemoveAccountConfig as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n getDisplayApiKey,\n removeAccount(account: BingAccount, event: Event) {\n this.removeAccountName = this.getDisplayApiKey(account.apiKey);\n Matomo.helper.modalConfirm(this.$refs.confirmDeleteAccount as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n },\n computed: {\n hasApiKeyError() {\n return typeof this.error !== 'undefined' && this.error !== null;\n },\n configuredMeasurablesToDisplay() {\n const entries = Object.entries(\n this.configuredMeasurables as Record,\n );\n\n return Object.fromEntries(\n entries.filter(([, config]) => {\n const [account] = config.bingSiteUrl.split('##');\n return !!this.accounts[account];\n }).map(([siteId, config]) => {\n const [account, url] = config.bingSiteUrl.split('##');\n const { apiKey } = this.accounts[account];\n\n return [\n siteId,\n {\n ...config,\n account,\n url,\n apiKeyDisplay: this.getDisplayApiKey(apiKey),\n },\n ];\n }),\n );\n },\n bingApiKeyInstructionText() {\n const url = externalRawLink('https://matomo.org/faq/reports/import-bing-and-yahoo-search-keywords-into-matomo/');\n return translate(\n 'SearchEngineKeywordsPerformance_BingAPIKeyInstruction',\n '',\n '',\n ``,\n '',\n );\n },\n accountsToDisplay() {\n const asArray = Object.entries(this.accounts);\n const filtered = asArray.filter(([, value]) => value.hasAccess);\n\n return Object.fromEntries(filtered);\n },\n },\n});\n","import { render } from \"./Configuration.vue?vue&type=template&id=752192ce\"\nimport script from \"./Configuration.vue?vue&type=script&lang=ts\"\nexport * from \"./Configuration.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","\nimport {\n defineComponent,\n markRaw,\n} from 'vue';\nimport {\n ContentBlock,\n ContentTable,\n Matomo,\n SiteRef,\n translate,\n Notification,\n MatomoUrl,\n Site,\n useExternalPluginComponent,\n externalRawLink,\n} from 'CoreHome';\nimport { Field } from 'CorePluginsAdmin';\nimport { getDisplayApiKey } from '../utilities';\n\ninterface GoogleConfigState {\n removeAccountConfigName: string;\n removeAccountName: string;\n isAddingMeasurable: boolean;\n currentSiteToAdd: SiteRef;\n googleAccountAndUrlToAdd: string|null;\n googleTypesToAdd: string[];\n clientFile: unknown;\n clientText: string;\n}\n\ninterface GoogleAccount {\n name: string;\n apiKey: string;\n urls: Record;\n}\n\ninterface ConfiguredGoogleInfo {\n googleSearchConsoleUrl: string;\n}\n\ninterface ComponentExtension {\n plugin: string;\n component: string;\n}\n\ninterface ConfigureConnectionRadioOption {\n connectAccounts: string;\n manual: string;\n}\n\ninterface ConfigureConnectionProps {\n baseDomain: string;\n baseUrl: string;\n manualConfigNonce: string;\n manualActionUrl: string;\n primaryText: string;\n radioOptions: ConfigureConnectionRadioOption[];\n manualConfigText: string;\n connectAccountsUrl: string;\n connectAccountsBtnText: string;\n authUrl: string;\n unlinkUrl: string;\n strategy: string;\n connectedWith: string;\n}\n\nexport default defineComponent({\n props: {\n configuredMeasurables: {\n type: Object,\n required: true,\n },\n isClientConfigured: Boolean,\n isClientConfigurable: Boolean,\n isOAuthConfigured: Boolean,\n clientId: String,\n clientSecret: String,\n accounts: {\n type: Object,\n required: true,\n },\n sitesInfos: {\n type: Object,\n required: true,\n },\n currentSite: {\n type: Object,\n required: true,\n },\n urlOptions: {\n type: [Object, Array],\n required: true,\n },\n hasOAuthError: [String, Boolean],\n authNonce: {\n type: String,\n required: true,\n },\n formNonce: String,\n addGoogleSiteConfigNonce: String,\n removeGoogleSiteConfigNonce: String,\n removeGoogleAccountNonce: String,\n countOfAccountsWithAccess: Number,\n userIsSuperUser: String,\n extensions: Array,\n removeConfigUrl: String,\n configureConnectionProps: {\n type: Object,\n required: true,\n },\n },\n components: {\n ContentBlock,\n Field,\n Notification,\n },\n directives: {\n ContentTable,\n },\n data(): GoogleConfigState {\n return {\n removeAccountConfigName: '',\n removeAccountName: '',\n isAddingMeasurable: false,\n currentSiteToAdd: this.currentSite as SiteRef,\n googleAccountAndUrlToAdd: null,\n googleTypesToAdd: ['web'],\n clientFile: null,\n clientText: '',\n };\n },\n methods: {\n removeAccountConfig(siteId: string|number, event: Event) {\n const siteInfos = this.sitesInfos as Record;\n this.removeAccountConfigName = siteInfos[siteId].name;\n\n Matomo.helper.modalConfirm(this.$refs.confirmRemoveAccountConfig as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n removeAccount(account: GoogleAccount, event: Event) {\n this.removeAccountName = account.name;\n\n Matomo.helper.modalConfirm(\n this.$refs.confirmDeleteAccount as HTMLElement,\n {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n },\n );\n },\n accountHasAvailableSites(account: GoogleAccount) {\n const siteAccessLevels = ['siteOwner', 'siteFullUser', 'siteRestrictedUser'];\n return Object.values(account.urls).some(\n (siteAccess) => siteAccessLevels.indexOf(siteAccess) !== -1,\n );\n },\n },\n computed: {\n configuredMeasurablesToDisplay() {\n const entries = Object.entries(\n this.configuredMeasurables as Record,\n );\n\n return Object.fromEntries(\n entries.filter(([, config]) => {\n const [account] = config.googleSearchConsoleUrl.split('##');\n return !!this.accounts[account];\n }).map(([siteId, config]) => {\n const [account, url] = config.googleSearchConsoleUrl.split('##');\n const { apiKey } = this.accounts[account];\n\n return [\n siteId,\n {\n ...config,\n account,\n url,\n apiKeyDisplay: getDisplayApiKey(apiKey),\n },\n ];\n }),\n );\n },\n accountsToDisplay() {\n const asArray = Object.entries(this.accounts);\n const filtered = asArray.filter(([, value]) => value.hasAccess);\n\n return Object.fromEntries(filtered);\n },\n googleTypeOptions() {\n return {\n web: translate('SearchEngineKeywordsPerformance_KeywordTypeWeb'),\n image: translate('SearchEngineKeywordsPerformance_KeywordTypeImage'),\n video: translate('SearchEngineKeywordsPerformance_KeywordTypeVideo'),\n news: translate('SearchEngineKeywordsPerformance_KeywordTypeNews'),\n };\n },\n forwardToAuthUrl() {\n return `?${MatomoUrl.stringify({\n ...MatomoUrl.urlParsed.value,\n action: 'forwardToAuth',\n })}`;\n },\n visitOAuthHowTo() {\n const link = externalRawLink('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-oauth-client-config');\n return translate(\n 'SearchEngineKeywordsPerformance_VisitOAuthHowTo',\n ``,\n '',\n 'Google',\n );\n },\n componentExtensions() {\n const entries = this.extensions as Array;\n\n return markRaw(entries.map((ref) => useExternalPluginComponent(ref.plugin,\n ref.component)));\n },\n configConnectProps() {\n return this.configureConnectionProps as ConfigureConnectionProps;\n },\n },\n});\n","import { render } from \"./Configuration.vue?vue&type=template&id=f24fe118\"\nimport script from \"./Configuration.vue?vue&type=script&lang=ts\"\nexport * from \"./Configuration.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","\nimport { defineComponent } from 'vue';\nimport {\n Matomo,\n ContentBlock,\n ContentTable,\n SiteRef,\n Notification,\n MatomoUrl,\n translate,\n Site,\n externalRawLink,\n} from 'CoreHome';\nimport { Field } from 'CorePluginsAdmin';\nimport { getDisplayApiKey } from '../utilities';\n\ninterface YandexConfigState {\n removeAccountConfigName: string;\n removeAccountName: string;\n isAddingMeasurable: boolean;\n currentSiteToAdd: SiteRef;\n yandexAccountAndHostIdToAdd: string|null;\n clientIdToUse: string;\n clientSecretToUse: string;\n}\n\ninterface YandexAccount {\n name: string;\n apiKey: string;\n urls: Record;\n}\n\ninterface ConfiguredYandexInfo {\n yandexAccountAndHostId: string;\n}\n\nexport default defineComponent({\n props: {\n isClientConfigured: Boolean,\n isClientConfigurable: Boolean,\n isOAuthConfigured: Boolean,\n clientId: String,\n clientSecret: String,\n configuredMeasurables: {\n type: Object,\n required: true,\n },\n sitesInfos: {\n type: Object,\n required: true,\n },\n currentSite: {\n type: Object,\n required: true,\n },\n urlOptions: {\n type: [Object, Array],\n required: true,\n },\n hasOAuthError: [String, Boolean],\n accounts: {\n type: Object,\n required: true,\n },\n auth_nonce: {\n type: String,\n required: true,\n },\n formNonce: {\n type: String,\n required: true,\n },\n addYandexSiteConfigNonce: {\n type: String,\n required: true,\n },\n removeYandexSiteConfigNonce: {\n type: String,\n required: true,\n },\n removeYandexAccountNonce: {\n type: String,\n required: true,\n },\n countOfAccountsWithAccess: Number,\n userIsSuperUser: String,\n baseDomain: String,\n baseDomainUrl: String,\n },\n components: {\n ContentBlock,\n Field,\n Notification,\n },\n directives: {\n ContentTable,\n },\n data(): YandexConfigState {\n return {\n removeAccountConfigName: '',\n removeAccountName: '',\n isAddingMeasurable: false,\n currentSiteToAdd: this.currentSite as SiteRef,\n yandexAccountAndHostIdToAdd: null,\n clientIdToUse: '',\n clientSecretToUse: '',\n };\n },\n methods: {\n removeAccountConfig(siteId: string|number, event: Event) {\n const siteInfos = this.sitesInfos as Record;\n this.removeAccountConfigName = siteInfos[siteId].name;\n\n Matomo.helper.modalConfirm(\n this.$refs.confirmRemoveAccountConfig as HTMLElement,\n {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n },\n );\n },\n removeAccount(account: YandexAccount, event: Event) {\n this.removeAccountName = account.name;\n\n Matomo.helper.modalConfirm(this.$refs.confirmDeleteAccount as HTMLElement, {\n yes() {\n (event.target as HTMLFormElement).submit();\n },\n });\n },\n },\n computed: {\n configuredMeasurablesToDisplay() {\n const entries = Object.entries(\n this.configuredMeasurables as Record,\n );\n\n return Object.fromEntries(\n entries.filter(([, config]) => {\n const [account] = config.yandexAccountAndHostId.split('##');\n return !!this.accounts[account];\n }).map(([siteId, config]) => {\n const [account, host] = config.yandexAccountAndHostId.split('##');\n const accountInfo = this.accounts[account] as YandexAccount;\n const { apiKey } = accountInfo;\n\n const hostUrlPair = Object.entries(accountInfo.urls).find(\n ([, data]) => data.host_id === host,\n );\n const hostUrl = hostUrlPair?.[0];\n\n return [\n siteId,\n {\n ...config,\n account,\n host,\n hostUrl,\n apiKeyDisplay: getDisplayApiKey(apiKey),\n },\n ];\n }),\n );\n },\n forwardToYandexAuthUrl() {\n return `?${MatomoUrl.stringify({\n ...MatomoUrl.urlParsed.value,\n action: 'forwardToYandexAuth',\n })}`;\n },\n visitOAuthHowTo() {\n const link = externalRawLink('https://matomo.org/faq/reports/import-yandex-search-keywords-into-matomo/');\n return translate(\n 'SearchEngineKeywordsPerformance_VisitOAuthHowTo',\n ``,\n '',\n 'Yandex',\n );\n },\n accountsToDisplay() {\n const asArray = Object.entries(this.accounts);\n const filtered = asArray.filter(([, value]) => value.hasAccess);\n\n return Object.fromEntries(filtered);\n },\n },\n});\n","import { render } from \"./Configuration.vue?vue&type=template&id=a80179ac\"\nimport script from \"./Configuration.vue?vue&type=script&lang=ts\"\nexport * from \"./Configuration.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script","\n\n\n\n\n","\nimport { defineComponent } from 'vue';\nimport {\n translate,\n externalRawLink,\n} from 'CoreHome';\n\nexport default defineComponent({\n data() {\n return {\n redirectUri: '?module=SearchEngineKeywordsPerformance&action=processAuthCode',\n isSelectingFile: false,\n isUploading: false,\n };\n },\n props: {\n manualConfigNonce: {\n type: String,\n required: true,\n },\n baseDomain: {\n type: String,\n required: true,\n },\n baseUrl: {\n type: String,\n required: true,\n },\n },\n methods: {\n selectConfigFile() {\n this.isSelectingFile = true;\n const fileInput = document.getElementById('clientfile');\n if (fileInput) {\n fileInput.click();\n }\n },\n processFileChange() {\n const fileInput = document.getElementById('clientfile') as HTMLInputElement;\n const configFileUploadForm = document.getElementById('configFileUploadForm') as HTMLFormElement;\n if (fileInput && fileInput.value && configFileUploadForm) {\n this.isUploading = true;\n configFileUploadForm.submit();\n }\n },\n checkForCancel() {\n // If we're not in currently selecting a file or if we're uploading, there's no point checking\n if (!this.isSelectingFile || this.isUploading) {\n return;\n }\n\n // Check if the file is empty and change back from selecting status\n const fileInput = document.getElementById('clientfile') as HTMLInputElement;\n if (fileInput && !fileInput.value) {\n this.isSelectingFile = false;\n }\n },\n },\n computed: {\n setupGoogleAnalyticsImportFaq() {\n const url = externalRawLink('https://matomo.org/faq/reports/import-google-search-keywords-in-matomo/#how-to-set-up-google-search-console-and-verify-your-website');\n return translate(\n 'SearchEngineKeywordsPerformance_ConfigureTheImporterLabel3',\n ``,\n '',\n );\n },\n isUploadButtonDisabled() {\n return this.isSelectingFile || this.isUploading;\n },\n },\n mounted() {\n document.body.onfocus = this.checkForCancel;\n },\n});\n","import { render } from \"./ConfigureConnection.vue?vue&type=template&id=9e9de9fe\"\nimport script from \"./ConfigureConnection.vue?vue&type=script&lang=ts\"\nexport * from \"./ConfigureConnection.vue?vue&type=script&lang=ts\"\nscript.render = render\n\nexport default script"],"sourceRoot":""} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/umd.metadata.json b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/umd.metadata.json new file mode 100644 index 0000000..dce4477 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/dist/umd.metadata.json @@ -0,0 +1,6 @@ +{ + "dependsOn": [ + "CoreHome", + "CorePluginsAdmin" + ] +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Admin/AdminPage.vue b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Admin/AdminPage.vue new file mode 100644 index 0000000..3c4970a --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Admin/AdminPage.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Admin/Provider.vue b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Admin/Provider.vue new file mode 100644 index 0000000..819c321 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Admin/Provider.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Bing/Configuration.vue b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Bing/Configuration.vue new file mode 100644 index 0000000..3ca6c47 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Bing/Configuration.vue @@ -0,0 +1,432 @@ + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Configure/ConfigureConnection.less b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Configure/ConfigureConnection.less new file mode 100644 index 0000000..6dcbbda --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Configure/ConfigureConnection.less @@ -0,0 +1,3 @@ +h3.section-heading { + margin-top: 56px; +} \ No newline at end of file diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Configure/ConfigureConnection.vue b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Configure/ConfigureConnection.vue new file mode 100644 index 0000000..6877e84 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Configure/ConfigureConnection.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Google/Configuration.vue b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Google/Configuration.vue new file mode 100644 index 0000000..4dffd4e --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Google/Configuration.vue @@ -0,0 +1,637 @@ + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Yandex/Configuration.vue b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Yandex/Configuration.vue new file mode 100644 index 0000000..3a43086 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/Yandex/Configuration.vue @@ -0,0 +1,580 @@ + + + + + diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/index.ts b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/index.ts new file mode 100644 index 0000000..c3d5b84 --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/index.ts @@ -0,0 +1,20 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +export { default as AdminPage } from './Admin/AdminPage.vue'; +export { default as BingConfiguration } from './Bing/Configuration.vue'; +export { default as GoogleConfiguration } from './Google/Configuration.vue'; +export { default as YandexConfiguration } from './Yandex/Configuration.vue'; +export { default as ConfigureConnection } from './Configure/ConfigureConnection.vue'; diff --git a/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/utilities.ts b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/utilities.ts new file mode 100644 index 0000000..4d2b83c --- /dev/null +++ b/files/plugin-SearchEngineKeywordsPerformance-5.0.23/vue/src/utilities.ts @@ -0,0 +1,18 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +export function getDisplayApiKey(apiKey = ''): string { + return `${apiKey.substr(0, 5)}*****${apiKey.substr(apiKey.length - 5, 5)}`; +} diff --git a/files/plugin-UsersFlow-5.0.6/API.php b/files/plugin-UsersFlow-5.0.6/API.php new file mode 100644 index 0000000..c40914f --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/API.php @@ -0,0 +1,277 @@ +configuration = $configuration; + } + + /** + * Get flow details for each available interaction step. + * + * The first table level will list all available interaction steps, + * Their subtables list all pages and actions they viewed or performed within that interaction steps, + * Their subtables list where they proceeded to afterwards as the next interaction. + * + * This report is polished to be more human readable and adds some processed metrics like the proceeded rate and exit rate. + * If you are interested in integrating the data into a different system you may be interested in the "UsersFlow.getUsersFlow" API method. + * + * @param $idSite + * @param $period + * @param $date + * @param bool $segment + * @param bool $expanded + * @param bool $flat + * @param bool $idSubtable + * @param string $dataSource Either 'page_url' or 'page_title'. For a list of all available data sources call the API method UsersFlow.getAvailableDataSources + * @return DataTable|DataTable\Map + */ + public function getUsersFlowPretty($idSite, $period, $date, $segment = false, $expanded = false, $flat = false, $idSubtable = false, $dataSource = false) + { + Piwik::checkUserHasViewAccess($idSite); + + $dataSource = DataSources::getValidDataSource($dataSource); + + $table = $this->getDataTable($idSite, $period, $date, $segment, $dataSource, $expanded, $idSubtable, $flat); + $table->queueFilter('\Piwik\Plugins\UsersFlow\DataTable\Filter\ReplaceActionLabels'); + + if ($flat) { + $table->queueFilterSubtables('\Piwik\Plugins\UsersFlow\DataTable\Filter\ReplaceActionLabels'); + } + + if (empty($idSubtable)) { + $table->filter('ColumnCallbackReplace', array('label', function ($value) { + if (is_numeric($value)) { + return Piwik::translate('UsersFlow_ColumnInteraction') . ' ' . $value; + } + + return $value; + })); + } + + if ($flat) { + $table->filterSubtables('ColumnCallbackDeleteRow', array('label', function ($value) { + if ( + $value === false + || $value == DataTable::LABEL_SUMMARY_ROW + || $value === Piwik::translate('General_Others') + ) { + return true; + } + return false; + })); + } + + return $table; + } + + /** + * Get flow details for each available interaction step. + * + * The first table level will list all available interaction steps, + * Their subtables list all pages and actions they viewed or performed within that interaction steps, + * Their subtables list where they proceeded to afterwards as the next interaction. + * + * This report is "unformatted" and useful if you want to develop your own visualization on top of this API or if + * you want to use the data for integrating it into another tool. If you are interested in requesting the report data + * in a more human readable way you may want to have a look at "UsersFlow.getUsersFlowPretty". + * + * @param $idSite + * @param $period + * @param $date + * @param int $limitActionsPerStep By default, only 5 rows per interaction step are returned and all other rows are merged into "Others". + * @param bool $exploreStep + * @param bool $exploreUrl + * @param bool $segment + * @param bool $expanded + * @param string $dataSource Either 'page_url' or 'page_title'. For a list of all available data sources call the API method UsersFlow.getAvailableDataSources + * @return DataTable|DataTable\Map + */ + public function getUsersFlow($idSite, $period, $date, $limitActionsPerStep = 5, $exploreStep = false, $exploreUrl = false, $segment = false, $expanded = false, $dataSource = false) + { + Piwik::checkUserHasViewAccess($idSite); + + $dataSource = DataSources::getValidDataSource($dataSource); + + $table = $this->getUsersFlowDataTable($idSite, $period, $date, $segment, $dataSource, $expanded, $exploreStep, $exploreUrl); + $table->filter('\Piwik\Plugins\UsersFlow\DataTable\Filter\AddLabelsForMissingSteps'); + $table->filter('Sort', array('label', SortFilter::ORDER_ASC, $naturalSort = true, $recursiveSort = false)); + // we do not need to filter the subtables recursive as we will in the sub-subtable only keep rows anyway that are present in the sub-table + $table->filterSubtables('Sort', array(Metrics::NB_VISITS, SortFilter::ORDER_DESC, $naturalSort = true, $recursiveSort = false)); + $table->filter('\Piwik\Plugins\UsersFlow\DataTable\Filter\LimitStepActions', array($limitActionsPerStep)); + $table->filter('\Piwik\Plugins\UsersFlow\DataTable\Filter\LimitProceededToActions'); + $table->filter('\Piwik\Plugins\UsersFlow\DataTable\Filter\BalanceOtherActions'); + $table->filter('\Piwik\Plugins\UsersFlow\DataTable\Filter\ReplaceActionLabels'); + $table->disableFilter('Sort'); + + return $table; + } + + private function getUsersFlowDataTable($idSite, $period, $date, $segment, $dataSource, $expanded, $exploreStep, $exploreUrl) + { + if (empty($exploreStep) || empty($exploreUrl)) { + $table = $this->getDataTable($idSite, $period, $date, $segment, $dataSource, $expanded); + return $table; + } + + $site = new Site($idSite); + + if (Period::isMultiplePeriod($date, $period)) { + throw new \Exception('Multi period is not supported'); + } else { + $period = PeriodFactory::makePeriodFromQueryParams($site->getTimezone(), $period, $date); + } + + $parameters = new ArchiveProcessor\Parameters($site, $period, new Segment($segment, array($idSite))); + $archiveWriter = new ArchiveWriter($parameters); + $logAggregator = new LogAggregator($parameters); + + $processor = new ArchiveProcessor($parameters, $archiveWriter, $logAggregator); + + $numMaxSteps = $exploreStep + 3; + $numMaxStepsTotal = $this->configuration->getMaxSteps(); + if ($numMaxSteps > $numMaxStepsTotal) { + $numMaxSteps = $numMaxStepsTotal; + } + + $recordBuilder = new GenericUsersFlow($dataSource, $numMaxSteps, $this->configuration); + $records = $recordBuilder->aggregate($processor, $exploreStep, $exploreUrl); + + $table = reset($records); + $table->queueFilter('ReplaceSummaryRowLabel'); + + return $table; + } + + /** + * Get all actions that were performed as part of a specific interaction step. For example "Give me all pages that + * were viewed in the first step". Their subtables hold rows to where the users proceeded to next. + * + * @param $idSite + * @param $period + * @param $date + * @param $interactionPosition + * @param bool $offsetActionsPerStep + * @param bool $segment + * @param bool $idSubtable + * @param string $dataSource Either 'page_url' or 'page_title' + * @return DataTable|DataTable\Map + */ + public function getInteractionActions($idSite, $period, $date, $interactionPosition, $offsetActionsPerStep = false, $segment = false, $idSubtable = false, $dataSource = false) + { + Piwik::checkUserHasViewAccess($idSite); + + if (Period::isMultiplePeriod($date, $period) || Site::getIdSitesFromIdSitesString($idSite) !== [$idSite]) { + throw new \Exception('Requesting multiple dates or sites is currently not supported.'); + } + + $requestsTargetLinks = !empty($idSubtable); + + if (!$requestsTargetLinks) { + // in this case we are fetching first level actions and not the subtable of one of those actions + $table = $this->getDataTable($idSite, $period, $date, $segment, $dataSource, $expanded = false); + $stepRow = $table->getRowFromLabel($interactionPosition); + + if (!$stepRow) { + return new DataTable(); + } + $idSubtable = $stepRow->getIdSubDataTable(); + + if (!$idSubtable) { + return new DataTable(); + } + + unset($table); // the above table contains like only 10 rows so no need to destroy it + } + + $stepSubtable = $this->getDataTable($idSite, $period, $date, $segment, $dataSource, $expanded = false, $idSubtable); + $stepSubtable->filter('Sort', array(Metrics::NB_VISITS)); + if ($offsetActionsPerStep && !$requestsTargetLinks) { + // this way we only show the actions within the others group + $stepSubtable->filter('Limit', array($offset = $offsetActionsPerStep, $limit = -1, $keepSummaryRow = true)); + } + + $stepSubtable->filter('\Piwik\Plugins\UsersFlow\DataTable\Filter\ReplaceActionLabels'); + + return $stepSubtable; + } + + /** + * Get a list of all available data sources + * @return array + */ + public function getAvailableDataSources() + { + Piwik::checkUserHasSomeViewAccess(); + + return DataSources::getAvailableDataSources(); + } + + private function getDataTable($idSite, $period, $date, $segment, $dataSource, $expanded, $idSubtable = null, $flat = false) + { + if (false === $idSubtable) { + $idSubtable = null; + } + + if ($dataSource === DataSources::DATA_SOURCE_PAGE_TITLE) { + $recordName = Archiver::USERSFLOW_PAGE_TITLE_ARCHIVE_RECORD; + } else { + $recordName = Archiver::USERSFLOW_ARCHIVE_RECORD; + } + + return Archive::createDataTableFromArchive( + $recordName, + $idSite, + $period, + $date, + $segment, + $expanded, + $flat, + $idSubtable + ); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Archiver.php b/files/plugin-UsersFlow-5.0.6/Archiver.php new file mode 100644 index 0000000..fa9f507 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Archiver.php @@ -0,0 +1,25 @@ + self::DATA_SOURCE_PAGE_URL, 'name' => Piwik::translate('Actions_PageUrls')), + array('value' => self::DATA_SOURCE_PAGE_TITLE, 'name' => Piwik::translate('Actions_WidgetPageTitles')), + ); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Archiver/LogAggregator.php b/files/plugin-UsersFlow-5.0.6/Archiver/LogAggregator.php new file mode 100644 index 0000000..0b73716 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Archiver/LogAggregator.php @@ -0,0 +1,194 @@ +logAggregator = $logAggregator; + $this->configuration = $configuration; + } + + public function makeUrlColumn($column, $dataSource, $ignoreSearchQuery, $ignoreDomain, $siteKeepsUrlFragments) + { + if ($dataSource === DataSources::DATA_SOURCE_PAGE_TITLE) { + return $column; + } + + $theColumn = $column; + + if ($ignoreSearchQuery) { + if ($siteKeepsUrlFragments) { + $removeHash = "SUBSTRING_INDEX(%s, '#', 1)"; // if the site keeps url hashes, we remove them as well + } else { + $removeHash = '%s'; + } + + $pathName = "TRIM(TRAILING '/' FROM SUBSTRING_INDEX($removeHash, '?', 1))"; + + $column = sprintf($pathName, $column); + } + + if ($ignoreDomain) { + $pathName = "SUBSTR(%s, LOCATE('/', $theColumn))"; + $column = sprintf($pathName, $column); + } + + return $column; + } + + public function aggregateTopStepActions($step, $dataSource, $ignoreSearchQuery, $ignoreDomain, $siteKeepsUrlFragments, $exploreStep, $exploreValueToMatch) + { + if ($dataSource === DataSources::DATA_SOURCE_PAGE_TITLE) { + $columnToFetch = 'idaction_name'; + $idAction = Action::TYPE_PAGE_TITLE; + } else { + $columnToFetch = 'idaction_url'; + $idAction = Action::TYPE_PAGE_URL; + } + + $step = (int) $step; + $nextStep = $step + 1; + + $doExploreTraffic = !empty($exploreStep) && !empty($exploreValueToMatch); + + $fromTable = version_compare(Version::VERSION, '5.2.0-b6', '>=') + ? ['table' => 'log_link_visit_action', 'useIndex' => 'index_idsite_servertime'] : 'log_link_visit_action'; + $from = [$fromTable, [ + 'table' => 'log_action', + 'joinOn' => "log_link_visit_action.$columnToFetch = log_action.idaction" + ]]; + + $extraWhere = ''; + $keyToBeReplacedWithBind = "'TO_BE_REPLACED_WITH_BIND'"; + + if ($doExploreTraffic) { + $isExploringSearch = $exploreValueToMatch === 'Search' || $exploreValueToMatch === Piwik::translate('General_Search'); + + $from[] = array( + 'table' => 'log_link_visit_action', + 'tableAlias' => 'log_link_visit_action_match', + 'joinOn' => "log_link_visit_action.idvisit = log_link_visit_action_match.idvisit" + ); + if ($isExploringSearch) { + $extraWhere .= ' + AND log_link_visit_action_match.pageview_position = ' . (int) $exploreStep . ' AND log_link_visit_action_match.' . $columnToFetch . ' is null'; + } else { + $columnToExplore = $this->makeUrlColumn('`log_action_match`.`name`', $dataSource, $ignoreSearchQuery, $ignoreDomain, $siteKeepsUrlFragments); + $extraWhere .= ' + AND log_link_visit_action_match.pageview_position = ' . (int) $exploreStep . " AND $columnToExplore = $keyToBeReplacedWithBind"; + $from[] = array( + 'table' => 'log_action', + 'tableAlias' => 'log_action_match', + 'joinOn' => "log_link_visit_action_match.$columnToFetch = log_action_match.idaction AND log_action_match.type = $idAction" + ); + } + } + + $pluginManager = Plugin\Manager::getInstance(); + if ($pluginManager->isPluginActivated('Events')) { + $extraWhere .= ' AND log_link_visit_action.idaction_event_category is null'; + } + if ($pluginManager->isPluginActivated('Contents')) { + $extraWhere .= ' AND log_link_visit_action.idaction_content_name is null'; + } + + $urlLabel = $this->makeUrlColumn('`log_action`.`name`', $dataSource, $ignoreSearchQuery, $ignoreDomain, $siteKeepsUrlFragments); + + $from[] = array( + 'table' => 'log_link_visit_action', + 'tableAlias' => 'log_link_visit_action_next', + 'joinOn' => "log_link_visit_action.idvisit = log_link_visit_action_next.idvisit + AND log_link_visit_action_next.pageview_position = " . $nextStep + ); + + if ($dataSource === DataSources::DATA_SOURCE_PAGE_TITLE) { + $extraWhere .= " AND (log_action.type = $idAction or log_action.type = " . Action::TYPE_SITE_SEARCH . ")"; + $extraWhere .= " AND (log_action_url_next.type = $idAction or log_link_visit_action_next.idlink_va is null or log_action_url_next.type = " . Action::TYPE_SITE_SEARCH . ")"; + } else { + $extraWhere .= " AND (log_action.type = $idAction or log_link_visit_action.idaction_url is null)"; + $extraWhere .= " AND (log_action_url_next.type = $idAction or log_link_visit_action_next.idaction_url is null)"; + } + + $from[] = array( + 'table' => 'log_action', + 'tableAlias' => 'log_action_url_next', + 'joinOn' => "log_link_visit_action_next.$columnToFetch = log_action_url_next.idaction" + ); + + $nextUrlLabel = $this->makeUrlColumn('`log_action_url_next`.`name`', $dataSource, $ignoreSearchQuery, $ignoreDomain, $siteKeepsUrlFragments); + $searchLabel = Archiver::LABEL_SEARCH; + + $where = $this->logAggregator->getWhereStatement('log_link_visit_action', 'server_time'); + $where .= " AND log_link_visit_action.pageview_position = $step " . $extraWhere; + + + if ($dataSource === DataSources::DATA_SOURCE_PAGE_TITLE) { + $select = "if(log_action.type = " . Action::TYPE_SITE_SEARCH . ", '$searchLabel', $urlLabel) as label, + CASE WHEN log_link_visit_action_next.idlink_va is null THEN null WHEN log_action_url_next.type = " . Action::TYPE_SITE_SEARCH . " THEN '$searchLabel' ELSE $nextUrlLabel END as nextLabel,"; + } else { + $select = "if(log_link_visit_action.idaction_url is null, '$searchLabel', $urlLabel) as label, + CASE WHEN log_link_visit_action_next.idlink_va is null THEN null WHEN log_link_visit_action_next.idaction_url is null THEN '$searchLabel' ELSE $nextUrlLabel END as nextLabel, + "; + } + + $select .= " count(*) as " . Metrics::NB_VISITS . ", + sum(if(log_link_visit_action_next.idlink_va is null, 1, 0)) as " . Metrics::NB_EXITS; + $groupBy = "label, nextLabel"; + $orderBy = Metrics::NB_VISITS . ' DESC'; + + $limit = $this->configuration->getMaxLinksPerInteractions(); + + $query = $this->logAggregator->generateQuery($select, $from, $where, $groupBy, $orderBy, $limit); + $sql = $query['sql']; + $bind = $query['bind']; + + if ($doExploreTraffic) { + $position = strpos($sql, $keyToBeReplacedWithBind); + if ($position !== false) { + // we do not want to count eg "'?'" + $countBindsBeforeReplace = substr_count($sql, ' ?', 0, $position); + $countBindsBeforeReplace += substr_count($sql, '(?)', 0, $position); + + array_splice($bind, $countBindsBeforeReplace, 0, $exploreValueToMatch); + $sql = str_replace($keyToBeReplacedWithBind, '?', $sql); + } + } + + return array('sql' => trim($sql), 'bind' => $bind); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/CHANGELOG.md b/files/plugin-UsersFlow-5.0.6/CHANGELOG.md new file mode 100644 index 0000000..b2fb1b4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/CHANGELOG.md @@ -0,0 +1,90 @@ +# Changelog + +## 5.0.6 - 2025-07-21 +- Correctly map filtered action to others +- Correctly distribute others actions to show correct inflow and outflow of links + +## 5.0.5 - 2024-11-05 +- Updated README.md + +## 5.0.4 - 2024-08-26 +- Pricing updated + +## 5.0.3 +- Added cover image for marketplace + +## 5.0.2 +- Updated README.md + +## 5.0.1 +- Compatibility with Matomo 5.0.0-b4 + +## 5.0.0 +- Compatibility with Matomo 5.0 + +## 4.1.1 +- Fixed faulty help text, which was being displayed always + +## 4.1.0 +- Migrate AngularJS code to Vue. + +## 4.0.4 +- Improve contrast in tooltip + +## 4.0.3 +- Add category help texts. + +## 4.0.2 +- Rearchive reports on plugin activation + +## 4.0.1 +- Compatibility with Matomo 4.0 + +## 4.0.0 +- Compatibility with Matomo 4.0 + +## 3.1.11 +- Reduce needed memory when archiving + +## 3.1.10 +- Support a DB reader + +## 3.1.9 +- Do not include events and content tracking in report + +## 3.1.8 +- Support more languages + +## 3.1.7 +- Fix exploring traffic when a segment is applied results in no data +- Moved Users Flow from Visitors menu category into Behaviour category + +## 3.1.6 +- Set default level in visualization to majority + +## 3.1.5 +- Fix a possible rendering issue when there a node link is expected but there is none + +## 3.1.4 +- Fix exits were not shown for page titles + +## 3.1.3 +- Piwik is now Matomo + +## 3.1.2 +- Fix the word "UsersFlow_LabelUsedSearch" was not translated in a flattened report + +## 3.1.1 +- Making sure UsersFlow will work correctly with Piwik 3.2.0 + +## 3.1.0 +- Updated d3.js to the latest v4 version +- Add possibility to view the flow for page titles + +## 3.0.1 + +- Added new feature to ignore domain when aggregating URLs. + +## 3.0.0 + +- Initial version diff --git a/files/plugin-UsersFlow-5.0.6/Categories/TopPathsSubcategory.php b/files/plugin-UsersFlow-5.0.6/Categories/TopPathsSubcategory.php new file mode 100644 index 0000000..0bc1300 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Categories/TopPathsSubcategory.php @@ -0,0 +1,33 @@ +' . Piwik::translate('UsersFlow_TopPathsSubcategoryHelp') . '

'; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Categories/UsersFlowSubcategory.php b/files/plugin-UsersFlow-5.0.6/Categories/UsersFlowSubcategory.php new file mode 100644 index 0000000..329fe86 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Categories/UsersFlowSubcategory.php @@ -0,0 +1,33 @@ +' . Piwik::translate('UsersFlow_UsersFlowSubcategoryHelp', ['', '', '', '']) . '

'; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Columns/Interactions.php b/files/plugin-UsersFlow-5.0.6/Columns/Interactions.php new file mode 100644 index 0000000..37df23c --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Columns/Interactions.php @@ -0,0 +1,28 @@ +getMetric($row, PluginMetrics::NB_EXITS); + $hits = $this->getMetric($row, PluginMetrics::NB_VISITS); + + return Piwik::getQuotientSafe($proceeded, $hits, $precision = 2); + } + + public function getDependentMetrics() + { + return array(PluginMetrics::NB_EXITS, PluginMetrics::NB_VISITS); + } + + public function format($value, Formatter $formatter) + { + return $formatter->getPrettyPercentFromQuotient($value); + } + + public function getSemanticType(): ?string + { + return Dimension::TYPE_PERCENT; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Columns/Metrics/Proceeded.php b/files/plugin-UsersFlow-5.0.6/Columns/Metrics/Proceeded.php new file mode 100644 index 0000000..b91d62b --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Columns/Metrics/Proceeded.php @@ -0,0 +1,65 @@ +getMetric($row, PluginMetrics::NB_VISITS); + $exits = $this->getMetric($row, PluginMetrics::NB_EXITS); + + $proceeded = $visits - $exits; + + if ($proceeded < 0) { + $proceeded = 0; + } + + return (int) $proceeded; + } + + public function getDependentMetrics() + { + return array(PluginMetrics::NB_VISITS, PluginMetrics::NB_EXITS); + } + + public function getSemanticType(): ?string + { + return Dimension::TYPE_NUMBER; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Columns/Metrics/ProceededRate.php b/files/plugin-UsersFlow-5.0.6/Columns/Metrics/ProceededRate.php new file mode 100644 index 0000000..ac5efdf --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Columns/Metrics/ProceededRate.php @@ -0,0 +1,65 @@ +getMetric($row, PluginMetrics::NB_PROCEEDED); + $hits = $this->getMetric($row, PluginMetrics::NB_VISITS); + + return Piwik::getQuotientSafe($proceeded, $hits, $precision = 2); + } + + public function getDependentMetrics() + { + return array(PluginMetrics::NB_PROCEEDED, PluginMetrics::NB_VISITS); + } + + public function format($value, Formatter $formatter) + { + return $formatter->getPrettyPercentFromQuotient($value); + } + + public function getSemanticType(): ?string + { + return Dimension::TYPE_PERCENT; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Configuration.php b/files/plugin-UsersFlow-5.0.6/Configuration.php new file mode 100644 index 0000000..d3a6bda --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Configuration.php @@ -0,0 +1,143 @@ +getConfig(); + $config->UsersFlow = array( + self::KEY_MAX_STEPS => self::DEFAULT_MAX_STEPS, + self::KEY_MAX_ACTIONS_PER_TABLE => self::DEFAULT_MAX_ACTIONS_PER_TABLE, + self::KEY_MAX_LINKS_PER_INTERACTION => self::DEFAULT_MAX_LINKS_PER_INTERACTION, + ); + $config->forceSave(); + } + + public function uninstall() + { + $config = $this->getConfig(); + $config->UsersFlow = array(); + $config->forceSave(); + } + + /** + * @return int + */ + public function getMaxRowsInActions() + { + return $this->getIntegerConfigSetting(self::KEY_MAX_ACTIONS_PER_TABLE, self::DEFAULT_MAX_ACTIONS_PER_TABLE); + } + + /** + * @return int + */ + public function getMaxLinksPerInteractions() + { + return $this->getIntegerConfigSetting(self::KEY_MAX_LINKS_PER_INTERACTION, self::DEFAULT_MAX_LINKS_PER_INTERACTION); + } + + /** + * @return int + */ + public function getMaxSteps() + { + $maxSteps = $this->getIntegerConfigSetting(self::KEY_MAX_STEPS, self::DEFAULT_MAX_STEPS); + if ($maxSteps < 3) { + $maxSteps = 3; + } + return $maxSteps; + } + + public function getUsersFlowReportParams($login) + { + $params = Manager::getViewDataTableParameters($login, 'UsersFlow.getUsersFlow'); + + if (!empty($params['levelOfDetail'])) { + $levelOfDetail = (int) $params['levelOfDetail']; + } else { + $levelOfDetail = self::DEFAULT_LEVEL_OF_DETAIL; + } + if ($levelOfDetail < 1 || $levelOfDetail > 6) { + $levelOfDetail = self::DEFAULT_LEVEL_OF_DETAIL; + } + + if (isset($params['userFlowSource'])) { + $userFlowSource = DataSources::getValidDataSource($params['userFlowSource']); + } else { + $userFlowSource = DataSources::getValidDataSource(''); + } + + if (!empty($params['numActionsPerStep'])) { + $numActionsPerStep = (int) $params['numActionsPerStep']; + } else { + $numActionsPerStep = self::DEFAULT_NUM_ACTIONS_PER_STEP; + } + + if ($numActionsPerStep < 4) { + $numActionsPerStep = self::DEFAULT_NUM_ACTIONS_PER_STEP; + } + + return array( + 'levelOfDetail' => $levelOfDetail, + 'numActionsPerStep' => $numActionsPerStep, + 'userFlowSource' => $userFlowSource + ); + } + + /** + * @return int + */ + private function getIntegerConfigSetting($key, $default) + { + $config = $this->getConfig(); + $usersFlow = $config->UsersFlow; + + $value = null; + + if (!empty($usersFlow[$key])) { + $value = (int) $usersFlow[$key]; + } + + if (empty($value)) { + // eg when wrongly configured or not configured + $value = $default; + } + + return $value; + } + + private function getConfig() + { + return Config::getInstance(); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Controller.php b/files/plugin-UsersFlow-5.0.6/Controller.php new file mode 100644 index 0000000..5ea5934 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Controller.php @@ -0,0 +1,52 @@ +configuration = $configuration; + parent::__construct(); + } + + public function getUsersFlow() + { + $this->checkSitePermission(); + + $login = Piwik::getCurrentUserLogin(); + $params = $this->configuration->getUsersFlowReportParams($login); + + $showTitle = Common::getRequestVar('showtitle', 0, 'int'); + + return $this->renderTemplate('getUsersFlow', array( + 'showTitle' => $showTitle, + 'numActionsPerStep' => $params['numActionsPerStep'], + 'levelOfDetail' => $params['levelOfDetail'], + 'userFlowSource' => $params['userFlowSource'], + 'maxLinksPerInteractions' => $this->configuration->getMaxLinksPerInteractions() + )); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/DataTable/Filter/AddLabelsForMissingSteps.php b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/AddLabelsForMissingSteps.php new file mode 100644 index 0000000..c4b621e --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/AddLabelsForMissingSteps.php @@ -0,0 +1,52 @@ +getRowsWithoutSummaryRow() as $row) { + $step = $row->getColumn('label'); + if ($step > $numSteps) { + $numSteps = $step; + } + } + + for ($i = 1; $i < $numSteps; $i++) { + if (!$table->getRowFromLabel($i . '')) { + $table->addRow(new Row(array(Row::COLUMNS => array( + 'label' => $i, + Metrics::NB_VISITS => 0, + Metrics::NB_EXITS => 0, + )))); + } + } + } +} diff --git a/files/plugin-UsersFlow-5.0.6/DataTable/Filter/BalanceOtherActions.php b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/BalanceOtherActions.php new file mode 100644 index 0000000..541cb22 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/BalanceOtherActions.php @@ -0,0 +1,124 @@ +getRowsWithoutSummaryRow() as $stepRow) { + $step = $stepRow->getColumn('label'); + $nextRow = $table->getRowFromLabel($step + 1); + + // No need to go ahead if nextRow is empty as there is no row to balance the count + if (empty($nextRow)) { + continue; + } + + $nextSubtable = $nextRow->getSubtable(); + + if (empty($nextSubtable)) { + continue; + } + + // Get the labels of next row and its visits, E.g ['label1' => 5, 'label2' => 17, -1 => '35] + $labelsInNextRow = []; + foreach ($nextSubtable->getRows() as $nextSubtableRow) { + $labelsInNextRow[$nextSubtableRow->getColumn('label')] = $nextSubtableRow->getColumn(Metrics::NB_VISITS); + } + + if (!$labelsInNextRow) { + continue; + } + + $subtable = $stepRow->getSubtable(); + + if (!$subtable) { + continue; + } + + $summaryRow = $subtable->getSummaryRow(); + if (!$summaryRow) { + continue; + } + $summaryRowSubTable = $summaryRow->getSubtable(); + if (!$summaryRowSubTable) { + continue; + } + // Now check if all the labels in next row has incoming links and deduct the visits count + // $labelsInNextRow = ['label1' => 5, 'label2' => 17, -1 => '35]; + // E.g if label 1 is part of subtable with 4 visits, this would change the $labelsInNextRow to ['label1' => 1, 'label2' => 17, -1 => '35] + // Run the same iteration with summary row and calculate the sum for further check + $this->reduceLabelsInNextRow($subtable, $labelsInNextRow); + $summaryRowSubTableSum = 0; + $this->reduceLabelsInNextRow($summaryRowSubTable, $labelsInNextRow, $summaryRowSubTableSum); + + // Sum the next label to determine if there is any label left to balance + $nextLabelSum = array_sum($labelsInNextRow); + // nb_proceeded is a calculated field, so we determine it manually here to match the counts + $othersProceeded = $summaryRow->getColumn(Metrics::NB_VISITS) - $summaryRow->getColumn(Metrics::NB_EXITS); + // We balance only when the counts are equal + if (($othersProceeded - ($nextLabelSum + $summaryRowSubTableSum)) !== 0) { + continue; + } + foreach ($labelsInNextRow as $label => $nbVisits) { + // Balance only when any visits left and no corresponding inflow node is found + if ($nbVisits > 0) { + $existingRow = $summaryRowSubTable->getRowFromLabel($label); + if ($existingRow) { + $existingRow->setColumn(Metrics::NB_VISITS, $existingRow->getColumn(Metrics::NB_VISITS) + $nbVisits); + } else { + $summaryRowSubTable->addRow(new Row(array(Row::COLUMNS => array( + 'label' => $label, + Metrics::NB_VISITS => $nbVisits, + )))); + } + } + } + $summaryRowSubTable->filter('Sort', array(Metrics::NB_VISITS)); + } + } + + private function reduceLabelsInNextRow(DataTable $table, array &$labelsInNextRow, int &$sum = 0): void + { + foreach ($table->getRows() as $subtableRow) { + $subtableRowSubTable = $subtableRow->getSubtable(); + $sum = $sum + $subtableRow->getColumn(Metrics::NB_VISITS); + if ($subtableRowSubTable) { + foreach ($subtableRowSubTable->getRows() as $subtableRowSubTableRow) { + $label = $subtableRowSubTableRow->getColumn('label'); + if (isset($labelsInNextRow[$label])) { + $labelsInNextRow[$label] = $labelsInNextRow[$label] - $subtableRowSubTableRow->getColumn(Metrics::NB_VISITS); + } + } + } + } + } +} diff --git a/files/plugin-UsersFlow-5.0.6/DataTable/Filter/LimitProceededToActions.php b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/LimitProceededToActions.php new file mode 100644 index 0000000..d588947 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/LimitProceededToActions.php @@ -0,0 +1,116 @@ +getRowsWithoutSummaryRow() as $stepRow) { + $step = $stepRow->getColumn('label'); + $nextRow = $table->getRowFromLabel($step + 1); + + if (empty($nextRow)) { + // we need to remove all links to next interaction depth because there are is no next step + $this->removeAllLinksToNextInteraction($stepRow); + continue; + } + + $nextSubtable = $nextRow->getSubtable(); + + if (empty($nextSubtable)) { + // we need to remove all links to next interaction depth because there is a next step but there were + // no interactions for that step + $this->removeAllLinksToNextInteraction($stepRow); + continue; + } + + $labelsInNextRow = $nextSubtable->getColumn('label'); + + // now we keep in this subtable only labels that are used in the next step, we are only interested in + // links between for action urls that move from step X to step X +1 + $subtable = $stepRow->getSubtable(); + + if (!$subtable) { + continue; + } + + foreach ($subtable->getRows() as $actionRow) { + $actionSubtable = $actionRow->getSubtable(); + + if (!$actionSubtable) { + continue; + } + + $deleteIds = array(); + $deleteRows = []; + $removedVisitsSum = 0; + foreach ($actionSubtable->getRows() as $index => $actionLinkRow) { + if (!in_array($actionLinkRow->getColumn('label'), $labelsInNextRow, $strict = true)) { + $deleteIds[] = $index; + $deleteRows[] = $actionLinkRow; + $removedVisitsSum += $actionLinkRow->getColumn(Metrics::NB_VISITS); + } + } + + if ($removedVisitsSum) { + $this->addDeletedRowsAsSummaryRow($actionSubtable, $removedVisitsSum, $deleteRows); + } + $actionSubtable->deleteRows($deleteIds); + } + } + } + + private function removeAllLinksToNextInteraction(Row $row) + { + $subtable = $row->getSubtable(); + + if (!empty($subtable)) { + foreach ($subtable->getRows() as $actionRow) { + $actionRow->removeSubtable(); + } + } + } + + private function addDeletedRowsAsSummaryRow(DataTable $table, int $removedVisitsSum, array $deletedRows): void + { + $subtableSummaryRow = $table->getSummaryRow(); + if ($subtableSummaryRow) { + $subtableSummaryRow->setColumn(Metrics::NB_VISITS, $subtableSummaryRow->getColumn(Metrics::NB_VISITS) + $removedVisitsSum); + } else { + $subtableSummaryRow = $table->addSummaryRow(new Row(array(Row::COLUMNS => array( + 'label' => DataTable::LABEL_SUMMARY_ROW, + Metrics::NB_VISITS => $removedVisitsSum, + )))); + } + if (!$subtableSummaryRow->getSubtable()) { + $subtableSummaryRow->setSubtable(new DataTable()); + } + $subtableSummaryRow->getSubtable()->addRowsFromArray($deletedRows); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/DataTable/Filter/LimitStepActions.php b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/LimitStepActions.php new file mode 100644 index 0000000..c52e0e0 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/LimitStepActions.php @@ -0,0 +1,110 @@ +limitToXactionsPerStep = $limitToXactionsPerStep; + } + + /** + * See {@link Limit}. + * + * @param DataTable $table + */ + public function filter($table) + { + foreach ($table->getRowsWithoutSummaryRow() as $row) { + // first we limit all steps to show eg only 5 actions and we merge all removed ones into summary row + $subtable = $row->getSubtable(); + if ($subtable) { + $this->limitActions($subtable); + } + } + } + + private function limitActions(DataTable $table) + { + $table->setMetadata(DataTable::TOTAL_ROWS_BEFORE_LIMIT_METADATA_NAME, $table->getRowsCount()); + + $subtableSummaryRow = $table->getEmptyClone($keepFilters = true); + // we add all rows that we remove to the summaryRow table so we can still draw connections from the + // others row and are still able to access these rows + + $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); + if (!$summaryRow) { + $summaryRow = new DataTable\Row(array(DataTable\Row::COLUMNS => array( + 'label' => DataTable::LABEL_SUMMARY_ROW, + Metrics::NB_VISITS => 0, + Metrics::NB_EXITS => 0, + Metrics::NB_PAGES_IN_GROUP => 0 + ))); + $table->addSummaryRow($summaryRow); + } + + if ($table->getRowsCount() > $this->limitToXactionsPerStep) { + $rows = $table->getRowsWithoutSummaryRow(); + + $keepRows = array_splice($rows, $offset = 0, $this->limitToXactionsPerStep); + $table->setRows($keepRows); + // we keep only the top X rows, and then add all removed rows to the summary row + + $summaryRow->setColumn(Metrics::NB_PAGES_IN_GROUP, count($rows)); + + foreach ($rows as $row) { + $summaryRow->sumRow($row, $copyMetadata = false); + + $subtable = $row->getSubtable(); + if ($subtable) { + $subtableSummaryRow->addDataTable($subtable); + } + } + + unset($rows); + + $summaryVisits = $summaryRow->getColumn('nb_visits'); + + if ($summaryVisits && $subtableSummaryRow->getRowsCount()) { + // the other tables were already sorted before that filter, so we need to make sure to sort this one now as well + // otherwise we might keep wrong rows + $subtableSummaryRow->filter('Sort', array(Metrics::NB_VISITS)); + $summaryRow->setSubtable($subtableSummaryRow); + } + } else { + $summaryVisits = $summaryRow->getColumn('nb_visits'); + + $summaryRow->setColumn(Metrics::NB_PAGES_IN_GROUP, 0); + } + + if (empty($summaryVisits)) { + // if there were no visits, we can safely delete the row so it won't be shown in the visualization + // with zero visits + $table->deleteRow(DataTable::ID_SUMMARY_ROW); + } + } +} diff --git a/files/plugin-UsersFlow-5.0.6/DataTable/Filter/ReplaceActionLabels.php b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/ReplaceActionLabels.php new file mode 100644 index 0000000..806652f --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/DataTable/Filter/ReplaceActionLabels.php @@ -0,0 +1,56 @@ +enableRecursive = true; + } + + /** + * See {@link Limit}. + * + * @param DataTable $table + */ + public function filter($table) + { + // for some reason this might be unset when being queued + $this->enableRecursive = true; + $row = $table->getRowFromLabel(Archiver::LABEL_SEARCH); + if (!empty($row)) { + $row->setColumn('label', Piwik::translate('General_Search')); + } + + foreach ($table->getRowsWithoutSummaryRow() as $row1) { + $this->filterSubTable($row1); + } + + $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); + if (!empty($summaryRow)) { + $this->filterSubTable($summaryRow); + } + } +} diff --git a/files/plugin-UsersFlow-5.0.6/LEGALNOTICE b/files/plugin-UsersFlow-5.0.6/LEGALNOTICE new file mode 100644 index 0000000..30276f9 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/LEGALNOTICE @@ -0,0 +1,32 @@ +COPYRIGHT + + The software package is: + + Copyright (C) 2017 InnoCraft Ltd (NZBN 6106769) + + +SOFTWARE LICENSE + + This software is licensed under the InnoCraft EULA and the license has been included in this + software package in the file LICENSE. + + +THIRD-PARTY COMPONENTS AND LIBRARIES + + The following components/libraries are redistributed in this package, + and subject to their respective licenses. + + Name: d3.js + Link: https://d3js.org/ + License: MIT + License File: libs/d3/LICENSE + + Name: d3-tip + Link: https://github.com/caged/d3-tip + License: MIT + License File: libs/d3/tip/LICENSE + + Name: sankey + Link: https://github.com/d3/d3-plugins + License: MIT + License File: libs/d3/sankey/LICENSE diff --git a/files/plugin-UsersFlow-5.0.6/LICENSE b/files/plugin-UsersFlow-5.0.6/LICENSE new file mode 100644 index 0000000..4686f35 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/LICENSE @@ -0,0 +1,49 @@ +InnoCraft License + +This InnoCraft End User License Agreement (the "InnoCraft EULA") is between you and InnoCraft Ltd (NZBN 6106769) ("InnoCraft"). If you are agreeing to this Agreement not as an individual but on behalf of your company, then "Customer" or "you" means your company, and you are binding your company to this Agreement. InnoCraft may modify this Agreement from time to time, subject to the terms in Section (xii) below. + +By clicking on the "I’ve read and accept the terms & conditions (https://shop.matomo.org/terms-conditions/)" (or similar button) that is presented to you at the time of your Order, or by using or accessing InnoCraft products, you indicate your assent to be bound by this Agreement. + + +InnoCraft EULA + +(i) InnoCraft is the licensor of the Plugin for Matomo Analytics (the "Software"). + +(ii) Subject to the terms and conditions of this Agreement, InnoCraft grants you a limited, worldwide, non-exclusive, non-transferable and non-sublicensable license to install and use the Software only on hardware systems owned, leased or controlled by you, during the applicable License Term. The term of each Software license ("License Term") will be specified in your Order. Your License Term will end upon any breach of this Agreement. + +(iii) Unless otherwise specified in your Order, for each Software license that you purchase, you may install one production instance of the Software in a Matomo Analytics instance owned or operated by you, and accessible via one URL ("Matomo instance"). Additional licenses must be purchased in order to deploy the Software in multiple Matomo instances, including when these multiple Matomo instances are hosted on a single hardware system. + +(iv) Licenses granted by InnoCraft are granted subject to the condition that you must ensure the maximum number of Authorized Users and Authorized Sites that are able to access and use the Software is equal to the number of User and Site Licenses for which the necessary fees have been paid to InnoCraft for the Subscription period. You may upgrade your license at any time on payment of the appropriate fees to InnoCraft in order to increase the maximum number of authorized users or sites. The number of User and Site Licenses granted to you is dependent on the fees paid by you. “User License” means a license granted under this EULA to you to permit an Authorized User to use the Software. “Authorized User” means a person who has an account in the Matomo instance and for which the necessary fees (“Subscription fees”) have been paid to InnoCraft for the current license term. "Site License" means a license granted under this EULA to you to permit an Authorized Site to use the Matomo Marketplace Plugin. “Authorized Sites” means a website or a measurable within Matomo instance and for which the necessary fees (“Subscription fees”) have been paid to InnoCraft for the current license term. These restrictions also apply if you install the Matomo Analytics Platform as part of your WordPress. + +(v) Piwik Analytics was renamed to Matomo Analytics in January 2018. The same terms and conditions as well as any restrictions or grants apply if you are using any version of Piwik. + +(vi) The Software requires a license key in order to operate, which will be delivered to the email addresses specified in your Order when we have received payment of the applicable fees. + +(vii) Any information that InnoCraft may collect from you or your device will be subject to InnoCraft Privacy Policy (https://www.innocraft.com/privacy). + +(viii) You are bound by the Matomo Marketplace Terms and Conditions (https://shop.matomo.org/terms-conditions/). + +(ix) You may not reverse engineer or disassemble or re-distribute the Software in whole or in part, or create any derivative works from or sublicense any rights in the Software, unless otherwise expressly authorized in writing by InnoCraft. + +(x) The Software is protected by copyright and other intellectual property laws and treaties. InnoCraft own all title, copyright and other intellectual property rights in the Software, and the Software is licensed to you directly by InnoCraft, not sold. + +(xi) The Software is provided under an "as is" basis and without any support or maintenance. Nothing in this Agreement shall require InnoCraft to provide you with support or fixes to any bug, failure, mis-performance or other defect in The Software. InnoCraft may provide you, from time to time, according to his sole discretion, with updates of the Software. You hereby warrant to keep the Software up-to-date and install all relevant updates. InnoCraft shall provide any update free of charge. + +(xii) The Software is provided "as is", and InnoCraft hereby disclaim all warranties, including but not limited to any implied warranties of title, non-infringement, merchantability or fitness for a particular purpose. InnoCraft shall not be liable or responsible in any way for any losses or damage of any kind, including lost profits or other indirect or consequential damages, relating to your use of or reliance upon the Software. + +(xiii) We may update or modify this Agreement from time to time, including the referenced Privacy Policy and the Matomo Marketplace Terms and Conditions. If a revision meaningfully reduces your rights, we will use reasonable efforts to notify you (by, for example, sending an email to the billing or technical contact you designate in the applicable Order). If we modify the Agreement during your License Term or Subscription Term, the modified version will be effective upon your next renewal of a License Term. + + +About InnoCraft Ltd + +At InnoCraft Ltd, we create innovating quality products to grow your business and to maximize your success. + +Our software products are built on top of Matomo Analytics: the leading open digital analytics platform used by more than one million websites worldwide. We are the creators and makers of the Matomo Analytics platform. + + +Contact + +Email: contact@innocraft.com +Contact form: https://www.innocraft.com/#contact +Website: https://www.innocraft.com/ +Buy our products: Premium Features for Matomo Analytics https://plugins.matomo.org/premium diff --git a/files/plugin-UsersFlow-5.0.6/Metrics.php b/files/plugin-UsersFlow-5.0.6/Metrics.php new file mode 100644 index 0000000..5ed73a0 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Metrics.php @@ -0,0 +1,27 @@ + +
+

Study how your visitors go through your site and unlock a deeper understanding of their behaviour.

+

Adjust the user flow's detail by configuring the granularity and number of steps to display. Make data-driven decisions that shape and refine your site's user journey, optimising for both engagement and conversion.

+
+
+Visualise the Journey Your Visitors Take +
+ + +#### Analyse the User Flow of Any Page, Anytime, Anywhere + +
+
+

Gain detailed insights into how your visitors navigate to and from any specific page on your site.

+

Add this visualisation to your dashboard and share this key data with your team or clients to keep them always in the loop.

+
+
+Analyse the User Flow of Any Page, Anytime, Anywhere +
+
+ +#### View the Most Popular Paths + +
+
+

Discover which paths and interactions resonate most with your visitors with the "Top Paths" report.

+

Prioritise content, optimise navigation, and align your site's structure with their preferences to create a compelling user experience.

+
+
+View the Most Popular Paths +
+
+ +#### Study How Your Visitors Engage with Your Site + +
+
+

Analyse how your visitors engage with each path. Spotlight high drop-off pages and unexpected exits to uncover new opportunities for improvement.

+

Whether it's a minor bug or a design flaw, get the clarity you need to refine the user experience, ensuring visitors stay interested and connected throughout their journey.

+
+
+Study How Your Visitors Engage with Your Site +
+
+ +### Try User Flow Today + +Every twist, turn, and exit from your site tells a story. Take your web analytics beyond numbers and get a visual map of your visitors' journeys. Learn what captivates them and what might deter them from buying or signing up. Craft a user experience that resonates, converts, and keeps your visitors coming back for more. + +Start your free 30-day trial and watch your site thrive like never before. + +### Features + +* Displays visitor engagement and lets you find out after how many pages your users exited your site +* Shows navigation paths for up to 10 interaction steps and more steps can be added optionally +* For each interaction step, get insights into over 100 pages and for each of those pages see where they went to from that page +* The visualization lets you configure how many details and how many steps you want to see per interaction +* Explore traffic through a certain page and get details how they got to that page and where they went afterwards +* Discover the path for page URLs and page titles +* Apply segments to dice your analytics reports exactly how you need it +* Adds several new Users Flow widgets that you can add to your dashboards +* Quickly see the top paths across all interactions with the "Top Paths" widget or get a quick overview with the "Overview" widget +* View how your visitors navigate through your website on the go with the [Matomo Mobile app](https://matomo.org/mobile) for iOS and Android +* Get users flow data for your historical data that you already tracked. +* + +### Privacy features +* The plugin neither tracks nor stores any additional data and therefore no personal or sensitive information is recorded. + +### Export & API features +* Get automatic [email and sms reports](https://matomo.org/docs/email-reports/) for the top paths in your Matomo, or share them with your colleagues or customers. +* [Embed](https://matomo.org/docs/embed-piwik-report/) the UsersFlow widgets directly in your app, dashboard, or even TV screen!. +* All reports are available via the [UsersFlow HTTP Reporting API](https://developer.matomo.org/api-reference/reporting-api#UsersFlow). + +### Other features +* Does not slow down tracking time +* 100% data ownership +* No data limit \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/RecordBuilders/GenericUsersFlow.php b/files/plugin-UsersFlow-5.0.6/RecordBuilders/GenericUsersFlow.php new file mode 100644 index 0000000..f598fb0 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/RecordBuilders/GenericUsersFlow.php @@ -0,0 +1,152 @@ +dataSource = $dataSource; + $this->numStepsToAggregate = $numStepsToAggregate; + $this->configuration = $configuration; + $this->recordName = $recordName; + + $this->maxRowsInSubtable = $this->configuration->getMaxRowsInActions(); + $this->maxRowsInTable = $this->maxRowsInSubtable; + $this->columnToSortByBeforeTruncation = Metrics::NB_VISITS; + } + + public function getRecordMetadata(ArchiveProcessor $archiveProcessor): array + { + if ($this->recordName) { + return [Record::make(Record::TYPE_BLOB, $this->recordName)]; + } + + return []; + } + + // public so API.php can use it directly + public function aggregate(ArchiveProcessor $archiveProcessor, $exploreStep = null, $exploreValueToMatch = null): array + { + $record = $this->createDataTable(); + + $logAggregator = new LogAggregator($archiveProcessor->getLogAggregator(), $this->configuration); + $db = $archiveProcessor->getLogAggregator()->getDb(); + + $siteKeepsUrlFragments = $this->doesAnySiteKeepUrlFragments($archiveProcessor); + + $systemSettings = new SystemSettings(); + $ignoreSearchQuery = $systemSettings->ignoreUrlQuery->getValue(); + $ignoreDomain = $systemSettings->ignoreDomain->getValue(); + + for ($step = 1; $step <= $this->numStepsToAggregate; $step++) { + $query = $logAggregator->aggregateTopStepActions($step, $this->dataSource, $ignoreSearchQuery, $ignoreDomain, $siteKeepsUrlFragments, $exploreStep, $exploreValueToMatch); + $cursor = $db->query($query['sql'], $query['bind']); + while ($row = $cursor->fetch()) { + $columns = [ + Metrics::NB_VISITS => $row[Metrics::NB_VISITS] ?: 0, + Metrics::NB_EXITS => $row[Metrics::NB_EXITS] ?: 0, + ]; + + $topLevelRow = $record->sumRowWithLabel($step, $columns); + + $label = $row['label']; + if (!empty($label)) { + $subtableRow = $topLevelRow->sumRowWithLabelToSubtable($label, $columns); + + $nextLabel = $row['nextLabel']; + if (!empty($nextLabel)) { + $nextColumns = [Metrics::NB_VISITS => $row[Metrics::NB_VISITS] ?: 0]; + $subtableRow->sumRowWithLabelToSubtable($nextLabel, $nextColumns); + } + } + } + $cursor->closeCursor(); + + $stepTable = $record->getRowFromLabel($step)->getSubtable(); + if (!empty($stepTable)) { + $stepTable->filter(DataTable\Filter\Truncate::class, [ + $this->maxRowsInSubtable, + DataTable::LABEL_SUMMARY_ROW, + Metrics::NB_VISITS, + $filterRecursive = true, + ]); + } + } + + return [$this->recordName => $record]; + } + + private function createDataTable(): DataTable + { + $emptyRow = [ + Metrics::NB_VISITS => 0, + Metrics::NB_EXITS => 0, + ]; + + $table = new DataTable(); + for ($step = 1; $step <= $this->numStepsToAggregate; $step++) { + $table->addRowFromSimpleArray(array_merge(['label' => $step], $emptyRow)); + $table->getRowFromLabel($step)->setSubtable(new DataTable()); + } + return $table; + } + + private function doesAnySiteKeepUrlFragments(ArchiveProcessor $archiveProcessor): bool + { + foreach ($archiveProcessor->getParams()->getIdSites() as $idSite) { + $site = Site::getSite($idSite); + if (!empty($site['keep_url_fragment'])) { + return true; + } + } + + return false; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/RecordBuilders/UsersFlowPageTitle.php b/files/plugin-UsersFlow-5.0.6/RecordBuilders/UsersFlowPageTitle.php new file mode 100644 index 0000000..4d38de5 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/RecordBuilders/UsersFlowPageTitle.php @@ -0,0 +1,33 @@ +getMaxSteps(); + + parent::__construct(DataSources::DATA_SOURCE_PAGE_TITLE, $maxSteps, $configuration, Archiver::USERSFLOW_PAGE_TITLE_ARCHIVE_RECORD); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/RecordBuilders/UsersFlowPageUrl.php b/files/plugin-UsersFlow-5.0.6/RecordBuilders/UsersFlowPageUrl.php new file mode 100644 index 0000000..e3262fb --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/RecordBuilders/UsersFlowPageUrl.php @@ -0,0 +1,33 @@ +getMaxSteps(); + + parent::__construct(DataSources::DATA_SOURCE_PAGE_URL, $maxSteps, $configuration, Archiver::USERSFLOW_ARCHIVE_RECORD); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Reports/Base.php b/files/plugin-UsersFlow-5.0.6/Reports/Base.php new file mode 100644 index 0000000..4b0a498 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Reports/Base.php @@ -0,0 +1,41 @@ +categoryId = 'General_Actions'; + } + + public function getMetrics() + { + $metrics = parent::getMetrics(); + + if (isset($metrics[Metrics::NB_EXITS])) { + $metrics[Metrics::NB_EXITS] = Piwik::translate('General_ColumnExits'); + } + + return $metrics; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Reports/GetInteractionActions.php b/files/plugin-UsersFlow-5.0.6/Reports/GetInteractionActions.php new file mode 100644 index 0000000..c978908 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Reports/GetInteractionActions.php @@ -0,0 +1,101 @@ +name = Piwik::translate('UsersFlow_UsersFlow'); + $this->dimension = new Interactions(); + $this->documentation = Piwik::translate(''); + $this->metrics = array(Metrics::NB_VISITS, Metrics::NB_EXITS); + $this->processedMetrics = array(new Proceeded()); + + $this->order = 52; + } + + public function configureView(ViewDataTable $view) + { + if (!empty($this->dimension)) { + $view->config->addTranslations(array('label' => $this->dimension->getName())); + } + + if ($view->isViewDataTableId(HtmlTable::ID)) { + $view->config->disable_row_evolution = true; + } + + $offset = Common::getRequestVar('offsetActionsPerStep', 0, 'int'); + $position = Common::getRequestVar('interactionPosition', 0, 'int'); + $dataSource = Common::getRequestVar('dataSource', '', 'string'); + + $dataSource = DataSources::getValidDataSource($dataSource); + + $idSubtable = Common::getRequestVar('idSubtable', 0, 'int'); + + $view->requestConfig->request_parameters_to_modify['offsetActionsPerStep'] = $offset; + $view->requestConfig->request_parameters_to_modify['interactionPosition'] = $position; + $view->requestConfig->request_parameters_to_modify['dataSource'] = $dataSource; + + if (empty($idSubtable)) { + $view->config->show_footer_message = Piwik::translate('UsersFlow_ActionsReportFooterMessage'); + $view->config->columns_to_display = array('label', Metrics::NB_VISITS, Metrics::NB_PROCEEDED, Metrics::NB_EXITS); + } else { + $view->config->columns_to_display = array('label', Metrics::NB_VISITS); + $view->config->addTranslations(array('label' => Piwik::translate('UsersFlow_DimensionProceededTo'))); + $view->requestConfig->filter_limit = '-1'; + $view->config->show_limit_control = false; + $view->config->show_pagination_control = false; + } + + $view->config->title = $this->name; + + if ($position) { + $view->config->title .= ' - ' . $this->dimension->getName() . ' ' . $position; + } + + if ($rowLabel = Common::getRequestVar('rowLabel', '', 'string')) { + $view->config->title .= ' - ' . $rowLabel; + } + + $view->config->show_flatten_table = false; + $view->config->show_exclude_low_population = false; + $view->config->show_table_all_columns = false; + $view->config->show_pie_chart = false; + $view->config->show_bar_chart = false; + $view->config->show_tag_cloud = false; + $view->config->show_goals = false; + $view->config->show_ecommerce = false; + $view->config->show_all_views_icons = false; + } + + public function configureReportMetadata(&$availableReports, $infos) + { + // not visible in report metadata + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Reports/GetUsersFlow.php b/files/plugin-UsersFlow-5.0.6/Reports/GetUsersFlow.php new file mode 100644 index 0000000..77843b5 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Reports/GetUsersFlow.php @@ -0,0 +1,73 @@ +name = Piwik::translate('UsersFlow_UsersFlow'); + $this->dimension = new Interactions(); + $this->documentation = Piwik::translate(''); + $this->subcategoryId = 'UsersFlow_UsersFlow'; + $this->metrics = array(Metrics::NB_VISITS, Metrics::NB_EXITS); + $this->processedMetrics = array(new Proceeded()); + + $this->order = 1999; + } + + public function getMetricsDocumentation() + { + $docs = parent::getMetricsDocumentation(); + $docs[Metrics::NB_EXITS] = Piwik::translate('UsersFlow_ColumnExitsDocumentation'); + return $docs; + } + + public function configureView(ViewDataTable $view) + { + if (!empty($this->dimension)) { + $view->config->addTranslations(array('label' => $this->dimension->getName())); + } + + $view->config->columns_to_display = array_merge(array('label'), $this->metrics); + $view->config->overridableProperties[] = 'levelOfDetail'; + $view->config->overridableProperties[] = 'numActionsPerStep'; + $view->config->overridableProperties[] = 'userFlowSource'; + } + + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $name = $this->name . ' - ' . Piwik::translate('UsersFlow_Visualization'); + $config = $factory->createWidget()->setName($name)->setOrder(2000); + $widgetsList->addWidgetConfig($config); + } + + public function configureReportMetadata(&$availableReports, $infos) + { + // not visible in report metadata + } +} diff --git a/files/plugin-UsersFlow-5.0.6/Reports/GetUsersFlowPretty.php b/files/plugin-UsersFlow-5.0.6/Reports/GetUsersFlowPretty.php new file mode 100644 index 0000000..a342d3f --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/Reports/GetUsersFlowPretty.php @@ -0,0 +1,139 @@ +name = Piwik::translate('UsersFlow_UsersFlow'); + $this->dimension = new Interactions(); + $this->documentation = Piwik::translate(''); + $this->metrics = array(Metrics::NB_VISITS, Metrics::NB_EXITS); + $this->processedMetrics = array(new Proceeded(), new ProceededRate(), new ExitRate()); + $this->actionToLoadSubTables = 'getUsersFlowPretty'; + + $this->order = 2000; + } + + public function getMetricsDocumentation() + { + $docs = parent::getMetricsDocumentation(); + $docs[Metrics::NB_EXITS] = Piwik::translate('UsersFlow_ColumnExitsDocumentation'); + return $docs; + } + + public function configureView(ViewDataTable $view) + { + $view->config->show_flatten_table = false; + + if (Common::getRequestVar('topPaths', 0, 'int') === 1) { + $_GET['flat'] = '1'; + $view->requestConfig->flat = 1; + $view->config->show_bar_chart = false; + $view->config->show_pie_chart = false; + $view->config->show_tag_cloud = false; + $view->config->show_table_all_columns = false; + $view->config->addTranslations(array('label' => Piwik::translate('UsersFlow_Path'))); + + $view->config->columns_to_display = array('label', Metrics::NB_VISITS); + } else { + $idSubtable = Common::getRequestVar('idSubtable', 0, 'int'); + if (empty($idSubtable)) { + $view->config->addTranslations(array('label' => Piwik::translate('UsersFlow_ColumnInteractionPosition'))); + } else { + $view->config->addTranslations(array('label' => Piwik::translate('General_Action'))); + } + + if ($view->isViewDataTableId(AllColumns::ID)) { + $view->config->columns_to_display = array('label', Metrics::NB_VISITS, Metrics::NB_PROCEEDED, Metrics::RATE_PROCEEDED, Metrics::NB_EXITS, Metrics::RATE_EXIT); + $view->config->filters[] = function () use ($view) { + $view->config->columns_to_display = array('label', Metrics::NB_VISITS, Metrics::NB_PROCEEDED, Metrics::NB_EXITS, Metrics::RATE_PROCEEDED, Metrics::RATE_EXIT); + }; + } + + $view->config->filters[] = function (DataTable $table) use ($view) { + if ($table->getRowsCount() && $table->getFirstRow() && !$table->getFirstRow()->hasColumn(Metrics::NB_EXITS)) { + // we only have visits metric for 3rd level data table + $view->config->columns_to_display = array('label', Metrics::NB_VISITS); + $view->config->addTranslations(array('label' => Piwik::translate('UsersFlow_DimensionProceededTo'))); + } + }; + + $view->config->columns_to_display = array('label', Metrics::NB_VISITS, Metrics::RATE_PROCEEDED); + } + + $dataSource = Common::getRequestVar('dataSource', '', 'string'); + $dataSource = DataSources::getValidDataSource($dataSource); + $view->requestConfig->request_parameters_to_modify['dataSource'] = $dataSource; + + $view->config->show_exclude_low_population = false; + } + + public function configureWidgets(WidgetsList $widgetsList, ReportWidgetFactory $factory) + { + $name = $this->name . ' - ' . Piwik::translate('UsersFlow_TopPaths') . ' - ' . Piwik::translate('Actions_PageUrls'); + $config = $factory->createWidget() + ->setCategoryId('General_Actions') + ->setSubcategoryId('UsersFlow_TopPaths') + ->setIsWide() + ->setName($name)->setParameters(array('topPaths' => '1'))->setOrder(2000); + $widgetsList->addWidgetConfig($config); + + $name = $this->name . ' - ' . Piwik::translate('General_Overview') . ' - ' . Piwik::translate('Actions_PageUrls'); + $config = $factory->createWidget() + ->setIsWide() + ->setCategoryId('General_Actions') + ->setSubcategoryId('UsersFlow_TopPaths')->setName($name)->setOrder(2001); + $widgetsList->addWidgetConfig($config); + + $name = $this->name . ' - ' . Piwik::translate('UsersFlow_TopPaths') . ' - ' . Piwik::translate('Actions_WidgetPageTitles'); + $config = $factory->createWidget() + ->setCategoryId('General_Actions') + ->setSubcategoryId('UsersFlow_TopPaths') + ->setIsWide() + ->setName($name)->setParameters(array('topPaths' => '1', 'dataSource' => DataSources::DATA_SOURCE_PAGE_TITLE))->setOrder(2002); + $widgetsList->addWidgetConfig($config); + + $name = $this->name . ' - ' . Piwik::translate('General_Overview') . ' - ' . Piwik::translate('Actions_WidgetPageTitles'); + $config = $factory->createWidget() + ->setIsWide() + ->setCategoryId('General_Actions') + ->setSubcategoryId('UsersFlow_TopPaths') + ->setName($name) + ->setParameters(array('dataSource' => DataSources::DATA_SOURCE_PAGE_TITLE))->setOrder(2003); + $widgetsList->addWidgetConfig($config); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/SystemSettings.php b/files/plugin-UsersFlow-5.0.6/SystemSettings.php new file mode 100644 index 0000000..7e9c7e0 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/SystemSettings.php @@ -0,0 +1,54 @@ +ignoreUrlQuery = $this->createIgnoreUrlQuery(); + $this->ignoreDomain = $this->createIgnoreDomain(); + } + + private function createIgnoreUrlQuery() + { + return $this->makeSetting('ignoreUrlQuery', $default = true, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('UsersFlow_SettingIgnoreSearchQuery'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + $field->description = Piwik::translate('UsersFlow_SettingIgnoreSearchQueryDescription'); + }); + } + + private function createIgnoreDomain() + { + return $this->makeSetting('ignoreDomain', $default = false, FieldConfig::TYPE_BOOL, function (FieldConfig $field) { + $field->title = Piwik::translate('UsersFlow_SettingIgnoreDomain'); + $field->uiControl = FieldConfig::UI_CONTROL_CHECKBOX; + $field->description = Piwik::translate('UsersFlow_SettingIgnoreDomainDescription'); + }); + } +} diff --git a/files/plugin-UsersFlow-5.0.6/UsersFlow.php b/files/plugin-UsersFlow-5.0.6/UsersFlow.php new file mode 100644 index 0000000..b06ac7e --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/UsersFlow.php @@ -0,0 +1,136 @@ +install(); + } + + public function uninstall() + { + $configuration = new Configuration(); + $configuration->uninstall(); + } + + public function activate() + { + $this->schedulePluginReArchiving(); + } + + public function deactivate() + { + $archiveInvalidator = StaticContainer::get(ArchiveInvalidator::class); + $archiveInvalidator->removeInvalidationsSafely('all', $this->getPluginName()); + } + + /** + * @see \Piwik\Plugin::registerEvents + */ + public function registerEvents() + { + return array( + 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', + 'Translate.getClientSideTranslationKeys' => 'getClientSideTranslationKeys', + 'Metrics.getDefaultMetricSemanticTypes' => 'addDefaultMetricSemanticTypes', + ); + } + + public function addDefaultMetricSemanticTypes(&$types) + { + $types[Metrics::NB_EXITS] = Dimension::TYPE_NUMBER; + } + + public function getStylesheetFiles(&$stylesheets) + { + $stylesheets[] = "plugins/UsersFlow/vue/src/Visualization/Visualization.less"; + $stylesheets[] = "plugins/UsersFlow/stylesheets/d3-tip.less"; + } + + public function getClientSideTranslationKeys(&$translationKeys) + { + $translationKeys[] = 'CoreHome_ThereIsNoDataForThisReport'; + $translationKeys[] = 'UsersFlow_Interactions'; + $translationKeys[] = 'UsersFlow_ColumnInteraction'; + $translationKeys[] = 'Transitions_ExitsInline'; + $translationKeys[] = 'General_NVisits'; + $translationKeys[] = 'General_Others'; + $translationKeys[] = 'General_Search'; + $translationKeys[] = 'General_ColumnNbVisits'; + $translationKeys[] = 'General_ColumnExits'; + $translationKeys[] = 'General_Source'; + $translationKeys[] = 'Installation_SystemCheckOpenURL'; + $translationKeys[] = 'VisitorInterest_NPages'; + $translationKeys[] = 'UsersFlow_ExploringInfo'; + $translationKeys[] = 'UsersFlow_ColumnProceeded'; + $translationKeys[] = 'UsersFlow_ActionShowDetails'; + $translationKeys[] = 'UsersFlow_ActionClearHighlight'; + $translationKeys[] = 'UsersFlow_ActionHighlightTraffic'; + $translationKeys[] = 'UsersFlow_ActionRemoveStep'; + $translationKeys[] = 'UsersFlow_ActionAddStep'; + $translationKeys[] = 'UsersFlow_NProceededInline'; + $translationKeys[] = 'UsersFlow_InteractionXToY'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail1'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail2'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail3'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail4'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail5'; + $translationKeys[] = 'UsersFlow_OptionLevelOfDetail6'; + $translationKeys[] = 'UsersFlow_OptionNumActionsPerStep'; + $translationKeys[] = 'UsersFlow_ExploreTraffic'; + $translationKeys[] = 'UsersFlow_UnexploreTraffic'; + $translationKeys[] = 'UsersFlow_UsersFlowReportDescription'; + $translationKeys[] = 'UsersFlow_UsersFlow'; + $translationKeys[] = 'UsersFlow_UsersFlowVisualizationDescription1'; + $translationKeys[] = 'UsersFlow_UsersFlowVisualizationDescription2'; + } +} diff --git a/files/plugin-UsersFlow-5.0.6/docs/index.md b/files/plugin-UsersFlow-5.0.6/docs/index.md new file mode 100644 index 0000000..998df72 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/docs/index.md @@ -0,0 +1,6 @@ +## Documentation + +The [Users Flow User Guide](https://matomo.org/docs/users-flow/) and the [Users Flow FAQ](https://matomo.org/faq/users-flow/) +cover how to get the most out of this plugin. + +For any other question feel free to [contact us](#support). diff --git a/files/plugin-UsersFlow-5.0.6/lang/bg.json b/files/plugin-UsersFlow-5.0.6/lang/bg.json new file mode 100644 index 0000000..45f8df5 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/bg.json @@ -0,0 +1,7 @@ +{ + "UsersFlow": { + "UsersFlow": "Потребителски поток", + "UsersFlowReportDescription": "Тези данни се основават на %1$s най-популярните връзки за взаимодействие. Ако искате да включите повече или по-малко данни, можете да промените броя на връзките на стъпка, като коригирате стойността на конфигурацията %2$s във файла %3$s. Функцията „Изследване на трафика“ понастоящем е достъпна само за периоди „ден“, „седмица“, „месец“ и „обхват“.", + "UsersFlowVisualizationDescription1": "Тази визуализация Ви показва как посетителите Ви се движат през Вашия уебсайт. Можете да добавите още стъпки, като кликнете върху иконата плюс, която се показва в горния десен ъгъл след последното взаимодействие." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/cs.json b/files/plugin-UsersFlow-5.0.6/lang/cs.json new file mode 100644 index 0000000..24e7f06 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/cs.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "UsersFlow": "Tok uživatelů", + "UsersFlowReportDescription": "Tato data jsou založena na %1$s nejoblíbenějších připojeních na interakci. Pokud chcete zahrnout více či méně dat, můžete změnit počet připojení za krok úpravou hodnoty %2$s konfigurace v %3$s souboru. Funkce „Prozkoumat provoz“ je aktuálně k dispozici pouze pro období „den“, „týden“, „měsíc“ a „rozsah“.", + "UsersFlowVisualizationDescription1": "Tato vizualizace ukazuje, jak návštěvníci procházejí váš web. Další kroky můžete přidat kliknutím na ikonu plus, která je zobrazena v pravém horním rohu po poslední interakci.", + "UsersFlowVisualizationDescription2": "Chcete-li zobrazit seznam všech stránek a odkud vaši uživatelé pokračovali, klikněte na \"%2$s\" nadpis. Chcete-li zobrazit všechny stránky, které byly seskupeny do \"%1$s\" nebo kde vaši návštěvníci pokračovali, klikněte na zelený uzel a vyberte \"%3$s\". Provoz na konkrétním uzlu můžete vidět pouze kliknutím na něj a výběrem \"%4$s\".", + "OptionLevelOfDetail": "Úroveň detailu", + "OptionLevelOfDetail1": "Málo", + "OptionLevelOfDetail2": "Někteří", + "OptionLevelOfDetail3": "Několik", + "OptionLevelOfDetail4": "Mnoho", + "OptionLevelOfDetail5": "Většina", + "OptionLevelOfDetail6": "Všichni", + "LabelUsedSearch": "Vyhledávání", + "ExploringInfo": "Prozkoumat \"%1$s\" v interakci %2$s", + "Visualization": "Vizualizace", + "TopPaths": "Nejpoužívanější Cesty", + "Path": "Cesta", + "ExploreTraffic": "Prozkoumat provoz", + "UnexploreTraffic": "Neprozkoumávat provoz", + "OptionNumActionsPerStep": "Počet Akcí na Krok", + "NProceededInline": "%s zpracováno", + "InteractionXToY": "%1$s na %2$s", + "SettingIgnoreSearchQuery": "Ignorovat vyhledávací dotaz URL.", + "SettingIgnoreDomain": "Ignorovat doménu", + "SettingIgnoreSearchQueryDescription": "Pokud je tato možnost povolena, budou při agregaci přehledu Toku uživatelů ignorovány parametry vyhledávacího dotazu z adres URL. To znamená, že např. Stránka „http://www.example.com/?foo=bar“ bude považována za stejnou jako „http://www.example.com/“", + "SettingIgnoreDomainDescription": "Pokud je tato možnost povolena, bude při agregaci přehledu Toku Uživatelů ignorována doména ve všech adresách URL. To znamená, že např. stránka „http://www.example.com/mypath“ bude považována za stejnou jako „http://www.example.org/mypath“.", + "Interactions": "Interakce", + "ColumnInteraction": "Interakce", + "ColumnInteractionPosition": "Pozice Interakce", + "ColumnExitRateDocumentation": "Procento návštěvníků, kteří opustili vaši stránku, nebo aplikaci po této interakci.", + "ColumnProceededRate": "Procento Pokračujících", + "ColumnProceededRateDocumentation": "Procento návštěvníků, kteří uskutečnili další interakci poté co uskutečnili interakci.", + "ColumnProceeded": "Pokračovalo", + "ActionAddStep": "Přidat krok", + "ActionRemoveStep": "Odebrat krok", + "ActionClearHighlight": "Odebrat zvýraznění", + "ActionHighlightTraffic": "Zvýraznit provoz", + "ActionShowDetails": "Ukázat detaily", + "DimensionProceededTo": "Pokračovali na", + "ActionsReportFooterMessage": "Kliknutím na řádek se zobrazí na které stránky návštěvníci pokračovali.", + "ColumnProceededDocumentation": "Počet návštěvníků kteří pokračovali na další interakci a neopustili vaši stránku nebo aplikaci.", + "ColumnExitsDocumentation": "Počet návštěvníků, kteří neodešli po této interakci.", + "UsersFlowSubcategoryHelp": "Tato data jsou založena na 5000 nejpopulárnějších připojení na interakci. Pokud chcete zahrnout více či méně dat, můžete změnit počet připojení na krok úpravou hodnoty konfigurace %1$s[UsersFlow] usersflow_num_max_links_per_interaction%2$s v %3$sconfig/config.ini.php%4$s souboru. "Explore traffic" funkce je momentálně dostupná pouze na "day", "week", "month" and "range" období.", + "TopPathsSubcategoryHelp": "V části Nejčastější/Top cesty jsou uvedeny nejpopulárnější cesty adres URL, které návštěvníci na vašem webu sledují. Poskytuje také seznam nejpopulárnějších stránek pro každou interakci na vašem webu." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/da.json b/files/plugin-UsersFlow-5.0.6/lang/da.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/da.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/de.json b/files/plugin-UsersFlow-5.0.6/lang/de.json new file mode 100644 index 0000000..266415f --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/de.json @@ -0,0 +1,46 @@ +{ + "UsersFlow": { + "ActionAddStep": "Schritt hinzufügen", + "ActionClearHighlight": "Demarkiere Traffic", + "ActionHighlightTraffic": "Markiere Traffic", + "ActionRemoveStep": "Schritt entfernen", + "ActionShowDetails": "Zeige Details", + "ActionsReportFooterMessage": "Klicke auf eine Zeile um zu sehen, zu welchen Seiten Ihre Besucher fortgefahren sind.", + "ColumnExitRateDocumentation": "Der Anteil der Besucher die Ihre Website nach dieser Interaktion verlassen haben.", + "ColumnExitsDocumentation": "Die Anzahl der Besucher die nach dieser Interaktion Ihre Website oder Anwendung verlassen hat.", + "ColumnInteraction": "Interaktion", + "ColumnInteractionPosition": "Interaktionsposition", + "ColumnProceeded": "Fortgefahren", + "ColumnProceededDocumentation": "Die Anzahl der Besucher die nach dieser Interaktion mindestens eine weitere Aktion ausgeführt haben und nicht Ihre Anwendung oder Website verlassen haben.", + "ColumnProceededRate": "Fortgefahrenrate", + "ColumnProceededRateDocumentation": "Der Anteil der Besucher die nach dieser Interaktion mindestens eine weitere Aktion ausgeführt haben.", + "DimensionProceededTo": "Fortgefahren zu", + "ExploreTraffic": "Erkunde Traffic", + "ExploringInfo": "Erkundung von \"%1$s\" an der Interaktion %2$s", + "InteractionXToY": "%1$s zu %2$s", + "Interactions": "Interaktionen", + "LabelUsedSearch": "Suche", + "NProceededInline": "%s fortgefahren", + "OptionLevelOfDetail": "Detaillierungsgrad", + "OptionLevelOfDetail1": "Wenige", + "OptionLevelOfDetail2": "Manche", + "OptionLevelOfDetail3": "Einige", + "OptionLevelOfDetail4": "Viele", + "OptionLevelOfDetail5": "Mehrheit", + "OptionLevelOfDetail6": "Alle", + "OptionNumActionsPerStep": "Anzahl der Aktionen pro Schritt", + "Path": "Pfad", + "SettingIgnoreDomain": "Ignoriere Domain", + "SettingIgnoreDomainDescription": "Wenn aktiviert, wird die Domain in allen URLs ignoriert, wenn die Daten für den Besucher-Fluss Report aggregiert werden. Dies bedeutet, dass zum Beispiel eine Seite \"http://www.example.com/verzeichnis\" als gleich an betrachtet wird wie \"http://www.example.org/verzeichnis\"", + "SettingIgnoreSearchQuery": "Ignoriere URL-Parameter", + "SettingIgnoreSearchQueryDescription": "Wenn aktiviert, werden URL-Parameter ignoriert, wenn die Daten für den Besucher-Fluss Report aggregiert werden. Dies bedeutet, dass zum Beispiel eine Seite \"http://www.example.com/?foo=bar\" als gleich an betrachtet wird wie \"http://www.example.com/\"", + "TopPaths": "Top Pfade", + "TopPathsSubcategoryHelp": "Der Abschnitt \"Top Paths\" gibt Auskunft über die beliebtesten URL-Pfade, denen Besucher auf Ihrer Website folgen. Er enthält auch eine Liste der beliebtesten Seiten für jede Interaktion auf Ihrer Website.", + "UnexploreTraffic": "Erkunde Traffic widerrufen", + "UsersFlow": "Besucher Fluss", + "UsersFlowReportDescription": "Diese Daten basieren auf den %1$s häufigsten Verbindungen pro Interaktion. Falls Sie mehr oder weniger Verbindungen in diese Daten einbeziehen möchten, können Sie die Anzahl der Verbindungen mit der Konfiguration %2$s in der Datei %3$s anpassen. Die \"Erkunde Traffic\" Funktion steht nicht zur Verfügung, wenn der Zeitraum \"Jahr\" ausgewählt ist.", + "UsersFlowVisualizationDescription1": "Diese Visualisierung zeigt Ihnen wie Ihre Besucher auf Ihrer Website oder Anwendung navigieren. Sie können mehr Schritte anzeigen, indem Sie auf das Plus-Symbol klicken, welches rechts oben nach der letzten Interaktion angezeigt wird.", + "UsersFlowVisualizationDescription2": "Um eine Liste aller Seiten zu sehen und wohin Ihre Besucher von dort aus gegangen sind, klicken Sie auf eine \"%2$s\" Überschrift. Um eine Liste aller Seiten zu sehen, die in der Gruppe \"%1$s\" zusammengefasst wurden, klicken Sie auf einen grünen Knoten und wählen Sie \"%3$s\". Sie können den Traffic für einen beliebigen grünen Knoten erkunden, indem Sie auf ihn klicken und dann \"%4$s\" auswählen.", + "Visualization": "Visualisierung" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/en.json b/files/plugin-UsersFlow-5.0.6/lang/en.json new file mode 100644 index 0000000..bf8979b --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/en.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "UsersFlow": "Users Flow", + "UsersFlowReportDescription": "This data is based on the %1$s most popular connections per interaction. If you want to include more or less data, you can change the number of connections per step by adjusting the value of the %2$s configuration in the %3$s file. The \"Explore traffic\" feature is currently only available to \"day\", \"week\", \"month\" and \"range\" periods.", + "UsersFlowVisualizationDescription1": "This visualization shows you how your visitors navigate through your website. You can add more steps by clicking on the plus icon which is shown in the top right after the last interaction.", + "UsersFlowVisualizationDescription2": "To see a list of all pages and where your users proceeded from there click on an \"%2$s\" title. To see all the pages that were grouped together into \"%1$s\" or where your visitors proceeded, click on a green node and select \"%3$s\". You can see the traffic for a specific node only by clicking on it and selecting \"%4$s\".", + "OptionLevelOfDetail": "Level of Detail", + "OptionLevelOfDetail1": "Few", + "OptionLevelOfDetail2": "Some", + "OptionLevelOfDetail3": "Several", + "OptionLevelOfDetail4": "Many", + "OptionLevelOfDetail5": "Majority", + "OptionLevelOfDetail6": "All", + "LabelUsedSearch": "Search", + "ExploringInfo": "Exploring \"%1$s\" at interaction %2$s", + "Visualization": "Visualization", + "TopPaths": "Top Paths", + "Path": "Path", + "ExploreTraffic": "Explore traffic", + "UnexploreTraffic": "Unexplore traffic", + "OptionNumActionsPerStep": "Number of Actions per Step", + "NProceededInline": "%s proceeded", + "InteractionXToY": "%1$s to %2$s", + "SettingIgnoreSearchQuery": "Ignore URL search query", + "SettingIgnoreDomain": "Ignore domain", + "SettingIgnoreSearchQueryDescription": "If enabled, search query parameters from URLs will be ignored when aggregating the Users Flow report. This means that eg a page \"http://www.example.com/?foo=bar\" will be considered to be the same as \"http://www.example.com/\"", + "SettingIgnoreDomainDescription": "If enabled, the domain in all URLs will be ignored when aggregating the Users Flow report. This means that eg a page \"http://www.example.com/mypath\" will be considered to be the same as \"http://www.example.org/mypath\"", + "Interactions": "Interactions", + "ColumnInteraction": "Interaction", + "ColumnInteractionPosition": "Interaction Position", + "ColumnExitRateDocumentation": "The percentage of visits that have left your website or app after this interaction.", + "ColumnProceededRate": "Proceeded Rate", + "ColumnProceededRateDocumentation": "The percentage of visits that performed another interaction after performing an interaction.", + "ColumnProceeded": "Proceeded", + "ActionAddStep": "Add step", + "ActionRemoveStep": "Remove step", + "ActionClearHighlight": "Clear highlight", + "ActionHighlightTraffic": "Highlight traffic", + "ActionShowDetails": "Show details", + "DimensionProceededTo": "Proceeded to", + "ActionsReportFooterMessage": "Click on a row to see to which pages your visitors proceeded.", + "ColumnProceededDocumentation": "The number of visits that proceeded to the next interaction and did not exit your website or app.", + "ColumnExitsDocumentation": "The number of visits that did not leave after this interaction.", + "UsersFlowSubcategoryHelp": "This data is based on the 5000 most popular connections per interaction. If you want to include more or less data, you can change the number of connections per step by adjusting the value of the %1$s[UsersFlow] usersflow_num_max_links_per_interaction%2$s configuration in the %3$sconfig/config.ini.php%4$s file. The "Explore traffic" feature is currently only available to "day", "week", "month" and "range" periods.", + "TopPathsSubcategoryHelp": "The Top Paths section reports on the most popular URL paths that visitors follow through your site. It also provides a list of the most popular pages for each interaction on your site." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/es.json b/files/plugin-UsersFlow-5.0.6/lang/es.json new file mode 100644 index 0000000..cd3a6a1 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/es.json @@ -0,0 +1,45 @@ +{ + "UsersFlow": { + "UsersFlow": "Flujo de usuarios", + "UsersFlowReportDescription": "Este dato está basado en las %1$s conexiones más populares por interacción. Si desea incluir más o menos datos, puede cambiar el número de conexiones por pasos simplemente ajustando el valor de la configuración %2$s en el archivo %3$s. La función \"Explorar tráfico\" está actualmente disponible para los períodos \"hoy\", \"semana\", \"mes\" y \"intervalo\".", + "UsersFlowVisualizationDescription1": "Esta visualización muestra cómo navegan sus visitantes a través de su sitio web. Puede agregar más pasos haciendo clic en el icono más que se muestra en la parte superior derecha después de la última interacción.", + "UsersFlowVisualizationDescription2": "Para ver una lista de todas las páginas y de donde proceden sus usuarios haga clic sobre el título \"%2$s\". Para ver todas las páginas que fueron agrupadas en \"%1$s\" o de dónde vienen sus visitantes, haga clic en el nodo verde y luego seleccione \"%3$s\". Puede observar el tráfico de un nodo específico sólo haciendo clic sobre el mismo y seleccionando \"%4$s\".", + "OptionLevelOfDetail": "Nivel de detalle", + "OptionLevelOfDetail1": "Pocos", + "OptionLevelOfDetail2": "Algún", + "OptionLevelOfDetail3": "Varios", + "OptionLevelOfDetail4": "Muchos", + "OptionLevelOfDetail5": "Mayoría", + "OptionLevelOfDetail6": "Todos", + "LabelUsedSearch": "Buscar", + "ExploringInfo": "Explorando \"%1$s\" y su interacción con %2$s", + "Visualization": "Visualización", + "TopPaths": "Camino superior", + "Path": "Camino", + "ExploreTraffic": "Explorar tráfico", + "UnexploreTraffic": "Tráfico inexplorado", + "OptionNumActionsPerStep": "Número de acciones por pasos", + "NProceededInline": "%s procedido", + "InteractionXToY": "%1$s a %2$s", + "SettingIgnoreSearchQuery": "Ignorar URL de consulta", + "SettingIgnoreDomain": "Ignorar dominio", + "SettingIgnoreSearchQueryDescription": "Si es habilitado, los parámetros de consulta de búsqueda de las URLs se ignorarán al agregar el informe Flujo de usuarios. Esto significa que por ejemplo la página \"http://www.example.com/?foo=bar\" será considerada igual que \"http://www.example.com/\"", + "SettingIgnoreDomainDescription": "Si es habilitado, el dominio de todas las URLs se ignorarán al agregar el informe Flujo de usuarios. Esto significa que, por ejemplo \"http://www.example.com/mypath\" será considerada igual que \"http://www.example.org/mypath\"", + "Interactions": "Interacciones", + "ColumnInteraction": "Interacción", + "ColumnInteractionPosition": "Posición de la interacción", + "ColumnExitRateDocumentation": "El porcentaje de visitas que dejaron su sitio o aplicación después de esta interacción.", + "ColumnProceededRate": "Tasa procesada", + "ColumnProceededRateDocumentation": "El porcentaje de visitas que realizaron otra interacción después de realizar una interacción.", + "ColumnProceeded": "Procedido", + "ActionAddStep": "Agregar paso", + "ActionRemoveStep": "Quitar paso", + "ActionClearHighlight": "Limpiar resaltado", + "ActionHighlightTraffic": "Tráfico resaltado", + "ActionShowDetails": "Mostrar detalles", + "DimensionProceededTo": "Procedido a", + "ActionsReportFooterMessage": "Haga clic en una fila para ver a qué páginas procedieron sus visitantes.", + "ColumnProceededDocumentation": "La cantidad de visitas que pasaron a la siguiente interacción y no salieron de su sitio web o aplicación.", + "ColumnExitsDocumentation": "El número de visitas que no salieron de su sitio después de esta interacción." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/fi.json b/files/plugin-UsersFlow-5.0.6/lang/fi.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/fi.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/fr.json b/files/plugin-UsersFlow-5.0.6/lang/fr.json new file mode 100644 index 0000000..55d7d99 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/fr.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "ActionAddStep": "Ajoutez une étape", + "ActionClearHighlight": "Retirer la mise en valeur", + "ActionHighlightTraffic": "Mettre en valeur le trafic", + "ActionRemoveStep": "Retirer l'étape", + "ActionShowDetails": "Montrer les détails", + "ActionsReportFooterMessage": "Cliquez sur une ligne pour voir sur quelles pages vos visiteurs se sont rendus.", + "ColumnExitRateDocumentation": "Le pourcentage de visites qui ont quitté votre site Web ou votre application après cette interaction.", + "ColumnExitsDocumentation": "Le nombre de visites qui ne sont pas quittées votre site après cette interaction.", + "ColumnInteraction": "Intéraction", + "ColumnInteractionPosition": "Position de l'interaction", + "ColumnProceeded": "Ont continué", + "ColumnProceededDocumentation": "Le nombre de visites qui sont passées à l'interaction suivante et n'ont pas quitté votre site Web ou votre application.", + "ColumnProceededRate": "Taux d'avancement", + "ColumnProceededRateDocumentation": "Le pourcentage de visites qui ont effectué une autre interaction après avoir effectué une interaction.", + "DimensionProceededTo": "Ont avancé jusqu'à", + "ExploreTraffic": "Explorer le trafic", + "ExploringInfo": "Exploration de \"%1$s\" à l'interaction %2$s", + "InteractionXToY": "%1$s à %2$s", + "Interactions": "Intéractions", + "LabelUsedSearch": "Rechercher", + "NProceededInline": "%s ont continué", + "OptionLevelOfDetail": "Niveau de détails", + "OptionLevelOfDetail1": "Peu", + "OptionLevelOfDetail2": "Quelques-uns", + "OptionLevelOfDetail3": "Plusieurs", + "OptionLevelOfDetail4": "Beaucoup", + "OptionLevelOfDetail5": "La majorité", + "OptionLevelOfDetail6": "Tous", + "OptionNumActionsPerStep": "Nombre d'actions par étape", + "Path": "Chemin", + "SettingIgnoreDomain": "Ignorer le domaine", + "SettingIgnoreDomainDescription": "Si cette option est activée, le domaine dans toutes les URLs sera ignoré lors de l'agrégation du rapport sur le flux d'utilisateurs. Cela signifie que, par exemple, une page \"http://www.example.com/mypath\" sera considérée comme étant la même que \"http://www.example.org/mypath\"", + "SettingIgnoreSearchQuery": "Ignorer la requête de recherche de l'URL", + "SettingIgnoreSearchQueryDescription": "Si cette option est activée, les paramètres de recherche des URL seront ignorées lors de l'agrégation du rapport sur le flux d'utilisateurs. Cela signifie que, par exemple, une page \"http://www.example.com/?foo=bar\" sera considérée comme étant la même que \"http://www.example.com/\"", + "TopPaths": "Chemins principaux", + "TopPathsSubcategoryHelp": "La section \"Chemins principaux\" indique les chemins d'URL les plus populaires suivis par les visiteurs sur votre site. Elle fournit également une liste des pages les plus populaires pour chaque interaction sur votre site.", + "UnexploreTraffic": "Désactiver l'exploration", + "UsersFlow": "Flux d'utilisateurs", + "UsersFlowReportDescription": "Ces données sont basées sur les %1$s connexions les plus populaires par interaction. Si vous souhaitez inclure plus ou moins de données, vous pouvez modifier le nombre de connexions par étape en ajustant la valeur de la configuration %2$s dans le fichier %3$s. La fonctionnalité \"Explorer le trafic\" n'est actuellement disponible que pour les périodes \"jour\", \"semaine\", \"mois\" et \"plage\".", + "UsersFlowSubcategoryHelp": "Ces données sont basées sur les 5000 connexions les plus populaires par interaction. Si vous souhaitez inclure plus ou moins de données, vous pouvez modifier le nombre de connexions par étape en ajustant la valeur de la configuration %1$s [UsersFlow] usersflow_num_max_links_per_interaction%2$s dans le fichier %3$sconfig/config.ini.php%4$s. La fonctionnalité \"Explorer le trafic\" n'est actuellement disponible que pour les périodes \"jour\", \"semaine\", \"mois\" et \"plage\".", + "UsersFlowVisualizationDescription1": "Cette visualisation vous montre comment vos visiteurs naviguent sur votre site web. Vous pouvez ajouter des étapes supplémentaires en cliquant sur l'icône plus qui apparaît en haut à droite après la dernière interaction.", + "UsersFlowVisualizationDescription2": "Pour voir une liste de toutes les pages et savoir où vos utilisateurs sont allés, cliquez sur un titre \"%2$s\". Pour voir toutes les pages regroupées dans \"%1$s\" ou l'endroit où vos visiteurs sont allés, cliquez sur un nœud vert et sélectionnez \"%3$s\". Vous pouvez voir le trafic d'un nœud spécifique uniquement en cliquant dessus et en sélectionnant \"%4$s\".", + "Visualization": "Visualisation" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/hi.json b/files/plugin-UsersFlow-5.0.6/lang/hi.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/hi.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/it.json b/files/plugin-UsersFlow-5.0.6/lang/it.json new file mode 100644 index 0000000..7519ca9 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/it.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "UsersFlow": "Flusso di Utenti", + "UsersFlowReportDescription": "Questi dati sono basati sulle %1$s connessioni più popolari per interazione. Se si desidera includere più o meno dati, è possibile modificare il numero di connessioni per passaggio regolando il valore della %2$s configurazione nel file%3$s. La funzione \"Esplora traffico\" è attualmente disponibile solo per i periodi \"giorno\", \"settimana\", \"mese\" e \"intervallo\".", + "UsersFlowVisualizationDescription1": "Questa visualizzazione mostra come i tuoi visitatori navigano attraverso il tuo sito web. Puoi aggiungere altri passaggi facendo clic sull'icona + che viene visualizzata in alto a destra dopo l'ultima interazione.", + "UsersFlowVisualizationDescription2": "Per vedere un elenco di tutte le pagine, e da dove i tuoi utenti hanno proceduto da lì, fai clic su un titolo \"%2$s\". Per vedere tutte le pagine raggruppate in \"%1$s\" o dove sono stati visualizzati i tuoi visitatori, fai click su un nodo verde e seleziona \"%3$s\". Puoi vedere il traffico per un nodo specifico cliccando su di esso e selezionando \"%4$s\".", + "OptionLevelOfDetail": "Livello di Dettaglio", + "OptionLevelOfDetail1": "Pochi", + "OptionLevelOfDetail2": "Alcuni", + "OptionLevelOfDetail3": "Parecchi", + "OptionLevelOfDetail4": "Molti", + "OptionLevelOfDetail5": "La maggioranza", + "OptionLevelOfDetail6": "Tutti", + "LabelUsedSearch": "Ricerca", + "ExploringInfo": "Esplorazione di \"%1$s\" all'interazione %2$s", + "Visualization": "Visualizzazione", + "TopPaths": "Percorsi migliori", + "Path": "Percorso", + "ExploreTraffic": "Esplora il traffico", + "UnexploreTraffic": "Non esplorare il traffico", + "OptionNumActionsPerStep": "Numero di Azioni per Step", + "NProceededInline": "%s hanno proseguito", + "InteractionXToY": "%1$s verso %2$s", + "SettingIgnoreSearchQuery": "Ignora query di ricerca URL", + "SettingIgnoreDomain": "Ignora dominio", + "SettingIgnoreSearchQueryDescription": "Se abilitato, i parametri della query di ricerca degli URL verranno ignorati durante l'aggregazione del report Flusso Utenti. Ciò significa che, ad esempio, una pagina \"http://www.example.com/?foo=bar\" sarà considerata uguale a \"http://www.example.com/\"", + "SettingIgnoreDomainDescription": "Se abilitato, il dominio di tutti gli URL verrà ignorato durante l'aggregazione del rapporto Flusso di Utenti. Ciò significa che. ad esempio. una pagina \"http://www.example.com/mypath\" sarà considerata uguale a \"http://www.example.org/mypath\"", + "Interactions": "Interazioni", + "ColumnInteraction": "Interazione", + "ColumnInteractionPosition": "Posizione Interazione", + "ColumnExitRateDocumentation": "La percentuale di visite che hanno lasciato il tuo sito web o la tua app dopo questa interazione.", + "ColumnProceededRate": "Percentuale di chi ha proseguito", + "ColumnProceededRateDocumentation": "Percentuale di visite che hanno eseguito un'altra interazione dopo averne fatta una.", + "ColumnProceeded": "Hanno proceduto", + "ActionAddStep": "Aggiungi step", + "ActionRemoveStep": "Rimuovi step", + "ActionClearHighlight": "Cancella highlight", + "ActionHighlightTraffic": "Highlight traffico", + "ActionShowDetails": "Mostra dettagli", + "DimensionProceededTo": "Hanno proceduto verso", + "ActionsReportFooterMessage": "Clicca su una riga per vedere verso quali pagine hanno proceduto i tuoi visitatori.", + "ColumnProceededDocumentation": "Il numero di visite che hanno proceduto verso la successiva interazione e non hanno chiuso il tuo sito web o la tua app.", + "ColumnExitsDocumentation": "Il numero di visite che non hanno abbandonato dopo questa interazione.", + "UsersFlowSubcategoryHelp": "Questi dati si basano sulle 5000 connessioni più popolari per interazione. Se vuoi includere più o meno dati, puoi cambiare il numero di connessioni per passo regolando il valore della configurazione di %1$s[UsersFlow] usersflow_num_max_links_per_interaction%2$s nel file %3$sconfig / config.ini.php%4$s. La funzione "Esplora traffico" lè attualmente disponibile solo per periodi "giorno" ;, "settimana" ;, "mese" e "intervallo"..", + "TopPathsSubcategoryHelp": "La sezione Percorsi più frequenti riporta i percorsi URL più popolari seguiti dai visitatori attraverso il tuo sito. Fornisce inoltre un elenco delle pagine più popolari per ciascuna interazione sul tuo sito." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/ja.json b/files/plugin-UsersFlow-5.0.6/lang/ja.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/ja.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/nb.json b/files/plugin-UsersFlow-5.0.6/lang/nb.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/nb.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/nl.json b/files/plugin-UsersFlow-5.0.6/lang/nl.json new file mode 100644 index 0000000..55eb37a --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/nl.json @@ -0,0 +1,45 @@ +{ + "UsersFlow": { + "UsersFlow": "Gebruikersstroom", + "UsersFlowReportDescription": "Deze data is gebaseerd op de %1$smeest populaire connecties per interacties. Wil je meer of minder data insluiten, dan kan je het aantal connecties per stap aanpassen door de waarde van %2$s configuratie in het %3$s bestand. De functie \"Verkeer verkennen\" is momenteel alleen beschikbaar voor perioden \"dag\", \"week\", \"maand\" en \"bereik\".", + "UsersFlowVisualizationDescription1": "Deze visualisatie toont hoe bezoekers door je website navigeren. Je kan meer stappen toevoegen door op het plus icoon te klikken. Deze wordt na de laatste interactie rechtsboven getoond.", + "UsersFlowVisualizationDescription2": "Om een lijst van alle pagina's en waarvandaan gebruikers verder zijn gegaan te zien, klik dan op een \"%2$s\" titel. Als u alle pagina's wilt bekijken die zijn gegroepeerd in \"%1$s\" of waar uw bezoekers verder naar zijn gegaan, klik dan op een groen knooppunt en selecteer \"%3$s\". Je kunt het verkeer voor een specifiek knooppunt alleen bekijken door erop te klikken en \"%4$s\" te selecteren.", + "OptionLevelOfDetail": "Detailniveau", + "OptionLevelOfDetail1": "Paar", + "OptionLevelOfDetail2": "Sommige", + "OptionLevelOfDetail3": "Verscheidene", + "OptionLevelOfDetail4": "Veel", + "OptionLevelOfDetail5": "Meerderheid", + "OptionLevelOfDetail6": "Allemaal", + "LabelUsedSearch": "Zoeken", + "ExploringInfo": "Verkennen \"%1$s\" bij interactie %2$s", + "Visualization": "Visualisatie", + "TopPaths": "Top paden", + "Path": "Pad", + "ExploreTraffic": "Verkeer verkennen", + "UnexploreTraffic": "Onbekend verkeer", + "OptionNumActionsPerStep": "Aantal acties per stap", + "NProceededInline": "%s doorgegaan", + "InteractionXToY": "%1$s naar %2$s", + "SettingIgnoreSearchQuery": "Negeer URL search query", + "SettingIgnoreDomain": "Negeer domein", + "SettingIgnoreSearchQueryDescription": "Indien ingeschakeld, worden zoek query parameters van URL's genegeerd bij het aggregeren van het User Flow rapport. Dit betekent dat bijvoorbeeld een pagina \"http://www.example.com/?foo=bar\" wordt beschouwd als hetzelfde als \"http://www.example.com/\"", + "SettingIgnoreDomainDescription": "Indien ingeschakeld, wordt het domein in alle URL's genegeerd bij het aggregeren van het User Flow rapport. Dit betekent dat bijvoorbeeld een pagina \"http://www.example.com/mypath\" wordt beschouwd als hetzelfde als \"http://www.example.org/mypath\"", + "Interactions": "Interacties", + "ColumnInteraction": "Interactie", + "ColumnInteractionPosition": "Interactie Positie", + "ColumnExitRateDocumentation": "Het percentage bezoeken dat je website of app heeft verlaten na deze interactie.", + "ColumnProceededRate": "Percentage doorgegaan", + "ColumnProceededRateDocumentation": "Het percentage bezoeken dat nog een interactie heeft uitgevoerd na het uitvoeren van een interactie.", + "ColumnProceeded": "Verder gegaan", + "ActionAddStep": "Voeg stap toe", + "ActionRemoveStep": "Verwijder stap", + "ActionClearHighlight": "Duidelijk hoogtepunt", + "ActionHighlightTraffic": "Hoogtepunt verkeer", + "ActionShowDetails": "Toon details", + "DimensionProceededTo": "Doorgegaan naar", + "ActionsReportFooterMessage": "Klik op een rij om te zien naar welke pagina's bezoekers zijn gegaan.", + "ColumnProceededDocumentation": "Het aantal bezoekers die zijn verder gegaan naar de volgende interactie en de website of app niet hebben verlaten.", + "ColumnExitsDocumentation": "Het aantal bezoekers die niet zijn vertrokken na deze interactie." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/pl.json b/files/plugin-UsersFlow-5.0.6/lang/pl.json new file mode 100644 index 0000000..dec8708 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/pl.json @@ -0,0 +1,45 @@ +{ + "UsersFlow": { + "UsersFlow": "Przepływ Użytkowników", + "UsersFlowReportDescription": "Prezentowane dane bazują na %1$snajpopularniejszych przejściach podczas interakcji. Aby użyć większej lub mniejszej ilości danych, możesz zmienić liczbę połączeń na każdy krok dostosowując wartość %2$s w pliku %3$s. Funkcjonalność \"Zbadaj ruch\" dostępna jest jedynie dla przedziałów \"dzień\", \"tydzień\", \"miesiąc\" i \"zakres\".", + "UsersFlowVisualizationDescription1": "Niniejsza wizualizacja pokazuje w jaki sposób Twoi odwiedzający nawigują po stronie. Możesz dodać więcej kroków klikając ikonę plusa wyświetlaną w prawym górnym rogu za ostatnią interakcją.", + "UsersFlowVisualizationDescription2": "Kliknij w tytuł \"%2$s\", aby zobaczyć listę stron, na które przeszli użytkownicy. Aby zobaczyć wszystkie strony zgrupowane w \"%1$s\" lub te, na które użytkownicy przeszli, kliknij zielony węzeł i wybierz \"%3$s\". Podgląd ruchu dla wybranego węzła uzyskasz klikając w niego i wybierając \"%4$s\".", + "OptionLevelOfDetail": "Poziom szczegółów", + "OptionLevelOfDetail1": "Niewiele", + "OptionLevelOfDetail2": "Trochę", + "OptionLevelOfDetail3": "Kilka", + "OptionLevelOfDetail4": "Wiele", + "OptionLevelOfDetail5": "Większość", + "OptionLevelOfDetail6": "Wszystkie", + "LabelUsedSearch": "Wyszukaj", + "ExploringInfo": "Badanie \"%1$s\" dla interakcji %2$s", + "Visualization": "Wizualizacja", + "TopPaths": "Najpopularniejsze ścieżki", + "Path": "Ścieżka", + "ExploreTraffic": "Zbadaj ruch", + "UnexploreTraffic": "Zakończ badanie ruchu", + "OptionNumActionsPerStep": "Liczba akcji na krok", + "NProceededInline": "przeszło %s", + "InteractionXToY": "%1$s do %2$s", + "SettingIgnoreSearchQuery": "Ignoruj kwerendy wyszukiwania", + "SettingIgnoreDomain": "Ignoruj domenę", + "SettingIgnoreSearchQueryDescription": "Zaznaczenie tej opcji spowoduje ignorowanie parametrów wyszukiwania w adresach podczas zbierania danych do raportu Przepływu Użytkowników. Oznacza to, że na przykład strona \"http://www.example.com/?foo=bar\" zostanie zliczona jako \"http://www.example.com/\"", + "SettingIgnoreDomainDescription": "Zaznaczenie tej opcji spowoduje, że domena we wszystkich adresach będzie ignorowana podczas zbierania danych do raportu Przepływ Użytkowników. Oznacza to, że przykładowa strona \"http://www.example.com/mypath\" będzie zliczona łącznie z \"http://www.example.org/mypath\"", + "Interactions": "Interakcji", + "ColumnInteraction": "Interakcja", + "ColumnInteractionPosition": "Pozycja interakcji", + "ColumnExitRateDocumentation": "Odsetek odwiedzin, które zakończyły się opuszczeniem serwisu lub aplikacji po tej interakcji.", + "ColumnProceededRate": "Odsetek przejść", + "ColumnProceededRateDocumentation": "Odsetek odwiedzin, które po wejściu w interakcję przeszli do kolejnej interakcji.", + "ColumnProceeded": "Przeszli", + "ActionAddStep": "Dodaj krok", + "ActionRemoveStep": "Usuń krok", + "ActionClearHighlight": "Wyczyść zaznaczenie", + "ActionHighlightTraffic": "Podświetl ruch", + "ActionShowDetails": "Pokaż szczegóły", + "DimensionProceededTo": "Przejdź do", + "ActionsReportFooterMessage": "Kliknij rząd, aby zobaczyć dokąd przeszli Twoi odwiedzający.", + "ColumnProceededDocumentation": "Liczba odwiedzających, którzy przeszli do kolejnej interakcji nie opuszczając Twojego serwisu lub aplikacji.", + "ColumnExitsDocumentation": "Liczba odwiedzających, którzy pozostali po wykonaniu tej interakcji." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/pt.json b/files/plugin-UsersFlow-5.0.6/lang/pt.json new file mode 100644 index 0000000..ddf76aa --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/pt.json @@ -0,0 +1,45 @@ +{ + "UsersFlow": { + "UsersFlow": "Fluxo de utilizadores", + "UsersFlowReportDescription": "Estes dados são baseados nas %1$s ligações mais populares por interação. Se quiser incluir mais ou menos dados, pode alterar o número de ligações por passo ajustando o valor da configuração %2$s no ficheiro %3$s. Atualmente, a funcionalidade \"Explorar tráfego\" apenas está disponível para os períodos \"dia\", \"semana\", \"mês\" e \"intervalo\".", + "UsersFlowVisualizationDescription1": "Esta visualização apenas mostra como os seus visitantes navegam através do seu site. Pode adicionar mais passos clicando no ícone do mais, disponível no canto superior direito depois da última interação.", + "UsersFlowVisualizationDescription2": "Para ver uma lista de todas as páginas e para onde os seus utilizadores foram a partir daí, clique num título \"%2$s\". Para ver todas as páginas que foram agrupadas em \"%1$s\" ou para onde os seus visitantes foram, clique no nó verde e selecione \"%3$s\". Pode ver o tráfego para apenas um nó específico clicando no mesmo e selecionando \"%4$s\".", + "OptionLevelOfDetail": "Nível de detalhe", + "OptionLevelOfDetail1": "Poucos", + "OptionLevelOfDetail2": "Alguns", + "OptionLevelOfDetail3": "Vários", + "OptionLevelOfDetail4": "Muitos", + "OptionLevelOfDetail5": "A maioria", + "OptionLevelOfDetail6": "Todos", + "LabelUsedSearch": "Pesquisar", + "ExploringInfo": "A explorar \"%1$s\" na interação %2$s", + "Visualization": "Visualização", + "TopPaths": "Principais caminhos", + "Path": "Caminho", + "ExploreTraffic": "Explorar tráfego", + "UnexploreTraffic": "Deixar de explorar tráfego", + "OptionNumActionsPerStep": "Número de ações por passo", + "NProceededInline": "%s continuaram", + "InteractionXToY": "%1$s para %2$s", + "SettingIgnoreSearchQuery": "Ignorar consulta de pesquisa do endereço", + "SettingIgnoreDomain": "Ignorar domínio", + "SettingIgnoreSearchQueryDescription": "Se ativo, os parâmetros da consulta de pesquisa dos endereços serão ignorados na agregação do relatório de Fluxo de utilizadores. Isto significa que, por exemplo, uma página \"http://www.example.com/?foo=bar\" será considerada como sendo a mesma que \"http://www.example.com/\"", + "SettingIgnoreDomainDescription": "Se ativo, o domínio em todos os endereços será ignorado na agregação do relatório de Fluxo de utilizadores. Isto significa que, por exemplo, uma página \"http://www.example.com/meucaminho?foo=bar\" será considerada como sendo a mesma que \"http://www.example.com/meucaminho\"", + "Interactions": "Interações", + "ColumnInteraction": "Interação", + "ColumnInteractionPosition": "Posição da interação", + "ColumnExitRateDocumentation": "A percentagem de visitas que deixaram o seu site ou aplicação depois desta interação.", + "ColumnProceededRate": "Taxa de continuação", + "ColumnProceededRateDocumentation": "A percentagem de visitas que executaram outra interação depois de executar uma interação.", + "ColumnProceeded": "Continuaram", + "ActionAddStep": "Adicionar passo", + "ActionRemoveStep": "Remover passo", + "ActionClearHighlight": "Limpar destaque", + "ActionHighlightTraffic": "Destacar tráfego", + "ActionShowDetails": "Mostrar detalhes", + "DimensionProceededTo": "Continuou para", + "ActionsReportFooterMessage": "Clique numa linha para ver para que páginas os seus visitantes continuaram.", + "ColumnProceededDocumentation": "O número de visitas que continuaram para a próxima interação e não saíram do seu site ou aplicação.", + "ColumnExitsDocumentation": "O número de visitas que não saíram depois desta interação." + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/ro.json b/files/plugin-UsersFlow-5.0.6/lang/ro.json new file mode 100644 index 0000000..43c579a --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/ro.json @@ -0,0 +1,5 @@ +{ + "UsersFlow": { + "LabelUsedSearch": "Căutare" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/ru.json b/files/plugin-UsersFlow-5.0.6/lang/ru.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/ru.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/sq.json b/files/plugin-UsersFlow-5.0.6/lang/sq.json new file mode 100644 index 0000000..47faa75 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/sq.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "ActionAddStep": "Shtoni hap", + "ActionClearHighlight": "Pastro theksimin", + "ActionHighlightTraffic": "Thekso trafikun", + "ActionRemoveStep": "Hiqni hap", + "ActionShowDetails": "Shfaq hollësi", + "ActionsReportFooterMessage": "Klikoni mbi një rresht që të shihni te cilat faqe vazhduan vizitorët tuaj.", + "ColumnExitRateDocumentation": "Përqindja e vizitave që janë larguar nga sajti apo aplikacioni juaj pas këtij ndërveprimi.", + "ColumnExitsDocumentation": "Numri i vizitave pa braktisje pas këtij ndërveprimi.", + "ColumnInteraction": "ndërveprim", + "ColumnInteractionPosition": "Pozicion Ndërveprimi", + "ColumnProceeded": "Vazhduan", + "ColumnProceededDocumentation": "Numri i vizitave që vazhduan te ndërveprimi tjetër dhe që nuk e braktisën sajtin apo aplikacionin tuaj.", + "ColumnProceededRate": "Shkallë Vazhdimi", + "ColumnProceededRateDocumentation": "Përqindje vizitash që kryen një tjetër ndërveprim pas kryerjes së një ndërveprimi.", + "DimensionProceededTo": "Vazhduan te", + "ExploreTraffic": "Eksploroni trafik", + "ExploringInfo": "Po eksplorohet “%1$s” te ndërveprimi %2$s", + "InteractionXToY": "%1$s në %2$s", + "Interactions": "Ndërveprime", + "LabelUsedSearch": "Kërkoni", + "NProceededInline": "%s vazhdim", + "OptionLevelOfDetail": "Shkallë Hollësish", + "OptionLevelOfDetail1": "Më pak", + "OptionLevelOfDetail2": "Ca", + "OptionLevelOfDetail3": "Disa", + "OptionLevelOfDetail4": "Mjaft", + "OptionLevelOfDetail5": "Shumica", + "OptionLevelOfDetail6": "Krejt", + "OptionNumActionsPerStep": "Numër Veprimesh për Hap", + "Path": "Shteg", + "SettingIgnoreDomain": "Shpërfill përkatësi", + "SettingIgnoreDomainDescription": "Në u aktivizoftë, përkatësia, në krejt URL-të, do të shpërfillet, kur të krijohet raporti Rrjedha Përdoruesish. Kjo do të thotë se, për shembull, një faqe “http://www.example.com/mypath” do të konsiderohet e njëjta me “http://www.example.org/mypath”", + "SettingIgnoreSearchQuery": "Shpërfill kërkesë kërkimi URL-je", + "SettingIgnoreSearchQueryDescription": "Në u aktivizoftë, parametrat e kërkesave të kërkimit prej URL-sh do të shpërfillen, kur të krijohet raporti Rrjedha Përdoruesish. Kjo do të thotë që, për shembull, një faqe “http://www.example.com/?foo=bar” do të konsiderohet e njëjta me “http://www.example.com/”", + "TopPaths": "Shtigje Kryesues", + "TopPathsSubcategoryHelp": "Ndarja Shtigjet Kryesuese raporton shtigjet URL më popullore që vizitorët ndjekin në sajtin tuaj. Furnizon gjithashtu një listë të faqeve më popullore për çdo ndërveprim në sajtin tuaj.", + "UnexploreTraffic": "Ndalni eksplorim trafiku", + "UsersFlow": "Rrjedha Përdoruesish", + "UsersFlowReportDescription": "Këto të dhëna bazohen në %1$s lidhjet më popullore për ndërveprim. Nëse doni të përfshini më shumë ose më pak të dhëna, mund të ndryshoni numrin e lidhjeve për hap, duke ndryshuar vlerën e formësimit %2$s te kartela %3$s. Veçoria “Eksploroni trafik” aktualisht është e përdorshme vetëm për periudha “ditë”, “javë”, “muaj” dhe “interval”.", + "UsersFlowSubcategoryHelp": "Këto të dhëna bazohen në 5000 lidhjet më popullore për ndërveprim. Nëse doni të përfshini më shumë ose më pak të dhëna, mund të ndryshoni numrin e lidhjeve për hap, duke ndryshuar vlerën e formësimit %1$s[UsersFlow] usersflow_num_max_links_per_interaction%2$s te kartela %3$sconfig/config.ini.php%4$s. Veçoria “Eksploroni trafik” aktualisht është e përdorshme vetëm për periudha “ditë”, “javë”, “muaj” dhe “interval”.", + "UsersFlowVisualizationDescription1": "Ky vizualizim ju tregon se si lëvizin nëpër sajtin tuaj vizitorët. Duke klikuar mbi ikonën plus, që shfaqet sipër djathtas pas ndërveprimit të fundit, mund të shtoni më tepër hapa.", + "UsersFlowVisualizationDescription2": "Që të shihni një listë të krejt faqeve dhe se prej nga vazhduan përdoruesit tuaj, klikoni mbi një titull “%2$s”. Që të shihni krejt faqet e bëra tok nën “%1$s” ose për ku vazhduan vizitorët tuaj, klikoni mbi një nyjë të gjelbër dhe përzgjidhni “%3$s”. Trafikun për një nyjë specifike mund ta shihni duke klikuar mbi të dhe duke përzgjedhur “%4$s”.", + "Visualization": "Vizualizim" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/sv.json b/files/plugin-UsersFlow-5.0.6/lang/sv.json new file mode 100644 index 0000000..6741379 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/sv.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "ActionAddStep": "Lägg till steg", + "ActionClearHighlight": "Rensa höjdpunkt", + "ActionHighlightTraffic": "Höjdpunkt trafik", + "ActionRemoveStep": "Ta bort steg", + "ActionShowDetails": "Visa detaljer", + "ActionsReportFooterMessage": "Klicka på en rad för att se vilka sidor dina besökare fortsatte till.", + "ColumnExitRateDocumentation": "Procentuell andel av besök som lämnade din webbplats eller app efter denna interaktion.", + "ColumnExitsDocumentation": "Antalet besök som inte lämnade efter denna interaktion.", + "ColumnInteraction": "Interaktion", + "ColumnInteractionPosition": "Interaktionsposition", + "ColumnProceeded": "Fortsatte", + "ColumnProceededDocumentation": "Antalet besök som fortsatte till nästa interaktion och inte lämnade din webbplats eller app.", + "ColumnProceededRate": "Andel fullföljare", + "ColumnProceededRateDocumentation": "Procentuell andel av besök som genomförde ännu en interaktion efter denna interaktion.", + "DimensionProceededTo": "Fortsatte till", + "ExploreTraffic": "Utforska trafik", + "ExploringInfo": "Utforska \"%1$s\" vid interaktion %2$s", + "InteractionXToY": "%1$s till %2$s", + "Interactions": "Interaktioner", + "LabelUsedSearch": "Sök", + "NProceededInline": "%s fortsatte", + "OptionLevelOfDetail": "Detaljnivå", + "OptionLevelOfDetail1": "Fåtal", + "OptionLevelOfDetail2": "Några", + "OptionLevelOfDetail3": "Flertal", + "OptionLevelOfDetail4": "Många", + "OptionLevelOfDetail5": "Majoritet", + "OptionLevelOfDetail6": "Alla", + "OptionNumActionsPerStep": "Antal händelser per steg", + "Path": "Väg", + "SettingIgnoreDomain": "Ignorera domän", + "SettingIgnoreDomainDescription": "Om det är aktiverat kommer domänen i alla URL:er att ignoreras när rapporten \"Användarflöde\" sammanställs. Detta innebär att till exempel sidan \"http://www.example.com/mypath\" kommer att anses vara densamma som \"http://www.example.org/mypath\"", + "SettingIgnoreSearchQuery": "Ignorera URL-sökfras", + "SettingIgnoreSearchQueryDescription": "Om aktiverat kommer sökfrågeparametrar från URL:er att ignoreras vid sammanställning av rapporten \"Användarflöde\". Detta innebär att till exempel sidan \"http://www.example.com/?foo=bar\" kommer att anses vara densamma som \"http://www.example.com/\"", + "TopPaths": "Vanligaste vägarna", + "TopPathsSubcategoryHelp": "Avsnittet \"Toppvägar\" rapporterar om de mest populära URL-vägarna som besökare följer på din webbplats. Det ger också en lista över de mest populära sidorna för varje interaktion på din webbplats.", + "UnexploreTraffic": "Outforska trafik", + "UsersFlow": "Användarflöde", + "UsersFlowReportDescription": "Dessa data är baserade på de %1$s mest populära kopplingarna per interaktion. Om du vill inkludera fler eller färre data kan du ändra antalet kopplingar per steg genom att justera värdet för %2$s-konfigurationen i filen %3$s. Funktionen \"Utforska trafik\" är för närvarande endast tillgänglig för perioderna \"dag\", \"vecka\", \"månad\" och \"intervall\".", + "UsersFlowSubcategoryHelp": "Dessa data är baserade på de 5000 mest populära kopplingarna per interaktion. Om du vill inkludera fler eller färre data kan du ändra antalet kopplingar per steg genom att justera värdet för %1$s[UsersFlow] usersflow_num_max_links_per_interaction%2$s-konfigurationen i filen %3$sconfig/config.ini.php%4$s. Funktionen \"Utforska trafik\" är för närvarande endast tillgänglig för perioderna \"dag\", \"vecka\", \"månad\" och \"intervall\".", + "UsersFlowVisualizationDescription1": "Visualiseringen visar hur dina besökare navigerat genom din webbplats. Du kan lägga till fler steg genom att klicka på plusikonen som visas uppe till höger efter den senaste interaktionen.", + "UsersFlowVisualizationDescription2": "För att se en lista över alla sidor och vart dina användare gick därifrån, klicka på en titel med \"%2$s\". För att se alla sidor som grupperades tillsammans under \"%1$s\" eller vart dina besökare fortsatte, klicka på en grön nod och välj \"%3$s\". Du kan se trafiken för en specifik nod genom att klicka på den och välja \"%4$s\".", + "Visualization": "Visualisering" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/tr.json b/files/plugin-UsersFlow-5.0.6/lang/tr.json new file mode 100644 index 0000000..f9f9e48 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/tr.json @@ -0,0 +1,47 @@ +{ + "UsersFlow": { + "ActionAddStep": "Adım ekle", + "ActionClearHighlight": "Vurgulamayı temizle", + "ActionHighlightTraffic": "Trafiği vurgula", + "ActionRemoveStep": "Adımı sil", + "ActionShowDetails": "Ayrıntıları görüntüle", + "ActionsReportFooterMessage": "Ziyaretçilerinizin ilerlediği sayfaları görüntülemek için bir satıra tıklayın.", + "ColumnExitRateDocumentation": "Bu etkileşimden sonra sitenizden ayrılan ziyaretlerin yüzdesi.", + "ColumnExitsDocumentation": "Bu etkileşimden sonra ayrılmayan ziyaretlerin yüzdesi.", + "ColumnInteraction": "Etkileşim", + "ColumnInteractionPosition": "Etkileşim konumu", + "ColumnProceeded": "İlerleme", + "ColumnProceededDocumentation": "Sonraki etkileşime geçerek sitenizden ya da uygulamanızdan ayrılmayan ziyaretlerin sayısı.", + "ColumnProceededRate": "İlerleme oranı", + "ColumnProceededRateDocumentation": "Bir etkileşimden sonra başka bir etkileşimde bulunan ziyaretlerin yüzdesi.", + "DimensionProceededTo": "İlerlenen konum", + "ExploreTraffic": "Trafiği keşfet", + "ExploringInfo": "%2$s etkileşiminde \"%1$s\" keşfediliyor", + "InteractionXToY": "%1$s ile %2$s", + "Interactions": "Etkileşimler", + "LabelUsedSearch": "Arama", + "NProceededInline": "%s işlem yapıldı", + "OptionLevelOfDetail": "Ayrıntı düzeyi", + "OptionLevelOfDetail1": "Çok azı", + "OptionLevelOfDetail2": "Azı", + "OptionLevelOfDetail3": "Bir kaçı", + "OptionLevelOfDetail4": "Bir çoğu", + "OptionLevelOfDetail5": "Çoğunluğu", + "OptionLevelOfDetail6": "Tümü", + "OptionNumActionsPerStep": "Her adımdaki işlem sayısı", + "Path": "Yol", + "SettingIgnoreDomain": "Etki alanı yok sayılsın", + "SettingIgnoreDomainDescription": "Açıldığında, kullanıcıların akışı raporu derlenirken adreslerdeki etki alanı yok sayılır. Yani \"http://www.ornek.com/yol\" adresi \"http://www.ornek.org/\" adresi gibi işlenir", + "SettingIgnoreSearchQuery": "Adres arama sorgusu yok sayılsın", + "SettingIgnoreSearchQueryDescription": "Açıldığında, kullanıcıların akışı raporu derlenirken adreslerdeki arama sorgusu parametreleri yok sayılır. Yani \"http://www.ornek.com/?parametre=deger\" adresi \"http://www.ornek.com/\" olarak işlenir", + "TopPaths": "En çok kullanılan yollar", + "TopPathsSubcategoryHelp": "En çok kullanılan yollar bölümü, ziyaretçilerin sitede en sık kullandığı adres yollarını içerir. Ayrıca sitedeki her etkileşim için en sık kullanılan sayfaların listesini de verir.", + "UnexploreTraffic": "Trafiği keşfetme", + "UsersFlow": "Kullanıcıların akışı", + "UsersFlowReportDescription": "Bu veriler her etkileşim için %1$s en çok kullanılan bağlantılara göredir. Daha çok ya da daha az veri katmak isterseniz, her adımdaki bağlantı sayısını %3$s dosyasındaki %2$s yapılandırma değerini ayarlayarak değiştirebilirsiniz. \"Trafiği keşfet\" özelliği şu anda yalnızca \"gün\", \"hafta\", \"ay\" ve \"aralık\" dönemleri için kullanılabilir.", + "UsersFlowSubcategoryHelp": "Bu veriler her etkileşim için en çok kullanılan 5000 bağlantıya göredir. Daha çok ya da daha az veri katmak isterseniz, her adımdaki bağlantı sayısını %3$sconfig/config.ini.php%4$s dosyasındaki %1$s[UsersFlow] usersflow_num_max_links_per_interaction%2$s yapılandırma değerini ayarlayarak değiştirebilirsiniz. \"Trafiği keşfet\" özelliği şu anda yalnızca \"gün\", \"hafta\", \"ay\" ve \"aralık\" dönemleri için kullanılabilir.", + "UsersFlowVisualizationDescription1": "Görselleştirmede ziyaretçilerinizin sitenizde nasıl dolaştığını görebilirsiniz. Son etkileşimden sonra sağ üstteki artı simgesine tıklayarak daha fazla adım ekleyebilirsiniz.", + "UsersFlowVisualizationDescription2": "Tüm sayfaların listesini ve kullanıcıların oradan nereye ilerlediğini görüntülemek için bir \"%2$s\" başlığı üzerine tıklayın. \"%1$s\" içinde gruplanmış tüm sayfaları ya da ziyaretçilerin nereye ilerlediğini görüntülemek için yeşil düğüm üzerine tıklayın ve \"%3$s\" seçin. Beliril bir düğümün trafiğini görüntülemek için üzerine tıklayın ve \"%4$s\" seçin.", + "Visualization": "Görselleştirme" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/uk.json b/files/plugin-UsersFlow-5.0.6/lang/uk.json new file mode 100644 index 0000000..52a3dd0 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/uk.json @@ -0,0 +1,5 @@ +{ + "UsersFlow": { + "LabelUsedSearch": "Пошук" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/lang/zh-cn.json b/files/plugin-UsersFlow-5.0.6/lang/zh-cn.json new file mode 100644 index 0000000..0967ef4 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/zh-cn.json @@ -0,0 +1 @@ +{} diff --git a/files/plugin-UsersFlow-5.0.6/lang/zh-tw.json b/files/plugin-UsersFlow-5.0.6/lang/zh-tw.json new file mode 100644 index 0000000..a305af5 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/lang/zh-tw.json @@ -0,0 +1,45 @@ +{ + "UsersFlow": { + "UsersFlow": "使用者流程", + "UsersFlowReportDescription": "這份資料是來自每個互動中的前 %1$s 熱門連線數。如果你想要包含更多或減少數據來源,你可以調整 %3$s 中的 %2$s 設定值來變更每個步驟中的連線數。「探索流量」功能目前只開放「日」、「周」、「月」和「範圍」日期。", + "UsersFlowVisualizationDescription1": "這份圖表顯示你的訪客在網站中是如何瀏覽的。你可以點擊最後一個互動右上方的加號按鈕來展開更多步驟。", + "UsersFlowVisualizationDescription2": "You can see the traffic for a specific node only by clicking on it and selecting \"Explore traffic\". 點擊任一「%2$s」標題來查看你的使用者通過的網頁列表。點擊綠色區塊並選擇「%3$s」來查看被分組至「%1$s」或你的訪客通過的所有網頁。你點擊任一區塊並選擇「%4$s」來查看特定區塊的流量。", + "OptionLevelOfDetail": "詳細程度", + "OptionLevelOfDetail1": "少數", + "OptionLevelOfDetail2": "一些", + "OptionLevelOfDetail3": "較多", + "OptionLevelOfDetail4": "許多", + "OptionLevelOfDetail5": "多數", + "OptionLevelOfDetail6": "全部", + "LabelUsedSearch": "搜尋", + "ExploringInfo": "正在探索「%1$s」的互動 %2$s", + "Visualization": "可視化圖表", + "TopPaths": "熱門路徑", + "Path": "路徑", + "ExploreTraffic": "探索流量", + "UnexploreTraffic": "取消探索流量", + "OptionNumActionsPerStep": "每個步驟的活動數", + "NProceededInline": "%s 次通過", + "InteractionXToY": "%1$s 到 %2$s", + "SettingIgnoreSearchQuery": "忽略網址搜尋參數", + "SettingIgnoreDomain": "忽略域名", + "SettingIgnoreSearchQueryDescription": "若啟用,當統整使用者流程時,網址中的搜尋參數將會被忽略。這代表例如「http://www.example.com/?foo=bar」會被認為是和「http://www.example.com/」相同的網頁。", + "SettingIgnoreDomainDescription": "若啟用,當統整使用者流程時,所有網址中的域名將會被忽略。這代表例如「http://www.example.com/mypath」會被認為是和「http://www.example.org/mypath」相同的網頁。", + "Interactions": "互動", + "ColumnInteraction": "互動", + "ColumnInteractionPosition": "互動位置", + "ColumnExitRateDocumentation": "在此互動後離開你的網站或應用程式的訪問數百分比。", + "ColumnProceededRate": "通過率", + "ColumnProceededRateDocumentation": "進行互動後又進行其他互動的訪問數百分比。", + "ColumnProceeded": "通過", + "ActionAddStep": "增加步驟", + "ActionRemoveStep": "移除步驟", + "ActionClearHighlight": "取消突顯", + "ActionHighlightTraffic": "突顯流量", + "ActionShowDetails": "顯示詳情", + "DimensionProceededTo": "通過至", + "ActionsReportFooterMessage": "點擊一列來查看你的訪客通過了哪些網頁。", + "ColumnProceededDocumentation": "進行了其他互動並沒有離開你的網站或應用程式的訪問數。", + "ColumnExitsDocumentation": "在此互動後沒有離開的訪問數。" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/libs/sankey/LICENSE b/files/plugin-UsersFlow-5.0.6/libs/sankey/LICENSE new file mode 100644 index 0000000..83d9ceb --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/libs/sankey/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2012-2015, Michael Bostock +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* The name Michael Bostock may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/libs/sankey/sankey.js b/files/plugin-UsersFlow-5.0.6/libs/sankey/sankey.js new file mode 100644 index 0000000..ec72d40 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/libs/sankey/sankey.js @@ -0,0 +1,335 @@ +/* eslint-disable */ + +// from https://github.com/d3/d3-plugins with custom modifications from our side +// to fix heights and ordering of nodes and links as well as out nodes and summary nodes + +export default function (d3) { + d3.sankey = function () { + + function isOutNode(name) { + return name && name === '_out_'; + } + + function isSummaryNode(node) { + return node.isSummaryNode; + } + + var sankey = {}, + nodeWidth = 24, + nodePadding = 8, + size = [1, 1], + nodes = [], + links = []; + + sankey.nodeWidth = function (_) { + if (!arguments.length) return nodeWidth; + nodeWidth = +_; + return sankey; + }; + + sankey.nodePadding = function (_) { + if (!arguments.length) return nodePadding; + nodePadding = +_; + return sankey; + }; + + sankey.nodes = function (_) { + if (!arguments.length) return nodes; + nodes = _; + return sankey; + }; + + sankey.links = function (_) { + if (!arguments.length) return links; + links = _; + return sankey; + }; + + sankey.size = function (_) { + if (!arguments.length) return size; + size = _; + return sankey; + }; + + sankey.layout = function (iterations) { + computeNodeLinks(); + computeNodeValues(); + computeNodeBreadths(); + computeNodeDepths(iterations); + computeLinkDepths(); + return sankey; + }; + + sankey.relayout = function () { + computeLinkDepths(); + return sankey; + }; + + sankey.link = function () { + var curvature = .5; + + function link(d) { + if (isOutNode(d.target.name)) { + // we only show a square for exits + var x0 = d.source.x + d.source.dx, + y0 = d.source.y + d.sy + d.dy / 2; + /** + * + return "M" + x0 + "," + (y0) + + " V" + y0 + 15 + + " H " + (x0 + 15); + */ + return "M" + x0 + "," + (y0) + + " L" + (x0 + 15) + "," + (y0); + } + var x0 = d.source.x + d.source.dx, + x1 = d.target.x, + xi = d3.interpolateNumber(x0, x1), + x2 = xi(curvature), + x3 = xi(1 - curvature), + y0 = d.source.y + d.sy + d.dy / 2, + y1 = d.target.y + d.ty + d.dy / 2; + return "M" + x0 + "," + y0 + + "C" + x2 + "," + y0 + + " " + x3 + "," + y1 + + " " + x1 + "," + y1; + } + + link.curvature = function (_) { + if (!arguments.length) return curvature; + curvature = +_; + return link; + }; + + return link; + }; + + function computeNodeLinks() { + nodes.forEach(function (node) { + node.sourceLinks = []; + node.targetLinks = []; + }); + links.forEach(function (link) { + var source = link.source, + target = link.target; + if (typeof source === 'number') source = link.source = nodes[link.source]; + if (typeof target === 'number') target = link.target = nodes[link.target]; + source.sourceLinks.push(link); + target.targetLinks.push(link); + }); + } + + function computeNodeValues() { + nodes.forEach(function (node) { + node.value = Math.max( + d3.sum(node.sourceLinks, value), + d3.sum(node.targetLinks, value) + ); + }); + } + + function computeNodeBreadths() { + var x = 0; + + nodes.forEach(function (node) { + node.x = node.depth; + node.dx = nodeWidth; + if (node.depth > x) { + x = node.depth; + } + }); + + scaleNodeBreadths((size[0] - nodeWidth) / (x)); + } + + function moveSourcesRight() { + nodes.forEach(function (node) { + if (!node.targetLinks.length) { + node.x = d3.min(node.sourceLinks, function (d) { + return d.target.x; + }) - 1; + } + }); + } + + function scaleNodeBreadths(kx) { + nodes.forEach(function (node) { + node.x *= kx; + }); + } + + function computeNodeDepths(iterations) { + var nodesByBreadth = d3.nest() + .key(function (d) { + return d.x; + }) + .sortKeys(d3.ascending) + .entries(nodes) + .map(function (d) { + return d.values; + }); + + // + initializeNodeDepth(); + resolveCollisions(); + for (var alpha = 1; iterations > 0; --iterations) { + relaxRightToLeft(alpha *= .99); + resolveCollisions(); + relaxLeftToRight(alpha); + resolveCollisions(); + } + + function initializeNodeDepth() { + var ky = d3.min(nodesByBreadth, function (nodes) { + var sumNodes = d3.sum(nodes, value); + if (!sumNodes) { + return 0; + } + return (size[1] - (nodes.length - 1) * nodePadding) / sumNodes; + }); + + nodesByBreadth.forEach(function (nodes) { + nodes.forEach(function (node, i) { + node.y = i; + node.dy = node.value * ky; + + if (isSummaryNode(node)) { + // we also need to scale the links in this case + node.sourceLinks.forEach(function (link) { + link.scaleNodeDy = 25 / node.dy; + link.scaleNodeMax = 25; + }); + node.dy = 25; + return; + } + + if (node.dy < 4) { + // we also need to scale the links in this case + node.sourceLinks.forEach(function (link) { + link.scaleNodeDy = 4 / node.dy; + link.scaleNodeMax = 4; + }); + + node.dy = 4; + } + }); + }); + + links.forEach(function (link) { + link.dy = link.value * ky; + if (link.scaleNodeDy) { + link.dy *= link.scaleNodeDy + } + if (link.scaleNodeMax && link.dy > link.scaleNodeMax) { + link.dy = link.scaleNodeMax; + } + }); + } + + function relaxLeftToRight(alpha) { + nodesByBreadth.forEach(function (nodes, breadth) { + nodes.forEach(function (node) { + if (node.targetLinks.length) { + var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedSource(link) { + return center(link.source) * link.value; + } + } + + function relaxRightToLeft(alpha) { + nodesByBreadth.slice().reverse().forEach(function (nodes) { + nodes.forEach(function (node) { + if (node.sourceLinks.length) { + var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedTarget(link) { + return center(link.target) * link.value; + } + } + + function resolveCollisions() { + nodesByBreadth.forEach(function (nodes) { + var node, + dy, + y0 = 0, + n = nodes.length, + i; + + // Push any overlapping nodes down. + for (i = 0; i < n; ++i) { + node = nodes[i]; + dy = y0 - node.y; + if (dy > 0) node.y += dy; + y0 = node.y + node.dy + nodePadding; + } + + // push it back up if the bottommost node goes outside the bounds + /* removed by us, we do not want to push them back up + dy = y0 - nodePadding - size[1]; + if (dy > 0) { + y0 = node.y -= dy; + + // Pushin back up any overlapping nodes. + for (i = n - 2; i >= 0; --i) { + node = nodes[i]; + dy = node.y + node.dy + nodePadding - y0; + if (dy > 0) node.y -= dy; + y0 = node.y; + } + } + */ + }); + } + + function ascendingDepth(a, b) { + return a.y - b.y; + } + + } + + function computeLinkDepths() { + nodes.forEach(function (node) { + node.sourceLinks.sort(ascendingTargetDepth); + node.targetLinks.sort(ascendingSourceDepth); + }); + nodes.forEach(function (node) { + var sy = 0, ty = 0; + node.sourceLinks.forEach(function (link) { + link.sy = sy; + sy += link.dy; + }); + node.targetLinks.forEach(function (link) { + link.ty = ty; + ty += link.dy; + }); + }); + + function ascendingSourceDepth(a, b) { + return a.source.y - b.source.y; + } + + function ascendingTargetDepth(a, b) { + return a.target.y - b.target.y; + } + } + + function center(node) { + return 0; + } + + function value(link) { + return link.value; + } + + return sankey; + }; +}; diff --git a/files/plugin-UsersFlow-5.0.6/package-lock.json b/files/plugin-UsersFlow-5.0.6/package-lock.json new file mode 100644 index 0000000..155ac62 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/package-lock.json @@ -0,0 +1,1145 @@ +{ + "name": "usersflow", + "version": "1.0.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "usersflow", + "version": "1.0.0", + "license": "InnoCraft EULA", + "dependencies": { + "@types/d3": "4.9.0", + "d3": "4.9.1" + }, + "devDependencies": { + "@types/d3-tip": "^3.5.5", + "d3-tip": "^0.9.1" + } + }, + "node_modules/@types/d3": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-4.9.0.tgz", + "integrity": "sha512-1QXBT7ZI7nXDrNcAv4oXZ90aiO9HVVYJVZzGv/gYCSDp+9YeaoAkSifphH9nR7FbZLamxD2XTkQOEG0sBDubAg==", + "dependencies": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-collection": "*", + "@types/d3-color": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-queue": "*", + "@types/d3-random": "*", + "@types/d3-request": "*", + "@types/d3-scale": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-voronoi": "*", + "@types/d3-zoom": "*" + } + }, + "node_modules/@types/d3-array": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.0.2.tgz", + "integrity": "sha512-5mjGjz6XOXKOCdTajXTZ/pMsg236RdiwKPrRPWAEf/2S/+PzwY+LLYShUpeysWaMvsdS7LArh6GdUefoxpchsQ==" + }, + "node_modules/@types/d3-axis": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.1.tgz", + "integrity": "sha512-zji/iIbdd49g9WN0aIsGcwcTBUkgLsCSwB+uH+LPVDAiKWENMtI3cJEWt+7/YYwelMoZmbBfzA3qCdrZ2XFNnw==", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-brush": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.1.tgz", + "integrity": "sha512-B532DozsiTuQMHu2YChdZU0qsFJSio3Q6jmBYGYNp3gMDzBmuFFgPt9qKA4VYuLZMp4qc6eX7IUFUEsvHiXZAw==", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-eQfcxIHrg7V++W8Qxn6QkqBNBokyhdWSAS73AbkbMzvLQmVVBviknoz2SRS/ZJdIOmhcmmdCRE/NFOm28Z1AMw==" + }, + "node_modules/@types/d3-collection": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/d3-collection/-/d3-collection-1.0.10.tgz", + "integrity": "sha512-54Fdv8u5JbuXymtmXm2SYzi1x/Svt+jfWBU5junkhrCewL92VjqtCBDn97coBRVwVFmYNnVTNDyV8gQyPYfm+A==" + }, + "node_modules/@types/d3-color": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.0.2.tgz", + "integrity": "sha512-WVx6zBiz4sWlboCy7TCgjeyHpNjMsoF36yaagny1uXfbadc9f+5BeBf7U+lRmQqY3EHbGQpP8UdW8AC+cywSwQ==" + }, + "node_modules/@types/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-NhxMn3bAkqhjoxabVJWKryhnZXXYYVQxaBnbANu0O94+O/nX9qSjrA1P1jbAQJxJf+VC72TxDX/YJcKue5bRqw==" + }, + "node_modules/@types/d3-drag": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.1.tgz", + "integrity": "sha512-o1Va7bLwwk6h03+nSM8dpaGEYnoIG19P0lKqlic8Un36ymh9NSkNFX1yiXMKNMx8rJ0Kfnn2eovuFaL6Jvj0zA==", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-dsv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.0.tgz", + "integrity": "sha512-o0/7RlMl9p5n6FQDptuJVMxDf/7EDEv2SYEO/CwdG2tr1hTfUVi0Iavkk2ax+VpaQ/1jVhpnj5rq1nj8vwhn2A==" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.0.tgz", + "integrity": "sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==" + }, + "node_modules/@types/d3-force": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.3.tgz", + "integrity": "sha512-z8GteGVfkWJMKsx6hwC3SiTSLspL98VNpmvLpEFJQpZPq6xpA1I8HNBDNSpukfK0Vb0l64zGFhzunLgEAcBWSA==" + }, + "node_modules/@types/d3-format": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.1.tgz", + "integrity": "sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==" + }, + "node_modules/@types/d3-geo": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.0.2.tgz", + "integrity": "sha512-DbqK7MLYA8LpyHQfv6Klz0426bQEf7bRTvhMy44sNGVyZoWn//B0c+Qbeg8Osi2Obdc9BLLXYAKpyWege2/7LQ==", + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-hierarchy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.0.2.tgz", + "integrity": "sha512-+krnrWOZ+aQB6v+E+jEkmkAx9HvsNAD+1LCD0vlBY3t+HwjKnsBFbpVLx6WWzDzCIuiTWdAxXMEnGnVXpB09qQ==" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.0.0.tgz", + "integrity": "sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==" + }, + "node_modules/@types/d3-polygon": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.0.tgz", + "integrity": "sha512-D49z4DyzTKXM0sGKVqiTDTYr+DHg/uxsiWDAkNrwXYuiZVd9o9wXZIo+YsHkifOiyBkmSWlEngHCQme54/hnHw==" + }, + "node_modules/@types/d3-quadtree": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.2.tgz", + "integrity": "sha512-QNcK8Jguvc8lU+4OfeNx+qnVy7c0VrDJ+CCVFS9srBo2GL9Y18CnIxBdTF3v38flrGy5s1YggcoAiu6s4fLQIw==" + }, + "node_modules/@types/d3-queue": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-queue/-/d3-queue-3.0.8.tgz", + "integrity": "sha512-1FWOiI/MYwS5Z1Sa9EvS1Xet3isiVIIX5ozD6iGnwHonGcqL+RcC1eThXN5VfDmAiYt9Me9EWNEv/9J9k9RIKQ==" + }, + "node_modules/@types/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-IIE6YTekGczpLYo/HehAy3JGF1ty7+usI97LqraNa8IiDur+L44d0VOjAvFQWJVdZOJHukUJw+ZdZBlgeUsHOQ==" + }, + "node_modules/@types/d3-request": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-request/-/d3-request-1.0.6.tgz", + "integrity": "sha512-4nRKDUBg3EBx8VowpMvM3NAVMiMMI1qFUOYv3OJsclGjHX6xjtu09nsWhRQ0fvSUla3MEjb5Ch4IeaYarMEi1w==", + "dependencies": { + "@types/d3-dsv": "^1" + } + }, + "node_modules/@types/d3-request/node_modules/@types/d3-dsv": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-1.2.1.tgz", + "integrity": "sha512-LLmJmjiqp/fTNEdij5bIwUJ6P6TVNk5hKM9/uk5RPO2YNgEu9XvKO0dJ7Iqd3psEdmZN1m7gB1bOsjr4HmO2BA==" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-Yk4htunhPAwN0XGlIwArRomOjdoBFXC3+kCxK2Ubg7I9shQlVSJy/pG/Ht5ASN+gdMIalpk8TJ5xV74jFsetLA==", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-selection": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.2.tgz", + "integrity": "sha512-d29EDd0iUBrRoKhPndhDY6U/PYxOWqgIZwKTooy2UkBfU7TNZNpRho0yLWPxlatQrFWk2mnTu71IZQ4+LRgKlQ==" + }, + "node_modules/@types/d3-shape": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.0.2.tgz", + "integrity": "sha512-5+ButCmIfNX8id5seZ7jKj3igdcxx+S9IDBiT35fQGTLZUfkFgTv+oBH34xgeoWDKpWcMITSzBILWQtBoN5Piw==", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==" + }, + "node_modules/@types/d3-time-format": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.0.tgz", + "integrity": "sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.0.tgz", + "integrity": "sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==" + }, + "node_modules/@types/d3-tip": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/@types/d3-tip/-/d3-tip-3.5.5.tgz", + "integrity": "sha512-MWt1tlChRfHZtwBh8kIOrJo//TC5cdH5UN+KwcAs4wbFi6wnQJtk/MY4LBr/ZG7b2BQmRNJXu+EMI6NnH6VmxQ==", + "dev": true, + "dependencies": { + "@types/d3": "^3" + } + }, + "node_modules/@types/d3-tip/node_modules/@types/d3": { + "version": "3.5.47", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-3.5.47.tgz", + "integrity": "sha512-VkWIQoZXLFdcBGe5pdBKJmTU3fmpXvo/KV6ixvTzOMl1yJ2hbTXpfvsziag0kcaerPDwas2T0vxojwQG3YwivQ==", + "dev": true + }, + "node_modules/@types/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-Sv4qEI9uq3bnZwlOANvYK853zvpdKEm1yz9rcc8ZTsxvRklcs9Fx4YFuGA3gXoQN/c/1T6QkVNjhaRO/cWj94g==", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-voronoi": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@types/d3-voronoi/-/d3-voronoi-1.1.9.tgz", + "integrity": "sha512-DExNQkaHd1F3dFPvGA/Aw2NGyjMln6E9QzsiqOcBgnE+VInYnFBHBBySbZQts6z6xD+5jTfKCP7M4OqMyVjdwQ==" + }, + "node_modules/@types/d3-zoom": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.1.tgz", + "integrity": "sha512-7s5L9TjfqIYQmQQEUcpMAcBOahem7TRoSO/+Gkz02GbMVuULiZzjF2BOdw291dbO2aNon4m2OdFsRGaCq2caLQ==", + "dependencies": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, + "node_modules/@types/geojson": { + "version": "7946.0.8", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.8.tgz", + "integrity": "sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA==" + }, + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "node_modules/d3": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/d3/-/d3-4.9.1.tgz", + "integrity": "sha1-+GC+klImGjwU7qZLHSWQ0U9NuDg=", + "dependencies": { + "d3-array": "1.2.0", + "d3-axis": "1.0.7", + "d3-brush": "1.0.4", + "d3-chord": "1.0.4", + "d3-collection": "1.0.3", + "d3-color": "1.0.3", + "d3-dispatch": "1.0.3", + "d3-drag": "1.1.0", + "d3-dsv": "1.0.5", + "d3-ease": "1.0.3", + "d3-force": "1.0.6", + "d3-format": "1.2.0", + "d3-geo": "1.6.4", + "d3-hierarchy": "1.1.4", + "d3-interpolate": "1.1.5", + "d3-path": "1.0.5", + "d3-polygon": "1.0.3", + "d3-quadtree": "1.0.3", + "d3-queue": "3.0.7", + "d3-random": "1.1.0", + "d3-request": "1.0.5", + "d3-scale": "1.0.6", + "d3-selection": "1.1.0", + "d3-shape": "1.1.1", + "d3-time": "1.0.6", + "d3-time-format": "2.0.5", + "d3-timer": "1.0.5", + "d3-transition": "1.1.0", + "d3-voronoi": "1.1.2", + "d3-zoom": "1.2.0" + } + }, + "node_modules/d3-array": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.0.tgz", + "integrity": "sha1-FH0mlyDhdMQFen9CvosPPyulMQg=" + }, + "node_modules/d3-axis": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-1.0.7.tgz", + "integrity": "sha1-BIQz0wcGH2LR0kjikwwB17ZzjNg=" + }, + "node_modules/d3-brush": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-1.0.4.tgz", + "integrity": "sha1-AMLyOAGfJPbAoZSibUGhUw/+e8Q=", + "dependencies": { + "d3-dispatch": "1", + "d3-drag": "1", + "d3-interpolate": "1", + "d3-selection": "1", + "d3-transition": "1" + } + }, + "node_modules/d3-chord": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-1.0.4.tgz", + "integrity": "sha1-fexPC6iG9xP+ERxF92NBT290yiw=", + "dependencies": { + "d3-array": "1", + "d3-path": "1" + } + }, + "node_modules/d3-collection": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.3.tgz", + "integrity": "sha1-AL3qlPvBYo1DWruuL03CFk433TQ=" + }, + "node_modules/d3-color": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.0.3.tgz", + "integrity": "sha1-vHZD/KjlOoNH4vva/6I2eWtYUJs=" + }, + "node_modules/d3-dispatch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.3.tgz", + "integrity": "sha1-RuFJHqqbWMNY/OW+TovtYm54cfg=" + }, + "node_modules/d3-drag": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-1.1.0.tgz", + "integrity": "sha1-Skm013pC6ePVoO87SSsUqqLlpzM=", + "dependencies": { + "d3-dispatch": "1", + "d3-selection": "1" + } + }, + "node_modules/d3-dsv": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-1.0.5.tgz", + "integrity": "sha1-QZ99tH9ih4n8P9tjbmeESdCCETY=", + "dependencies": { + "commander": "2", + "iconv-lite": "0.4", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json", + "csv2tsv": "bin/dsv2dsv", + "dsv2dsv": "bin/dsv2dsv", + "dsv2json": "bin/dsv2json", + "json2csv": "bin/json2dsv", + "json2dsv": "bin/json2dsv", + "json2tsv": "bin/json2dsv", + "tsv2csv": "bin/dsv2dsv", + "tsv2json": "bin/dsv2json" + } + }, + "node_modules/d3-ease": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.3.tgz", + "integrity": "sha1-aL+8NJM4o4DETYrMT7wzBKotjA4=" + }, + "node_modules/d3-force": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-1.0.6.tgz", + "integrity": "sha1-6n4bdzDiZkzTFPWU1nGMV8wTK3k=", + "dependencies": { + "d3-collection": "1", + "d3-dispatch": "1", + "d3-quadtree": "1", + "d3-timer": "1" + } + }, + "node_modules/d3-format": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.2.0.tgz", + "integrity": "sha1-a0gLqohohdRlHcJIqPSsnaFtsHo=" + }, + "node_modules/d3-geo": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.6.4.tgz", + "integrity": "sha1-8g4eRhyxhF9ai+Vatvh2VCp+MZk=", + "dependencies": { + "d3-array": "1" + } + }, + "node_modules/d3-hierarchy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-1.1.4.tgz", + "integrity": "sha1-lsOULz8hz5l6EbTt8A3eKne0xtA=" + }, + "node_modules/d3-interpolate": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.1.5.tgz", + "integrity": "sha1-aeCZ/zkhRxblY8muw+qdHqS4p58=", + "dependencies": { + "d3-color": "1" + } + }, + "node_modules/d3-path": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.5.tgz", + "integrity": "sha1-JB6xhJvZ6egCHA0KeZ+KDo5EF2Q=" + }, + "node_modules/d3-polygon": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-1.0.3.tgz", + "integrity": "sha1-FoiOkCZGCTPysXllKtN4Ik04LGI=" + }, + "node_modules/d3-quadtree": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-1.0.3.tgz", + "integrity": "sha1-rHmH4+I/6AWpkPKOG1DTj8uCJDg=" + }, + "node_modules/d3-queue": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/d3-queue/-/d3-queue-3.0.7.tgz", + "integrity": "sha1-yTouVLQXwJWRKdfXP2z31Ckudhg=" + }, + "node_modules/d3-random": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-1.1.0.tgz", + "integrity": "sha1-ZkLlBsb6OmSFldKyRpeIqNElKdM=" + }, + "node_modules/d3-request": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-request/-/d3-request-1.0.5.tgz", + "integrity": "sha1-TarpRtHdDVff4B8CKVY1SVjVHyM=", + "dependencies": { + "d3-collection": "1", + "d3-dispatch": "1", + "d3-dsv": "1", + "xmlhttprequest": "1" + } + }, + "node_modules/d3-scale": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-1.0.6.tgz", + "integrity": "sha1-vOGdqA06DPQiyVQ64zIghiILNO0=", + "dependencies": { + "d3-array": "^1.2.0", + "d3-collection": "1", + "d3-color": "1", + "d3-format": "1", + "d3-interpolate": "1", + "d3-time": "1", + "d3-time-format": "2" + } + }, + "node_modules/d3-selection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-1.1.0.tgz", + "integrity": "sha1-GZhoSJZIj4OcoDchI9o08dMYgJw=" + }, + "node_modules/d3-shape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.1.1.tgz", + "integrity": "sha1-UKEDfkinn1uP2dWM3lJ5musfdyM=", + "dependencies": { + "d3-path": "1" + } + }, + "node_modules/d3-time": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.0.6.tgz", + "integrity": "sha1-pVsT19FdOhYK6RcIIy4INfHV6UU=" + }, + "node_modules/d3-time-format": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.0.5.tgz", + "integrity": "sha1-nXeAIE98kRnJFwsaVttN6aivly4=", + "dependencies": { + "d3-time": "1" + } + }, + "node_modules/d3-timer": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.5.tgz", + "integrity": "sha1-smbUdscbDSaeesXzUrQQo7b+bvA=" + }, + "node_modules/d3-tip": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/d3-tip/-/d3-tip-0.9.1.tgz", + "integrity": "sha512-EVBfG9d+HnjIoyVXfhpytWxlF59JaobwizqMX9EBXtsFmJytjwHeYiUs74ldHQjE7S9vzfKTx2LCtvUrIbuFYg==", + "dev": true, + "dependencies": { + "d3-collection": "^1.0.4", + "d3-selection": "^1.3.0" + }, + "engines": { + "node": ">=4.2.6" + } + }, + "node_modules/d3-tip/node_modules/d3-collection": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.7.tgz", + "integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==", + "dev": true + }, + "node_modules/d3-tip/node_modules/d3-selection": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-1.4.2.tgz", + "integrity": "sha512-SJ0BqYihzOjDnnlfyeHT0e30k0K1+5sR3d5fNueCNeuhZTnGw4M4o8mqJchSwgKMXCNFo+e2VTChiSJ0vYtXkg==", + "dev": true + }, + "node_modules/d3-transition": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-1.1.0.tgz", + "integrity": "sha1-z8hcdOUjkyQpBUZiNXKZBWDDlm8=", + "dependencies": { + "d3-color": "1", + "d3-dispatch": "1", + "d3-ease": "1", + "d3-interpolate": "1", + "d3-selection": "^1.1.0", + "d3-timer": "1" + } + }, + "node_modules/d3-voronoi": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.2.tgz", + "integrity": "sha1-Fodmfo8TotFYyAwUgMWinLDYlzw=" + }, + "node_modules/d3-zoom": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-1.2.0.tgz", + "integrity": "sha1-syMfT5OGJBR13v4cVXv9P94QZfs=", + "dependencies": { + "d3-dispatch": "1", + "d3-drag": "1", + "d3-interpolate": "1", + "d3-selection": "1", + "d3-transition": "1" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=", + "engines": { + "node": ">=0.4.0" + } + } + }, + "dependencies": { + "@types/d3": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-4.9.0.tgz", + "integrity": "sha512-1QXBT7ZI7nXDrNcAv4oXZ90aiO9HVVYJVZzGv/gYCSDp+9YeaoAkSifphH9nR7FbZLamxD2XTkQOEG0sBDubAg==", + "requires": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-collection": "*", + "@types/d3-color": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-queue": "*", + "@types/d3-random": "*", + "@types/d3-request": "*", + "@types/d3-scale": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-voronoi": "*", + "@types/d3-zoom": "*" + } + }, + "@types/d3-array": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.0.2.tgz", + "integrity": "sha512-5mjGjz6XOXKOCdTajXTZ/pMsg236RdiwKPrRPWAEf/2S/+PzwY+LLYShUpeysWaMvsdS7LArh6GdUefoxpchsQ==" + }, + "@types/d3-axis": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.1.tgz", + "integrity": "sha512-zji/iIbdd49g9WN0aIsGcwcTBUkgLsCSwB+uH+LPVDAiKWENMtI3cJEWt+7/YYwelMoZmbBfzA3qCdrZ2XFNnw==", + "requires": { + "@types/d3-selection": "*" + } + }, + "@types/d3-brush": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.1.tgz", + "integrity": "sha512-B532DozsiTuQMHu2YChdZU0qsFJSio3Q6jmBYGYNp3gMDzBmuFFgPt9qKA4VYuLZMp4qc6eX7IUFUEsvHiXZAw==", + "requires": { + "@types/d3-selection": "*" + } + }, + "@types/d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-eQfcxIHrg7V++W8Qxn6QkqBNBokyhdWSAS73AbkbMzvLQmVVBviknoz2SRS/ZJdIOmhcmmdCRE/NFOm28Z1AMw==" + }, + "@types/d3-collection": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/d3-collection/-/d3-collection-1.0.10.tgz", + "integrity": "sha512-54Fdv8u5JbuXymtmXm2SYzi1x/Svt+jfWBU5junkhrCewL92VjqtCBDn97coBRVwVFmYNnVTNDyV8gQyPYfm+A==" + }, + "@types/d3-color": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.0.2.tgz", + "integrity": "sha512-WVx6zBiz4sWlboCy7TCgjeyHpNjMsoF36yaagny1uXfbadc9f+5BeBf7U+lRmQqY3EHbGQpP8UdW8AC+cywSwQ==" + }, + "@types/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-NhxMn3bAkqhjoxabVJWKryhnZXXYYVQxaBnbANu0O94+O/nX9qSjrA1P1jbAQJxJf+VC72TxDX/YJcKue5bRqw==" + }, + "@types/d3-drag": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.1.tgz", + "integrity": "sha512-o1Va7bLwwk6h03+nSM8dpaGEYnoIG19P0lKqlic8Un36ymh9NSkNFX1yiXMKNMx8rJ0Kfnn2eovuFaL6Jvj0zA==", + "requires": { + "@types/d3-selection": "*" + } + }, + "@types/d3-dsv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.0.tgz", + "integrity": "sha512-o0/7RlMl9p5n6FQDptuJVMxDf/7EDEv2SYEO/CwdG2tr1hTfUVi0Iavkk2ax+VpaQ/1jVhpnj5rq1nj8vwhn2A==" + }, + "@types/d3-ease": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.0.tgz", + "integrity": "sha512-aMo4eaAOijJjA6uU+GIeW018dvy9+oH5Y2VPPzjjfxevvGQ/oRDs+tfYC9b50Q4BygRR8yE2QCLsrT0WtAVseA==" + }, + "@types/d3-force": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.3.tgz", + "integrity": "sha512-z8GteGVfkWJMKsx6hwC3SiTSLspL98VNpmvLpEFJQpZPq6xpA1I8HNBDNSpukfK0Vb0l64zGFhzunLgEAcBWSA==" + }, + "@types/d3-format": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.1.tgz", + "integrity": "sha512-5KY70ifCCzorkLuIkDe0Z9YTf9RR2CjBX1iaJG+rgM/cPP+sO+q9YdQ9WdhQcgPj1EQiJ2/0+yUkkziTG6Lubg==" + }, + "@types/d3-geo": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.0.2.tgz", + "integrity": "sha512-DbqK7MLYA8LpyHQfv6Klz0426bQEf7bRTvhMy44sNGVyZoWn//B0c+Qbeg8Osi2Obdc9BLLXYAKpyWege2/7LQ==", + "requires": { + "@types/geojson": "*" + } + }, + "@types/d3-hierarchy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.0.2.tgz", + "integrity": "sha512-+krnrWOZ+aQB6v+E+jEkmkAx9HvsNAD+1LCD0vlBY3t+HwjKnsBFbpVLx6WWzDzCIuiTWdAxXMEnGnVXpB09qQ==" + }, + "@types/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-jx5leotSeac3jr0RePOH1KdR9rISG91QIE4Q2PYTu4OymLTZfA3SrnURSLzKH48HmXVUru50b8nje4E79oQSQw==", + "requires": { + "@types/d3-color": "*" + } + }, + "@types/d3-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.0.0.tgz", + "integrity": "sha512-0g/A+mZXgFkQxN3HniRDbXMN79K3CdTpLsevj+PXiTcb2hVyvkZUBg37StmgCQkaD84cUJ4uaDAWq7UJOQy2Tg==" + }, + "@types/d3-polygon": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.0.tgz", + "integrity": "sha512-D49z4DyzTKXM0sGKVqiTDTYr+DHg/uxsiWDAkNrwXYuiZVd9o9wXZIo+YsHkifOiyBkmSWlEngHCQme54/hnHw==" + }, + "@types/d3-quadtree": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.2.tgz", + "integrity": "sha512-QNcK8Jguvc8lU+4OfeNx+qnVy7c0VrDJ+CCVFS9srBo2GL9Y18CnIxBdTF3v38flrGy5s1YggcoAiu6s4fLQIw==" + }, + "@types/d3-queue": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-queue/-/d3-queue-3.0.8.tgz", + "integrity": "sha512-1FWOiI/MYwS5Z1Sa9EvS1Xet3isiVIIX5ozD6iGnwHonGcqL+RcC1eThXN5VfDmAiYt9Me9EWNEv/9J9k9RIKQ==" + }, + "@types/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-IIE6YTekGczpLYo/HehAy3JGF1ty7+usI97LqraNa8IiDur+L44d0VOjAvFQWJVdZOJHukUJw+ZdZBlgeUsHOQ==" + }, + "@types/d3-request": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-request/-/d3-request-1.0.6.tgz", + "integrity": "sha512-4nRKDUBg3EBx8VowpMvM3NAVMiMMI1qFUOYv3OJsclGjHX6xjtu09nsWhRQ0fvSUla3MEjb5Ch4IeaYarMEi1w==", + "requires": { + "@types/d3-dsv": "^1" + }, + "dependencies": { + "@types/d3-dsv": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-1.2.1.tgz", + "integrity": "sha512-LLmJmjiqp/fTNEdij5bIwUJ6P6TVNk5hKM9/uk5RPO2YNgEu9XvKO0dJ7Iqd3psEdmZN1m7gB1bOsjr4HmO2BA==" + } + } + }, + "@types/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-Yk4htunhPAwN0XGlIwArRomOjdoBFXC3+kCxK2Ubg7I9shQlVSJy/pG/Ht5ASN+gdMIalpk8TJ5xV74jFsetLA==", + "requires": { + "@types/d3-time": "*" + } + }, + "@types/d3-selection": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.2.tgz", + "integrity": "sha512-d29EDd0iUBrRoKhPndhDY6U/PYxOWqgIZwKTooy2UkBfU7TNZNpRho0yLWPxlatQrFWk2mnTu71IZQ4+LRgKlQ==" + }, + "@types/d3-shape": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.0.2.tgz", + "integrity": "sha512-5+ButCmIfNX8id5seZ7jKj3igdcxx+S9IDBiT35fQGTLZUfkFgTv+oBH34xgeoWDKpWcMITSzBILWQtBoN5Piw==", + "requires": { + "@types/d3-path": "*" + } + }, + "@types/d3-time": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.0.tgz", + "integrity": "sha512-sZLCdHvBUcNby1cB6Fd3ZBrABbjz3v1Vm90nysCQ6Vt7vd6e/h9Lt7SiJUoEX0l4Dzc7P5llKyhqSi1ycSf1Hg==" + }, + "@types/d3-time-format": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.0.tgz", + "integrity": "sha512-yjfBUe6DJBsDin2BMIulhSHmr5qNR5Pxs17+oW4DoVPyVIXZ+m6bs7j1UVKP08Emv6jRmYrYqxYzO63mQxy1rw==" + }, + "@types/d3-timer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.0.tgz", + "integrity": "sha512-HNB/9GHqu7Fo8AQiugyJbv6ZxYz58wef0esl4Mv828w1ZKpAshw/uFWVDUcIB9KKFeFKoxS3cHY07FFgtTRZ1g==" + }, + "@types/d3-tip": { + "version": "3.5.5", + "resolved": "https://registry.npmjs.org/@types/d3-tip/-/d3-tip-3.5.5.tgz", + "integrity": "sha512-MWt1tlChRfHZtwBh8kIOrJo//TC5cdH5UN+KwcAs4wbFi6wnQJtk/MY4LBr/ZG7b2BQmRNJXu+EMI6NnH6VmxQ==", + "dev": true, + "requires": { + "@types/d3": "^3" + }, + "dependencies": { + "@types/d3": { + "version": "3.5.47", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-3.5.47.tgz", + "integrity": "sha512-VkWIQoZXLFdcBGe5pdBKJmTU3fmpXvo/KV6ixvTzOMl1yJ2hbTXpfvsziag0kcaerPDwas2T0vxojwQG3YwivQ==", + "dev": true + } + } + }, + "@types/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-Sv4qEI9uq3bnZwlOANvYK853zvpdKEm1yz9rcc8ZTsxvRklcs9Fx4YFuGA3gXoQN/c/1T6QkVNjhaRO/cWj94g==", + "requires": { + "@types/d3-selection": "*" + } + }, + "@types/d3-voronoi": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@types/d3-voronoi/-/d3-voronoi-1.1.9.tgz", + "integrity": "sha512-DExNQkaHd1F3dFPvGA/Aw2NGyjMln6E9QzsiqOcBgnE+VInYnFBHBBySbZQts6z6xD+5jTfKCP7M4OqMyVjdwQ==" + }, + "@types/d3-zoom": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.1.tgz", + "integrity": "sha512-7s5L9TjfqIYQmQQEUcpMAcBOahem7TRoSO/+Gkz02GbMVuULiZzjF2BOdw291dbO2aNon4m2OdFsRGaCq2caLQ==", + "requires": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, + "@types/geojson": { + "version": "7946.0.8", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.8.tgz", + "integrity": "sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA==" + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "d3": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/d3/-/d3-4.9.1.tgz", + "integrity": "sha1-+GC+klImGjwU7qZLHSWQ0U9NuDg=", + "requires": { + "d3-array": "1.2.0", + "d3-axis": "1.0.7", + "d3-brush": "1.0.4", + "d3-chord": "1.0.4", + "d3-collection": "1.0.3", + "d3-color": "1.0.3", + "d3-dispatch": "1.0.3", + "d3-drag": "1.1.0", + "d3-dsv": "1.0.5", + "d3-ease": "1.0.3", + "d3-force": "1.0.6", + "d3-format": "1.2.0", + "d3-geo": "1.6.4", + "d3-hierarchy": "1.1.4", + "d3-interpolate": "1.1.5", + "d3-path": "1.0.5", + "d3-polygon": "1.0.3", + "d3-quadtree": "1.0.3", + "d3-queue": "3.0.7", + "d3-random": "1.1.0", + "d3-request": "1.0.5", + "d3-scale": "1.0.6", + "d3-selection": "1.1.0", + "d3-shape": "1.1.1", + "d3-time": "1.0.6", + "d3-time-format": "2.0.5", + "d3-timer": "1.0.5", + "d3-transition": "1.1.0", + "d3-voronoi": "1.1.2", + "d3-zoom": "1.2.0" + } + }, + "d3-array": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-1.2.0.tgz", + "integrity": "sha1-FH0mlyDhdMQFen9CvosPPyulMQg=" + }, + "d3-axis": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-1.0.7.tgz", + "integrity": "sha1-BIQz0wcGH2LR0kjikwwB17ZzjNg=" + }, + "d3-brush": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-1.0.4.tgz", + "integrity": "sha1-AMLyOAGfJPbAoZSibUGhUw/+e8Q=", + "requires": { + "d3-dispatch": "1", + "d3-drag": "1", + "d3-interpolate": "1", + "d3-selection": "1", + "d3-transition": "1" + } + }, + "d3-chord": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-1.0.4.tgz", + "integrity": "sha1-fexPC6iG9xP+ERxF92NBT290yiw=", + "requires": { + "d3-array": "1", + "d3-path": "1" + } + }, + "d3-collection": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.3.tgz", + "integrity": "sha1-AL3qlPvBYo1DWruuL03CFk433TQ=" + }, + "d3-color": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-1.0.3.tgz", + "integrity": "sha1-vHZD/KjlOoNH4vva/6I2eWtYUJs=" + }, + "d3-dispatch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-1.0.3.tgz", + "integrity": "sha1-RuFJHqqbWMNY/OW+TovtYm54cfg=" + }, + "d3-drag": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-1.1.0.tgz", + "integrity": "sha1-Skm013pC6ePVoO87SSsUqqLlpzM=", + "requires": { + "d3-dispatch": "1", + "d3-selection": "1" + } + }, + "d3-dsv": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-1.0.5.tgz", + "integrity": "sha1-QZ99tH9ih4n8P9tjbmeESdCCETY=", + "requires": { + "commander": "2", + "iconv-lite": "0.4", + "rw": "1" + } + }, + "d3-ease": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-1.0.3.tgz", + "integrity": "sha1-aL+8NJM4o4DETYrMT7wzBKotjA4=" + }, + "d3-force": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-1.0.6.tgz", + "integrity": "sha1-6n4bdzDiZkzTFPWU1nGMV8wTK3k=", + "requires": { + "d3-collection": "1", + "d3-dispatch": "1", + "d3-quadtree": "1", + "d3-timer": "1" + } + }, + "d3-format": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-1.2.0.tgz", + "integrity": "sha1-a0gLqohohdRlHcJIqPSsnaFtsHo=" + }, + "d3-geo": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-1.6.4.tgz", + "integrity": "sha1-8g4eRhyxhF9ai+Vatvh2VCp+MZk=", + "requires": { + "d3-array": "1" + } + }, + "d3-hierarchy": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-1.1.4.tgz", + "integrity": "sha1-lsOULz8hz5l6EbTt8A3eKne0xtA=" + }, + "d3-interpolate": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-1.1.5.tgz", + "integrity": "sha1-aeCZ/zkhRxblY8muw+qdHqS4p58=", + "requires": { + "d3-color": "1" + } + }, + "d3-path": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.5.tgz", + "integrity": "sha1-JB6xhJvZ6egCHA0KeZ+KDo5EF2Q=" + }, + "d3-polygon": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-1.0.3.tgz", + "integrity": "sha1-FoiOkCZGCTPysXllKtN4Ik04LGI=" + }, + "d3-quadtree": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-1.0.3.tgz", + "integrity": "sha1-rHmH4+I/6AWpkPKOG1DTj8uCJDg=" + }, + "d3-queue": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/d3-queue/-/d3-queue-3.0.7.tgz", + "integrity": "sha1-yTouVLQXwJWRKdfXP2z31Ckudhg=" + }, + "d3-random": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-1.1.0.tgz", + "integrity": "sha1-ZkLlBsb6OmSFldKyRpeIqNElKdM=" + }, + "d3-request": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-request/-/d3-request-1.0.5.tgz", + "integrity": "sha1-TarpRtHdDVff4B8CKVY1SVjVHyM=", + "requires": { + "d3-collection": "1", + "d3-dispatch": "1", + "d3-dsv": "1", + "xmlhttprequest": "1" + } + }, + "d3-scale": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-1.0.6.tgz", + "integrity": "sha1-vOGdqA06DPQiyVQ64zIghiILNO0=", + "requires": { + "d3-array": "^1.2.0", + "d3-collection": "1", + "d3-color": "1", + "d3-format": "1", + "d3-interpolate": "1", + "d3-time": "1", + "d3-time-format": "2" + } + }, + "d3-selection": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-1.1.0.tgz", + "integrity": "sha1-GZhoSJZIj4OcoDchI9o08dMYgJw=" + }, + "d3-shape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.1.1.tgz", + "integrity": "sha1-UKEDfkinn1uP2dWM3lJ5musfdyM=", + "requires": { + "d3-path": "1" + } + }, + "d3-time": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-1.0.6.tgz", + "integrity": "sha1-pVsT19FdOhYK6RcIIy4INfHV6UU=" + }, + "d3-time-format": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-2.0.5.tgz", + "integrity": "sha1-nXeAIE98kRnJFwsaVttN6aivly4=", + "requires": { + "d3-time": "1" + } + }, + "d3-timer": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-1.0.5.tgz", + "integrity": "sha1-smbUdscbDSaeesXzUrQQo7b+bvA=" + }, + "d3-tip": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/d3-tip/-/d3-tip-0.9.1.tgz", + "integrity": "sha512-EVBfG9d+HnjIoyVXfhpytWxlF59JaobwizqMX9EBXtsFmJytjwHeYiUs74ldHQjE7S9vzfKTx2LCtvUrIbuFYg==", + "dev": true, + "requires": { + "d3-collection": "^1.0.4", + "d3-selection": "^1.3.0" + }, + "dependencies": { + "d3-collection": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/d3-collection/-/d3-collection-1.0.7.tgz", + "integrity": "sha512-ii0/r5f4sjKNTfh84Di+DpztYwqKhEyUlKoPrzUFfeSkWxjW49xU2QzO9qrPrNkpdI0XJkfzvmTu8V2Zylln6A==", + "dev": true + }, + "d3-selection": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-1.4.2.tgz", + "integrity": "sha512-SJ0BqYihzOjDnnlfyeHT0e30k0K1+5sR3d5fNueCNeuhZTnGw4M4o8mqJchSwgKMXCNFo+e2VTChiSJ0vYtXkg==", + "dev": true + } + } + }, + "d3-transition": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-1.1.0.tgz", + "integrity": "sha1-z8hcdOUjkyQpBUZiNXKZBWDDlm8=", + "requires": { + "d3-color": "1", + "d3-dispatch": "1", + "d3-ease": "1", + "d3-interpolate": "1", + "d3-selection": "^1.1.0", + "d3-timer": "1" + } + }, + "d3-voronoi": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/d3-voronoi/-/d3-voronoi-1.1.2.tgz", + "integrity": "sha1-Fodmfo8TotFYyAwUgMWinLDYlzw=" + }, + "d3-zoom": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-1.2.0.tgz", + "integrity": "sha1-syMfT5OGJBR13v4cVXv9P94QZfs=", + "requires": { + "d3-dispatch": "1", + "d3-drag": "1", + "d3-interpolate": "1", + "d3-selection": "1", + "d3-transition": "1" + } + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha1-P4Yt+pGrdmsUiF700BEkv9oHT7Q=" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "xmlhttprequest": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", + "integrity": "sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=" + } + } +} diff --git a/files/plugin-UsersFlow-5.0.6/package.json b/files/plugin-UsersFlow-5.0.6/package.json new file mode 100644 index 0000000..51086b1 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/package.json @@ -0,0 +1,29 @@ +{ + "name": "usersflow", + "version": "1.0.0", + "description": "## Description", + "main": "tracker.js", + "directories": { + "doc": "docs", + "test": "tests" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/innocraft/plugin-UsersFlow.git" + }, + "author": "", + "license": "InnoCraft EULA", + "bugs": { + "url": "https://github.com/innocraft/plugin-UsersFlow/issues" + }, + "homepage": "https://github.com/innocraft/plugin-UsersFlow#readme", + "devDependencies": { + "@types/d3": "4.9.0", + "d3": "4.9.1", + "@types/d3-tip": "^3.5.5", + "d3-tip": "^0.9.1" + } +} diff --git a/files/plugin-UsersFlow-5.0.6/phpcs.xml b/files/plugin-UsersFlow-5.0.6/phpcs.xml new file mode 100644 index 0000000..45faec7 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/phpcs.xml @@ -0,0 +1,36 @@ + + + + Matomo Coding Standard for UsersFlow plugin + + + + . + + tests/javascript/* + */vendor/* + + + + + + + + tests/* + + + + + Updates/* + + + + + tests/* + + + + + tests/* + + \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/plugin.json b/files/plugin-UsersFlow-5.0.6/plugin.json new file mode 100644 index 0000000..ba52535 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/plugin.json @@ -0,0 +1,22 @@ +{ + "name": "UsersFlow", + "description": "Users Flow is a visual representation of the most popular paths your users take through your website & app which lets you understand your users needs", + "version": "5.0.6", + "theme": false, + "require": { + "matomo": ">=5.0.0-b4,<6.0.0-b1" + }, + "authors": [ + { + "name": "InnoCraft", + "email": "contact@innocraft.com", + "homepage": "https://www.innocraft.com" + } + ], + "price": { + "base": 94 + }, + "homepage": "https://plugins.matomo.org/UsersFlow", + "license": "InnoCraft EULA", + "keywords": ["visitors", "users", "flow", "path", "goal", "sales", "click", "interaction", "cro", "conversion", "optimization", "marketing"] +} diff --git a/files/plugin-UsersFlow-5.0.6/pull_request_template.md b/files/plugin-UsersFlow-5.0.6/pull_request_template.md new file mode 100644 index 0000000..e7d9cf5 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/pull_request_template.md @@ -0,0 +1,26 @@ +## Description + + +## Issue No + + +## Steps to Replicate the Issue +1. +2. +3. + + + +## Checklist +- [✔/✖] Tested locally or on demo2/demo3? +- [✔/✖/NA] New test case added/updated? +- [✔/✖/NA] Are all newly added texts included via translation? +- [✔/✖/NA] Are text sanitized properly? (Eg use of v-text v/s v-html for vue) +- [✔/✖/NA] Version bumped? \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/stylesheets/d3-tip.less b/files/plugin-UsersFlow-5.0.6/stylesheets/d3-tip.less new file mode 100644 index 0000000..b428e65 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/stylesheets/d3-tip.less @@ -0,0 +1,55 @@ +.d3-tip { + line-height: 1; + font-weight: bold; + padding: 12px; + background: rgba(0, 0, 0, 0.8); + color: #fff; + border-radius: 2px; + pointer-events: none; +} + +/* Creates a small triangle extender for the tooltip */ +.d3-tip:after { + box-sizing: border-box; + display: inline; + font-size: 10px; + width: 100%; + line-height: 1; + color: rgba(0, 0, 0, 0.8); + position: absolute; + pointer-events: none; +} + +/* Northward tooltips */ +.d3-tip.n:after { + content: "\25BC"; + margin: -1px 0 0 0; + top: 100%; + left: 0; + text-align: center; +} + +/* Eastward tooltips */ +.d3-tip.e:after { + content: "\25C0"; + margin: -4px 0 0 0; + top: 50%; + left: -8px; +} + +/* Southward tooltips */ +.d3-tip.s:after { + content: "\25B2"; + margin: 0 0 1px 0; + top: -8px; + left: 0; + text-align: center; +} + +/* Westward tooltips */ +.d3-tip.w:after { + content: "\25B6"; + margin: -4px 0 0 -1px; + top: 50%; + left: 100%; +} \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/templates/getUsersFlow.twig b/files/plugin-UsersFlow-5.0.6/templates/getUsersFlow.twig new file mode 100644 index 0000000..464d7cf --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/templates/getUsersFlow.twig @@ -0,0 +1,7 @@ +
+
diff --git a/files/plugin-UsersFlow-5.0.6/tsconfig.json b/files/plugin-UsersFlow-5.0.6/tsconfig.json new file mode 100644 index 0000000..ca38484 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/tsconfig.json @@ -0,0 +1,15 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "typeRoots": [ + "../../node_modules/@types", + "../../plugins/CoreVue/types/index.d.ts", + "./node_modules/@types" + ], + "types": [ + "jquery", + "d3", + "d3-tip" + ] + } +} \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/vue/dist/UsersFlow.umd.js b/files/plugin-UsersFlow-5.0.6/vue/dist/UsersFlow.umd.js new file mode 100644 index 0000000..2e1007d --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/dist/UsersFlow.umd.js @@ -0,0 +1,19850 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("CoreHome"), require("vue"), require("CorePluginsAdmin")); + else if(typeof define === 'function' && define.amd) + define(["CoreHome", , "CorePluginsAdmin"], factory); + else if(typeof exports === 'object') + exports["UsersFlow"] = factory(require("CoreHome"), require("vue"), require("CorePluginsAdmin")); + else + root["UsersFlow"] = factory(root["CoreHome"], root["Vue"], root["CorePluginsAdmin"]); +})((typeof self !== 'undefined' ? self : this), function(__WEBPACK_EXTERNAL_MODULE__19dc__, __WEBPACK_EXTERNAL_MODULE__8bbf__, __WEBPACK_EXTERNAL_MODULE_a5a2__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "plugins/UsersFlow/vue/dist/"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "fae3"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "19dc": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__19dc__; + +/***/ }), + +/***/ "8bbf": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__8bbf__; + +/***/ }), + +/***/ "9314": +/***/ (function(module, exports, __webpack_require__) { + +// https://d3js.org Version 4.9.1. Copyright 2017 Mike Bostock. +(function (global, factory) { + true ? factory(exports) : + undefined; +}(this, (function (exports) { 'use strict'; + +var version = "4.9.1"; + +var ascending = function(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +}; + +var bisector = function(compare) { + if (compare.length === 1) compare = ascendingComparator(compare); + return { + left: function(a, x, lo, hi) { + if (lo == null) lo = 0; + if (hi == null) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) < 0) lo = mid + 1; + else hi = mid; + } + return lo; + }, + right: function(a, x, lo, hi) { + if (lo == null) lo = 0; + if (hi == null) hi = a.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (compare(a[mid], x) > 0) hi = mid; + else lo = mid + 1; + } + return lo; + } + }; +}; + +function ascendingComparator(f) { + return function(d, x) { + return ascending(f(d), x); + }; +} + +var ascendingBisect = bisector(ascending); +var bisectRight = ascendingBisect.right; +var bisectLeft = ascendingBisect.left; + +var pairs = function(array, f) { + if (f == null) f = pair; + var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); + while (i < n) pairs[i] = f(p, p = array[++i]); + return pairs; +}; + +function pair(a, b) { + return [a, b]; +} + +var cross = function(values0, values1, reduce) { + var n0 = values0.length, + n1 = values1.length, + values = new Array(n0 * n1), + i0, + i1, + i, + value0; + + if (reduce == null) reduce = pair; + + for (i0 = i = 0; i0 < n0; ++i0) { + for (value0 = values0[i0], i1 = 0; i1 < n1; ++i1, ++i) { + values[i] = reduce(value0, values1[i1]); + } + } + + return values; +}; + +var descending = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +}; + +var number = function(x) { + return x === null ? NaN : +x; +}; + +var variance = function(values, valueof) { + var n = values.length, + m = 0, + i = -1, + mean = 0, + value, + delta, + sum = 0; + + if (valueof == null) { + while (++i < n) { + if (!isNaN(value = number(values[i]))) { + delta = value - mean; + mean += delta / ++m; + sum += delta * (value - mean); + } + } + } + + else { + while (++i < n) { + if (!isNaN(value = number(valueof(values[i], i, values)))) { + delta = value - mean; + mean += delta / ++m; + sum += delta * (value - mean); + } + } + } + + if (m > 1) return sum / (m - 1); +}; + +var deviation = function(array, f) { + var v = variance(array, f); + return v ? Math.sqrt(v) : v; +}; + +var extent = function(values, valueof) { + var n = values.length, + i = -1, + value, + min, + max; + + if (valueof == null) { + while (++i < n) { // Find the first comparable value. + if ((value = values[i]) != null && value >= value) { + min = max = value; + while (++i < n) { // Compare the remaining values. + if ((value = values[i]) != null) { + if (min > value) min = value; + if (max < value) max = value; + } + } + } + } + } + + else { + while (++i < n) { // Find the first comparable value. + if ((value = valueof(values[i], i, values)) != null && value >= value) { + min = max = value; + while (++i < n) { // Compare the remaining values. + if ((value = valueof(values[i], i, values)) != null) { + if (min > value) min = value; + if (max < value) max = value; + } + } + } + } + } + + return [min, max]; +}; + +var array = Array.prototype; + +var slice = array.slice; +var map = array.map; + +var constant = function(x) { + return function() { + return x; + }; +}; + +var identity = function(x) { + return x; +}; + +var sequence = function(start, stop, step) { + start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; + + var i = -1, + n = Math.max(0, Math.ceil((stop - start) / step)) | 0, + range = new Array(n); + + while (++i < n) { + range[i] = start + i * step; + } + + return range; +}; + +var e10 = Math.sqrt(50); +var e5 = Math.sqrt(10); +var e2 = Math.sqrt(2); + +var ticks = function(start, stop, count) { + var reverse = stop < start, + i = -1, + n, + ticks, + step; + + if (reverse) n = start, start = stop, stop = n; + + if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return []; + + if (step > 0) { + start = Math.ceil(start / step); + stop = Math.floor(stop / step); + ticks = new Array(n = Math.ceil(stop - start + 1)); + while (++i < n) ticks[i] = (start + i) * step; + } else { + start = Math.floor(start * step); + stop = Math.ceil(stop * step); + ticks = new Array(n = Math.ceil(start - stop + 1)); + while (++i < n) ticks[i] = (start - i) / step; + } + + if (reverse) ticks.reverse(); + + return ticks; +}; + +function tickIncrement(start, stop, count) { + var step = (stop - start) / Math.max(0, count), + power = Math.floor(Math.log(step) / Math.LN10), + error = step / Math.pow(10, power); + return power >= 0 + ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) + : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); +} + +function tickStep(start, stop, count) { + var step0 = Math.abs(stop - start) / Math.max(0, count), + step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), + error = step0 / step1; + if (error >= e10) step1 *= 10; + else if (error >= e5) step1 *= 5; + else if (error >= e2) step1 *= 2; + return stop < start ? -step1 : step1; +} + +var sturges = function(values) { + return Math.ceil(Math.log(values.length) / Math.LN2) + 1; +}; + +var histogram = function() { + var value = identity, + domain = extent, + threshold = sturges; + + function histogram(data) { + var i, + n = data.length, + x, + values = new Array(n); + + for (i = 0; i < n; ++i) { + values[i] = value(data[i], i, data); + } + + var xz = domain(values), + x0 = xz[0], + x1 = xz[1], + tz = threshold(values, x0, x1); + + // Convert number of thresholds into uniform thresholds. + if (!Array.isArray(tz)) { + tz = tickStep(x0, x1, tz); + tz = sequence(Math.ceil(x0 / tz) * tz, Math.floor(x1 / tz) * tz, tz); // exclusive + } + + // Remove any thresholds outside the domain. + var m = tz.length; + while (tz[0] <= x0) tz.shift(), --m; + while (tz[m - 1] > x1) tz.pop(), --m; + + var bins = new Array(m + 1), + bin; + + // Initialize bins. + for (i = 0; i <= m; ++i) { + bin = bins[i] = []; + bin.x0 = i > 0 ? tz[i - 1] : x0; + bin.x1 = i < m ? tz[i] : x1; + } + + // Assign data to bins by value, ignoring any outside the domain. + for (i = 0; i < n; ++i) { + x = values[i]; + if (x0 <= x && x <= x1) { + bins[bisectRight(tz, x, 0, m)].push(data[i]); + } + } + + return bins; + } + + histogram.value = function(_) { + return arguments.length ? (value = typeof _ === "function" ? _ : constant(_), histogram) : value; + }; + + histogram.domain = function(_) { + return arguments.length ? (domain = typeof _ === "function" ? _ : constant([_[0], _[1]]), histogram) : domain; + }; + + histogram.thresholds = function(_) { + return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), histogram) : threshold; + }; + + return histogram; +}; + +var threshold = function(values, p, valueof) { + if (valueof == null) valueof = number; + if (!(n = values.length)) return; + if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); + if (p >= 1) return +valueof(values[n - 1], n - 1, values); + var n, + i = (n - 1) * p, + i0 = Math.floor(i), + value0 = +valueof(values[i0], i0, values), + value1 = +valueof(values[i0 + 1], i0 + 1, values); + return value0 + (value1 - value0) * (i - i0); +}; + +var freedmanDiaconis = function(values, min, max) { + values = map.call(values, number).sort(ascending); + return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3))); +}; + +var scott = function(values, min, max) { + return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); +}; + +var max = function(values, valueof) { + var n = values.length, + i = -1, + value, + max; + + if (valueof == null) { + while (++i < n) { // Find the first comparable value. + if ((value = values[i]) != null && value >= value) { + max = value; + while (++i < n) { // Compare the remaining values. + if ((value = values[i]) != null && value > max) { + max = value; + } + } + } + } + } + + else { + while (++i < n) { // Find the first comparable value. + if ((value = valueof(values[i], i, values)) != null && value >= value) { + max = value; + while (++i < n) { // Compare the remaining values. + if ((value = valueof(values[i], i, values)) != null && value > max) { + max = value; + } + } + } + } + } + + return max; +}; + +var mean = function(values, valueof) { + var n = values.length, + m = n, + i = -1, + value, + sum = 0; + + if (valueof == null) { + while (++i < n) { + if (!isNaN(value = number(values[i]))) sum += value; + else --m; + } + } + + else { + while (++i < n) { + if (!isNaN(value = number(valueof(values[i], i, values)))) sum += value; + else --m; + } + } + + if (m) return sum / m; +}; + +var median = function(values, valueof) { + var n = values.length, + i = -1, + value, + numbers = []; + + if (valueof == null) { + while (++i < n) { + if (!isNaN(value = number(values[i]))) { + numbers.push(value); + } + } + } + + else { + while (++i < n) { + if (!isNaN(value = number(valueof(values[i], i, values)))) { + numbers.push(value); + } + } + } + + return threshold(numbers.sort(ascending), 0.5); +}; + +var merge = function(arrays) { + var n = arrays.length, + m, + i = -1, + j = 0, + merged, + array; + + while (++i < n) j += arrays[i].length; + merged = new Array(j); + + while (--n >= 0) { + array = arrays[n]; + m = array.length; + while (--m >= 0) { + merged[--j] = array[m]; + } + } + + return merged; +}; + +var min = function(values, valueof) { + var n = values.length, + i = -1, + value, + min; + + if (valueof == null) { + while (++i < n) { // Find the first comparable value. + if ((value = values[i]) != null && value >= value) { + min = value; + while (++i < n) { // Compare the remaining values. + if ((value = values[i]) != null && min > value) { + min = value; + } + } + } + } + } + + else { + while (++i < n) { // Find the first comparable value. + if ((value = valueof(values[i], i, values)) != null && value >= value) { + min = value; + while (++i < n) { // Compare the remaining values. + if ((value = valueof(values[i], i, values)) != null && min > value) { + min = value; + } + } + } + } + } + + return min; +}; + +var permute = function(array, indexes) { + var i = indexes.length, permutes = new Array(i); + while (i--) permutes[i] = array[indexes[i]]; + return permutes; +}; + +var scan = function(values, compare) { + if (!(n = values.length)) return; + var n, + i = 0, + j = 0, + xi, + xj = values[j]; + + if (compare == null) compare = ascending; + + while (++i < n) { + if (compare(xi = values[i], xj) < 0 || compare(xj, xj) !== 0) { + xj = xi, j = i; + } + } + + if (compare(xj, xj) === 0) return j; +}; + +var shuffle = function(array, i0, i1) { + var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0), + t, + i; + + while (m) { + i = Math.random() * m-- | 0; + t = array[m + i0]; + array[m + i0] = array[i + i0]; + array[i + i0] = t; + } + + return array; +}; + +var sum = function(values, valueof) { + var n = values.length, + i = -1, + value, + sum = 0; + + if (valueof == null) { + while (++i < n) { + if (value = +values[i]) sum += value; // Note: zero and null are equivalent. + } + } + + else { + while (++i < n) { + if (value = +valueof(values[i], i, values)) sum += value; + } + } + + return sum; +}; + +var transpose = function(matrix) { + if (!(n = matrix.length)) return []; + for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) { + for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) { + row[j] = matrix[j][i]; + } + } + return transpose; +}; + +function length(d) { + return d.length; +} + +var zip = function() { + return transpose(arguments); +}; + +var slice$1 = Array.prototype.slice; + +var identity$1 = function(x) { + return x; +}; + +var top = 1; +var right = 2; +var bottom = 3; +var left = 4; +var epsilon = 1e-6; + +function translateX(x) { + return "translate(" + (x + 0.5) + ",0)"; +} + +function translateY(y) { + return "translate(0," + (y + 0.5) + ")"; +} + +function center(scale) { + var offset = Math.max(0, scale.bandwidth() - 1) / 2; // Adjust for 0.5px offset. + if (scale.round()) offset = Math.round(offset); + return function(d) { + return scale(d) + offset; + }; +} + +function entering() { + return !this.__axis; +} + +function axis(orient, scale) { + var tickArguments = [], + tickValues = null, + tickFormat = null, + tickSizeInner = 6, + tickSizeOuter = 6, + tickPadding = 3, + k = orient === top || orient === left ? -1 : 1, + x = orient === left || orient === right ? "x" : "y", + transform = orient === top || orient === bottom ? translateX : translateY; + + function axis(context) { + var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues, + format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$1) : tickFormat, + spacing = Math.max(tickSizeInner, 0) + tickPadding, + range = scale.range(), + range0 = range[0] + 0.5, + range1 = range[range.length - 1] + 0.5, + position = (scale.bandwidth ? center : identity$1)(scale.copy()), + selection = context.selection ? context.selection() : context, + path = selection.selectAll(".domain").data([null]), + tick = selection.selectAll(".tick").data(values, scale).order(), + tickExit = tick.exit(), + tickEnter = tick.enter().append("g").attr("class", "tick"), + line = tick.select("line"), + text = tick.select("text"); + + path = path.merge(path.enter().insert("path", ".tick") + .attr("class", "domain") + .attr("stroke", "#000")); + + tick = tick.merge(tickEnter); + + line = line.merge(tickEnter.append("line") + .attr("stroke", "#000") + .attr(x + "2", k * tickSizeInner)); + + text = text.merge(tickEnter.append("text") + .attr("fill", "#000") + .attr(x, k * spacing) + .attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")); + + if (context !== selection) { + path = path.transition(context); + tick = tick.transition(context); + line = line.transition(context); + text = text.transition(context); + + tickExit = tickExit.transition(context) + .attr("opacity", epsilon) + .attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d) : this.getAttribute("transform"); }); + + tickEnter + .attr("opacity", epsilon) + .attr("transform", function(d) { var p = this.parentNode.__axis; return transform(p && isFinite(p = p(d)) ? p : position(d)); }); + } + + tickExit.remove(); + + path + .attr("d", orient === left || orient == right + ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter + : "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter); + + tick + .attr("opacity", 1) + .attr("transform", function(d) { return transform(position(d)); }); + + line + .attr(x + "2", k * tickSizeInner); + + text + .attr(x, k * spacing) + .text(format); + + selection.filter(entering) + .attr("fill", "none") + .attr("font-size", 10) + .attr("font-family", "sans-serif") + .attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); + + selection + .each(function() { this.__axis = position; }); + } + + axis.scale = function(_) { + return arguments.length ? (scale = _, axis) : scale; + }; + + axis.ticks = function() { + return tickArguments = slice$1.call(arguments), axis; + }; + + axis.tickArguments = function(_) { + return arguments.length ? (tickArguments = _ == null ? [] : slice$1.call(_), axis) : tickArguments.slice(); + }; + + axis.tickValues = function(_) { + return arguments.length ? (tickValues = _ == null ? null : slice$1.call(_), axis) : tickValues && tickValues.slice(); + }; + + axis.tickFormat = function(_) { + return arguments.length ? (tickFormat = _, axis) : tickFormat; + }; + + axis.tickSize = function(_) { + return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner; + }; + + axis.tickSizeInner = function(_) { + return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner; + }; + + axis.tickSizeOuter = function(_) { + return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter; + }; + + axis.tickPadding = function(_) { + return arguments.length ? (tickPadding = +_, axis) : tickPadding; + }; + + return axis; +} + +function axisTop(scale) { + return axis(top, scale); +} + +function axisRight(scale) { + return axis(right, scale); +} + +function axisBottom(scale) { + return axis(bottom, scale); +} + +function axisLeft(scale) { + return axis(left, scale); +} + +var noop = {value: function() {}}; + +function dispatch() { + for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { + if (!(t = arguments[i] + "") || (t in _)) throw new Error("illegal type: " + t); + _[t] = []; + } + return new Dispatch(_); +} + +function Dispatch(_) { + this._ = _; +} + +function parseTypenames(typenames, types) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + if (t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t); + return {type: t, name: name}; + }); +} + +Dispatch.prototype = dispatch.prototype = { + constructor: Dispatch, + on: function(typename, callback) { + var _ = this._, + T = parseTypenames(typename + "", _), + t, + i = -1, + n = T.length; + + // If no callback was specified, return the callback of the given type and name. + if (arguments.length < 2) { + while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t; + return; + } + + // If a type was specified, set the callback for the given type and name. + // Otherwise, if a null callback was specified, remove callbacks of the given name. + if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); + while (++i < n) { + if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); + else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null); + } + + return this; + }, + copy: function() { + var copy = {}, _ = this._; + for (var t in _) copy[t] = _[t].slice(); + return new Dispatch(copy); + }, + call: function(type, that) { + if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; + if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); + for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + }, + apply: function(type, that, args) { + if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type); + for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); + } +}; + +function get(type, name) { + for (var i = 0, n = type.length, c; i < n; ++i) { + if ((c = type[i]).name === name) { + return c.value; + } + } +} + +function set(type, name, callback) { + for (var i = 0, n = type.length; i < n; ++i) { + if (type[i].name === name) { + type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1)); + break; + } + } + if (callback != null) type.push({name: name, value: callback}); + return type; +} + +var xhtml = "http://www.w3.org/1999/xhtml"; + +var namespaces = { + svg: "http://www.w3.org/2000/svg", + xhtml: xhtml, + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}; + +var namespace = function(name) { + var prefix = name += "", i = prefix.indexOf(":"); + if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); + return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; +}; + +function creatorInherit(name) { + return function() { + var document = this.ownerDocument, + uri = this.namespaceURI; + return uri === xhtml && document.documentElement.namespaceURI === xhtml + ? document.createElement(name) + : document.createElementNS(uri, name); + }; +} + +function creatorFixed(fullname) { + return function() { + return this.ownerDocument.createElementNS(fullname.space, fullname.local); + }; +} + +var creator = function(name) { + var fullname = namespace(name); + return (fullname.local + ? creatorFixed + : creatorInherit)(fullname); +}; + +var nextId = 0; + +function local$1() { + return new Local; +} + +function Local() { + this._ = "@" + (++nextId).toString(36); +} + +Local.prototype = local$1.prototype = { + constructor: Local, + get: function(node) { + var id = this._; + while (!(id in node)) if (!(node = node.parentNode)) return; + return node[id]; + }, + set: function(node, value) { + return node[this._] = value; + }, + remove: function(node) { + return this._ in node && delete node[this._]; + }, + toString: function() { + return this._; + } +}; + +var matcher = function(selector) { + return function() { + return this.matches(selector); + }; +}; + +if (typeof document !== "undefined") { + var element = document.documentElement; + if (!element.matches) { + var vendorMatches = element.webkitMatchesSelector + || element.msMatchesSelector + || element.mozMatchesSelector + || element.oMatchesSelector; + matcher = function(selector) { + return function() { + return vendorMatches.call(this, selector); + }; + }; + } +} + +var matcher$1 = matcher; + +var filterEvents = {}; + +exports.event = null; + +if (typeof document !== "undefined") { + var element$1 = document.documentElement; + if (!("onmouseenter" in element$1)) { + filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"}; + } +} + +function filterContextListener(listener, index, group) { + listener = contextListener(listener, index, group); + return function(event) { + var related = event.relatedTarget; + if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) { + listener.call(this, event); + } + }; +} + +function contextListener(listener, index, group) { + return function(event1) { + var event0 = exports.event; // Events can be reentrant (e.g., focus). + exports.event = event1; + try { + listener.call(this, this.__data__, index, group); + } finally { + exports.event = event0; + } + }; +} + +function parseTypenames$1(typenames) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + return {type: t, name: name}; + }); +} + +function onRemove(typename) { + return function() { + var on = this.__on; + if (!on) return; + for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { + if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { + this.removeEventListener(o.type, o.listener, o.capture); + } else { + on[++i] = o; + } + } + if (++i) on.length = i; + else delete this.__on; + }; +} + +function onAdd(typename, value, capture) { + var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener; + return function(d, i, group) { + var on = this.__on, o, listener = wrap(value, i, group); + if (on) for (var j = 0, m = on.length; j < m; ++j) { + if ((o = on[j]).type === typename.type && o.name === typename.name) { + this.removeEventListener(o.type, o.listener, o.capture); + this.addEventListener(o.type, o.listener = listener, o.capture = capture); + o.value = value; + return; + } + } + this.addEventListener(typename.type, listener, capture); + o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture}; + if (!on) this.__on = [o]; + else on.push(o); + }; +} + +var selection_on = function(typename, value, capture) { + var typenames = parseTypenames$1(typename + ""), i, n = typenames.length, t; + + if (arguments.length < 2) { + var on = this.node().__on; + if (on) for (var j = 0, m = on.length, o; j < m; ++j) { + for (i = 0, o = on[j]; i < n; ++i) { + if ((t = typenames[i]).type === o.type && t.name === o.name) { + return o.value; + } + } + } + return; + } + + on = value ? onAdd : onRemove; + if (capture == null) capture = false; + for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture)); + return this; +}; + +function customEvent(event1, listener, that, args) { + var event0 = exports.event; + event1.sourceEvent = exports.event; + exports.event = event1; + try { + return listener.apply(that, args); + } finally { + exports.event = event0; + } +} + +var sourceEvent = function() { + var current = exports.event, source; + while (source = current.sourceEvent) current = source; + return current; +}; + +var point = function(node, event) { + var svg = node.ownerSVGElement || node; + + if (svg.createSVGPoint) { + var point = svg.createSVGPoint(); + point.x = event.clientX, point.y = event.clientY; + point = point.matrixTransform(node.getScreenCTM().inverse()); + return [point.x, point.y]; + } + + var rect = node.getBoundingClientRect(); + return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop]; +}; + +var mouse = function(node) { + var event = sourceEvent(); + if (event.changedTouches) event = event.changedTouches[0]; + return point(node, event); +}; + +function none() {} + +var selector = function(selector) { + return selector == null ? none : function() { + return this.querySelector(selector); + }; +}; + +var selection_select = function(select) { + if (typeof select !== "function") select = selector(select); + + for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { + if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { + if ("__data__" in node) subnode.__data__ = node.__data__; + subgroup[i] = subnode; + } + } + } + + return new Selection(subgroups, this._parents); +}; + +function empty$1() { + return []; +} + +var selectorAll = function(selector) { + return selector == null ? empty$1 : function() { + return this.querySelectorAll(selector); + }; +}; + +var selection_selectAll = function(select) { + if (typeof select !== "function") select = selectorAll(select); + + for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { + if (node = group[i]) { + subgroups.push(select.call(node, node.__data__, i, group)); + parents.push(node); + } + } + } + + return new Selection(subgroups, parents); +}; + +var selection_filter = function(match) { + if (typeof match !== "function") match = matcher$1(match); + + for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { + if ((node = group[i]) && match.call(node, node.__data__, i, group)) { + subgroup.push(node); + } + } + } + + return new Selection(subgroups, this._parents); +}; + +var sparse = function(update) { + return new Array(update.length); +}; + +var selection_enter = function() { + return new Selection(this._enter || this._groups.map(sparse), this._parents); +}; + +function EnterNode(parent, datum) { + this.ownerDocument = parent.ownerDocument; + this.namespaceURI = parent.namespaceURI; + this._next = null; + this._parent = parent; + this.__data__ = datum; +} + +EnterNode.prototype = { + constructor: EnterNode, + appendChild: function(child) { return this._parent.insertBefore(child, this._next); }, + insertBefore: function(child, next) { return this._parent.insertBefore(child, next); }, + querySelector: function(selector) { return this._parent.querySelector(selector); }, + querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); } +}; + +var constant$1 = function(x) { + return function() { + return x; + }; +}; + +var keyPrefix = "$"; // Protect against keys like “__proto__”. + +function bindIndex(parent, group, enter, update, exit, data) { + var i = 0, + node, + groupLength = group.length, + dataLength = data.length; + + // Put any non-null nodes that fit into update. + // Put any null nodes into enter. + // Put any remaining data into enter. + for (; i < dataLength; ++i) { + if (node = group[i]) { + node.__data__ = data[i]; + update[i] = node; + } else { + enter[i] = new EnterNode(parent, data[i]); + } + } + + // Put any non-null nodes that don’t fit into exit. + for (; i < groupLength; ++i) { + if (node = group[i]) { + exit[i] = node; + } + } +} + +function bindKey(parent, group, enter, update, exit, data, key) { + var i, + node, + nodeByKeyValue = {}, + groupLength = group.length, + dataLength = data.length, + keyValues = new Array(groupLength), + keyValue; + + // Compute the key for each node. + // If multiple nodes have the same key, the duplicates are added to exit. + for (i = 0; i < groupLength; ++i) { + if (node = group[i]) { + keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group); + if (keyValue in nodeByKeyValue) { + exit[i] = node; + } else { + nodeByKeyValue[keyValue] = node; + } + } + } + + // Compute the key for each datum. + // If there a node associated with this key, join and add it to update. + // If there is not (or the key is a duplicate), add it to enter. + for (i = 0; i < dataLength; ++i) { + keyValue = keyPrefix + key.call(parent, data[i], i, data); + if (node = nodeByKeyValue[keyValue]) { + update[i] = node; + node.__data__ = data[i]; + nodeByKeyValue[keyValue] = null; + } else { + enter[i] = new EnterNode(parent, data[i]); + } + } + + // Add any remaining nodes that were not bound to data to exit. + for (i = 0; i < groupLength; ++i) { + if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) { + exit[i] = node; + } + } +} + +var selection_data = function(value, key) { + if (!value) { + data = new Array(this.size()), j = -1; + this.each(function(d) { data[++j] = d; }); + return data; + } + + var bind = key ? bindKey : bindIndex, + parents = this._parents, + groups = this._groups; + + if (typeof value !== "function") value = constant$1(value); + + for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { + var parent = parents[j], + group = groups[j], + groupLength = group.length, + data = value.call(parent, parent && parent.__data__, j, parents), + dataLength = data.length, + enterGroup = enter[j] = new Array(dataLength), + updateGroup = update[j] = new Array(dataLength), + exitGroup = exit[j] = new Array(groupLength); + + bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); + + // Now connect the enter nodes to their following update node, such that + // appendChild can insert the materialized enter node before this node, + // rather than at the end of the parent node. + for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) { + if (previous = enterGroup[i0]) { + if (i0 >= i1) i1 = i0 + 1; + while (!(next = updateGroup[i1]) && ++i1 < dataLength); + previous._next = next || null; + } + } + } + + update = new Selection(update, parents); + update._enter = enter; + update._exit = exit; + return update; +}; + +var selection_exit = function() { + return new Selection(this._exit || this._groups.map(sparse), this._parents); +}; + +var selection_merge = function(selection) { + + for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { + for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { + if (node = group0[i] || group1[i]) { + merge[i] = node; + } + } + } + + for (; j < m0; ++j) { + merges[j] = groups0[j]; + } + + return new Selection(merges, this._parents); +}; + +var selection_order = function() { + + for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) { + for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) { + if (node = group[i]) { + if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + + return this; +}; + +var selection_sort = function(compare) { + if (!compare) compare = ascending$1; + + function compareNode(a, b) { + return a && b ? compare(a.__data__, b.__data__) : !a - !b; + } + + for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) { + if (node = group[i]) { + sortgroup[i] = node; + } + } + sortgroup.sort(compareNode); + } + + return new Selection(sortgroups, this._parents).order(); +}; + +function ascending$1(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +} + +var selection_call = function() { + var callback = arguments[0]; + arguments[0] = this; + callback.apply(null, arguments); + return this; +}; + +var selection_nodes = function() { + var nodes = new Array(this.size()), i = -1; + this.each(function() { nodes[++i] = this; }); + return nodes; +}; + +var selection_node = function() { + + for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { + for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { + var node = group[i]; + if (node) return node; + } + } + + return null; +}; + +var selection_size = function() { + var size = 0; + this.each(function() { ++size; }); + return size; +}; + +var selection_empty = function() { + return !this.node(); +}; + +var selection_each = function(callback) { + + for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { + if (node = group[i]) callback.call(node, node.__data__, i, group); + } + } + + return this; +}; + +function attrRemove(name) { + return function() { + this.removeAttribute(name); + }; +} + +function attrRemoveNS(fullname) { + return function() { + this.removeAttributeNS(fullname.space, fullname.local); + }; +} + +function attrConstant(name, value) { + return function() { + this.setAttribute(name, value); + }; +} + +function attrConstantNS(fullname, value) { + return function() { + this.setAttributeNS(fullname.space, fullname.local, value); + }; +} + +function attrFunction(name, value) { + return function() { + var v = value.apply(this, arguments); + if (v == null) this.removeAttribute(name); + else this.setAttribute(name, v); + }; +} + +function attrFunctionNS(fullname, value) { + return function() { + var v = value.apply(this, arguments); + if (v == null) this.removeAttributeNS(fullname.space, fullname.local); + else this.setAttributeNS(fullname.space, fullname.local, v); + }; +} + +var selection_attr = function(name, value) { + var fullname = namespace(name); + + if (arguments.length < 2) { + var node = this.node(); + return fullname.local + ? node.getAttributeNS(fullname.space, fullname.local) + : node.getAttribute(fullname); + } + + return this.each((value == null + ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function" + ? (fullname.local ? attrFunctionNS : attrFunction) + : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)); +}; + +var defaultView = function(node) { + return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node + || (node.document && node) // node is a Window + || node.defaultView; // node is a Document +}; + +function styleRemove(name) { + return function() { + this.style.removeProperty(name); + }; +} + +function styleConstant(name, value, priority) { + return function() { + this.style.setProperty(name, value, priority); + }; +} + +function styleFunction(name, value, priority) { + return function() { + var v = value.apply(this, arguments); + if (v == null) this.style.removeProperty(name); + else this.style.setProperty(name, v, priority); + }; +} + +var selection_style = function(name, value, priority) { + return arguments.length > 1 + ? this.each((value == null + ? styleRemove : typeof value === "function" + ? styleFunction + : styleConstant)(name, value, priority == null ? "" : priority)) + : styleValue(this.node(), name); +}; + +function styleValue(node, name) { + return node.style.getPropertyValue(name) + || defaultView(node).getComputedStyle(node, null).getPropertyValue(name); +} + +function propertyRemove(name) { + return function() { + delete this[name]; + }; +} + +function propertyConstant(name, value) { + return function() { + this[name] = value; + }; +} + +function propertyFunction(name, value) { + return function() { + var v = value.apply(this, arguments); + if (v == null) delete this[name]; + else this[name] = v; + }; +} + +var selection_property = function(name, value) { + return arguments.length > 1 + ? this.each((value == null + ? propertyRemove : typeof value === "function" + ? propertyFunction + : propertyConstant)(name, value)) + : this.node()[name]; +}; + +function classArray(string) { + return string.trim().split(/^|\s+/); +} + +function classList(node) { + return node.classList || new ClassList(node); +} + +function ClassList(node) { + this._node = node; + this._names = classArray(node.getAttribute("class") || ""); +} + +ClassList.prototype = { + add: function(name) { + var i = this._names.indexOf(name); + if (i < 0) { + this._names.push(name); + this._node.setAttribute("class", this._names.join(" ")); + } + }, + remove: function(name) { + var i = this._names.indexOf(name); + if (i >= 0) { + this._names.splice(i, 1); + this._node.setAttribute("class", this._names.join(" ")); + } + }, + contains: function(name) { + return this._names.indexOf(name) >= 0; + } +}; + +function classedAdd(node, names) { + var list = classList(node), i = -1, n = names.length; + while (++i < n) list.add(names[i]); +} + +function classedRemove(node, names) { + var list = classList(node), i = -1, n = names.length; + while (++i < n) list.remove(names[i]); +} + +function classedTrue(names) { + return function() { + classedAdd(this, names); + }; +} + +function classedFalse(names) { + return function() { + classedRemove(this, names); + }; +} + +function classedFunction(names, value) { + return function() { + (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names); + }; +} + +var selection_classed = function(name, value) { + var names = classArray(name + ""); + + if (arguments.length < 2) { + var list = classList(this.node()), i = -1, n = names.length; + while (++i < n) if (!list.contains(names[i])) return false; + return true; + } + + return this.each((typeof value === "function" + ? classedFunction : value + ? classedTrue + : classedFalse)(names, value)); +}; + +function textRemove() { + this.textContent = ""; +} + +function textConstant(value) { + return function() { + this.textContent = value; + }; +} + +function textFunction(value) { + return function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + }; +} + +var selection_text = function(value) { + return arguments.length + ? this.each(value == null + ? textRemove : (typeof value === "function" + ? textFunction + : textConstant)(value)) + : this.node().textContent; +}; + +function htmlRemove() { + this.innerHTML = ""; +} + +function htmlConstant(value) { + return function() { + this.innerHTML = value; + }; +} + +function htmlFunction(value) { + return function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + }; +} + +var selection_html = function(value) { + return arguments.length + ? this.each(value == null + ? htmlRemove : (typeof value === "function" + ? htmlFunction + : htmlConstant)(value)) + : this.node().innerHTML; +}; + +function raise() { + if (this.nextSibling) this.parentNode.appendChild(this); +} + +var selection_raise = function() { + return this.each(raise); +}; + +function lower() { + if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); +} + +var selection_lower = function() { + return this.each(lower); +}; + +var selection_append = function(name) { + var create = typeof name === "function" ? name : creator(name); + return this.select(function() { + return this.appendChild(create.apply(this, arguments)); + }); +}; + +function constantNull() { + return null; +} + +var selection_insert = function(name, before) { + var create = typeof name === "function" ? name : creator(name), + select = before == null ? constantNull : typeof before === "function" ? before : selector(before); + return this.select(function() { + return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null); + }); +}; + +function remove() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); +} + +var selection_remove = function() { + return this.each(remove); +}; + +var selection_datum = function(value) { + return arguments.length + ? this.property("__data__", value) + : this.node().__data__; +}; + +function dispatchEvent(node, type, params) { + var window = defaultView(node), + event = window.CustomEvent; + + if (typeof event === "function") { + event = new event(type, params); + } else { + event = window.document.createEvent("Event"); + if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; + else event.initEvent(type, false, false); + } + + node.dispatchEvent(event); +} + +function dispatchConstant(type, params) { + return function() { + return dispatchEvent(this, type, params); + }; +} + +function dispatchFunction(type, params) { + return function() { + return dispatchEvent(this, type, params.apply(this, arguments)); + }; +} + +var selection_dispatch = function(type, params) { + return this.each((typeof params === "function" + ? dispatchFunction + : dispatchConstant)(type, params)); +}; + +var root = [null]; + +function Selection(groups, parents) { + this._groups = groups; + this._parents = parents; +} + +function selection() { + return new Selection([[document.documentElement]], root); +} + +Selection.prototype = selection.prototype = { + constructor: Selection, + select: selection_select, + selectAll: selection_selectAll, + filter: selection_filter, + data: selection_data, + enter: selection_enter, + exit: selection_exit, + merge: selection_merge, + order: selection_order, + sort: selection_sort, + call: selection_call, + nodes: selection_nodes, + node: selection_node, + size: selection_size, + empty: selection_empty, + each: selection_each, + attr: selection_attr, + style: selection_style, + property: selection_property, + classed: selection_classed, + text: selection_text, + html: selection_html, + raise: selection_raise, + lower: selection_lower, + append: selection_append, + insert: selection_insert, + remove: selection_remove, + datum: selection_datum, + on: selection_on, + dispatch: selection_dispatch +}; + +var select = function(selector) { + return typeof selector === "string" + ? new Selection([[document.querySelector(selector)]], [document.documentElement]) + : new Selection([[selector]], root); +}; + +var selectAll = function(selector) { + return typeof selector === "string" + ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) + : new Selection([selector == null ? [] : selector], root); +}; + +var touch = function(node, touches, identifier) { + if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches; + + for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) { + if ((touch = touches[i]).identifier === identifier) { + return point(node, touch); + } + } + + return null; +}; + +var touches = function(node, touches) { + if (touches == null) touches = sourceEvent().touches; + + for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) { + points[i] = point(node, touches[i]); + } + + return points; +}; + +function nopropagation() { + exports.event.stopImmediatePropagation(); +} + +var noevent = function() { + exports.event.preventDefault(); + exports.event.stopImmediatePropagation(); +}; + +var dragDisable = function(view) { + var root = view.document.documentElement, + selection$$1 = select(view).on("dragstart.drag", noevent, true); + if ("onselectstart" in root) { + selection$$1.on("selectstart.drag", noevent, true); + } else { + root.__noselect = root.style.MozUserSelect; + root.style.MozUserSelect = "none"; + } +}; + +function yesdrag(view, noclick) { + var root = view.document.documentElement, + selection$$1 = select(view).on("dragstart.drag", null); + if (noclick) { + selection$$1.on("click.drag", noevent, true); + setTimeout(function() { selection$$1.on("click.drag", null); }, 0); + } + if ("onselectstart" in root) { + selection$$1.on("selectstart.drag", null); + } else { + root.style.MozUserSelect = root.__noselect; + delete root.__noselect; + } +} + +var constant$2 = function(x) { + return function() { + return x; + }; +}; + +function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) { + this.target = target; + this.type = type; + this.subject = subject; + this.identifier = id; + this.active = active; + this.x = x; + this.y = y; + this.dx = dx; + this.dy = dy; + this._ = dispatch; +} + +DragEvent.prototype.on = function() { + var value = this._.on.apply(this._, arguments); + return value === this._ ? this : value; +}; + +// Ignore right-click, since that should open the context menu. +function defaultFilter$1() { + return !exports.event.button; +} + +function defaultContainer() { + return this.parentNode; +} + +function defaultSubject(d) { + return d == null ? {x: exports.event.x, y: exports.event.y} : d; +} + +var drag = function() { + var filter = defaultFilter$1, + container = defaultContainer, + subject = defaultSubject, + gestures = {}, + listeners = dispatch("start", "drag", "end"), + active = 0, + mousedownx, + mousedowny, + mousemoving, + touchending, + clickDistance2 = 0; + + function drag(selection$$1) { + selection$$1 + .on("mousedown.drag", mousedowned) + .on("touchstart.drag", touchstarted) + .on("touchmove.drag", touchmoved) + .on("touchend.drag touchcancel.drag", touchended) + .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); + } + + function mousedowned() { + if (touchending || !filter.apply(this, arguments)) return; + var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments); + if (!gesture) return; + select(exports.event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true); + dragDisable(exports.event.view); + nopropagation(); + mousemoving = false; + mousedownx = exports.event.clientX; + mousedowny = exports.event.clientY; + gesture("start"); + } + + function mousemoved() { + noevent(); + if (!mousemoving) { + var dx = exports.event.clientX - mousedownx, dy = exports.event.clientY - mousedowny; + mousemoving = dx * dx + dy * dy > clickDistance2; + } + gestures.mouse("drag"); + } + + function mouseupped() { + select(exports.event.view).on("mousemove.drag mouseup.drag", null); + yesdrag(exports.event.view, mousemoving); + noevent(); + gestures.mouse("end"); + } + + function touchstarted() { + if (!filter.apply(this, arguments)) return; + var touches$$1 = exports.event.changedTouches, + c = container.apply(this, arguments), + n = touches$$1.length, i, gesture; + + for (i = 0; i < n; ++i) { + if (gesture = beforestart(touches$$1[i].identifier, c, touch, this, arguments)) { + nopropagation(); + gesture("start"); + } + } + } + + function touchmoved() { + var touches$$1 = exports.event.changedTouches, + n = touches$$1.length, i, gesture; + + for (i = 0; i < n; ++i) { + if (gesture = gestures[touches$$1[i].identifier]) { + noevent(); + gesture("drag"); + } + } + } + + function touchended() { + var touches$$1 = exports.event.changedTouches, + n = touches$$1.length, i, gesture; + + if (touchending) clearTimeout(touchending); + touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed! + for (i = 0; i < n; ++i) { + if (gesture = gestures[touches$$1[i].identifier]) { + nopropagation(); + gesture("end"); + } + } + } + + function beforestart(id, container, point, that, args) { + var p = point(container, id), s, dx, dy, + sublisteners = listeners.copy(); + + if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() { + if ((exports.event.subject = s = subject.apply(that, args)) == null) return false; + dx = s.x - p[0] || 0; + dy = s.y - p[1] || 0; + return true; + })) return; + + return function gesture(type) { + var p0 = p, n; + switch (type) { + case "start": gestures[id] = gesture, n = active++; break; + case "end": delete gestures[id], --active; // nobreak + case "drag": p = point(container, id), n = active; break; + } + customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]); + }; + } + + drag.filter = function(_) { + return arguments.length ? (filter = typeof _ === "function" ? _ : constant$2(!!_), drag) : filter; + }; + + drag.container = function(_) { + return arguments.length ? (container = typeof _ === "function" ? _ : constant$2(_), drag) : container; + }; + + drag.subject = function(_) { + return arguments.length ? (subject = typeof _ === "function" ? _ : constant$2(_), drag) : subject; + }; + + drag.on = function() { + var value = listeners.on.apply(listeners, arguments); + return value === listeners ? drag : value; + }; + + drag.clickDistance = function(_) { + return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2); + }; + + return drag; +}; + +var define = function(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; +}; + +function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; +} + +function Color() {} + +var darker = 0.7; +var brighter = 1 / darker; + +var reI = "\\s*([+-]?\\d+)\\s*"; +var reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*"; +var reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*"; +var reHex3 = /^#([0-9a-f]{3})$/; +var reHex6 = /^#([0-9a-f]{6})$/; +var reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"); +var reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"); +var reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"); +var reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"); +var reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"); +var reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); + +var named = { + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 +}; + +define(Color, color, { + displayable: function() { + return this.rgb().displayable(); + }, + toString: function() { + return this.rgb() + ""; + } +}); + +function color(format) { + var m; + format = (format + "").trim().toLowerCase(); + return (m = reHex3.exec(format)) ? (m = parseInt(m[1], 16), new Rgb((m >> 8 & 0xf) | (m >> 4 & 0x0f0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1)) // #f00 + : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000 + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; +} + +function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); +} + +function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); +} + +function rgbConvert(o) { + if (!(o instanceof Color)) o = color(o); + if (!o) return new Rgb; + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); +} + +function rgb(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); +} + +function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; +} + +define(Rgb, rgb, extend(Color, { + brighter: function(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker: function(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb: function() { + return this; + }, + displayable: function() { + return (0 <= this.r && this.r <= 255) + && (0 <= this.g && this.g <= 255) + && (0 <= this.b && this.b <= 255) + && (0 <= this.opacity && this.opacity <= 1); + }, + toString: function() { + var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); + return (a === 1 ? "rgb(" : "rgba(") + + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + + (a === 1 ? ")" : ", " + a + ")"); + } +})); + +function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); +} + +function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color)) o = color(o); + if (!o) return new Hsl; + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + h = NaN, + s = max - min, + l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < 0.5 ? max + min : 2 - max - min; + h *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h; + } + return new Hsl(h, s, l, o.opacity); +} + +function hsl(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); +} + +function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; +} + +define(Hsl, hsl, extend(Color, { + brighter: function(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker: function(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb: function() { + var h = this.h % 360 + (this.h < 0) * 360, + s = isNaN(h) || isNaN(this.s) ? 0 : this.s, + l = this.l, + m2 = l + (l < 0.5 ? l : 1 - l) * s, + m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), + hsl2rgb(h, m1, m2), + hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), + this.opacity + ); + }, + displayable: function() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) + && (0 <= this.l && this.l <= 1) + && (0 <= this.opacity && this.opacity <= 1); + } +})); + +/* From FvD 13.37, CSS Color Module Level 3 */ +function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 + : h < 180 ? m2 + : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 + : m1) * 255; +} + +var deg2rad = Math.PI / 180; +var rad2deg = 180 / Math.PI; + +var Kn = 18; +var Xn = 0.950470; +var Yn = 1; +var Zn = 1.088830; +var t0 = 4 / 29; +var t1 = 6 / 29; +var t2 = 3 * t1 * t1; +var t3 = t1 * t1 * t1; + +function labConvert(o) { + if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity); + if (o instanceof Hcl) { + var h = o.h * deg2rad; + return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity); + } + if (!(o instanceof Rgb)) o = rgbConvert(o); + var b = rgb2xyz(o.r), + a = rgb2xyz(o.g), + l = rgb2xyz(o.b), + x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn), + y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn), + z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn); + return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity); +} + +function lab(l, a, b, opacity) { + return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity); +} + +function Lab(l, a, b, opacity) { + this.l = +l; + this.a = +a; + this.b = +b; + this.opacity = +opacity; +} + +define(Lab, lab, extend(Color, { + brighter: function(k) { + return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + darker: function(k) { + return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity); + }, + rgb: function() { + var y = (this.l + 16) / 116, + x = isNaN(this.a) ? y : y + this.a / 500, + z = isNaN(this.b) ? y : y - this.b / 200; + y = Yn * lab2xyz(y); + x = Xn * lab2xyz(x); + z = Zn * lab2xyz(z); + return new Rgb( + xyz2rgb( 3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB + xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), + xyz2rgb( 0.0556434 * x - 0.2040259 * y + 1.0572252 * z), + this.opacity + ); + } +})); + +function xyz2lab(t) { + return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0; +} + +function lab2xyz(t) { + return t > t1 ? t * t * t : t2 * (t - t0); +} + +function xyz2rgb(x) { + return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); +} + +function rgb2xyz(x) { + return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4); +} + +function hclConvert(o) { + if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity); + if (!(o instanceof Lab)) o = labConvert(o); + var h = Math.atan2(o.b, o.a) * rad2deg; + return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); +} + +function hcl(h, c, l, opacity) { + return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity); +} + +function Hcl(h, c, l, opacity) { + this.h = +h; + this.c = +c; + this.l = +l; + this.opacity = +opacity; +} + +define(Hcl, hcl, extend(Color, { + brighter: function(k) { + return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity); + }, + darker: function(k) { + return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity); + }, + rgb: function() { + return labConvert(this).rgb(); + } +})); + +var A = -0.14861; +var B = +1.78277; +var C = -0.29227; +var D = -0.90649; +var E = +1.97294; +var ED = E * D; +var EB = E * B; +var BC_DA = B * C - D * A; + +function cubehelixConvert(o) { + if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Rgb)) o = rgbConvert(o); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), + bl = b - l, + k = (E * (g - l) - C * bl) / D, + s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1 + h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; + return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); +} + +function cubehelix(h, s, l, opacity) { + return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); +} + +function Cubehelix(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; +} + +define(Cubehelix, cubehelix, extend(Color, { + brighter: function(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + darker: function(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Cubehelix(this.h, this.s, this.l * k, this.opacity); + }, + rgb: function() { + var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, + l = +this.l, + a = isNaN(this.s) ? 0 : this.s * l * (1 - l), + cosh = Math.cos(h), + sinh = Math.sin(h); + return new Rgb( + 255 * (l + a * (A * cosh + B * sinh)), + 255 * (l + a * (C * cosh + D * sinh)), + 255 * (l + a * (E * cosh)), + this.opacity + ); + } +})); + +function basis(t1, v0, v1, v2, v3) { + var t2 = t1 * t1, t3 = t2 * t1; + return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + + (4 - 6 * t2 + 3 * t3) * v1 + + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + + t3 * v3) / 6; +} + +var basis$1 = function(values) { + var n = values.length - 1; + return function(t) { + var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), + v1 = values[i], + v2 = values[i + 1], + v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, + v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; +}; + +var basisClosed = function(values) { + var n = values.length; + return function(t) { + var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), + v0 = values[(i + n - 1) % n], + v1 = values[i % n], + v2 = values[(i + 1) % n], + v3 = values[(i + 2) % n]; + return basis((t - i / n) * n, v0, v1, v2, v3); + }; +}; + +var constant$3 = function(x) { + return function() { + return x; + }; +}; + +function linear(a, d) { + return function(t) { + return a + t * d; + }; +} + +function exponential(a, b, y) { + return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { + return Math.pow(a + t * b, y); + }; +} + +function hue(a, b) { + var d = b - a; + return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$3(isNaN(a) ? b : a); +} + +function gamma(y) { + return (y = +y) === 1 ? nogamma : function(a, b) { + return b - a ? exponential(a, b, y) : constant$3(isNaN(a) ? b : a); + }; +} + +function nogamma(a, b) { + var d = b - a; + return d ? linear(a, d) : constant$3(isNaN(a) ? b : a); +} + +var interpolateRgb = ((function rgbGamma(y) { + var color$$1 = gamma(y); + + function rgb$$1(start, end) { + var r = color$$1((start = rgb(start)).r, (end = rgb(end)).r), + g = color$$1(start.g, end.g), + b = color$$1(start.b, end.b), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; + } + + rgb$$1.gamma = rgbGamma; + + return rgb$$1; +}))(1); + +function rgbSpline(spline) { + return function(colors) { + var n = colors.length, + r = new Array(n), + g = new Array(n), + b = new Array(n), + i, color$$1; + for (i = 0; i < n; ++i) { + color$$1 = rgb(colors[i]); + r[i] = color$$1.r || 0; + g[i] = color$$1.g || 0; + b[i] = color$$1.b || 0; + } + r = spline(r); + g = spline(g); + b = spline(b); + color$$1.opacity = 1; + return function(t) { + color$$1.r = r(t); + color$$1.g = g(t); + color$$1.b = b(t); + return color$$1 + ""; + }; + }; +} + +var rgbBasis = rgbSpline(basis$1); +var rgbBasisClosed = rgbSpline(basisClosed); + +var array$1 = function(a, b) { + var nb = b ? b.length : 0, + na = a ? Math.min(nb, a.length) : 0, + x = new Array(nb), + c = new Array(nb), + i; + + for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]); + for (; i < nb; ++i) c[i] = b[i]; + + return function(t) { + for (i = 0; i < na; ++i) c[i] = x[i](t); + return c; + }; +}; + +var date = function(a, b) { + var d = new Date; + return a = +a, b -= a, function(t) { + return d.setTime(a + b * t), d; + }; +}; + +var reinterpolate = function(a, b) { + return a = +a, b -= a, function(t) { + return a + b * t; + }; +}; + +var object = function(a, b) { + var i = {}, + c = {}, + k; + + if (a === null || typeof a !== "object") a = {}; + if (b === null || typeof b !== "object") b = {}; + + for (k in b) { + if (k in a) { + i[k] = interpolateValue(a[k], b[k]); + } else { + c[k] = b[k]; + } + } + + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; +}; + +var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; +var reB = new RegExp(reA.source, "g"); + +function zero(b) { + return function() { + return b; + }; +} + +function one(b) { + return function(t) { + return b(t) + ""; + }; +} + +var interpolateString = function(a, b) { + var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b + am, // current match in a + bm, // current match in b + bs, // string preceding current number in b, if any + i = -1, // index in s + s = [], // string constants and placeholders + q = []; // number interpolators + + // Coerce inputs to strings. + a = a + "", b = b + ""; + + // Interpolate pairs of numbers in a & b. + while ((am = reA.exec(a)) + && (bm = reB.exec(b))) { + if ((bs = bm.index) > bi) { // a string precedes the next number in b + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match + if (s[i]) s[i] += bm; // coalesce with previous string + else s[++i] = bm; + } else { // interpolate non-matching numbers + s[++i] = null; + q.push({i: i, x: reinterpolate(am, bm)}); + } + bi = reB.lastIndex; + } + + // Add remains of b. + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + + // Special optimization for only a single match. + // Otherwise, interpolate each of the numbers and rejoin the string. + return s.length < 2 ? (q[0] + ? one(q[0].x) + : zero(b)) + : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); +}; + +var interpolateValue = function(a, b) { + var t = typeof b, c; + return b == null || t === "boolean" ? constant$3(b) + : (t === "number" ? reinterpolate + : t === "string" ? ((c = color(b)) ? (b = c, interpolateRgb) : interpolateString) + : b instanceof color ? interpolateRgb + : b instanceof Date ? date + : Array.isArray(b) ? array$1 + : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object + : reinterpolate)(a, b); +}; + +var interpolateRound = function(a, b) { + return a = +a, b -= a, function(t) { + return Math.round(a + b * t); + }; +}; + +var degrees = 180 / Math.PI; + +var identity$2 = { + translateX: 0, + translateY: 0, + rotate: 0, + skewX: 0, + scaleX: 1, + scaleY: 1 +}; + +var decompose = function(a, b, c, d, e, f) { + var scaleX, scaleY, skewX; + if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX; + if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX; + if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY; + if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX; + return { + translateX: e, + translateY: f, + rotate: Math.atan2(b, a) * degrees, + skewX: Math.atan(skewX) * degrees, + scaleX: scaleX, + scaleY: scaleY + }; +}; + +var cssNode; +var cssRoot; +var cssView; +var svgNode; + +function parseCss(value) { + if (value === "none") return identity$2; + if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView; + cssNode.style.transform = value; + value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"); + cssRoot.removeChild(cssNode); + value = value.slice(7, -1).split(","); + return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]); +} + +function parseSvg(value) { + if (value == null) return identity$2; + if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); + svgNode.setAttribute("transform", value); + if (!(value = svgNode.transform.baseVal.consolidate())) return identity$2; + value = value.matrix; + return decompose(value.a, value.b, value.c, value.d, value.e, value.f); +} + +function interpolateTransform(parse, pxComma, pxParen, degParen) { + + function pop(s) { + return s.length ? s.pop() + " " : ""; + } + + function translate(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push("translate(", null, pxComma, null, pxParen); + q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)}); + } else if (xb || yb) { + s.push("translate(" + xb + pxComma + yb + pxParen); + } + } + + function rotate(a, b, s, q) { + if (a !== b) { + if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path + q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: reinterpolate(a, b)}); + } else if (b) { + s.push(pop(s) + "rotate(" + b + degParen); + } + } + + function skewX(a, b, s, q) { + if (a !== b) { + q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: reinterpolate(a, b)}); + } else if (b) { + s.push(pop(s) + "skewX(" + b + degParen); + } + } + + function scale(xa, ya, xb, yb, s, q) { + if (xa !== xb || ya !== yb) { + var i = s.push(pop(s) + "scale(", null, ",", null, ")"); + q.push({i: i - 4, x: reinterpolate(xa, xb)}, {i: i - 2, x: reinterpolate(ya, yb)}); + } else if (xb !== 1 || yb !== 1) { + s.push(pop(s) + "scale(" + xb + "," + yb + ")"); + } + } + + return function(a, b) { + var s = [], // string constants and placeholders + q = []; // number interpolators + a = parse(a), b = parse(b); + translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q); + rotate(a.rotate, b.rotate, s, q); + skewX(a.skewX, b.skewX, s, q); + scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q); + a = b = null; // gc + return function(t) { + var i = -1, n = q.length, o; + while (++i < n) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }; + }; +} + +var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); +var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); + +var rho = Math.SQRT2; +var rho2 = 2; +var rho4 = 4; +var epsilon2 = 1e-12; + +function cosh(x) { + return ((x = Math.exp(x)) + 1 / x) / 2; +} + +function sinh(x) { + return ((x = Math.exp(x)) - 1 / x) / 2; +} + +function tanh(x) { + return ((x = Math.exp(2 * x)) - 1) / (x + 1); +} + +// p0 = [ux0, uy0, w0] +// p1 = [ux1, uy1, w1] +var interpolateZoom = function(p0, p1) { + var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], + ux1 = p1[0], uy1 = p1[1], w1 = p1[2], + dx = ux1 - ux0, + dy = uy1 - uy0, + d2 = dx * dx + dy * dy, + i, + S; + + // Special case for u0 ≅ u1. + if (d2 < epsilon2) { + S = Math.log(w1 / w0) / rho; + i = function(t) { + return [ + ux0 + t * dx, + uy0 + t * dy, + w0 * Math.exp(rho * t * S) + ]; + }; + } + + // General case. + else { + var d1 = Math.sqrt(d2), + b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), + b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), + r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), + r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); + S = (r1 - r0) / rho; + i = function(t) { + var s = t * S, + coshr0 = cosh(r0), + u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0)); + return [ + ux0 + u * dx, + uy0 + u * dy, + w0 * coshr0 / cosh(rho * s + r0) + ]; + }; + } + + i.duration = S * 1000; + + return i; +}; + +function hsl$1(hue$$1) { + return function(start, end) { + var h = hue$$1((start = hsl(start)).h, (end = hsl(end)).h), + s = nogamma(start.s, end.s), + l = nogamma(start.l, end.l), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.s = s(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; + } +} + +var hsl$2 = hsl$1(hue); +var hslLong = hsl$1(nogamma); + +function lab$1(start, end) { + var l = nogamma((start = lab(start)).l, (end = lab(end)).l), + a = nogamma(start.a, end.a), + b = nogamma(start.b, end.b), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.l = l(t); + start.a = a(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; +} + +function hcl$1(hue$$1) { + return function(start, end) { + var h = hue$$1((start = hcl(start)).h, (end = hcl(end)).h), + c = nogamma(start.c, end.c), + l = nogamma(start.l, end.l), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.c = c(t); + start.l = l(t); + start.opacity = opacity(t); + return start + ""; + }; + } +} + +var hcl$2 = hcl$1(hue); +var hclLong = hcl$1(nogamma); + +function cubehelix$1(hue$$1) { + return (function cubehelixGamma(y) { + y = +y; + + function cubehelix$$1(start, end) { + var h = hue$$1((start = cubehelix(start)).h, (end = cubehelix(end)).h), + s = nogamma(start.s, end.s), + l = nogamma(start.l, end.l), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.h = h(t); + start.s = s(t); + start.l = l(Math.pow(t, y)); + start.opacity = opacity(t); + return start + ""; + }; + } + + cubehelix$$1.gamma = cubehelixGamma; + + return cubehelix$$1; + })(1); +} + +var cubehelix$2 = cubehelix$1(hue); +var cubehelixLong = cubehelix$1(nogamma); + +var quantize = function(interpolator, n) { + var samples = new Array(n); + for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); + return samples; +}; + +var frame = 0; +var timeout = 0; +var interval = 0; +var pokeDelay = 1000; +var taskHead; +var taskTail; +var clockLast = 0; +var clockNow = 0; +var clockSkew = 0; +var clock = typeof performance === "object" && performance.now ? performance : Date; +var setFrame = typeof requestAnimationFrame === "function" ? requestAnimationFrame : function(f) { setTimeout(f, 17); }; + +function now() { + return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); +} + +function clearNow() { + clockNow = 0; +} + +function Timer() { + this._call = + this._time = + this._next = null; +} + +Timer.prototype = timer.prototype = { + constructor: Timer, + restart: function(callback, delay, time) { + if (typeof callback !== "function") throw new TypeError("callback is not a function"); + time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); + if (!this._next && taskTail !== this) { + if (taskTail) taskTail._next = this; + else taskHead = this; + taskTail = this; + } + this._call = callback; + this._time = time; + sleep(); + }, + stop: function() { + if (this._call) { + this._call = null; + this._time = Infinity; + sleep(); + } + } +}; + +function timer(callback, delay, time) { + var t = new Timer; + t.restart(callback, delay, time); + return t; +} + +function timerFlush() { + now(); // Get the current time, if not already set. + ++frame; // Pretend we’ve set an alarm, if we haven’t already. + var t = taskHead, e; + while (t) { + if ((e = clockNow - t._time) >= 0) t._call.call(null, e); + t = t._next; + } + --frame; +} + +function wake() { + clockNow = (clockLast = clock.now()) + clockSkew; + frame = timeout = 0; + try { + timerFlush(); + } finally { + frame = 0; + nap(); + clockNow = 0; + } +} + +function poke() { + var now = clock.now(), delay = now - clockLast; + if (delay > pokeDelay) clockSkew -= delay, clockLast = now; +} + +function nap() { + var t0, t1 = taskHead, t2, time = Infinity; + while (t1) { + if (t1._call) { + if (time > t1._time) time = t1._time; + t0 = t1, t1 = t1._next; + } else { + t2 = t1._next, t1._next = null; + t1 = t0 ? t0._next = t2 : taskHead = t2; + } + } + taskTail = t0; + sleep(time); +} + +function sleep(time) { + if (frame) return; // Soonest alarm already set, or will be. + if (timeout) timeout = clearTimeout(timeout); + var delay = time - clockNow; + if (delay > 24) { + if (time < Infinity) timeout = setTimeout(wake, delay); + if (interval) interval = clearInterval(interval); + } else { + if (!interval) clockLast = clockNow, interval = setInterval(poke, pokeDelay); + frame = 1, setFrame(wake); + } +} + +var timeout$1 = function(callback, delay, time) { + var t = new Timer; + delay = delay == null ? 0 : +delay; + t.restart(function(elapsed) { + t.stop(); + callback(elapsed + delay); + }, delay, time); + return t; +}; + +var interval$1 = function(callback, delay, time) { + var t = new Timer, total = delay; + if (delay == null) return t.restart(callback, delay, time), t; + delay = +delay, time = time == null ? now() : +time; + t.restart(function tick(elapsed) { + elapsed += total; + t.restart(tick, total += delay, time); + callback(elapsed); + }, delay, time); + return t; +}; + +var emptyOn = dispatch("start", "end", "interrupt"); +var emptyTween = []; + +var CREATED = 0; +var SCHEDULED = 1; +var STARTING = 2; +var STARTED = 3; +var RUNNING = 4; +var ENDING = 5; +var ENDED = 6; + +var schedule = function(node, name, id, index, group, timing) { + var schedules = node.__transition; + if (!schedules) node.__transition = {}; + else if (id in schedules) return; + create(node, id, { + name: name, + index: index, // For context during callback. + group: group, // For context during callback. + on: emptyOn, + tween: emptyTween, + time: timing.time, + delay: timing.delay, + duration: timing.duration, + ease: timing.ease, + timer: null, + state: CREATED + }); +}; + +function init(node, id) { + var schedule = node.__transition; + if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late"); + return schedule; +} + +function set$1(node, id) { + var schedule = node.__transition; + if (!schedule || !(schedule = schedule[id]) || schedule.state > STARTING) throw new Error("too late"); + return schedule; +} + +function get$1(node, id) { + var schedule = node.__transition; + if (!schedule || !(schedule = schedule[id])) throw new Error("too late"); + return schedule; +} + +function create(node, id, self) { + var schedules = node.__transition, + tween; + + // Initialize the self timer when the transition is created. + // Note the actual delay is not known until the first callback! + schedules[id] = self; + self.timer = timer(schedule, 0, self.time); + + function schedule(elapsed) { + self.state = SCHEDULED; + self.timer.restart(start, self.delay, self.time); + + // If the elapsed delay is less than our first sleep, start immediately. + if (self.delay <= elapsed) start(elapsed - self.delay); + } + + function start(elapsed) { + var i, j, n, o; + + // If the state is not SCHEDULED, then we previously errored on start. + if (self.state !== SCHEDULED) return stop(); + + for (i in schedules) { + o = schedules[i]; + if (o.name !== self.name) continue; + + // While this element already has a starting transition during this frame, + // defer starting an interrupting transition until that transition has a + // chance to tick (and possibly end); see d3/d3-transition#54! + if (o.state === STARTED) return timeout$1(start); + + // Interrupt the active transition, if any. + // Dispatch the interrupt event. + if (o.state === RUNNING) { + o.state = ENDED; + o.timer.stop(); + o.on.call("interrupt", node, node.__data__, o.index, o.group); + delete schedules[i]; + } + + // Cancel any pre-empted transitions. No interrupt event is dispatched + // because the cancelled transitions never started. Note that this also + // removes this transition from the pending list! + else if (+i < id) { + o.state = ENDED; + o.timer.stop(); + delete schedules[i]; + } + } + + // Defer the first tick to end of the current frame; see d3/d3#1576. + // Note the transition may be canceled after start and before the first tick! + // Note this must be scheduled before the start event; see d3/d3-transition#16! + // Assuming this is successful, subsequent callbacks go straight to tick. + timeout$1(function() { + if (self.state === STARTED) { + self.state = RUNNING; + self.timer.restart(tick, self.delay, self.time); + tick(elapsed); + } + }); + + // Dispatch the start event. + // Note this must be done before the tween are initialized. + self.state = STARTING; + self.on.call("start", node, node.__data__, self.index, self.group); + if (self.state !== STARTING) return; // interrupted + self.state = STARTED; + + // Initialize the tween, deleting null tween. + tween = new Array(n = self.tween.length); + for (i = 0, j = -1; i < n; ++i) { + if (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) { + tween[++j] = o; + } + } + tween.length = j + 1; + } + + function tick(elapsed) { + var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), self.state = ENDING, 1), + i = -1, + n = tween.length; + + while (++i < n) { + tween[i].call(null, t); + } + + // Dispatch the end event. + if (self.state === ENDING) { + self.on.call("end", node, node.__data__, self.index, self.group); + stop(); + } + } + + function stop() { + self.state = ENDED; + self.timer.stop(); + delete schedules[id]; + for (var i in schedules) return; // eslint-disable-line no-unused-vars + delete node.__transition; + } +} + +var interrupt = function(node, name) { + var schedules = node.__transition, + schedule, + active, + empty = true, + i; + + if (!schedules) return; + + name = name == null ? null : name + ""; + + for (i in schedules) { + if ((schedule = schedules[i]).name !== name) { empty = false; continue; } + active = schedule.state > STARTING && schedule.state < ENDING; + schedule.state = ENDED; + schedule.timer.stop(); + if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group); + delete schedules[i]; + } + + if (empty) delete node.__transition; +}; + +var selection_interrupt = function(name) { + return this.each(function() { + interrupt(this, name); + }); +}; + +function tweenRemove(id, name) { + var tween0, tween1; + return function() { + var schedule = set$1(this, id), + tween = schedule.tween; + + // If this node shared tween with the previous node, + // just assign the updated shared tween and we’re done! + // Otherwise, copy-on-write. + if (tween !== tween0) { + tween1 = tween0 = tween; + for (var i = 0, n = tween1.length; i < n; ++i) { + if (tween1[i].name === name) { + tween1 = tween1.slice(); + tween1.splice(i, 1); + break; + } + } + } + + schedule.tween = tween1; + }; +} + +function tweenFunction(id, name, value) { + var tween0, tween1; + if (typeof value !== "function") throw new Error; + return function() { + var schedule = set$1(this, id), + tween = schedule.tween; + + // If this node shared tween with the previous node, + // just assign the updated shared tween and we’re done! + // Otherwise, copy-on-write. + if (tween !== tween0) { + tween1 = (tween0 = tween).slice(); + for (var t = {name: name, value: value}, i = 0, n = tween1.length; i < n; ++i) { + if (tween1[i].name === name) { + tween1[i] = t; + break; + } + } + if (i === n) tween1.push(t); + } + + schedule.tween = tween1; + }; +} + +var transition_tween = function(name, value) { + var id = this._id; + + name += ""; + + if (arguments.length < 2) { + var tween = get$1(this.node(), id).tween; + for (var i = 0, n = tween.length, t; i < n; ++i) { + if ((t = tween[i]).name === name) { + return t.value; + } + } + return null; + } + + return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value)); +}; + +function tweenValue(transition, name, value) { + var id = transition._id; + + transition.each(function() { + var schedule = set$1(this, id); + (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments); + }); + + return function(node) { + return get$1(node, id).value[name]; + }; +} + +var interpolate$$1 = function(a, b) { + var c; + return (typeof b === "number" ? reinterpolate + : b instanceof color ? interpolateRgb + : (c = color(b)) ? (b = c, interpolateRgb) + : interpolateString)(a, b); +}; + +function attrRemove$1(name) { + return function() { + this.removeAttribute(name); + }; +} + +function attrRemoveNS$1(fullname) { + return function() { + this.removeAttributeNS(fullname.space, fullname.local); + }; +} + +function attrConstant$1(name, interpolate$$1, value1) { + var value00, + interpolate0; + return function() { + var value0 = this.getAttribute(name); + return value0 === value1 ? null + : value0 === value00 ? interpolate0 + : interpolate0 = interpolate$$1(value00 = value0, value1); + }; +} + +function attrConstantNS$1(fullname, interpolate$$1, value1) { + var value00, + interpolate0; + return function() { + var value0 = this.getAttributeNS(fullname.space, fullname.local); + return value0 === value1 ? null + : value0 === value00 ? interpolate0 + : interpolate0 = interpolate$$1(value00 = value0, value1); + }; +} + +function attrFunction$1(name, interpolate$$1, value) { + var value00, + value10, + interpolate0; + return function() { + var value0, value1 = value(this); + if (value1 == null) return void this.removeAttribute(name); + value0 = this.getAttribute(name); + return value0 === value1 ? null + : value0 === value00 && value1 === value10 ? interpolate0 + : interpolate0 = interpolate$$1(value00 = value0, value10 = value1); + }; +} + +function attrFunctionNS$1(fullname, interpolate$$1, value) { + var value00, + value10, + interpolate0; + return function() { + var value0, value1 = value(this); + if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local); + value0 = this.getAttributeNS(fullname.space, fullname.local); + return value0 === value1 ? null + : value0 === value00 && value1 === value10 ? interpolate0 + : interpolate0 = interpolate$$1(value00 = value0, value10 = value1); + }; +} + +var transition_attr = function(name, value) { + var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate$$1; + return this.attrTween(name, typeof value === "function" + ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value)) + : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname) + : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value + "")); +}; + +function attrTweenNS(fullname, value) { + function tween() { + var node = this, i = value.apply(node, arguments); + return i && function(t) { + node.setAttributeNS(fullname.space, fullname.local, i(t)); + }; + } + tween._value = value; + return tween; +} + +function attrTween(name, value) { + function tween() { + var node = this, i = value.apply(node, arguments); + return i && function(t) { + node.setAttribute(name, i(t)); + }; + } + tween._value = value; + return tween; +} + +var transition_attrTween = function(name, value) { + var key = "attr." + name; + if (arguments.length < 2) return (key = this.tween(key)) && key._value; + if (value == null) return this.tween(key, null); + if (typeof value !== "function") throw new Error; + var fullname = namespace(name); + return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); +}; + +function delayFunction(id, value) { + return function() { + init(this, id).delay = +value.apply(this, arguments); + }; +} + +function delayConstant(id, value) { + return value = +value, function() { + init(this, id).delay = value; + }; +} + +var transition_delay = function(value) { + var id = this._id; + + return arguments.length + ? this.each((typeof value === "function" + ? delayFunction + : delayConstant)(id, value)) + : get$1(this.node(), id).delay; +}; + +function durationFunction(id, value) { + return function() { + set$1(this, id).duration = +value.apply(this, arguments); + }; +} + +function durationConstant(id, value) { + return value = +value, function() { + set$1(this, id).duration = value; + }; +} + +var transition_duration = function(value) { + var id = this._id; + + return arguments.length + ? this.each((typeof value === "function" + ? durationFunction + : durationConstant)(id, value)) + : get$1(this.node(), id).duration; +}; + +function easeConstant(id, value) { + if (typeof value !== "function") throw new Error; + return function() { + set$1(this, id).ease = value; + }; +} + +var transition_ease = function(value) { + var id = this._id; + + return arguments.length + ? this.each(easeConstant(id, value)) + : get$1(this.node(), id).ease; +}; + +var transition_filter = function(match) { + if (typeof match !== "function") match = matcher$1(match); + + for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { + if ((node = group[i]) && match.call(node, node.__data__, i, group)) { + subgroup.push(node); + } + } + } + + return new Transition(subgroups, this._parents, this._name, this._id); +}; + +var transition_merge = function(transition) { + if (transition._id !== this._id) throw new Error; + + for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { + for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { + if (node = group0[i] || group1[i]) { + merge[i] = node; + } + } + } + + for (; j < m0; ++j) { + merges[j] = groups0[j]; + } + + return new Transition(merges, this._parents, this._name, this._id); +}; + +function start(name) { + return (name + "").trim().split(/^|\s+/).every(function(t) { + var i = t.indexOf("."); + if (i >= 0) t = t.slice(0, i); + return !t || t === "start"; + }); +} + +function onFunction(id, name, listener) { + var on0, on1, sit = start(name) ? init : set$1; + return function() { + var schedule = sit(this, id), + on = schedule.on; + + // If this node shared a dispatch with the previous node, + // just assign the updated shared dispatch and we’re done! + // Otherwise, copy-on-write. + if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener); + + schedule.on = on1; + }; +} + +var transition_on = function(name, listener) { + var id = this._id; + + return arguments.length < 2 + ? get$1(this.node(), id).on.on(name) + : this.each(onFunction(id, name, listener)); +}; + +function removeFunction(id) { + return function() { + var parent = this.parentNode; + for (var i in this.__transition) if (+i !== id) return; + if (parent) parent.removeChild(this); + }; +} + +var transition_remove = function() { + return this.on("end.remove", removeFunction(this._id)); +}; + +var transition_select = function(select$$1) { + var name = this._name, + id = this._id; + + if (typeof select$$1 !== "function") select$$1 = selector(select$$1); + + for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { + if ((node = group[i]) && (subnode = select$$1.call(node, node.__data__, i, group))) { + if ("__data__" in node) subnode.__data__ = node.__data__; + subgroup[i] = subnode; + schedule(subgroup[i], name, id, i, subgroup, get$1(node, id)); + } + } + } + + return new Transition(subgroups, this._parents, name, id); +}; + +var transition_selectAll = function(select$$1) { + var name = this._name, + id = this._id; + + if (typeof select$$1 !== "function") select$$1 = selectorAll(select$$1); + + for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { + if (node = group[i]) { + for (var children = select$$1.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) { + if (child = children[k]) { + schedule(child, name, id, k, children, inherit); + } + } + subgroups.push(children); + parents.push(node); + } + } + } + + return new Transition(subgroups, parents, name, id); +}; + +var Selection$1 = selection.prototype.constructor; + +var transition_selection = function() { + return new Selection$1(this._groups, this._parents); +}; + +function styleRemove$1(name, interpolate$$2) { + var value00, + value10, + interpolate0; + return function() { + var value0 = styleValue(this, name), + value1 = (this.style.removeProperty(name), styleValue(this, name)); + return value0 === value1 ? null + : value0 === value00 && value1 === value10 ? interpolate0 + : interpolate0 = interpolate$$2(value00 = value0, value10 = value1); + }; +} + +function styleRemoveEnd(name) { + return function() { + this.style.removeProperty(name); + }; +} + +function styleConstant$1(name, interpolate$$2, value1) { + var value00, + interpolate0; + return function() { + var value0 = styleValue(this, name); + return value0 === value1 ? null + : value0 === value00 ? interpolate0 + : interpolate0 = interpolate$$2(value00 = value0, value1); + }; +} + +function styleFunction$1(name, interpolate$$2, value) { + var value00, + value10, + interpolate0; + return function() { + var value0 = styleValue(this, name), + value1 = value(this); + if (value1 == null) value1 = (this.style.removeProperty(name), styleValue(this, name)); + return value0 === value1 ? null + : value0 === value00 && value1 === value10 ? interpolate0 + : interpolate0 = interpolate$$2(value00 = value0, value10 = value1); + }; +} + +var transition_style = function(name, value, priority) { + var i = (name += "") === "transform" ? interpolateTransformCss : interpolate$$1; + return value == null ? this + .styleTween(name, styleRemove$1(name, i)) + .on("end.style." + name, styleRemoveEnd(name)) + : this.styleTween(name, typeof value === "function" + ? styleFunction$1(name, i, tweenValue(this, "style." + name, value)) + : styleConstant$1(name, i, value + ""), priority); +}; + +function styleTween(name, value, priority) { + function tween() { + var node = this, i = value.apply(node, arguments); + return i && function(t) { + node.style.setProperty(name, i(t), priority); + }; + } + tween._value = value; + return tween; +} + +var transition_styleTween = function(name, value, priority) { + var key = "style." + (name += ""); + if (arguments.length < 2) return (key = this.tween(key)) && key._value; + if (value == null) return this.tween(key, null); + if (typeof value !== "function") throw new Error; + return this.tween(key, styleTween(name, value, priority == null ? "" : priority)); +}; + +function textConstant$1(value) { + return function() { + this.textContent = value; + }; +} + +function textFunction$1(value) { + return function() { + var value1 = value(this); + this.textContent = value1 == null ? "" : value1; + }; +} + +var transition_text = function(value) { + return this.tween("text", typeof value === "function" + ? textFunction$1(tweenValue(this, "text", value)) + : textConstant$1(value == null ? "" : value + "")); +}; + +var transition_transition = function() { + var name = this._name, + id0 = this._id, + id1 = newId(); + + for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { + if (node = group[i]) { + var inherit = get$1(node, id0); + schedule(node, name, id1, i, group, { + time: inherit.time + inherit.delay + inherit.duration, + delay: 0, + duration: inherit.duration, + ease: inherit.ease + }); + } + } + } + + return new Transition(groups, this._parents, name, id1); +}; + +var id = 0; + +function Transition(groups, parents, name, id) { + this._groups = groups; + this._parents = parents; + this._name = name; + this._id = id; +} + +function transition(name) { + return selection().transition(name); +} + +function newId() { + return ++id; +} + +var selection_prototype = selection.prototype; + +Transition.prototype = transition.prototype = { + constructor: Transition, + select: transition_select, + selectAll: transition_selectAll, + filter: transition_filter, + merge: transition_merge, + selection: transition_selection, + transition: transition_transition, + call: selection_prototype.call, + nodes: selection_prototype.nodes, + node: selection_prototype.node, + size: selection_prototype.size, + empty: selection_prototype.empty, + each: selection_prototype.each, + on: transition_on, + attr: transition_attr, + attrTween: transition_attrTween, + style: transition_style, + styleTween: transition_styleTween, + text: transition_text, + remove: transition_remove, + tween: transition_tween, + delay: transition_delay, + duration: transition_duration, + ease: transition_ease +}; + +function linear$1(t) { + return +t; +} + +function quadIn(t) { + return t * t; +} + +function quadOut(t) { + return t * (2 - t); +} + +function quadInOut(t) { + return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2; +} + +function cubicIn(t) { + return t * t * t; +} + +function cubicOut(t) { + return --t * t * t + 1; +} + +function cubicInOut(t) { + return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; +} + +var exponent = 3; + +var polyIn = (function custom(e) { + e = +e; + + function polyIn(t) { + return Math.pow(t, e); + } + + polyIn.exponent = custom; + + return polyIn; +})(exponent); + +var polyOut = (function custom(e) { + e = +e; + + function polyOut(t) { + return 1 - Math.pow(1 - t, e); + } + + polyOut.exponent = custom; + + return polyOut; +})(exponent); + +var polyInOut = (function custom(e) { + e = +e; + + function polyInOut(t) { + return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2; + } + + polyInOut.exponent = custom; + + return polyInOut; +})(exponent); + +var pi = Math.PI; +var halfPi = pi / 2; + +function sinIn(t) { + return 1 - Math.cos(t * halfPi); +} + +function sinOut(t) { + return Math.sin(t * halfPi); +} + +function sinInOut(t) { + return (1 - Math.cos(pi * t)) / 2; +} + +function expIn(t) { + return Math.pow(2, 10 * t - 10); +} + +function expOut(t) { + return 1 - Math.pow(2, -10 * t); +} + +function expInOut(t) { + return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2; +} + +function circleIn(t) { + return 1 - Math.sqrt(1 - t * t); +} + +function circleOut(t) { + return Math.sqrt(1 - --t * t); +} + +function circleInOut(t) { + return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2; +} + +var b1 = 4 / 11; +var b2 = 6 / 11; +var b3 = 8 / 11; +var b4 = 3 / 4; +var b5 = 9 / 11; +var b6 = 10 / 11; +var b7 = 15 / 16; +var b8 = 21 / 22; +var b9 = 63 / 64; +var b0 = 1 / b1 / b1; + +function bounceIn(t) { + return 1 - bounceOut(1 - t); +} + +function bounceOut(t) { + return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9; +} + +function bounceInOut(t) { + return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2; +} + +var overshoot = 1.70158; + +var backIn = (function custom(s) { + s = +s; + + function backIn(t) { + return t * t * ((s + 1) * t - s); + } + + backIn.overshoot = custom; + + return backIn; +})(overshoot); + +var backOut = (function custom(s) { + s = +s; + + function backOut(t) { + return --t * t * ((s + 1) * t + s) + 1; + } + + backOut.overshoot = custom; + + return backOut; +})(overshoot); + +var backInOut = (function custom(s) { + s = +s; + + function backInOut(t) { + return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2; + } + + backInOut.overshoot = custom; + + return backInOut; +})(overshoot); + +var tau = 2 * Math.PI; +var amplitude = 1; +var period = 0.3; + +var elasticIn = (function custom(a, p) { + var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); + + function elasticIn(t) { + return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p); + } + + elasticIn.amplitude = function(a) { return custom(a, p * tau); }; + elasticIn.period = function(p) { return custom(a, p); }; + + return elasticIn; +})(amplitude, period); + +var elasticOut = (function custom(a, p) { + var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); + + function elasticOut(t) { + return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p); + } + + elasticOut.amplitude = function(a) { return custom(a, p * tau); }; + elasticOut.period = function(p) { return custom(a, p); }; + + return elasticOut; +})(amplitude, period); + +var elasticInOut = (function custom(a, p) { + var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau); + + function elasticInOut(t) { + return ((t = t * 2 - 1) < 0 + ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) + : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2; + } + + elasticInOut.amplitude = function(a) { return custom(a, p * tau); }; + elasticInOut.period = function(p) { return custom(a, p); }; + + return elasticInOut; +})(amplitude, period); + +var defaultTiming = { + time: null, // Set on use. + delay: 0, + duration: 250, + ease: cubicInOut +}; + +function inherit(node, id) { + var timing; + while (!(timing = node.__transition) || !(timing = timing[id])) { + if (!(node = node.parentNode)) { + return defaultTiming.time = now(), defaultTiming; + } + } + return timing; +} + +var selection_transition = function(name) { + var id, + timing; + + if (name instanceof Transition) { + id = name._id, name = name._name; + } else { + id = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + ""; + } + + for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { + if (node = group[i]) { + schedule(node, name, id, i, group, timing || inherit(node, id)); + } + } + } + + return new Transition(groups, this._parents, name, id); +}; + +selection.prototype.interrupt = selection_interrupt; +selection.prototype.transition = selection_transition; + +var root$1 = [null]; + +var active = function(node, name) { + var schedules = node.__transition, + schedule, + i; + + if (schedules) { + name = name == null ? null : name + ""; + for (i in schedules) { + if ((schedule = schedules[i]).state > SCHEDULED && schedule.name === name) { + return new Transition([[node]], root$1, name, +i); + } + } + } + + return null; +}; + +var constant$4 = function(x) { + return function() { + return x; + }; +}; + +var BrushEvent = function(target, type, selection) { + this.target = target; + this.type = type; + this.selection = selection; +}; + +function nopropagation$1() { + exports.event.stopImmediatePropagation(); +} + +var noevent$1 = function() { + exports.event.preventDefault(); + exports.event.stopImmediatePropagation(); +}; + +var MODE_DRAG = {name: "drag"}; +var MODE_SPACE = {name: "space"}; +var MODE_HANDLE = {name: "handle"}; +var MODE_CENTER = {name: "center"}; + +var X = { + name: "x", + handles: ["e", "w"].map(type), + input: function(x, e) { return x && [[x[0], e[0][1]], [x[1], e[1][1]]]; }, + output: function(xy) { return xy && [xy[0][0], xy[1][0]]; } +}; + +var Y = { + name: "y", + handles: ["n", "s"].map(type), + input: function(y, e) { return y && [[e[0][0], y[0]], [e[1][0], y[1]]]; }, + output: function(xy) { return xy && [xy[0][1], xy[1][1]]; } +}; + +var XY = { + name: "xy", + handles: ["n", "e", "s", "w", "nw", "ne", "se", "sw"].map(type), + input: function(xy) { return xy; }, + output: function(xy) { return xy; } +}; + +var cursors = { + overlay: "crosshair", + selection: "move", + n: "ns-resize", + e: "ew-resize", + s: "ns-resize", + w: "ew-resize", + nw: "nwse-resize", + ne: "nesw-resize", + se: "nwse-resize", + sw: "nesw-resize" +}; + +var flipX = { + e: "w", + w: "e", + nw: "ne", + ne: "nw", + se: "sw", + sw: "se" +}; + +var flipY = { + n: "s", + s: "n", + nw: "sw", + ne: "se", + se: "ne", + sw: "nw" +}; + +var signsX = { + overlay: +1, + selection: +1, + n: null, + e: +1, + s: null, + w: -1, + nw: -1, + ne: +1, + se: +1, + sw: -1 +}; + +var signsY = { + overlay: +1, + selection: +1, + n: -1, + e: null, + s: +1, + w: null, + nw: -1, + ne: -1, + se: +1, + sw: +1 +}; + +function type(t) { + return {type: t}; +} + +// Ignore right-click, since that should open the context menu. +function defaultFilter() { + return !exports.event.button; +} + +function defaultExtent() { + var svg = this.ownerSVGElement || this; + return [[0, 0], [svg.width.baseVal.value, svg.height.baseVal.value]]; +} + +// Like d3.local, but with the name “__brush” rather than auto-generated. +function local$$1(node) { + while (!node.__brush) if (!(node = node.parentNode)) return; + return node.__brush; +} + +function empty(extent) { + return extent[0][0] === extent[1][0] + || extent[0][1] === extent[1][1]; +} + +function brushSelection(node) { + var state = node.__brush; + return state ? state.dim.output(state.selection) : null; +} + +function brushX() { + return brush$1(X); +} + +function brushY() { + return brush$1(Y); +} + +var brush = function() { + return brush$1(XY); +}; + +function brush$1(dim) { + var extent = defaultExtent, + filter = defaultFilter, + listeners = dispatch(brush, "start", "brush", "end"), + handleSize = 6, + touchending; + + function brush(group) { + var overlay = group + .property("__brush", initialize) + .selectAll(".overlay") + .data([type("overlay")]); + + overlay.enter().append("rect") + .attr("class", "overlay") + .attr("pointer-events", "all") + .attr("cursor", cursors.overlay) + .merge(overlay) + .each(function() { + var extent = local$$1(this).extent; + select(this) + .attr("x", extent[0][0]) + .attr("y", extent[0][1]) + .attr("width", extent[1][0] - extent[0][0]) + .attr("height", extent[1][1] - extent[0][1]); + }); + + group.selectAll(".selection") + .data([type("selection")]) + .enter().append("rect") + .attr("class", "selection") + .attr("cursor", cursors.selection) + .attr("fill", "#777") + .attr("fill-opacity", 0.3) + .attr("stroke", "#fff") + .attr("shape-rendering", "crispEdges"); + + var handle = group.selectAll(".handle") + .data(dim.handles, function(d) { return d.type; }); + + handle.exit().remove(); + + handle.enter().append("rect") + .attr("class", function(d) { return "handle handle--" + d.type; }) + .attr("cursor", function(d) { return cursors[d.type]; }); + + group + .each(redraw) + .attr("fill", "none") + .attr("pointer-events", "all") + .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)") + .on("mousedown.brush touchstart.brush", started); + } + + brush.move = function(group, selection$$1) { + if (group.selection) { + group + .on("start.brush", function() { emitter(this, arguments).beforestart().start(); }) + .on("interrupt.brush end.brush", function() { emitter(this, arguments).end(); }) + .tween("brush", function() { + var that = this, + state = that.__brush, + emit = emitter(that, arguments), + selection0 = state.selection, + selection1 = dim.input(typeof selection$$1 === "function" ? selection$$1.apply(this, arguments) : selection$$1, state.extent), + i = interpolateValue(selection0, selection1); + + function tween(t) { + state.selection = t === 1 && empty(selection1) ? null : i(t); + redraw.call(that); + emit.brush(); + } + + return selection0 && selection1 ? tween : tween(1); + }); + } else { + group + .each(function() { + var that = this, + args = arguments, + state = that.__brush, + selection1 = dim.input(typeof selection$$1 === "function" ? selection$$1.apply(that, args) : selection$$1, state.extent), + emit = emitter(that, args).beforestart(); + + interrupt(that); + state.selection = selection1 == null || empty(selection1) ? null : selection1; + redraw.call(that); + emit.start().brush().end(); + }); + } + }; + + function redraw() { + var group = select(this), + selection$$1 = local$$1(this).selection; + + if (selection$$1) { + group.selectAll(".selection") + .style("display", null) + .attr("x", selection$$1[0][0]) + .attr("y", selection$$1[0][1]) + .attr("width", selection$$1[1][0] - selection$$1[0][0]) + .attr("height", selection$$1[1][1] - selection$$1[0][1]); + + group.selectAll(".handle") + .style("display", null) + .attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection$$1[1][0] - handleSize / 2 : selection$$1[0][0] - handleSize / 2; }) + .attr("y", function(d) { return d.type[0] === "s" ? selection$$1[1][1] - handleSize / 2 : selection$$1[0][1] - handleSize / 2; }) + .attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection$$1[1][0] - selection$$1[0][0] + handleSize : handleSize; }) + .attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection$$1[1][1] - selection$$1[0][1] + handleSize : handleSize; }); + } + + else { + group.selectAll(".selection,.handle") + .style("display", "none") + .attr("x", null) + .attr("y", null) + .attr("width", null) + .attr("height", null); + } + } + + function emitter(that, args) { + return that.__brush.emitter || new Emitter(that, args); + } + + function Emitter(that, args) { + this.that = that; + this.args = args; + this.state = that.__brush; + this.active = 0; + } + + Emitter.prototype = { + beforestart: function() { + if (++this.active === 1) this.state.emitter = this, this.starting = true; + return this; + }, + start: function() { + if (this.starting) this.starting = false, this.emit("start"); + return this; + }, + brush: function() { + this.emit("brush"); + return this; + }, + end: function() { + if (--this.active === 0) delete this.state.emitter, this.emit("end"); + return this; + }, + emit: function(type) { + customEvent(new BrushEvent(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [type, this.that, this.args]); + } + }; + + function started() { + if (exports.event.touches) { if (exports.event.changedTouches.length < exports.event.touches.length) return noevent$1(); } + else if (touchending) return; + if (!filter.apply(this, arguments)) return; + + var that = this, + type = exports.event.target.__data__.type, + mode = (exports.event.metaKey ? type = "overlay" : type) === "selection" ? MODE_DRAG : (exports.event.altKey ? MODE_CENTER : MODE_HANDLE), + signX = dim === Y ? null : signsX[type], + signY = dim === X ? null : signsY[type], + state = local$$1(that), + extent = state.extent, + selection$$1 = state.selection, + W = extent[0][0], w0, w1, + N = extent[0][1], n0, n1, + E = extent[1][0], e0, e1, + S = extent[1][1], s0, s1, + dx, + dy, + moving, + shifting = signX && signY && exports.event.shiftKey, + lockX, + lockY, + point0 = mouse(that), + point = point0, + emit = emitter(that, arguments).beforestart(); + + if (type === "overlay") { + state.selection = selection$$1 = [ + [w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1]], + [e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0] + ]; + } else { + w0 = selection$$1[0][0]; + n0 = selection$$1[0][1]; + e0 = selection$$1[1][0]; + s0 = selection$$1[1][1]; + } + + w1 = w0; + n1 = n0; + e1 = e0; + s1 = s0; + + var group = select(that) + .attr("pointer-events", "none"); + + var overlay = group.selectAll(".overlay") + .attr("cursor", cursors[type]); + + if (exports.event.touches) { + group + .on("touchmove.brush", moved, true) + .on("touchend.brush touchcancel.brush", ended, true); + } else { + var view = select(exports.event.view) + .on("keydown.brush", keydowned, true) + .on("keyup.brush", keyupped, true) + .on("mousemove.brush", moved, true) + .on("mouseup.brush", ended, true); + + dragDisable(exports.event.view); + } + + nopropagation$1(); + interrupt(that); + redraw.call(that); + emit.start(); + + function moved() { + var point1 = mouse(that); + if (shifting && !lockX && !lockY) { + if (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1])) lockY = true; + else lockX = true; + } + point = point1; + moving = true; + noevent$1(); + move(); + } + + function move() { + var t; + + dx = point[0] - point0[0]; + dy = point[1] - point0[1]; + + switch (mode) { + case MODE_SPACE: + case MODE_DRAG: { + if (signX) dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx; + if (signY) dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy; + break; + } + case MODE_HANDLE: { + if (signX < 0) dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0; + else if (signX > 0) dx = Math.max(W - e0, Math.min(E - e0, dx)), w1 = w0, e1 = e0 + dx; + if (signY < 0) dy = Math.max(N - n0, Math.min(S - n0, dy)), n1 = n0 + dy, s1 = s0; + else if (signY > 0) dy = Math.max(N - s0, Math.min(S - s0, dy)), n1 = n0, s1 = s0 + dy; + break; + } + case MODE_CENTER: { + if (signX) w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX)); + if (signY) n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY)); + break; + } + } + + if (e1 < w1) { + signX *= -1; + t = w0, w0 = e0, e0 = t; + t = w1, w1 = e1, e1 = t; + if (type in flipX) overlay.attr("cursor", cursors[type = flipX[type]]); + } + + if (s1 < n1) { + signY *= -1; + t = n0, n0 = s0, s0 = t; + t = n1, n1 = s1, s1 = t; + if (type in flipY) overlay.attr("cursor", cursors[type = flipY[type]]); + } + + if (state.selection) selection$$1 = state.selection; // May be set by brush.move! + if (lockX) w1 = selection$$1[0][0], e1 = selection$$1[1][0]; + if (lockY) n1 = selection$$1[0][1], s1 = selection$$1[1][1]; + + if (selection$$1[0][0] !== w1 + || selection$$1[0][1] !== n1 + || selection$$1[1][0] !== e1 + || selection$$1[1][1] !== s1) { + state.selection = [[w1, n1], [e1, s1]]; + redraw.call(that); + emit.brush(); + } + } + + function ended() { + nopropagation$1(); + if (exports.event.touches) { + if (exports.event.touches.length) return; + if (touchending) clearTimeout(touchending); + touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed! + group.on("touchmove.brush touchend.brush touchcancel.brush", null); + } else { + yesdrag(exports.event.view, moving); + view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null); + } + group.attr("pointer-events", "all"); + overlay.attr("cursor", cursors.overlay); + if (state.selection) selection$$1 = state.selection; // May be set by brush.move (on start)! + if (empty(selection$$1)) state.selection = null, redraw.call(that); + emit.end(); + } + + function keydowned() { + switch (exports.event.keyCode) { + case 16: { // SHIFT + shifting = signX && signY; + break; + } + case 18: { // ALT + if (mode === MODE_HANDLE) { + if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX; + if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY; + mode = MODE_CENTER; + move(); + } + break; + } + case 32: { // SPACE; takes priority over ALT + if (mode === MODE_HANDLE || mode === MODE_CENTER) { + if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx; + if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy; + mode = MODE_SPACE; + overlay.attr("cursor", cursors.selection); + move(); + } + break; + } + default: return; + } + noevent$1(); + } + + function keyupped() { + switch (exports.event.keyCode) { + case 16: { // SHIFT + if (shifting) { + lockX = lockY = shifting = false; + move(); + } + break; + } + case 18: { // ALT + if (mode === MODE_CENTER) { + if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1; + if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1; + mode = MODE_HANDLE; + move(); + } + break; + } + case 32: { // SPACE + if (mode === MODE_SPACE) { + if (exports.event.altKey) { + if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX; + if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY; + mode = MODE_CENTER; + } else { + if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1; + if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1; + mode = MODE_HANDLE; + } + overlay.attr("cursor", cursors[type]); + move(); + } + break; + } + default: return; + } + noevent$1(); + } + } + + function initialize() { + var state = this.__brush || {selection: null}; + state.extent = extent.apply(this, arguments); + state.dim = dim; + return state; + } + + brush.extent = function(_) { + return arguments.length ? (extent = typeof _ === "function" ? _ : constant$4([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), brush) : extent; + }; + + brush.filter = function(_) { + return arguments.length ? (filter = typeof _ === "function" ? _ : constant$4(!!_), brush) : filter; + }; + + brush.handleSize = function(_) { + return arguments.length ? (handleSize = +_, brush) : handleSize; + }; + + brush.on = function() { + var value = listeners.on.apply(listeners, arguments); + return value === listeners ? brush : value; + }; + + return brush; +} + +var cos = Math.cos; +var sin = Math.sin; +var pi$1 = Math.PI; +var halfPi$1 = pi$1 / 2; +var tau$1 = pi$1 * 2; +var max$1 = Math.max; + +function compareValue(compare) { + return function(a, b) { + return compare( + a.source.value + a.target.value, + b.source.value + b.target.value + ); + }; +} + +var chord = function() { + var padAngle = 0, + sortGroups = null, + sortSubgroups = null, + sortChords = null; + + function chord(matrix) { + var n = matrix.length, + groupSums = [], + groupIndex = sequence(n), + subgroupIndex = [], + chords = [], + groups = chords.groups = new Array(n), + subgroups = new Array(n * n), + k, + x, + x0, + dx, + i, + j; + + // Compute the sum. + k = 0, i = -1; while (++i < n) { + x = 0, j = -1; while (++j < n) { + x += matrix[i][j]; + } + groupSums.push(x); + subgroupIndex.push(sequence(n)); + k += x; + } + + // Sort groups… + if (sortGroups) groupIndex.sort(function(a, b) { + return sortGroups(groupSums[a], groupSums[b]); + }); + + // Sort subgroups… + if (sortSubgroups) subgroupIndex.forEach(function(d, i) { + d.sort(function(a, b) { + return sortSubgroups(matrix[i][a], matrix[i][b]); + }); + }); + + // Convert the sum to scaling factor for [0, 2pi]. + // TODO Allow start and end angle to be specified? + // TODO Allow padding to be specified as percentage? + k = max$1(0, tau$1 - padAngle * n) / k; + dx = k ? padAngle : tau$1 / n; + + // Compute the start and end angle for each group and subgroup. + // Note: Opera has a bug reordering object literal properties! + x = 0, i = -1; while (++i < n) { + x0 = x, j = -1; while (++j < n) { + var di = groupIndex[i], + dj = subgroupIndex[di][j], + v = matrix[di][dj], + a0 = x, + a1 = x += v * k; + subgroups[dj * n + di] = { + index: di, + subindex: dj, + startAngle: a0, + endAngle: a1, + value: v + }; + } + groups[di] = { + index: di, + startAngle: x0, + endAngle: x, + value: groupSums[di] + }; + x += dx; + } + + // Generate chords for each (non-empty) subgroup-subgroup link. + i = -1; while (++i < n) { + j = i - 1; while (++j < n) { + var source = subgroups[j * n + i], + target = subgroups[i * n + j]; + if (source.value || target.value) { + chords.push(source.value < target.value + ? {source: target, target: source} + : {source: source, target: target}); + } + } + } + + return sortChords ? chords.sort(sortChords) : chords; + } + + chord.padAngle = function(_) { + return arguments.length ? (padAngle = max$1(0, _), chord) : padAngle; + }; + + chord.sortGroups = function(_) { + return arguments.length ? (sortGroups = _, chord) : sortGroups; + }; + + chord.sortSubgroups = function(_) { + return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups; + }; + + chord.sortChords = function(_) { + return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._; + }; + + return chord; +}; + +var slice$2 = Array.prototype.slice; + +var constant$5 = function(x) { + return function() { + return x; + }; +}; + +var pi$2 = Math.PI; +var tau$2 = 2 * pi$2; +var epsilon$1 = 1e-6; +var tauEpsilon = tau$2 - epsilon$1; + +function Path() { + this._x0 = this._y0 = // start of current subpath + this._x1 = this._y1 = null; // end of current subpath + this._ = ""; +} + +function path() { + return new Path; +} + +Path.prototype = path.prototype = { + constructor: Path, + moveTo: function(x, y) { + this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y); + }, + closePath: function() { + if (this._x1 !== null) { + this._x1 = this._x0, this._y1 = this._y0; + this._ += "Z"; + } + }, + lineTo: function(x, y) { + this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y); + }, + quadraticCurveTo: function(x1, y1, x, y) { + this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y); + }, + bezierCurveTo: function(x1, y1, x2, y2, x, y) { + this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y); + }, + arcTo: function(x1, y1, x2, y2, r) { + x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r; + var x0 = this._x1, + y0 = this._y1, + x21 = x2 - x1, + y21 = y2 - y1, + x01 = x0 - x1, + y01 = y0 - y1, + l01_2 = x01 * x01 + y01 * y01; + + // Is the radius negative? Error. + if (r < 0) throw new Error("negative radius: " + r); + + // Is this path empty? Move to (x1,y1). + if (this._x1 === null) { + this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); + } + + // Or, is (x1,y1) coincident with (x0,y0)? Do nothing. + else if (!(l01_2 > epsilon$1)) {} + + // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear? + // Equivalently, is (x1,y1) coincident with (x2,y2)? + // Or, is the radius zero? Line to (x1,y1). + else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) { + this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); + } + + // Otherwise, draw an arc! + else { + var x20 = x2 - x0, + y20 = y2 - y0, + l21_2 = x21 * x21 + y21 * y21, + l20_2 = x20 * x20 + y20 * y20, + l21 = Math.sqrt(l21_2), + l01 = Math.sqrt(l01_2), + l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), + t01 = l / l01, + t21 = l / l21; + + // If the start tangent is not coincident with (x0,y0), line to. + if (Math.abs(t01 - 1) > epsilon$1) { + this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01); + } + + this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21); + } + }, + arc: function(x, y, r, a0, a1, ccw) { + x = +x, y = +y, r = +r; + var dx = r * Math.cos(a0), + dy = r * Math.sin(a0), + x0 = x + dx, + y0 = y + dy, + cw = 1 ^ ccw, + da = ccw ? a0 - a1 : a1 - a0; + + // Is the radius negative? Error. + if (r < 0) throw new Error("negative radius: " + r); + + // Is this path empty? Move to (x0,y0). + if (this._x1 === null) { + this._ += "M" + x0 + "," + y0; + } + + // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0). + else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) { + this._ += "L" + x0 + "," + y0; + } + + // Is this arc empty? We’re done. + if (!r) return; + + // Does the angle go the wrong way? Flip the direction. + if (da < 0) da = da % tau$2 + tau$2; + + // Is this a complete circle? Draw two arcs to complete the circle. + if (da > tauEpsilon) { + this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0); + } + + // Is this arc non-empty? Draw an arc! + else if (da > epsilon$1) { + this._ += "A" + r + "," + r + ",0," + (+(da >= pi$2)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1)); + } + }, + rect: function(x, y, w, h) { + this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z"; + }, + toString: function() { + return this._; + } +}; + +function defaultSource(d) { + return d.source; +} + +function defaultTarget(d) { + return d.target; +} + +function defaultRadius(d) { + return d.radius; +} + +function defaultStartAngle(d) { + return d.startAngle; +} + +function defaultEndAngle(d) { + return d.endAngle; +} + +var ribbon = function() { + var source = defaultSource, + target = defaultTarget, + radius = defaultRadius, + startAngle = defaultStartAngle, + endAngle = defaultEndAngle, + context = null; + + function ribbon() { + var buffer, + argv = slice$2.call(arguments), + s = source.apply(this, argv), + t = target.apply(this, argv), + sr = +radius.apply(this, (argv[0] = s, argv)), + sa0 = startAngle.apply(this, argv) - halfPi$1, + sa1 = endAngle.apply(this, argv) - halfPi$1, + sx0 = sr * cos(sa0), + sy0 = sr * sin(sa0), + tr = +radius.apply(this, (argv[0] = t, argv)), + ta0 = startAngle.apply(this, argv) - halfPi$1, + ta1 = endAngle.apply(this, argv) - halfPi$1; + + if (!context) context = buffer = path(); + + context.moveTo(sx0, sy0); + context.arc(0, 0, sr, sa0, sa1); + if (sa0 !== ta0 || sa1 !== ta1) { // TODO sr !== tr? + context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0)); + context.arc(0, 0, tr, ta0, ta1); + } + context.quadraticCurveTo(0, 0, sx0, sy0); + context.closePath(); + + if (buffer) return context = null, buffer + "" || null; + } + + ribbon.radius = function(_) { + return arguments.length ? (radius = typeof _ === "function" ? _ : constant$5(+_), ribbon) : radius; + }; + + ribbon.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$5(+_), ribbon) : startAngle; + }; + + ribbon.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$5(+_), ribbon) : endAngle; + }; + + ribbon.source = function(_) { + return arguments.length ? (source = _, ribbon) : source; + }; + + ribbon.target = function(_) { + return arguments.length ? (target = _, ribbon) : target; + }; + + ribbon.context = function(_) { + return arguments.length ? ((context = _ == null ? null : _), ribbon) : context; + }; + + return ribbon; +}; + +var prefix = "$"; + +function Map() {} + +Map.prototype = map$1.prototype = { + constructor: Map, + has: function(key) { + return (prefix + key) in this; + }, + get: function(key) { + return this[prefix + key]; + }, + set: function(key, value) { + this[prefix + key] = value; + return this; + }, + remove: function(key) { + var property = prefix + key; + return property in this && delete this[property]; + }, + clear: function() { + for (var property in this) if (property[0] === prefix) delete this[property]; + }, + keys: function() { + var keys = []; + for (var property in this) if (property[0] === prefix) keys.push(property.slice(1)); + return keys; + }, + values: function() { + var values = []; + for (var property in this) if (property[0] === prefix) values.push(this[property]); + return values; + }, + entries: function() { + var entries = []; + for (var property in this) if (property[0] === prefix) entries.push({key: property.slice(1), value: this[property]}); + return entries; + }, + size: function() { + var size = 0; + for (var property in this) if (property[0] === prefix) ++size; + return size; + }, + empty: function() { + for (var property in this) if (property[0] === prefix) return false; + return true; + }, + each: function(f) { + for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this); + } +}; + +function map$1(object, f) { + var map = new Map; + + // Copy constructor. + if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); + + // Index array by numeric index or specified key function. + else if (Array.isArray(object)) { + var i = -1, + n = object.length, + o; + + if (f == null) while (++i < n) map.set(i, object[i]); + else while (++i < n) map.set(f(o = object[i], i, object), o); + } + + // Convert object to map. + else if (object) for (var key in object) map.set(key, object[key]); + + return map; +} + +var nest = function() { + var keys = [], + sortKeys = [], + sortValues, + rollup, + nest; + + function apply(array, depth, createResult, setResult) { + if (depth >= keys.length) return rollup != null + ? rollup(array) : (sortValues != null + ? array.sort(sortValues) + : array); + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + value, + valuesByKey = map$1(), + values, + result = createResult(); + + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) { + values.push(value); + } else { + valuesByKey.set(keyValue, [value]); + } + } + + valuesByKey.each(function(values, key) { + setResult(result, key, apply(values, depth, createResult, setResult)); + }); + + return result; + } + + function entries(map, depth) { + if (++depth > keys.length) return map; + var array, sortKey = sortKeys[depth - 1]; + if (rollup != null && depth >= keys.length) array = map.entries(); + else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); }); + return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array; + } + + return nest = { + object: function(array) { return apply(array, 0, createObject, setObject); }, + map: function(array) { return apply(array, 0, createMap, setMap); }, + entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); }, + key: function(d) { keys.push(d); return nest; }, + sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, + sortValues: function(order) { sortValues = order; return nest; }, + rollup: function(f) { rollup = f; return nest; } + }; +}; + +function createObject() { + return {}; +} + +function setObject(object, key, value) { + object[key] = value; +} + +function createMap() { + return map$1(); +} + +function setMap(map, key, value) { + map.set(key, value); +} + +function Set() {} + +var proto = map$1.prototype; + +Set.prototype = set$2.prototype = { + constructor: Set, + has: proto.has, + add: function(value) { + value += ""; + this[prefix + value] = value; + return this; + }, + remove: proto.remove, + clear: proto.clear, + values: proto.keys, + size: proto.size, + empty: proto.empty, + each: proto.each +}; + +function set$2(object, f) { + var set = new Set; + + // Copy constructor. + if (object instanceof Set) object.each(function(value) { set.add(value); }); + + // Otherwise, assume it’s an array. + else if (object) { + var i = -1, n = object.length; + if (f == null) while (++i < n) set.add(object[i]); + else while (++i < n) set.add(f(object[i], i, object)); + } + + return set; +} + +var keys = function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}; + +var values = function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}; + +var entries = function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}; + +function objectConverter(columns) { + return new Function("d", "return {" + columns.map(function(name, i) { + return JSON.stringify(name) + ": d[" + i + "]"; + }).join(",") + "}"); +} + +function customConverter(columns, f) { + var object = objectConverter(columns); + return function(row, i) { + return f(object(row), i, columns); + }; +} + +// Compute unique columns in order of discovery. +function inferColumns(rows) { + var columnSet = Object.create(null), + columns = []; + + rows.forEach(function(row) { + for (var column in row) { + if (!(column in columnSet)) { + columns.push(columnSet[column] = column); + } + } + }); + + return columns; +} + +var dsv = function(delimiter) { + var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), + delimiterCode = delimiter.charCodeAt(0); + + function parse(text, f) { + var convert, columns, rows = parseRows(text, function(row, i) { + if (convert) return convert(row, i - 1); + columns = row, convert = f ? customConverter(row, f) : objectConverter(row); + }); + rows.columns = columns; + return rows; + } + + function parseRows(text, f) { + var EOL = {}, // sentinel value for end-of-line + EOF = {}, // sentinel value for end-of-file + rows = [], // output rows + N = text.length, + I = 0, // current character index + n = 0, // the current line number + t, // the current token + eol; // is the current token followed by EOL? + + function token() { + if (I >= N) return EOF; // special case: end of file + if (eol) return eol = false, EOL; // special case: end of line + + // special case: quotes + var j = I, c; + if (text.charCodeAt(j) === 34) { + var i = j; + while (i++ < N) { + if (text.charCodeAt(i) === 34) { + if (text.charCodeAt(i + 1) !== 34) break; + ++i; + } + } + I = i + 2; + c = text.charCodeAt(i + 1); + if (c === 13) { + eol = true; + if (text.charCodeAt(i + 2) === 10) ++I; + } else if (c === 10) { + eol = true; + } + return text.slice(j + 1, i).replace(/""/g, "\""); + } + + // common case: find next delimiter or newline + while (I < N) { + var k = 1; + c = text.charCodeAt(I++); + if (c === 10) eol = true; // \n + else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n + else if (c !== delimiterCode) continue; + return text.slice(j, I - k); + } + + // special case: last token before EOF + return text.slice(j); + } + + while ((t = token()) !== EOF) { + var a = []; + while (t !== EOL && t !== EOF) { + a.push(t); + t = token(); + } + if (f && (a = f(a, n++)) == null) continue; + rows.push(a); + } + + return rows; + } + + function format(rows, columns) { + if (columns == null) columns = inferColumns(rows); + return [columns.map(formatValue).join(delimiter)].concat(rows.map(function(row) { + return columns.map(function(column) { + return formatValue(row[column]); + }).join(delimiter); + })).join("\n"); + } + + function formatRows(rows) { + return rows.map(formatRow).join("\n"); + } + + function formatRow(row) { + return row.map(formatValue).join(delimiter); + } + + function formatValue(text) { + return text == null ? "" + : reFormat.test(text += "") ? "\"" + text.replace(/\"/g, "\"\"") + "\"" + : text; + } + + return { + parse: parse, + parseRows: parseRows, + format: format, + formatRows: formatRows + }; +}; + +var csv = dsv(","); + +var csvParse = csv.parse; +var csvParseRows = csv.parseRows; +var csvFormat = csv.format; +var csvFormatRows = csv.formatRows; + +var tsv = dsv("\t"); + +var tsvParse = tsv.parse; +var tsvParseRows = tsv.parseRows; +var tsvFormat = tsv.format; +var tsvFormatRows = tsv.formatRows; + +var center$1 = function(x, y) { + var nodes; + + if (x == null) x = 0; + if (y == null) y = 0; + + function force() { + var i, + n = nodes.length, + node, + sx = 0, + sy = 0; + + for (i = 0; i < n; ++i) { + node = nodes[i], sx += node.x, sy += node.y; + } + + for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) { + node = nodes[i], node.x -= sx, node.y -= sy; + } + } + + force.initialize = function(_) { + nodes = _; + }; + + force.x = function(_) { + return arguments.length ? (x = +_, force) : x; + }; + + force.y = function(_) { + return arguments.length ? (y = +_, force) : y; + }; + + return force; +}; + +var constant$6 = function(x) { + return function() { + return x; + }; +}; + +var jiggle = function() { + return (Math.random() - 0.5) * 1e-6; +}; + +var tree_add = function(d) { + var x = +this._x.call(null, d), + y = +this._y.call(null, d); + return add(this.cover(x, y), x, y, d); +}; + +function add(tree, x, y, d) { + if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points + + var parent, + node = tree._root, + leaf = {data: d}, + x0 = tree._x0, + y0 = tree._y0, + x1 = tree._x1, + y1 = tree._y1, + xm, + ym, + xp, + yp, + right, + bottom, + i, + j; + + // If the tree is empty, initialize the root as a leaf. + if (!node) return tree._root = leaf, tree; + + // Find the existing leaf for the new point, or add it. + while (node.length) { + if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; + if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; + if (parent = node, !(node = node[i = bottom << 1 | right])) return parent[i] = leaf, tree; + } + + // Is the new point is exactly coincident with the existing point? + xp = +tree._x.call(null, node.data); + yp = +tree._y.call(null, node.data); + if (x === xp && y === yp) return leaf.next = node, parent ? parent[i] = leaf : tree._root = leaf, tree; + + // Otherwise, split the leaf node until the old and new point are separated. + do { + parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4); + if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; + if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; + } while ((i = bottom << 1 | right) === (j = (yp >= ym) << 1 | (xp >= xm))); + return parent[j] = node, parent[i] = leaf, tree; +} + +function addAll(data) { + var d, i, n = data.length, + x, + y, + xz = new Array(n), + yz = new Array(n), + x0 = Infinity, + y0 = Infinity, + x1 = -Infinity, + y1 = -Infinity; + + // Compute the points and their extent. + for (i = 0; i < n; ++i) { + if (isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d))) continue; + xz[i] = x; + yz[i] = y; + if (x < x0) x0 = x; + if (x > x1) x1 = x; + if (y < y0) y0 = y; + if (y > y1) y1 = y; + } + + // If there were no (valid) points, inherit the existing extent. + if (x1 < x0) x0 = this._x0, x1 = this._x1; + if (y1 < y0) y0 = this._y0, y1 = this._y1; + + // Expand the tree to cover the new points. + this.cover(x0, y0).cover(x1, y1); + + // Add the new points. + for (i = 0; i < n; ++i) { + add(this, xz[i], yz[i], data[i]); + } + + return this; +} + +var tree_cover = function(x, y) { + if (isNaN(x = +x) || isNaN(y = +y)) return this; // ignore invalid points + + var x0 = this._x0, + y0 = this._y0, + x1 = this._x1, + y1 = this._y1; + + // If the quadtree has no extent, initialize them. + // Integer extent are necessary so that if we later double the extent, + // the existing quadrant boundaries don’t change due to floating point error! + if (isNaN(x0)) { + x1 = (x0 = Math.floor(x)) + 1; + y1 = (y0 = Math.floor(y)) + 1; + } + + // Otherwise, double repeatedly to cover. + else if (x0 > x || x > x1 || y0 > y || y > y1) { + var z = x1 - x0, + node = this._root, + parent, + i; + + switch (i = (y < (y0 + y1) / 2) << 1 | (x < (x0 + x1) / 2)) { + case 0: { + do parent = new Array(4), parent[i] = node, node = parent; + while (z *= 2, x1 = x0 + z, y1 = y0 + z, x > x1 || y > y1); + break; + } + case 1: { + do parent = new Array(4), parent[i] = node, node = parent; + while (z *= 2, x0 = x1 - z, y1 = y0 + z, x0 > x || y > y1); + break; + } + case 2: { + do parent = new Array(4), parent[i] = node, node = parent; + while (z *= 2, x1 = x0 + z, y0 = y1 - z, x > x1 || y0 > y); + break; + } + case 3: { + do parent = new Array(4), parent[i] = node, node = parent; + while (z *= 2, x0 = x1 - z, y0 = y1 - z, x0 > x || y0 > y); + break; + } + } + + if (this._root && this._root.length) this._root = node; + } + + // If the quadtree covers the point already, just return. + else return this; + + this._x0 = x0; + this._y0 = y0; + this._x1 = x1; + this._y1 = y1; + return this; +}; + +var tree_data = function() { + var data = []; + this.visit(function(node) { + if (!node.length) do data.push(node.data); while (node = node.next) + }); + return data; +}; + +var tree_extent = function(_) { + return arguments.length + ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) + : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]]; +}; + +var Quad = function(node, x0, y0, x1, y1) { + this.node = node; + this.x0 = x0; + this.y0 = y0; + this.x1 = x1; + this.y1 = y1; +}; + +var tree_find = function(x, y, radius) { + var data, + x0 = this._x0, + y0 = this._y0, + x1, + y1, + x2, + y2, + x3 = this._x1, + y3 = this._y1, + quads = [], + node = this._root, + q, + i; + + if (node) quads.push(new Quad(node, x0, y0, x3, y3)); + if (radius == null) radius = Infinity; + else { + x0 = x - radius, y0 = y - radius; + x3 = x + radius, y3 = y + radius; + radius *= radius; + } + + while (q = quads.pop()) { + + // Stop searching if this quadrant can’t contain a closer node. + if (!(node = q.node) + || (x1 = q.x0) > x3 + || (y1 = q.y0) > y3 + || (x2 = q.x1) < x0 + || (y2 = q.y1) < y0) continue; + + // Bisect the current quadrant. + if (node.length) { + var xm = (x1 + x2) / 2, + ym = (y1 + y2) / 2; + + quads.push( + new Quad(node[3], xm, ym, x2, y2), + new Quad(node[2], x1, ym, xm, y2), + new Quad(node[1], xm, y1, x2, ym), + new Quad(node[0], x1, y1, xm, ym) + ); + + // Visit the closest quadrant first. + if (i = (y >= ym) << 1 | (x >= xm)) { + q = quads[quads.length - 1]; + quads[quads.length - 1] = quads[quads.length - 1 - i]; + quads[quads.length - 1 - i] = q; + } + } + + // Visit this point. (Visiting coincident points isn’t necessary!) + else { + var dx = x - +this._x.call(null, node.data), + dy = y - +this._y.call(null, node.data), + d2 = dx * dx + dy * dy; + if (d2 < radius) { + var d = Math.sqrt(radius = d2); + x0 = x - d, y0 = y - d; + x3 = x + d, y3 = y + d; + data = node.data; + } + } + } + + return data; +}; + +var tree_remove = function(d) { + if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points + + var parent, + node = this._root, + retainer, + previous, + next, + x0 = this._x0, + y0 = this._y0, + x1 = this._x1, + y1 = this._y1, + x, + y, + xm, + ym, + right, + bottom, + i, + j; + + // If the tree is empty, initialize the root as a leaf. + if (!node) return this; + + // Find the leaf node for the point. + // While descending, also retain the deepest parent with a non-removed sibling. + if (node.length) while (true) { + if (right = x >= (xm = (x0 + x1) / 2)) x0 = xm; else x1 = xm; + if (bottom = y >= (ym = (y0 + y1) / 2)) y0 = ym; else y1 = ym; + if (!(parent = node, node = node[i = bottom << 1 | right])) return this; + if (!node.length) break; + if (parent[(i + 1) & 3] || parent[(i + 2) & 3] || parent[(i + 3) & 3]) retainer = parent, j = i; + } + + // Find the point to remove. + while (node.data !== d) if (!(previous = node, node = node.next)) return this; + if (next = node.next) delete node.next; + + // If there are multiple coincident points, remove just the point. + if (previous) return (next ? previous.next = next : delete previous.next), this; + + // If this is the root point, remove it. + if (!parent) return this._root = next, this; + + // Remove this leaf. + next ? parent[i] = next : delete parent[i]; + + // If the parent now contains exactly one leaf, collapse superfluous parents. + if ((node = parent[0] || parent[1] || parent[2] || parent[3]) + && node === (parent[3] || parent[2] || parent[1] || parent[0]) + && !node.length) { + if (retainer) retainer[j] = node; + else this._root = node; + } + + return this; +}; + +function removeAll(data) { + for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); + return this; +} + +var tree_root = function() { + return this._root; +}; + +var tree_size = function() { + var size = 0; + this.visit(function(node) { + if (!node.length) do ++size; while (node = node.next) + }); + return size; +}; + +var tree_visit = function(callback) { + var quads = [], q, node = this._root, child, x0, y0, x1, y1; + if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) { + var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; + if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); + if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); + if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); + if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); + } + } + return this; +}; + +var tree_visitAfter = function(callback) { + var quads = [], next = [], q; + if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); + while (q = quads.pop()) { + var node = q.node; + if (node.length) { + var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2; + if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); + if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); + if (child = node[2]) quads.push(new Quad(child, x0, ym, xm, y1)); + if (child = node[3]) quads.push(new Quad(child, xm, ym, x1, y1)); + } + next.push(q); + } + while (q = next.pop()) { + callback(q.node, q.x0, q.y0, q.x1, q.y1); + } + return this; +}; + +function defaultX(d) { + return d[0]; +} + +var tree_x = function(_) { + return arguments.length ? (this._x = _, this) : this._x; +}; + +function defaultY(d) { + return d[1]; +} + +var tree_y = function(_) { + return arguments.length ? (this._y = _, this) : this._y; +}; + +function quadtree(nodes, x, y) { + var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); + return nodes == null ? tree : tree.addAll(nodes); +} + +function Quadtree(x, y, x0, y0, x1, y1) { + this._x = x; + this._y = y; + this._x0 = x0; + this._y0 = y0; + this._x1 = x1; + this._y1 = y1; + this._root = undefined; +} + +function leaf_copy(leaf) { + var copy = {data: leaf.data}, next = copy; + while (leaf = leaf.next) next = next.next = {data: leaf.data}; + return copy; +} + +var treeProto = quadtree.prototype = Quadtree.prototype; + +treeProto.copy = function() { + var copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), + node = this._root, + nodes, + child; + + if (!node) return copy; + + if (!node.length) return copy._root = leaf_copy(node), copy; + + nodes = [{source: node, target: copy._root = new Array(4)}]; + while (node = nodes.pop()) { + for (var i = 0; i < 4; ++i) { + if (child = node.source[i]) { + if (child.length) nodes.push({source: child, target: node.target[i] = new Array(4)}); + else node.target[i] = leaf_copy(child); + } + } + } + + return copy; +}; + +treeProto.add = tree_add; +treeProto.addAll = addAll; +treeProto.cover = tree_cover; +treeProto.data = tree_data; +treeProto.extent = tree_extent; +treeProto.find = tree_find; +treeProto.remove = tree_remove; +treeProto.removeAll = removeAll; +treeProto.root = tree_root; +treeProto.size = tree_size; +treeProto.visit = tree_visit; +treeProto.visitAfter = tree_visitAfter; +treeProto.x = tree_x; +treeProto.y = tree_y; + +function x(d) { + return d.x + d.vx; +} + +function y(d) { + return d.y + d.vy; +} + +var collide = function(radius) { + var nodes, + radii, + strength = 1, + iterations = 1; + + if (typeof radius !== "function") radius = constant$6(radius == null ? 1 : +radius); + + function force() { + var i, n = nodes.length, + tree, + node, + xi, + yi, + ri, + ri2; + + for (var k = 0; k < iterations; ++k) { + tree = quadtree(nodes, x, y).visitAfter(prepare); + for (i = 0; i < n; ++i) { + node = nodes[i]; + ri = radii[node.index], ri2 = ri * ri; + xi = node.x + node.vx; + yi = node.y + node.vy; + tree.visit(apply); + } + } + + function apply(quad, x0, y0, x1, y1) { + var data = quad.data, rj = quad.r, r = ri + rj; + if (data) { + if (data.index > node.index) { + var x = xi - data.x - data.vx, + y = yi - data.y - data.vy, + l = x * x + y * y; + if (l < r * r) { + if (x === 0) x = jiggle(), l += x * x; + if (y === 0) y = jiggle(), l += y * y; + l = (r - (l = Math.sqrt(l))) / l * strength; + node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)); + node.vy += (y *= l) * r; + data.vx -= x * (r = 1 - r); + data.vy -= y * r; + } + } + return; + } + return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r; + } + } + + function prepare(quad) { + if (quad.data) return quad.r = radii[quad.data.index]; + for (var i = quad.r = 0; i < 4; ++i) { + if (quad[i] && quad[i].r > quad.r) { + quad.r = quad[i].r; + } + } + } + + function initialize() { + if (!nodes) return; + var i, n = nodes.length, node; + radii = new Array(n); + for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes); + } + + force.initialize = function(_) { + nodes = _; + initialize(); + }; + + force.iterations = function(_) { + return arguments.length ? (iterations = +_, force) : iterations; + }; + + force.strength = function(_) { + return arguments.length ? (strength = +_, force) : strength; + }; + + force.radius = function(_) { + return arguments.length ? (radius = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : radius; + }; + + return force; +}; + +function index(d) { + return d.index; +} + +function find(nodeById, nodeId) { + var node = nodeById.get(nodeId); + if (!node) throw new Error("missing: " + nodeId); + return node; +} + +var link = function(links) { + var id = index, + strength = defaultStrength, + strengths, + distance = constant$6(30), + distances, + nodes, + count, + bias, + iterations = 1; + + if (links == null) links = []; + + function defaultStrength(link) { + return 1 / Math.min(count[link.source.index], count[link.target.index]); + } + + function force(alpha) { + for (var k = 0, n = links.length; k < iterations; ++k) { + for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) { + link = links[i], source = link.source, target = link.target; + x = target.x + target.vx - source.x - source.vx || jiggle(); + y = target.y + target.vy - source.y - source.vy || jiggle(); + l = Math.sqrt(x * x + y * y); + l = (l - distances[i]) / l * alpha * strengths[i]; + x *= l, y *= l; + target.vx -= x * (b = bias[i]); + target.vy -= y * b; + source.vx += x * (b = 1 - b); + source.vy += y * b; + } + } + } + + function initialize() { + if (!nodes) return; + + var i, + n = nodes.length, + m = links.length, + nodeById = map$1(nodes, id), + link; + + for (i = 0, count = new Array(n); i < m; ++i) { + link = links[i], link.index = i; + if (typeof link.source !== "object") link.source = find(nodeById, link.source); + if (typeof link.target !== "object") link.target = find(nodeById, link.target); + count[link.source.index] = (count[link.source.index] || 0) + 1; + count[link.target.index] = (count[link.target.index] || 0) + 1; + } + + for (i = 0, bias = new Array(m); i < m; ++i) { + link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); + } + + strengths = new Array(m), initializeStrength(); + distances = new Array(m), initializeDistance(); + } + + function initializeStrength() { + if (!nodes) return; + + for (var i = 0, n = links.length; i < n; ++i) { + strengths[i] = +strength(links[i], i, links); + } + } + + function initializeDistance() { + if (!nodes) return; + + for (var i = 0, n = links.length; i < n; ++i) { + distances[i] = +distance(links[i], i, links); + } + } + + force.initialize = function(_) { + nodes = _; + initialize(); + }; + + force.links = function(_) { + return arguments.length ? (links = _, initialize(), force) : links; + }; + + force.id = function(_) { + return arguments.length ? (id = _, force) : id; + }; + + force.iterations = function(_) { + return arguments.length ? (iterations = +_, force) : iterations; + }; + + force.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initializeStrength(), force) : strength; + }; + + force.distance = function(_) { + return arguments.length ? (distance = typeof _ === "function" ? _ : constant$6(+_), initializeDistance(), force) : distance; + }; + + return force; +}; + +function x$1(d) { + return d.x; +} + +function y$1(d) { + return d.y; +} + +var initialRadius = 10; +var initialAngle = Math.PI * (3 - Math.sqrt(5)); + +var simulation = function(nodes) { + var simulation, + alpha = 1, + alphaMin = 0.001, + alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), + alphaTarget = 0, + velocityDecay = 0.6, + forces = map$1(), + stepper = timer(step), + event = dispatch("tick", "end"); + + if (nodes == null) nodes = []; + + function step() { + tick(); + event.call("tick", simulation); + if (alpha < alphaMin) { + stepper.stop(); + event.call("end", simulation); + } + } + + function tick() { + var i, n = nodes.length, node; + + alpha += (alphaTarget - alpha) * alphaDecay; + + forces.each(function(force) { + force(alpha); + }); + + for (i = 0; i < n; ++i) { + node = nodes[i]; + if (node.fx == null) node.x += node.vx *= velocityDecay; + else node.x = node.fx, node.vx = 0; + if (node.fy == null) node.y += node.vy *= velocityDecay; + else node.y = node.fy, node.vy = 0; + } + } + + function initializeNodes() { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.index = i; + if (isNaN(node.x) || isNaN(node.y)) { + var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle; + node.x = radius * Math.cos(angle); + node.y = radius * Math.sin(angle); + } + if (isNaN(node.vx) || isNaN(node.vy)) { + node.vx = node.vy = 0; + } + } + } + + function initializeForce(force) { + if (force.initialize) force.initialize(nodes); + return force; + } + + initializeNodes(); + + return simulation = { + tick: tick, + + restart: function() { + return stepper.restart(step), simulation; + }, + + stop: function() { + return stepper.stop(), simulation; + }, + + nodes: function(_) { + return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes; + }, + + alpha: function(_) { + return arguments.length ? (alpha = +_, simulation) : alpha; + }, + + alphaMin: function(_) { + return arguments.length ? (alphaMin = +_, simulation) : alphaMin; + }, + + alphaDecay: function(_) { + return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay; + }, + + alphaTarget: function(_) { + return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget; + }, + + velocityDecay: function(_) { + return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay; + }, + + force: function(name, _) { + return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name); + }, + + find: function(x, y, radius) { + var i = 0, + n = nodes.length, + dx, + dy, + d2, + node, + closest; + + if (radius == null) radius = Infinity; + else radius *= radius; + + for (i = 0; i < n; ++i) { + node = nodes[i]; + dx = x - node.x; + dy = y - node.y; + d2 = dx * dx + dy * dy; + if (d2 < radius) closest = node, radius = d2; + } + + return closest; + }, + + on: function(name, _) { + return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); + } + }; +}; + +var manyBody = function() { + var nodes, + node, + alpha, + strength = constant$6(-30), + strengths, + distanceMin2 = 1, + distanceMax2 = Infinity, + theta2 = 0.81; + + function force(_) { + var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate); + for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply); + } + + function initialize() { + if (!nodes) return; + var i, n = nodes.length, node; + strengths = new Array(n); + for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes); + } + + function accumulate(quad) { + var strength = 0, q, c, x$$1, y$$1, i; + + // For internal nodes, accumulate forces from child quadrants. + if (quad.length) { + for (x$$1 = y$$1 = i = 0; i < 4; ++i) { + if ((q = quad[i]) && (c = q.value)) { + strength += c, x$$1 += c * q.x, y$$1 += c * q.y; + } + } + quad.x = x$$1 / strength; + quad.y = y$$1 / strength; + } + + // For leaf nodes, accumulate forces from coincident quadrants. + else { + q = quad; + q.x = q.data.x; + q.y = q.data.y; + do strength += strengths[q.data.index]; + while (q = q.next); + } + + quad.value = strength; + } + + function apply(quad, x1, _, x2) { + if (!quad.value) return true; + + var x$$1 = quad.x - node.x, + y$$1 = quad.y - node.y, + w = x2 - x1, + l = x$$1 * x$$1 + y$$1 * y$$1; + + // Apply the Barnes-Hut approximation if possible. + // Limit forces for very close nodes; randomize direction if coincident. + if (w * w / theta2 < l) { + if (l < distanceMax2) { + if (x$$1 === 0) x$$1 = jiggle(), l += x$$1 * x$$1; + if (y$$1 === 0) y$$1 = jiggle(), l += y$$1 * y$$1; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + node.vx += x$$1 * quad.value * alpha / l; + node.vy += y$$1 * quad.value * alpha / l; + } + return true; + } + + // Otherwise, process points directly. + else if (quad.length || l >= distanceMax2) return; + + // Limit forces for very close nodes; randomize direction if coincident. + if (quad.data !== node || quad.next) { + if (x$$1 === 0) x$$1 = jiggle(), l += x$$1 * x$$1; + if (y$$1 === 0) y$$1 = jiggle(), l += y$$1 * y$$1; + if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); + } + + do if (quad.data !== node) { + w = strengths[quad.data.index] * alpha / l; + node.vx += x$$1 * w; + node.vy += y$$1 * w; + } while (quad = quad.next); + } + + force.initialize = function(_) { + nodes = _; + initialize(); + }; + + force.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength; + }; + + force.distanceMin = function(_) { + return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2); + }; + + force.distanceMax = function(_) { + return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2); + }; + + force.theta = function(_) { + return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); + }; + + return force; +}; + +var x$2 = function(x) { + var strength = constant$6(0.1), + nodes, + strengths, + xz; + + if (typeof x !== "function") x = constant$6(x == null ? 0 : +x); + + function force(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha; + } + } + + function initialize() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + xz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + + force.initialize = function(_) { + nodes = _; + initialize(); + }; + + force.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength; + }; + + force.x = function(_) { + return arguments.length ? (x = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : x; + }; + + return force; +}; + +var y$2 = function(y) { + var strength = constant$6(0.1), + nodes, + strengths, + yz; + + if (typeof y !== "function") y = constant$6(y == null ? 0 : +y); + + function force(alpha) { + for (var i = 0, n = nodes.length, node; i < n; ++i) { + node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha; + } + } + + function initialize() { + if (!nodes) return; + var i, n = nodes.length; + strengths = new Array(n); + yz = new Array(n); + for (i = 0; i < n; ++i) { + strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); + } + } + + force.initialize = function(_) { + nodes = _; + initialize(); + }; + + force.strength = function(_) { + return arguments.length ? (strength = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : strength; + }; + + force.y = function(_) { + return arguments.length ? (y = typeof _ === "function" ? _ : constant$6(+_), initialize(), force) : y; + }; + + return force; +}; + +// Computes the decimal coefficient and exponent of the specified number x with +// significant digits p, where x is positive and p is in [1, 21] or undefined. +// For example, formatDecimal(1.23) returns ["123", 0]. +var formatDecimal = function(x, p) { + if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity + var i, coefficient = x.slice(0, i); + + // The string returned by toExponential either has the form \d\.\d+e[-+]\d+ + // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). + return [ + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x.slice(i + 1) + ]; +}; + +var exponent$1 = function(x) { + return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; +}; + +var formatGroup = function(grouping, thousands) { + return function(value, width) { + var i = value.length, + t = [], + j = 0, + g = grouping[0], + length = 0; + + while (i > 0 && g > 0) { + if (length + g + 1 > width) g = Math.max(1, width - length); + t.push(value.substring(i -= g, i + g)); + if ((length += g + 1) > width) break; + g = grouping[j = (j + 1) % grouping.length]; + } + + return t.reverse().join(thousands); + }; +}; + +var formatNumerals = function(numerals) { + return function(value) { + return value.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; +}; + +var formatDefault = function(x, p) { + x = x.toPrecision(p); + + out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (x[i]) { + case ".": i0 = i1 = i; break; + case "0": if (i0 === 0) i0 = i; i1 = i; break; + case "e": break out; + default: if (i0 > 0) i0 = 0; break; + } + } + + return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; +}; + +var prefixExponent; + +var formatPrefixAuto = function(x, p) { + var d = formatDecimal(x, p); + if (!d) return x + ""; + var coefficient = d[0], + exponent = d[1], + i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, + n = coefficient.length; + return i === n ? coefficient + : i > n ? coefficient + new Array(i - n + 1).join("0") + : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) + : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y! +}; + +var formatRounded = function(x, p) { + var d = formatDecimal(x, p); + if (!d) return x + ""; + var coefficient = d[0], + exponent = d[1]; + return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient + : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) + : coefficient + new Array(exponent - coefficient.length + 2).join("0"); +}; + +var formatTypes = { + "": formatDefault, + "%": function(x, p) { return (x * 100).toFixed(p); }, + "b": function(x) { return Math.round(x).toString(2); }, + "c": function(x) { return x + ""; }, + "d": function(x) { return Math.round(x).toString(10); }, + "e": function(x, p) { return x.toExponential(p); }, + "f": function(x, p) { return x.toFixed(p); }, + "g": function(x, p) { return x.toPrecision(p); }, + "o": function(x) { return Math.round(x).toString(8); }, + "p": function(x, p) { return formatRounded(x * 100, p); }, + "r": formatRounded, + "s": formatPrefixAuto, + "X": function(x) { return Math.round(x).toString(16).toUpperCase(); }, + "x": function(x) { return Math.round(x).toString(16); } +}; + +// [[fill]align][sign][symbol][0][width][,][.precision][type] +var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; + +function formatSpecifier(specifier) { + return new FormatSpecifier(specifier); +} + +formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof + +function FormatSpecifier(specifier) { + if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); + + var match, + fill = match[1] || " ", + align = match[2] || ">", + sign = match[3] || "-", + symbol = match[4] || "", + zero = !!match[5], + width = match[6] && +match[6], + comma = !!match[7], + precision = match[8] && +match[8].slice(1), + type = match[9] || ""; + + // The "n" type is an alias for ",g". + if (type === "n") comma = true, type = "g"; + + // Map invalid types to the default format. + else if (!formatTypes[type]) type = ""; + + // If zero fill is specified, padding goes after sign and before digits. + if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; + + this.fill = fill; + this.align = align; + this.sign = sign; + this.symbol = symbol; + this.zero = zero; + this.width = width; + this.comma = comma; + this.precision = precision; + this.type = type; +} + +FormatSpecifier.prototype.toString = function() { + return this.fill + + this.align + + this.sign + + this.symbol + + (this.zero ? "0" : "") + + (this.width == null ? "" : Math.max(1, this.width | 0)) + + (this.comma ? "," : "") + + (this.precision == null ? "" : "." + Math.max(0, this.precision | 0)) + + this.type; +}; + +var identity$3 = function(x) { + return x; +}; + +var prefixes = ["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"]; + +var formatLocale = function(locale) { + var group = locale.grouping && locale.thousands ? formatGroup(locale.grouping, locale.thousands) : identity$3, + currency = locale.currency, + decimal = locale.decimal, + numerals = locale.numerals ? formatNumerals(locale.numerals) : identity$3, + percent = locale.percent || "%"; + + function newFormat(specifier) { + specifier = formatSpecifier(specifier); + + var fill = specifier.fill, + align = specifier.align, + sign = specifier.sign, + symbol = specifier.symbol, + zero = specifier.zero, + width = specifier.width, + comma = specifier.comma, + precision = specifier.precision, + type = specifier.type; + + // Compute the prefix and suffix. + // For SI-prefix, the suffix is lazily computed. + var prefix = symbol === "$" ? currency[0] : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", + suffix = symbol === "$" ? currency[1] : /[%p]/.test(type) ? percent : ""; + + // What format function should we use? + // Is this an integer type? + // Can this type generate exponential notation? + var formatType = formatTypes[type], + maybeSuffix = !type || /[defgprs%]/.test(type); + + // Set the default precision if not specified, + // or clamp the specified precision to the supported range. + // For significant precision, it must be in [1, 21]. + // For fixed precision, it must be in [0, 20]. + precision = precision == null ? (type ? 6 : 12) + : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) + : Math.max(0, Math.min(20, precision)); + + function format(value) { + var valuePrefix = prefix, + valueSuffix = suffix, + i, n, c; + + if (type === "c") { + valueSuffix = formatType(value) + valueSuffix; + value = ""; + } else { + value = +value; + + // Perform the initial formatting. + var valueNegative = value < 0; + value = formatType(Math.abs(value), precision); + + // If a negative value rounds to zero during formatting, treat as positive. + if (valueNegative && +value === 0) valueNegative = false; + + // Compute the prefix and suffix. + valuePrefix = (valueNegative ? (sign === "(" ? sign : "-") : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; + valueSuffix = valueSuffix + (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + (valueNegative && sign === "(" ? ")" : ""); + + // Break the formatted value into the integer “value” part that can be + // grouped, and fractional or exponential “suffix” part that is not. + if (maybeSuffix) { + i = -1, n = value.length; + while (++i < n) { + if (c = value.charCodeAt(i), 48 > c || c > 57) { + valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; + value = value.slice(0, i); + break; + } + } + } + } + + // If the fill character is not "0", grouping is applied before padding. + if (comma && !zero) value = group(value, Infinity); + + // Compute the padding. + var length = valuePrefix.length + value.length + valueSuffix.length, + padding = length < width ? new Array(width - length + 1).join(fill) : ""; + + // If the fill character is "0", grouping is applied after padding. + if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; + + // Reconstruct the final output based on the desired alignment. + switch (align) { + case "<": value = valuePrefix + value + valueSuffix + padding; break; + case "=": value = valuePrefix + padding + value + valueSuffix; break; + case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; + default: value = padding + valuePrefix + value + valueSuffix; break; + } + + return numerals(value); + } + + format.toString = function() { + return specifier + ""; + }; + + return format; + } + + function formatPrefix(specifier, value) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), + e = Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3, + k = Math.pow(10, -e), + prefix = prefixes[8 + e / 3]; + return function(value) { + return f(k * value) + prefix; + }; + } + + return { + format: newFormat, + formatPrefix: formatPrefix + }; +}; + +var locale$1; + + + +defaultLocale({ + decimal: ".", + thousands: ",", + grouping: [3], + currency: ["$", ""] +}); + +function defaultLocale(definition) { + locale$1 = formatLocale(definition); + exports.format = locale$1.format; + exports.formatPrefix = locale$1.formatPrefix; + return locale$1; +} + +var precisionFixed = function(step) { + return Math.max(0, -exponent$1(Math.abs(step))); +}; + +var precisionPrefix = function(step, value) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step))); +}; + +var precisionRound = function(step, max) { + step = Math.abs(step), max = Math.abs(max) - step; + return Math.max(0, exponent$1(max) - exponent$1(step)) + 1; +}; + +// Adds floating point numbers with twice the normal precision. +// Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and +// Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) +// 305–363 (1997). +// Code adapted from GeographicLib by Charles F. F. Karney, +// http://geographiclib.sourceforge.net/ + +var adder = function() { + return new Adder; +}; + +function Adder() { + this.reset(); +} + +Adder.prototype = { + constructor: Adder, + reset: function() { + this.s = // rounded value + this.t = 0; // exact error + }, + add: function(y) { + add$1(temp, y, this.t); + add$1(this, temp.s, this.s); + if (this.s) this.t += temp.t; + else this.s = temp.t; + }, + valueOf: function() { + return this.s; + } +}; + +var temp = new Adder; + +function add$1(adder, a, b) { + var x = adder.s = a + b, + bv = x - a, + av = x - bv; + adder.t = (a - av) + (b - bv); +} + +var epsilon$2 = 1e-6; +var epsilon2$1 = 1e-12; +var pi$3 = Math.PI; +var halfPi$2 = pi$3 / 2; +var quarterPi = pi$3 / 4; +var tau$3 = pi$3 * 2; + +var degrees$1 = 180 / pi$3; +var radians = pi$3 / 180; + +var abs = Math.abs; +var atan = Math.atan; +var atan2 = Math.atan2; +var cos$1 = Math.cos; +var ceil = Math.ceil; +var exp = Math.exp; + +var log = Math.log; +var pow = Math.pow; +var sin$1 = Math.sin; +var sign = Math.sign || function(x) { return x > 0 ? 1 : x < 0 ? -1 : 0; }; +var sqrt = Math.sqrt; +var tan = Math.tan; + +function acos(x) { + return x > 1 ? 0 : x < -1 ? pi$3 : Math.acos(x); +} + +function asin(x) { + return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x); +} + +function haversin(x) { + return (x = sin$1(x / 2)) * x; +} + +function noop$1() {} + +function streamGeometry(geometry, stream) { + if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { + streamGeometryType[geometry.type](geometry, stream); + } +} + +var streamObjectType = { + Feature: function(object, stream) { + streamGeometry(object.geometry, stream); + }, + FeatureCollection: function(object, stream) { + var features = object.features, i = -1, n = features.length; + while (++i < n) streamGeometry(features[i].geometry, stream); + } +}; + +var streamGeometryType = { + Sphere: function(object, stream) { + stream.sphere(); + }, + Point: function(object, stream) { + object = object.coordinates; + stream.point(object[0], object[1], object[2]); + }, + MultiPoint: function(object, stream) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) object = coordinates[i], stream.point(object[0], object[1], object[2]); + }, + LineString: function(object, stream) { + streamLine(object.coordinates, stream, 0); + }, + MultiLineString: function(object, stream) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamLine(coordinates[i], stream, 0); + }, + Polygon: function(object, stream) { + streamPolygon(object.coordinates, stream); + }, + MultiPolygon: function(object, stream) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) streamPolygon(coordinates[i], stream); + }, + GeometryCollection: function(object, stream) { + var geometries = object.geometries, i = -1, n = geometries.length; + while (++i < n) streamGeometry(geometries[i], stream); + } +}; + +function streamLine(coordinates, stream, closed) { + var i = -1, n = coordinates.length - closed, coordinate; + stream.lineStart(); + while (++i < n) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); + stream.lineEnd(); +} + +function streamPolygon(coordinates, stream) { + var i = -1, n = coordinates.length; + stream.polygonStart(); + while (++i < n) streamLine(coordinates[i], stream, 1); + stream.polygonEnd(); +} + +var geoStream = function(object, stream) { + if (object && streamObjectType.hasOwnProperty(object.type)) { + streamObjectType[object.type](object, stream); + } else { + streamGeometry(object, stream); + } +}; + +var areaRingSum = adder(); + +var areaSum = adder(); +var lambda00; +var phi00; +var lambda0; +var cosPhi0; +var sinPhi0; + +var areaStream = { + point: noop$1, + lineStart: noop$1, + lineEnd: noop$1, + polygonStart: function() { + areaRingSum.reset(); + areaStream.lineStart = areaRingStart; + areaStream.lineEnd = areaRingEnd; + }, + polygonEnd: function() { + var areaRing = +areaRingSum; + areaSum.add(areaRing < 0 ? tau$3 + areaRing : areaRing); + this.lineStart = this.lineEnd = this.point = noop$1; + }, + sphere: function() { + areaSum.add(tau$3); + } +}; + +function areaRingStart() { + areaStream.point = areaPointFirst; +} + +function areaRingEnd() { + areaPoint(lambda00, phi00); +} + +function areaPointFirst(lambda, phi) { + areaStream.point = areaPoint; + lambda00 = lambda, phi00 = phi; + lambda *= radians, phi *= radians; + lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi); +} + +function areaPoint(lambda, phi) { + lambda *= radians, phi *= radians; + phi = phi / 2 + quarterPi; // half the angular distance from south pole + + // Spherical excess E for a spherical triangle with vertices: south pole, + // previous point, current point. Uses a formula derived from Cagnoli’s + // theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2). + var dLambda = lambda - lambda0, + sdLambda = dLambda >= 0 ? 1 : -1, + adLambda = sdLambda * dLambda, + cosPhi = cos$1(phi), + sinPhi = sin$1(phi), + k = sinPhi0 * sinPhi, + u = cosPhi0 * cosPhi + k * cos$1(adLambda), + v = k * sdLambda * sin$1(adLambda); + areaRingSum.add(atan2(v, u)); + + // Advance the previous points. + lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi; +} + +var area = function(object) { + areaSum.reset(); + geoStream(object, areaStream); + return areaSum * 2; +}; + +function spherical(cartesian) { + return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])]; +} + +function cartesian(spherical) { + var lambda = spherical[0], phi = spherical[1], cosPhi = cos$1(phi); + return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)]; +} + +function cartesianDot(a, b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; +} + +function cartesianCross(a, b) { + return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]; +} + +// TODO return a +function cartesianAddInPlace(a, b) { + a[0] += b[0], a[1] += b[1], a[2] += b[2]; +} + +function cartesianScale(vector, k) { + return [vector[0] * k, vector[1] * k, vector[2] * k]; +} + +// TODO return d +function cartesianNormalizeInPlace(d) { + var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); + d[0] /= l, d[1] /= l, d[2] /= l; +} + +var lambda0$1; +var phi0; +var lambda1; +var phi1; +var lambda2; +var lambda00$1; +var phi00$1; +var p0; +var deltaSum = adder(); +var ranges; +var range; + +var boundsStream = { + point: boundsPoint, + lineStart: boundsLineStart, + lineEnd: boundsLineEnd, + polygonStart: function() { + boundsStream.point = boundsRingPoint; + boundsStream.lineStart = boundsRingStart; + boundsStream.lineEnd = boundsRingEnd; + deltaSum.reset(); + areaStream.polygonStart(); + }, + polygonEnd: function() { + areaStream.polygonEnd(); + boundsStream.point = boundsPoint; + boundsStream.lineStart = boundsLineStart; + boundsStream.lineEnd = boundsLineEnd; + if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); + else if (deltaSum > epsilon$2) phi1 = 90; + else if (deltaSum < -epsilon$2) phi0 = -90; + range[0] = lambda0$1, range[1] = lambda1; + } +}; + +function boundsPoint(lambda, phi) { + ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); + if (phi < phi0) phi0 = phi; + if (phi > phi1) phi1 = phi; +} + +function linePoint(lambda, phi) { + var p = cartesian([lambda * radians, phi * radians]); + if (p0) { + var normal = cartesianCross(p0, p), + equatorial = [normal[1], -normal[0], 0], + inflection = cartesianCross(equatorial, normal); + cartesianNormalizeInPlace(inflection); + inflection = spherical(inflection); + var delta = lambda - lambda2, + sign$$1 = delta > 0 ? 1 : -1, + lambdai = inflection[0] * degrees$1 * sign$$1, + phii, + antimeridian = abs(delta) > 180; + if (antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) { + phii = inflection[1] * degrees$1; + if (phii > phi1) phi1 = phii; + } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda)) { + phii = -inflection[1] * degrees$1; + if (phii < phi0) phi0 = phii; + } else { + if (phi < phi0) phi0 = phi; + if (phi > phi1) phi1 = phi; + } + if (antimeridian) { + if (lambda < lambda2) { + if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; + } + } else { + if (lambda1 >= lambda0$1) { + if (lambda < lambda0$1) lambda0$1 = lambda; + if (lambda > lambda1) lambda1 = lambda; + } else { + if (lambda > lambda2) { + if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; + } else { + if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; + } + } + } + } else { + ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); + } + if (phi < phi0) phi0 = phi; + if (phi > phi1) phi1 = phi; + p0 = p, lambda2 = lambda; +} + +function boundsLineStart() { + boundsStream.point = linePoint; +} + +function boundsLineEnd() { + range[0] = lambda0$1, range[1] = lambda1; + boundsStream.point = boundsPoint; + p0 = null; +} + +function boundsRingPoint(lambda, phi) { + if (p0) { + var delta = lambda - lambda2; + deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); + } else { + lambda00$1 = lambda, phi00$1 = phi; + } + areaStream.point(lambda, phi); + linePoint(lambda, phi); +} + +function boundsRingStart() { + areaStream.lineStart(); +} + +function boundsRingEnd() { + boundsRingPoint(lambda00$1, phi00$1); + areaStream.lineEnd(); + if (abs(deltaSum) > epsilon$2) lambda0$1 = -(lambda1 = 180); + range[0] = lambda0$1, range[1] = lambda1; + p0 = null; +} + +// Finds the left-right distance between two longitudes. +// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want +// the distance between ±180° to be 360°. +function angle(lambda0, lambda1) { + return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1; +} + +function rangeCompare(a, b) { + return a[0] - b[0]; +} + +function rangeContains(range, x) { + return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x; +} + +var bounds = function(feature) { + var i, n, a, b, merged, deltaMax, delta; + + phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity); + ranges = []; + geoStream(feature, boundsStream); + + // First, sort ranges by their minimum longitudes. + if (n = ranges.length) { + ranges.sort(rangeCompare); + + // Then, merge any ranges that overlap. + for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) { + b = ranges[i]; + if (rangeContains(a, b[0]) || rangeContains(a, b[1])) { + if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1]; + if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0]; + } else { + merged.push(a = b); + } + } + + // Finally, find the largest gap between the merged ranges. + // The final bounding box will be the inverse of this gap. + for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) { + b = merged[i]; + if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1]; + } + } + + ranges = range = null; + + return lambda0$1 === Infinity || phi0 === Infinity + ? [[NaN, NaN], [NaN, NaN]] + : [[lambda0$1, phi0], [lambda1, phi1]]; +}; + +var W0; +var W1; +var X0; +var Y0; +var Z0; +var X1; +var Y1; +var Z1; +var X2; +var Y2; +var Z2; +var lambda00$2; +var phi00$2; +var x0; +var y0; +var z0; // previous point + +var centroidStream = { + sphere: noop$1, + point: centroidPoint, + lineStart: centroidLineStart, + lineEnd: centroidLineEnd, + polygonStart: function() { + centroidStream.lineStart = centroidRingStart; + centroidStream.lineEnd = centroidRingEnd; + }, + polygonEnd: function() { + centroidStream.lineStart = centroidLineStart; + centroidStream.lineEnd = centroidLineEnd; + } +}; + +// Arithmetic mean of Cartesian vectors. +function centroidPoint(lambda, phi) { + lambda *= radians, phi *= radians; + var cosPhi = cos$1(phi); + centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi)); +} + +function centroidPointCartesian(x, y, z) { + ++W0; + X0 += (x - X0) / W0; + Y0 += (y - Y0) / W0; + Z0 += (z - Z0) / W0; +} + +function centroidLineStart() { + centroidStream.point = centroidLinePointFirst; +} + +function centroidLinePointFirst(lambda, phi) { + lambda *= radians, phi *= radians; + var cosPhi = cos$1(phi); + x0 = cosPhi * cos$1(lambda); + y0 = cosPhi * sin$1(lambda); + z0 = sin$1(phi); + centroidStream.point = centroidLinePoint; + centroidPointCartesian(x0, y0, z0); +} + +function centroidLinePoint(lambda, phi) { + lambda *= radians, phi *= radians; + var cosPhi = cos$1(phi), + x = cosPhi * cos$1(lambda), + y = cosPhi * sin$1(lambda), + z = sin$1(phi), + w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z); + W1 += w; + X1 += w * (x0 + (x0 = x)); + Y1 += w * (y0 + (y0 = y)); + Z1 += w * (z0 + (z0 = z)); + centroidPointCartesian(x0, y0, z0); +} + +function centroidLineEnd() { + centroidStream.point = centroidPoint; +} + +// See J. E. Brock, The Inertia Tensor for a Spherical Triangle, +// J. Applied Mechanics 42, 239 (1975). +function centroidRingStart() { + centroidStream.point = centroidRingPointFirst; +} + +function centroidRingEnd() { + centroidRingPoint(lambda00$2, phi00$2); + centroidStream.point = centroidPoint; +} + +function centroidRingPointFirst(lambda, phi) { + lambda00$2 = lambda, phi00$2 = phi; + lambda *= radians, phi *= radians; + centroidStream.point = centroidRingPoint; + var cosPhi = cos$1(phi); + x0 = cosPhi * cos$1(lambda); + y0 = cosPhi * sin$1(lambda); + z0 = sin$1(phi); + centroidPointCartesian(x0, y0, z0); +} + +function centroidRingPoint(lambda, phi) { + lambda *= radians, phi *= radians; + var cosPhi = cos$1(phi), + x = cosPhi * cos$1(lambda), + y = cosPhi * sin$1(lambda), + z = sin$1(phi), + cx = y0 * z - z0 * y, + cy = z0 * x - x0 * z, + cz = x0 * y - y0 * x, + m = sqrt(cx * cx + cy * cy + cz * cz), + w = asin(m), // line weight = angle + v = m && -w / m; // area weight multiplier + X2 += v * cx; + Y2 += v * cy; + Z2 += v * cz; + W1 += w; + X1 += w * (x0 + (x0 = x)); + Y1 += w * (y0 + (y0 = y)); + Z1 += w * (z0 + (z0 = z)); + centroidPointCartesian(x0, y0, z0); +} + +var centroid = function(object) { + W0 = W1 = + X0 = Y0 = Z0 = + X1 = Y1 = Z1 = + X2 = Y2 = Z2 = 0; + geoStream(object, centroidStream); + + var x = X2, + y = Y2, + z = Z2, + m = x * x + y * y + z * z; + + // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid. + if (m < epsilon2$1) { + x = X1, y = Y1, z = Z1; + // If the feature has zero length, fall back to arithmetic mean of point vectors. + if (W1 < epsilon$2) x = X0, y = Y0, z = Z0; + m = x * x + y * y + z * z; + // If the feature still has an undefined ccentroid, then return. + if (m < epsilon2$1) return [NaN, NaN]; + } + + return [atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1]; +}; + +var constant$7 = function(x) { + return function() { + return x; + }; +}; + +var compose = function(a, b) { + + function compose(x, y) { + return x = a(x, y), b(x[0], x[1]); + } + + if (a.invert && b.invert) compose.invert = function(x, y) { + return x = b.invert(x, y), x && a.invert(x[0], x[1]); + }; + + return compose; +}; + +function rotationIdentity(lambda, phi) { + return [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi]; +} + +rotationIdentity.invert = rotationIdentity; + +function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { + return (deltaLambda %= tau$3) ? (deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) + : rotationLambda(deltaLambda)) + : (deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) + : rotationIdentity); +} + +function forwardRotationLambda(deltaLambda) { + return function(lambda, phi) { + return lambda += deltaLambda, [lambda > pi$3 ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi]; + }; +} + +function rotationLambda(deltaLambda) { + var rotation = forwardRotationLambda(deltaLambda); + rotation.invert = forwardRotationLambda(-deltaLambda); + return rotation; +} + +function rotationPhiGamma(deltaPhi, deltaGamma) { + var cosDeltaPhi = cos$1(deltaPhi), + sinDeltaPhi = sin$1(deltaPhi), + cosDeltaGamma = cos$1(deltaGamma), + sinDeltaGamma = sin$1(deltaGamma); + + function rotation(lambda, phi) { + var cosPhi = cos$1(phi), + x = cos$1(lambda) * cosPhi, + y = sin$1(lambda) * cosPhi, + z = sin$1(phi), + k = z * cosDeltaPhi + x * sinDeltaPhi; + return [ + atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), + asin(k * cosDeltaGamma + y * sinDeltaGamma) + ]; + } + + rotation.invert = function(lambda, phi) { + var cosPhi = cos$1(phi), + x = cos$1(lambda) * cosPhi, + y = sin$1(lambda) * cosPhi, + z = sin$1(phi), + k = z * cosDeltaGamma - y * sinDeltaGamma; + return [ + atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), + asin(k * cosDeltaPhi - x * sinDeltaPhi) + ]; + }; + + return rotation; +} + +var rotation = function(rotate) { + rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); + + function forward(coordinates) { + coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; + } + + forward.invert = function(coordinates) { + coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); + return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; + }; + + return forward; +}; + +// Generates a circle centered at [0°, 0°], with a given radius and precision. +function circleStream(stream, radius, delta, direction, t0, t1) { + if (!delta) return; + var cosRadius = cos$1(radius), + sinRadius = sin$1(radius), + step = direction * delta; + if (t0 == null) { + t0 = radius + direction * tau$3; + t1 = radius - step / 2; + } else { + t0 = circleRadius(cosRadius, t0); + t1 = circleRadius(cosRadius, t1); + if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$3; + } + for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { + point = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]); + stream.point(point[0], point[1]); + } +} + +// Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. +function circleRadius(cosRadius, point) { + point = cartesian(point), point[0] -= cosRadius; + cartesianNormalizeInPlace(point); + var radius = acos(-point[1]); + return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3; +} + +var circle = function() { + var center = constant$7([0, 0]), + radius = constant$7(90), + precision = constant$7(6), + ring, + rotate, + stream = {point: point}; + + function point(x, y) { + ring.push(x = rotate(x, y)); + x[0] *= degrees$1, x[1] *= degrees$1; + } + + function circle() { + var c = center.apply(this, arguments), + r = radius.apply(this, arguments) * radians, + p = precision.apply(this, arguments) * radians; + ring = []; + rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert; + circleStream(stream, r, p, 1); + c = {type: "Polygon", coordinates: [ring]}; + ring = rotate = null; + return c; + } + + circle.center = function(_) { + return arguments.length ? (center = typeof _ === "function" ? _ : constant$7([+_[0], +_[1]]), circle) : center; + }; + + circle.radius = function(_) { + return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), circle) : radius; + }; + + circle.precision = function(_) { + return arguments.length ? (precision = typeof _ === "function" ? _ : constant$7(+_), circle) : precision; + }; + + return circle; +}; + +var clipBuffer = function() { + var lines = [], + line; + return { + point: function(x, y) { + line.push([x, y]); + }, + lineStart: function() { + lines.push(line = []); + }, + lineEnd: noop$1, + rejoin: function() { + if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); + }, + result: function() { + var result = lines; + lines = []; + line = null; + return result; + } + }; +}; + +var clipLine = function(a, b, x0, y0, x1, y1) { + var ax = a[0], + ay = a[1], + bx = b[0], + by = b[1], + t0 = 0, + t1 = 1, + dx = bx - ax, + dy = by - ay, + r; + + r = x0 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dx > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + + r = x1 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dx > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + + r = y0 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dy > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + + r = y1 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dy > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + + if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; + if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; + return true; +}; + +var pointEqual = function(a, b) { + return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2; +}; + +function Intersection(point, points, other, entry) { + this.x = point; + this.z = points; + this.o = other; // another intersection + this.e = entry; // is an entry? + this.v = false; // visited + this.n = this.p = null; // next & previous +} + +// A generalized polygon clipping algorithm: given a polygon that has been cut +// into its visible line segments, and rejoins the segments by interpolating +// along the clip edge. +var clipPolygon = function(segments, compareIntersection, startInside, interpolate, stream) { + var subject = [], + clip = [], + i, + n; + + segments.forEach(function(segment) { + if ((n = segment.length - 1) <= 0) return; + var n, p0 = segment[0], p1 = segment[n], x; + + // If the first and last points of a segment are coincident, then treat as a + // closed ring. TODO if all rings are closed, then the winding order of the + // exterior ring should be checked. + if (pointEqual(p0, p1)) { + stream.lineStart(); + for (i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]); + stream.lineEnd(); + return; + } + + subject.push(x = new Intersection(p0, segment, null, true)); + clip.push(x.o = new Intersection(p0, null, x, false)); + subject.push(x = new Intersection(p1, segment, null, false)); + clip.push(x.o = new Intersection(p1, null, x, true)); + }); + + if (!subject.length) return; + + clip.sort(compareIntersection); + link$1(subject); + link$1(clip); + + for (i = 0, n = clip.length; i < n; ++i) { + clip[i].e = startInside = !startInside; + } + + var start = subject[0], + points, + point; + + while (1) { + // Find first unvisited intersection. + var current = start, + isSubject = true; + while (current.v) if ((current = current.n) === start) return; + points = current.z; + stream.lineStart(); + do { + current.v = current.o.v = true; + if (current.e) { + if (isSubject) { + for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); + } else { + interpolate(current.x, current.n.x, 1, stream); + } + current = current.n; + } else { + if (isSubject) { + points = current.p.z; + for (i = points.length - 1; i >= 0; --i) stream.point((point = points[i])[0], point[1]); + } else { + interpolate(current.x, current.p.x, -1, stream); + } + current = current.p; + } + current = current.o; + points = current.z; + isSubject = !isSubject; + } while (!current.v); + stream.lineEnd(); + } +}; + +function link$1(array) { + if (!(n = array.length)) return; + var n, + i = 0, + a = array[0], + b; + while (++i < n) { + a.n = b = array[i]; + b.p = a; + a = b; + } + a.n = b = array[0]; + b.p = a; +} + +var clipMax = 1e9; +var clipMin = -clipMax; + +// TODO Use d3-polygon’s polygonContains here for the ring check? +// TODO Eliminate duplicate buffering in clipBuffer and polygon.push? + +function clipExtent(x0, y0, x1, y1) { + + function visible(x, y) { + return x0 <= x && x <= x1 && y0 <= y && y <= y1; + } + + function interpolate(from, to, direction, stream) { + var a = 0, a1 = 0; + if (from == null + || (a = corner(from, direction)) !== (a1 = corner(to, direction)) + || comparePoint(from, to) < 0 ^ direction > 0) { + do stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); + while ((a = (a + direction + 4) % 4) !== a1); + } else { + stream.point(to[0], to[1]); + } + } + + function corner(p, direction) { + return abs(p[0] - x0) < epsilon$2 ? direction > 0 ? 0 : 3 + : abs(p[0] - x1) < epsilon$2 ? direction > 0 ? 2 : 1 + : abs(p[1] - y0) < epsilon$2 ? direction > 0 ? 1 : 0 + : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon + } + + function compareIntersection(a, b) { + return comparePoint(a.x, b.x); + } + + function comparePoint(a, b) { + var ca = corner(a, 1), + cb = corner(b, 1); + return ca !== cb ? ca - cb + : ca === 0 ? b[1] - a[1] + : ca === 1 ? a[0] - b[0] + : ca === 2 ? a[1] - b[1] + : b[0] - a[0]; + } + + return function(stream) { + var activeStream = stream, + bufferStream = clipBuffer(), + segments, + polygon, + ring, + x__, y__, v__, // first point + x_, y_, v_, // previous point + first, + clean; + + var clipStream = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: polygonStart, + polygonEnd: polygonEnd + }; + + function point(x, y) { + if (visible(x, y)) activeStream.point(x, y); + } + + function polygonInside() { + var winding = 0; + + for (var i = 0, n = polygon.length; i < n; ++i) { + for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { + a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; + if (a1 <= y1) { if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; } + else { if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; } + } + } + + return winding; + } + + // Buffer geometry within a polygon and then clip it en masse. + function polygonStart() { + activeStream = bufferStream, segments = [], polygon = [], clean = true; + } + + function polygonEnd() { + var startInside = polygonInside(), + cleanInside = clean && startInside, + visible = (segments = merge(segments)).length; + if (cleanInside || visible) { + stream.polygonStart(); + if (cleanInside) { + stream.lineStart(); + interpolate(null, null, 1, stream); + stream.lineEnd(); + } + if (visible) { + clipPolygon(segments, compareIntersection, startInside, interpolate, stream); + } + stream.polygonEnd(); + } + activeStream = stream, segments = polygon = ring = null; + } + + function lineStart() { + clipStream.point = linePoint; + if (polygon) polygon.push(ring = []); + first = true; + v_ = false; + x_ = y_ = NaN; + } + + // TODO rather than special-case polygons, simply handle them separately. + // Ideally, coincident intersection points should be jittered to avoid + // clipping issues. + function lineEnd() { + if (segments) { + linePoint(x__, y__); + if (v__ && v_) bufferStream.rejoin(); + segments.push(bufferStream.result()); + } + clipStream.point = point; + if (v_) activeStream.lineEnd(); + } + + function linePoint(x, y) { + var v = visible(x, y); + if (polygon) ring.push([x, y]); + if (first) { + x__ = x, y__ = y, v__ = v; + first = false; + if (v) { + activeStream.lineStart(); + activeStream.point(x, y); + } + } else { + if (v && v_) activeStream.point(x, y); + else { + var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], + b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))]; + if (clipLine(a, b, x0, y0, x1, y1)) { + if (!v_) { + activeStream.lineStart(); + activeStream.point(a[0], a[1]); + } + activeStream.point(b[0], b[1]); + if (!v) activeStream.lineEnd(); + clean = false; + } else if (v) { + activeStream.lineStart(); + activeStream.point(x, y); + clean = false; + } + } + } + x_ = x, y_ = y, v_ = v; + } + + return clipStream; + }; +} + +var extent$1 = function() { + var x0 = 0, + y0 = 0, + x1 = 960, + y1 = 500, + cache, + cacheStream, + clip; + + return clip = { + stream: function(stream) { + return cache && cacheStream === stream ? cache : cache = clipExtent(x0, y0, x1, y1)(cacheStream = stream); + }, + extent: function(_) { + return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]]; + } + }; +}; + +var sum$1 = adder(); + +var polygonContains = function(polygon, point) { + var lambda = point[0], + phi = point[1], + normal = [sin$1(lambda), -cos$1(lambda), 0], + angle = 0, + winding = 0; + + sum$1.reset(); + + for (var i = 0, n = polygon.length; i < n; ++i) { + if (!(m = (ring = polygon[i]).length)) continue; + var ring, + m, + point0 = ring[m - 1], + lambda0 = point0[0], + phi0 = point0[1] / 2 + quarterPi, + sinPhi0 = sin$1(phi0), + cosPhi0 = cos$1(phi0); + + for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { + var point1 = ring[j], + lambda1 = point1[0], + phi1 = point1[1] / 2 + quarterPi, + sinPhi1 = sin$1(phi1), + cosPhi1 = cos$1(phi1), + delta = lambda1 - lambda0, + sign$$1 = delta >= 0 ? 1 : -1, + absDelta = sign$$1 * delta, + antimeridian = absDelta > pi$3, + k = sinPhi0 * sinPhi1; + + sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta))); + angle += antimeridian ? delta + sign$$1 * tau$3 : delta; + + // Are the longitudes either side of the point’s meridian (lambda), + // and are the latitudes smaller than the parallel (phi)? + if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { + var arc = cartesianCross(cartesian(point0), cartesian(point1)); + cartesianNormalizeInPlace(arc); + var intersection = cartesianCross(normal, arc); + cartesianNormalizeInPlace(intersection); + var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]); + if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { + winding += antimeridian ^ delta >= 0 ? 1 : -1; + } + } + } + } + + // First, determine whether the South pole is inside or outside: + // + // It is inside if: + // * the polygon winds around it in a clockwise direction. + // * the polygon does not (cumulatively) wind around it, but has a negative + // (counter-clockwise) area. + // + // Second, count the (signed) number of times a segment crosses a lambda + // from the point to the South pole. If it is zero, then the point is the + // same side as the South pole. + + return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ (winding & 1); +}; + +var lengthSum = adder(); +var lambda0$2; +var sinPhi0$1; +var cosPhi0$1; + +var lengthStream = { + sphere: noop$1, + point: noop$1, + lineStart: lengthLineStart, + lineEnd: noop$1, + polygonStart: noop$1, + polygonEnd: noop$1 +}; + +function lengthLineStart() { + lengthStream.point = lengthPointFirst; + lengthStream.lineEnd = lengthLineEnd; +} + +function lengthLineEnd() { + lengthStream.point = lengthStream.lineEnd = noop$1; +} + +function lengthPointFirst(lambda, phi) { + lambda *= radians, phi *= radians; + lambda0$2 = lambda, sinPhi0$1 = sin$1(phi), cosPhi0$1 = cos$1(phi); + lengthStream.point = lengthPoint; +} + +function lengthPoint(lambda, phi) { + lambda *= radians, phi *= radians; + var sinPhi = sin$1(phi), + cosPhi = cos$1(phi), + delta = abs(lambda - lambda0$2), + cosDelta = cos$1(delta), + sinDelta = sin$1(delta), + x = cosPhi * sinDelta, + y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta, + z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta; + lengthSum.add(atan2(sqrt(x * x + y * y), z)); + lambda0$2 = lambda, sinPhi0$1 = sinPhi, cosPhi0$1 = cosPhi; +} + +var length$1 = function(object) { + lengthSum.reset(); + geoStream(object, lengthStream); + return +lengthSum; +}; + +var coordinates = [null, null]; +var object$1 = {type: "LineString", coordinates: coordinates}; + +var distance = function(a, b) { + coordinates[0] = a; + coordinates[1] = b; + return length$1(object$1); +}; + +var containsObjectType = { + Feature: function(object, point) { + return containsGeometry(object.geometry, point); + }, + FeatureCollection: function(object, point) { + var features = object.features, i = -1, n = features.length; + while (++i < n) if (containsGeometry(features[i].geometry, point)) return true; + return false; + } +}; + +var containsGeometryType = { + Sphere: function() { + return true; + }, + Point: function(object, point) { + return containsPoint(object.coordinates, point); + }, + MultiPoint: function(object, point) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) if (containsPoint(coordinates[i], point)) return true; + return false; + }, + LineString: function(object, point) { + return containsLine(object.coordinates, point); + }, + MultiLineString: function(object, point) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) if (containsLine(coordinates[i], point)) return true; + return false; + }, + Polygon: function(object, point) { + return containsPolygon(object.coordinates, point); + }, + MultiPolygon: function(object, point) { + var coordinates = object.coordinates, i = -1, n = coordinates.length; + while (++i < n) if (containsPolygon(coordinates[i], point)) return true; + return false; + }, + GeometryCollection: function(object, point) { + var geometries = object.geometries, i = -1, n = geometries.length; + while (++i < n) if (containsGeometry(geometries[i], point)) return true; + return false; + } +}; + +function containsGeometry(geometry, point) { + return geometry && containsGeometryType.hasOwnProperty(geometry.type) + ? containsGeometryType[geometry.type](geometry, point) + : false; +} + +function containsPoint(coordinates, point) { + return distance(coordinates, point) === 0; +} + +function containsLine(coordinates, point) { + var ab = distance(coordinates[0], coordinates[1]), + ao = distance(coordinates[0], point), + ob = distance(point, coordinates[1]); + return ao + ob <= ab + epsilon$2; +} + +function containsPolygon(coordinates, point) { + return !!polygonContains(coordinates.map(ringRadians), pointRadians(point)); +} + +function ringRadians(ring) { + return ring = ring.map(pointRadians), ring.pop(), ring; +} + +function pointRadians(point) { + return [point[0] * radians, point[1] * radians]; +} + +var contains = function(object, point) { + return (object && containsObjectType.hasOwnProperty(object.type) + ? containsObjectType[object.type] + : containsGeometry)(object, point); +}; + +function graticuleX(y0, y1, dy) { + var y = sequence(y0, y1 - epsilon$2, dy).concat(y1); + return function(x) { return y.map(function(y) { return [x, y]; }); }; +} + +function graticuleY(x0, x1, dx) { + var x = sequence(x0, x1 - epsilon$2, dx).concat(x1); + return function(y) { return x.map(function(x) { return [x, y]; }); }; +} + +function graticule() { + var x1, x0, X1, X0, + y1, y0, Y1, Y0, + dx = 10, dy = dx, DX = 90, DY = 360, + x, y, X, Y, + precision = 2.5; + + function graticule() { + return {type: "MultiLineString", coordinates: lines()}; + } + + function lines() { + return sequence(ceil(X0 / DX) * DX, X1, DX).map(X) + .concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y)) + .concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs(x % DX) > epsilon$2; }).map(x)) + .concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs(y % DY) > epsilon$2; }).map(y)); + } + + graticule.lines = function() { + return lines().map(function(coordinates) { return {type: "LineString", coordinates: coordinates}; }); + }; + + graticule.outline = function() { + return { + type: "Polygon", + coordinates: [ + X(X0).concat( + Y(Y1).slice(1), + X(X1).reverse().slice(1), + Y(Y0).reverse().slice(1)) + ] + }; + }; + + graticule.extent = function(_) { + if (!arguments.length) return graticule.extentMinor(); + return graticule.extentMajor(_).extentMinor(_); + }; + + graticule.extentMajor = function(_) { + if (!arguments.length) return [[X0, Y0], [X1, Y1]]; + X0 = +_[0][0], X1 = +_[1][0]; + Y0 = +_[0][1], Y1 = +_[1][1]; + if (X0 > X1) _ = X0, X0 = X1, X1 = _; + if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; + return graticule.precision(precision); + }; + + graticule.extentMinor = function(_) { + if (!arguments.length) return [[x0, y0], [x1, y1]]; + x0 = +_[0][0], x1 = +_[1][0]; + y0 = +_[0][1], y1 = +_[1][1]; + if (x0 > x1) _ = x0, x0 = x1, x1 = _; + if (y0 > y1) _ = y0, y0 = y1, y1 = _; + return graticule.precision(precision); + }; + + graticule.step = function(_) { + if (!arguments.length) return graticule.stepMinor(); + return graticule.stepMajor(_).stepMinor(_); + }; + + graticule.stepMajor = function(_) { + if (!arguments.length) return [DX, DY]; + DX = +_[0], DY = +_[1]; + return graticule; + }; + + graticule.stepMinor = function(_) { + if (!arguments.length) return [dx, dy]; + dx = +_[0], dy = +_[1]; + return graticule; + }; + + graticule.precision = function(_) { + if (!arguments.length) return precision; + precision = +_; + x = graticuleX(y0, y1, 90); + y = graticuleY(x0, x1, precision); + X = graticuleX(Y0, Y1, 90); + Y = graticuleY(X0, X1, precision); + return graticule; + }; + + return graticule + .extentMajor([[-180, -90 + epsilon$2], [180, 90 - epsilon$2]]) + .extentMinor([[-180, -80 - epsilon$2], [180, 80 + epsilon$2]]); +} + +function graticule10() { + return graticule()(); +} + +var interpolate$1 = function(a, b) { + var x0 = a[0] * radians, + y0 = a[1] * radians, + x1 = b[0] * radians, + y1 = b[1] * radians, + cy0 = cos$1(y0), + sy0 = sin$1(y0), + cy1 = cos$1(y1), + sy1 = sin$1(y1), + kx0 = cy0 * cos$1(x0), + ky0 = cy0 * sin$1(x0), + kx1 = cy1 * cos$1(x1), + ky1 = cy1 * sin$1(x1), + d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))), + k = sin$1(d); + + var interpolate = d ? function(t) { + var B = sin$1(t *= d) / k, + A = sin$1(d - t) / k, + x = A * kx0 + B * kx1, + y = A * ky0 + B * ky1, + z = A * sy0 + B * sy1; + return [ + atan2(y, x) * degrees$1, + atan2(z, sqrt(x * x + y * y)) * degrees$1 + ]; + } : function() { + return [x0 * degrees$1, y0 * degrees$1]; + }; + + interpolate.distance = d; + + return interpolate; +}; + +var identity$4 = function(x) { + return x; +}; + +var areaSum$1 = adder(); +var areaRingSum$1 = adder(); +var x00; +var y00; +var x0$1; +var y0$1; + +var areaStream$1 = { + point: noop$1, + lineStart: noop$1, + lineEnd: noop$1, + polygonStart: function() { + areaStream$1.lineStart = areaRingStart$1; + areaStream$1.lineEnd = areaRingEnd$1; + }, + polygonEnd: function() { + areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$1; + areaSum$1.add(abs(areaRingSum$1)); + areaRingSum$1.reset(); + }, + result: function() { + var area = areaSum$1 / 2; + areaSum$1.reset(); + return area; + } +}; + +function areaRingStart$1() { + areaStream$1.point = areaPointFirst$1; +} + +function areaPointFirst$1(x, y) { + areaStream$1.point = areaPoint$1; + x00 = x0$1 = x, y00 = y0$1 = y; +} + +function areaPoint$1(x, y) { + areaRingSum$1.add(y0$1 * x - x0$1 * y); + x0$1 = x, y0$1 = y; +} + +function areaRingEnd$1() { + areaPoint$1(x00, y00); +} + +var x0$2 = Infinity; +var y0$2 = x0$2; +var x1 = -x0$2; +var y1 = x1; + +var boundsStream$1 = { + point: boundsPoint$1, + lineStart: noop$1, + lineEnd: noop$1, + polygonStart: noop$1, + polygonEnd: noop$1, + result: function() { + var bounds = [[x0$2, y0$2], [x1, y1]]; + x1 = y1 = -(y0$2 = x0$2 = Infinity); + return bounds; + } +}; + +function boundsPoint$1(x, y) { + if (x < x0$2) x0$2 = x; + if (x > x1) x1 = x; + if (y < y0$2) y0$2 = y; + if (y > y1) y1 = y; +} + +// TODO Enforce positive area for exterior, negative area for interior? + +var X0$1 = 0; +var Y0$1 = 0; +var Z0$1 = 0; +var X1$1 = 0; +var Y1$1 = 0; +var Z1$1 = 0; +var X2$1 = 0; +var Y2$1 = 0; +var Z2$1 = 0; +var x00$1; +var y00$1; +var x0$3; +var y0$3; + +var centroidStream$1 = { + point: centroidPoint$1, + lineStart: centroidLineStart$1, + lineEnd: centroidLineEnd$1, + polygonStart: function() { + centroidStream$1.lineStart = centroidRingStart$1; + centroidStream$1.lineEnd = centroidRingEnd$1; + }, + polygonEnd: function() { + centroidStream$1.point = centroidPoint$1; + centroidStream$1.lineStart = centroidLineStart$1; + centroidStream$1.lineEnd = centroidLineEnd$1; + }, + result: function() { + var centroid = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1] + : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1] + : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1] + : [NaN, NaN]; + X0$1 = Y0$1 = Z0$1 = + X1$1 = Y1$1 = Z1$1 = + X2$1 = Y2$1 = Z2$1 = 0; + return centroid; + } +}; + +function centroidPoint$1(x, y) { + X0$1 += x; + Y0$1 += y; + ++Z0$1; +} + +function centroidLineStart$1() { + centroidStream$1.point = centroidPointFirstLine; +} + +function centroidPointFirstLine(x, y) { + centroidStream$1.point = centroidPointLine; + centroidPoint$1(x0$3 = x, y0$3 = y); +} + +function centroidPointLine(x, y) { + var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy); + X1$1 += z * (x0$3 + x) / 2; + Y1$1 += z * (y0$3 + y) / 2; + Z1$1 += z; + centroidPoint$1(x0$3 = x, y0$3 = y); +} + +function centroidLineEnd$1() { + centroidStream$1.point = centroidPoint$1; +} + +function centroidRingStart$1() { + centroidStream$1.point = centroidPointFirstRing; +} + +function centroidRingEnd$1() { + centroidPointRing(x00$1, y00$1); +} + +function centroidPointFirstRing(x, y) { + centroidStream$1.point = centroidPointRing; + centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y); +} + +function centroidPointRing(x, y) { + var dx = x - x0$3, + dy = y - y0$3, + z = sqrt(dx * dx + dy * dy); + + X1$1 += z * (x0$3 + x) / 2; + Y1$1 += z * (y0$3 + y) / 2; + Z1$1 += z; + + z = y0$3 * x - x0$3 * y; + X2$1 += z * (x0$3 + x); + Y2$1 += z * (y0$3 + y); + Z2$1 += z * 3; + centroidPoint$1(x0$3 = x, y0$3 = y); +} + +function PathContext(context) { + this._context = context; +} + +PathContext.prototype = { + _radius: 4.5, + pointRadius: function(_) { + return this._radius = _, this; + }, + polygonStart: function() { + this._line = 0; + }, + polygonEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line === 0) this._context.closePath(); + this._point = NaN; + }, + point: function(x, y) { + switch (this._point) { + case 0: { + this._context.moveTo(x, y); + this._point = 1; + break; + } + case 1: { + this._context.lineTo(x, y); + break; + } + default: { + this._context.moveTo(x + this._radius, y); + this._context.arc(x, y, this._radius, 0, tau$3); + break; + } + } + }, + result: noop$1 +}; + +var lengthSum$1 = adder(); +var lengthRing; +var x00$2; +var y00$2; +var x0$4; +var y0$4; + +var lengthStream$1 = { + point: noop$1, + lineStart: function() { + lengthStream$1.point = lengthPointFirst$1; + }, + lineEnd: function() { + if (lengthRing) lengthPoint$1(x00$2, y00$2); + lengthStream$1.point = noop$1; + }, + polygonStart: function() { + lengthRing = true; + }, + polygonEnd: function() { + lengthRing = null; + }, + result: function() { + var length = +lengthSum$1; + lengthSum$1.reset(); + return length; + } +}; + +function lengthPointFirst$1(x, y) { + lengthStream$1.point = lengthPoint$1; + x00$2 = x0$4 = x, y00$2 = y0$4 = y; +} + +function lengthPoint$1(x, y) { + x0$4 -= x, y0$4 -= y; + lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4)); + x0$4 = x, y0$4 = y; +} + +function PathString() { + this._string = []; +} + +PathString.prototype = { + _radius: 4.5, + _circle: circle$1(4.5), + pointRadius: function(_) { + if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; + return this; + }, + polygonStart: function() { + this._line = 0; + }, + polygonEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line === 0) this._string.push("Z"); + this._point = NaN; + }, + point: function(x, y) { + switch (this._point) { + case 0: { + this._string.push("M", x, ",", y); + this._point = 1; + break; + } + case 1: { + this._string.push("L", x, ",", y); + break; + } + default: { + if (this._circle == null) this._circle = circle$1(this._radius); + this._string.push("M", x, ",", y, this._circle); + break; + } + } + }, + result: function() { + if (this._string.length) { + var result = this._string.join(""); + this._string = []; + return result; + } else { + return null; + } + } +}; + +function circle$1(radius) { + return "m0," + radius + + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + + "z"; +} + +var index$1 = function(projection, context) { + var pointRadius = 4.5, + projectionStream, + contextStream; + + function path(object) { + if (object) { + if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); + geoStream(object, projectionStream(contextStream)); + } + return contextStream.result(); + } + + path.area = function(object) { + geoStream(object, projectionStream(areaStream$1)); + return areaStream$1.result(); + }; + + path.measure = function(object) { + geoStream(object, projectionStream(lengthStream$1)); + return lengthStream$1.result(); + }; + + path.bounds = function(object) { + geoStream(object, projectionStream(boundsStream$1)); + return boundsStream$1.result(); + }; + + path.centroid = function(object) { + geoStream(object, projectionStream(centroidStream$1)); + return centroidStream$1.result(); + }; + + path.projection = function(_) { + return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$4) : (projection = _).stream, path) : projection; + }; + + path.context = function(_) { + if (!arguments.length) return context; + contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _); + if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); + return path; + }; + + path.pointRadius = function(_) { + if (!arguments.length) return pointRadius; + pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); + return path; + }; + + return path.projection(projection).context(context); +}; + +var clip = function(pointVisible, clipLine, interpolate, start) { + return function(rotate, sink) { + var line = clipLine(sink), + rotatedStart = rotate.invert(start[0], start[1]), + ringBuffer = clipBuffer(), + ringSink = clipLine(ringBuffer), + polygonStarted = false, + polygon, + segments, + ring; + + var clip = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { + clip.point = pointRing; + clip.lineStart = ringStart; + clip.lineEnd = ringEnd; + segments = []; + polygon = []; + }, + polygonEnd: function() { + clip.point = point; + clip.lineStart = lineStart; + clip.lineEnd = lineEnd; + segments = merge(segments); + var startInside = polygonContains(polygon, rotatedStart); + if (segments.length) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + clipPolygon(segments, compareIntersection, startInside, interpolate, sink); + } else if (startInside) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + interpolate(null, null, 1, sink); + sink.lineEnd(); + } + if (polygonStarted) sink.polygonEnd(), polygonStarted = false; + segments = polygon = null; + }, + sphere: function() { + sink.polygonStart(); + sink.lineStart(); + interpolate(null, null, 1, sink); + sink.lineEnd(); + sink.polygonEnd(); + } + }; + + function point(lambda, phi) { + var point = rotate(lambda, phi); + if (pointVisible(lambda = point[0], phi = point[1])) sink.point(lambda, phi); + } + + function pointLine(lambda, phi) { + var point = rotate(lambda, phi); + line.point(point[0], point[1]); + } + + function lineStart() { + clip.point = pointLine; + line.lineStart(); + } + + function lineEnd() { + clip.point = point; + line.lineEnd(); + } + + function pointRing(lambda, phi) { + ring.push([lambda, phi]); + var point = rotate(lambda, phi); + ringSink.point(point[0], point[1]); + } + + function ringStart() { + ringSink.lineStart(); + ring = []; + } + + function ringEnd() { + pointRing(ring[0][0], ring[0][1]); + ringSink.lineEnd(); + + var clean = ringSink.clean(), + ringSegments = ringBuffer.result(), + i, n = ringSegments.length, m, + segment, + point; + + ring.pop(); + polygon.push(ring); + ring = null; + + if (!n) return; + + // No intersections. + if (clean & 1) { + segment = ringSegments[0]; + if ((m = segment.length - 1) > 0) { + if (!polygonStarted) sink.polygonStart(), polygonStarted = true; + sink.lineStart(); + for (i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]); + sink.lineEnd(); + } + return; + } + + // Rejoin connected segments. + // TODO reuse ringBuffer.rejoin()? + if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); + + segments.push(ringSegments.filter(validSegment)); + } + + return clip; + }; +}; + +function validSegment(segment) { + return segment.length > 1; +} + +// Intersections are sorted along the clip edge. For both antimeridian cutting +// and circle clipping, the same comparison is used. +function compareIntersection(a, b) { + return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1]) + - ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]); +} + +var clipAntimeridian = clip( + function() { return true; }, + clipAntimeridianLine, + clipAntimeridianInterpolate, + [-pi$3, -halfPi$2] +); + +// Takes a line and cuts into visible segments. Return values: 0 - there were +// intersections or the line was empty; 1 - no intersections; 2 - there were +// intersections, and the first and last segments should be rejoined. +function clipAntimeridianLine(stream) { + var lambda0 = NaN, + phi0 = NaN, + sign0 = NaN, + clean; // no intersections + + return { + lineStart: function() { + stream.lineStart(); + clean = 1; + }, + point: function(lambda1, phi1) { + var sign1 = lambda1 > 0 ? pi$3 : -pi$3, + delta = abs(lambda1 - lambda0); + if (abs(delta - pi$3) < epsilon$2) { // line crosses a pole + stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$2 : -halfPi$2); + stream.point(sign0, phi0); + stream.lineEnd(); + stream.lineStart(); + stream.point(sign1, phi0); + stream.point(lambda1, phi0); + clean = 0; + } else if (sign0 !== sign1 && delta >= pi$3) { // line crosses antimeridian + if (abs(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies + if (abs(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2; + phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); + stream.point(sign0, phi0); + stream.lineEnd(); + stream.lineStart(); + stream.point(sign1, phi0); + clean = 0; + } + stream.point(lambda0 = lambda1, phi0 = phi1); + sign0 = sign1; + }, + lineEnd: function() { + stream.lineEnd(); + lambda0 = phi0 = NaN; + }, + clean: function() { + return 2 - clean; // if intersections, rejoin first and last segments + } + }; +} + +function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { + var cosPhi0, + cosPhi1, + sinLambda0Lambda1 = sin$1(lambda0 - lambda1); + return abs(sinLambda0Lambda1) > epsilon$2 + ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) + - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) + / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) + : (phi0 + phi1) / 2; +} + +function clipAntimeridianInterpolate(from, to, direction, stream) { + var phi; + if (from == null) { + phi = direction * halfPi$2; + stream.point(-pi$3, phi); + stream.point(0, phi); + stream.point(pi$3, phi); + stream.point(pi$3, 0); + stream.point(pi$3, -phi); + stream.point(0, -phi); + stream.point(-pi$3, -phi); + stream.point(-pi$3, 0); + stream.point(-pi$3, phi); + } else if (abs(from[0] - to[0]) > epsilon$2) { + var lambda = from[0] < to[0] ? pi$3 : -pi$3; + phi = direction * lambda / 2; + stream.point(-lambda, phi); + stream.point(0, phi); + stream.point(lambda, phi); + } else { + stream.point(to[0], to[1]); + } +} + +var clipCircle = function(radius, delta) { + var cr = cos$1(radius), + smallRadius = cr > 0, + notHemisphere = abs(cr) > epsilon$2; // TODO optimise for this common case + + function interpolate(from, to, direction, stream) { + circleStream(stream, radius, delta, direction, from, to); + } + + function visible(lambda, phi) { + return cos$1(lambda) * cos$1(phi) > cr; + } + + // Takes a line and cuts into visible segments. Return values used for polygon + // clipping: 0 - there were intersections or the line was empty; 1 - no + // intersections 2 - there were intersections, and the first and last segments + // should be rejoined. + function clipLine(stream) { + var point0, // previous point + c0, // code for previous point + v0, // visibility of previous point + v00, // visibility of first point + clean; // no intersections + return { + lineStart: function() { + v00 = v0 = false; + clean = 1; + }, + point: function(lambda, phi) { + var point1 = [lambda, phi], + point2, + v = visible(lambda, phi), + c = smallRadius + ? v ? 0 : code(lambda, phi) + : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0; + if (!point0 && (v00 = v0 = v)) stream.lineStart(); + // Handle degeneracies. + // TODO ignore if not clipping polygons. + if (v !== v0) { + point2 = intersect(point0, point1); + if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) { + point1[0] += epsilon$2; + point1[1] += epsilon$2; + v = visible(point1[0], point1[1]); + } + } + if (v !== v0) { + clean = 0; + if (v) { + // outside going in + stream.lineStart(); + point2 = intersect(point1, point0); + stream.point(point2[0], point2[1]); + } else { + // inside going out + point2 = intersect(point0, point1); + stream.point(point2[0], point2[1]); + stream.lineEnd(); + } + point0 = point2; + } else if (notHemisphere && point0 && smallRadius ^ v) { + var t; + // If the codes for two points are different, or are both zero, + // and there this segment intersects with the small circle. + if (!(c & c0) && (t = intersect(point1, point0, true))) { + clean = 0; + if (smallRadius) { + stream.lineStart(); + stream.point(t[0][0], t[0][1]); + stream.point(t[1][0], t[1][1]); + stream.lineEnd(); + } else { + stream.point(t[1][0], t[1][1]); + stream.lineEnd(); + stream.lineStart(); + stream.point(t[0][0], t[0][1]); + } + } + } + if (v && (!point0 || !pointEqual(point0, point1))) { + stream.point(point1[0], point1[1]); + } + point0 = point1, v0 = v, c0 = c; + }, + lineEnd: function() { + if (v0) stream.lineEnd(); + point0 = null; + }, + // Rejoin first and last segments if there were intersections and the first + // and last points were visible. + clean: function() { + return clean | ((v00 && v0) << 1); + } + }; + } + + // Intersects the great circle between a and b with the clip circle. + function intersect(a, b, two) { + var pa = cartesian(a), + pb = cartesian(b); + + // We have two planes, n1.p = d1 and n2.p = d2. + // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). + var n1 = [1, 0, 0], // normal + n2 = cartesianCross(pa, pb), + n2n2 = cartesianDot(n2, n2), + n1n2 = n2[0], // cartesianDot(n1, n2), + determinant = n2n2 - n1n2 * n1n2; + + // Two polar points. + if (!determinant) return !two && a; + + var c1 = cr * n2n2 / determinant, + c2 = -cr * n1n2 / determinant, + n1xn2 = cartesianCross(n1, n2), + A = cartesianScale(n1, c1), + B = cartesianScale(n2, c2); + cartesianAddInPlace(A, B); + + // Solve |p(t)|^2 = 1. + var u = n1xn2, + w = cartesianDot(A, u), + uu = cartesianDot(u, u), + t2 = w * w - uu * (cartesianDot(A, A) - 1); + + if (t2 < 0) return; + + var t = sqrt(t2), + q = cartesianScale(u, (-w - t) / uu); + cartesianAddInPlace(q, A); + q = spherical(q); + + if (!two) return q; + + // Two intersection points. + var lambda0 = a[0], + lambda1 = b[0], + phi0 = a[1], + phi1 = b[1], + z; + + if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; + + var delta = lambda1 - lambda0, + polar = abs(delta - pi$3) < epsilon$2, + meridian = polar || delta < epsilon$2; + + if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; + + // Check that the first point is between a and b. + if (meridian + ? polar + ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi0 : phi1) + : phi0 <= q[1] && q[1] <= phi1 + : delta > pi$3 ^ (lambda0 <= q[0] && q[0] <= lambda1)) { + var q1 = cartesianScale(u, (-w + t) / uu); + cartesianAddInPlace(q1, A); + return [q, spherical(q1)]; + } + } + + // Generates a 4-bit vector representing the location of a point relative to + // the small circle's bounding box. + function code(lambda, phi) { + var r = smallRadius ? radius : pi$3 - radius, + code = 0; + if (lambda < -r) code |= 1; // left + else if (lambda > r) code |= 2; // right + if (phi < -r) code |= 4; // below + else if (phi > r) code |= 8; // above + return code; + } + + return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$3, radius - pi$3]); +}; + +var transform = function(methods) { + return { + stream: transformer(methods) + }; +}; + +function transformer(methods) { + return function(stream) { + var s = new TransformStream; + for (var key in methods) s[key] = methods[key]; + s.stream = stream; + return s; + }; +} + +function TransformStream() {} + +TransformStream.prototype = { + constructor: TransformStream, + point: function(x, y) { this.stream.point(x, y); }, + sphere: function() { this.stream.sphere(); }, + lineStart: function() { this.stream.lineStart(); }, + lineEnd: function() { this.stream.lineEnd(); }, + polygonStart: function() { this.stream.polygonStart(); }, + polygonEnd: function() { this.stream.polygonEnd(); } +}; + +function fitExtent(projection, extent, object) { + var w = extent[1][0] - extent[0][0], + h = extent[1][1] - extent[0][1], + clip = projection.clipExtent && projection.clipExtent(); + + projection + .scale(150) + .translate([0, 0]); + + if (clip != null) projection.clipExtent(null); + + geoStream(object, projection.stream(boundsStream$1)); + + var b = boundsStream$1.result(), + k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), + x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, + y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; + + if (clip != null) projection.clipExtent(clip); + + return projection + .scale(k * 150) + .translate([x, y]); +} + +function fitSize(projection, size, object) { + return fitExtent(projection, [[0, 0], size], object); +} + +var maxDepth = 16; +var cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance) + +var resample = function(project, delta2) { + return +delta2 ? resample$1(project, delta2) : resampleNone(project); +}; + +function resampleNone(project) { + return transformer({ + point: function(x, y) { + x = project(x, y); + this.stream.point(x[0], x[1]); + } + }); +} + +function resample$1(project, delta2) { + + function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { + var dx = x1 - x0, + dy = y1 - y0, + d2 = dx * dx + dy * dy; + if (d2 > 4 * delta2 && depth--) { + var a = a0 + a1, + b = b0 + b1, + c = c0 + c1, + m = sqrt(a * a + b * b + c * c), + phi2 = asin(c /= m), + lambda2 = abs(abs(c) - 1) < epsilon$2 || abs(lambda0 - lambda1) < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2(b, a), + p = project(lambda2, phi2), + x2 = p[0], + y2 = p[1], + dx2 = x2 - x0, + dy2 = y2 - y0, + dz = dy * dx2 - dx * dy2; + if (dz * dz / d2 > delta2 // perpendicular projected distance + || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end + || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { // angular distance + resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); + stream.point(x2, y2); + resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); + } + } + } + return function(stream) { + var lambda00, x00, y00, a00, b00, c00, // first point + lambda0, x0, y0, a0, b0, c0; // previous point + + var resampleStream = { + point: point, + lineStart: lineStart, + lineEnd: lineEnd, + polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; }, + polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; } + }; + + function point(x, y) { + x = project(x, y); + stream.point(x[0], x[1]); + } + + function lineStart() { + x0 = NaN; + resampleStream.point = linePoint; + stream.lineStart(); + } + + function linePoint(lambda, phi) { + var c = cartesian([lambda, phi]), p = project(lambda, phi); + resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); + stream.point(x0, y0); + } + + function lineEnd() { + resampleStream.point = point; + stream.lineEnd(); + } + + function ringStart() { + lineStart(); + resampleStream.point = ringPoint; + resampleStream.lineEnd = ringEnd; + } + + function ringPoint(lambda, phi) { + linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; + resampleStream.point = linePoint; + } + + function ringEnd() { + resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); + resampleStream.lineEnd = lineEnd; + lineEnd(); + } + + return resampleStream; + }; +} + +var transformRadians = transformer({ + point: function(x, y) { + this.stream.point(x * radians, y * radians); + } +}); + +function projection(project) { + return projectionMutator(function() { return project; })(); +} + +function projectionMutator(projectAt) { + var project, + k = 150, // scale + x = 480, y = 250, // translate + dx, dy, lambda = 0, phi = 0, // center + deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, projectRotate, // rotate + theta = null, preclip = clipAntimeridian, // clip angle + x0 = null, y0, x1, y1, postclip = identity$4, // clip extent + delta2 = 0.5, projectResample = resample(projectTransform, delta2), // precision + cache, + cacheStream; + + function projection(point) { + point = projectRotate(point[0] * radians, point[1] * radians); + return [point[0] * k + dx, dy - point[1] * k]; + } + + function invert(point) { + point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k); + return point && [point[0] * degrees$1, point[1] * degrees$1]; + } + + function projectTransform(x, y) { + return x = project(x, y), [x[0] * k + dx, dy - x[1] * k]; + } + + projection.stream = function(stream) { + return cache && cacheStream === stream ? cache : cache = transformRadians(preclip(rotate, projectResample(postclip(cacheStream = stream)))); + }; + + projection.clipAngle = function(_) { + return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians, 6 * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees$1; + }; + + projection.clipExtent = function(_) { + return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; + }; + + projection.scale = function(_) { + return arguments.length ? (k = +_, recenter()) : k; + }; + + projection.translate = function(_) { + return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; + }; + + projection.center = function(_) { + return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees$1, phi * degrees$1]; + }; + + projection.rotate = function(_) { + return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1]; + }; + + projection.precision = function(_) { + return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2); + }; + + projection.fitExtent = function(extent, object) { + return fitExtent(projection, extent, object); + }; + + projection.fitSize = function(size, object) { + return fitSize(projection, size, object); + }; + + function recenter() { + projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project); + var center = project(lambda, phi); + dx = x - center[0] * k; + dy = y + center[1] * k; + return reset(); + } + + function reset() { + cache = cacheStream = null; + return projection; + } + + return function() { + project = projectAt.apply(this, arguments); + projection.invert = project.invert && invert; + return recenter(); + }; +} + +function conicProjection(projectAt) { + var phi0 = 0, + phi1 = pi$3 / 3, + m = projectionMutator(projectAt), + p = m(phi0, phi1); + + p.parallels = function(_) { + return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees$1, phi1 * degrees$1]; + }; + + return p; +} + +function cylindricalEqualAreaRaw(phi0) { + var cosPhi0 = cos$1(phi0); + + function forward(lambda, phi) { + return [lambda * cosPhi0, sin$1(phi) / cosPhi0]; + } + + forward.invert = function(x, y) { + return [x / cosPhi0, asin(y * cosPhi0)]; + }; + + return forward; +} + +function conicEqualAreaRaw(y0, y1) { + var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2; + + // Are the parallels symmetrical around the Equator? + if (abs(n) < epsilon$2) return cylindricalEqualAreaRaw(y0); + + var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n; + + function project(x, y) { + var r = sqrt(c - 2 * n * sin$1(y)) / n; + return [r * sin$1(x *= n), r0 - r * cos$1(x)]; + } + + project.invert = function(x, y) { + var r0y = r0 - y; + return [atan2(x, abs(r0y)) / n * sign(r0y), asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; + }; + + return project; +} + +var conicEqualArea = function() { + return conicProjection(conicEqualAreaRaw) + .scale(155.424) + .center([0, 33.6442]); +}; + +var albers = function() { + return conicEqualArea() + .parallels([29.5, 45.5]) + .scale(1070) + .translate([480, 250]) + .rotate([96, 0]) + .center([-0.6, 38.7]); +}; + +// The projections must have mutually exclusive clip regions on the sphere, +// as this will avoid emitting interleaving lines and polygons. +function multiplex(streams) { + var n = streams.length; + return { + point: function(x, y) { var i = -1; while (++i < n) streams[i].point(x, y); }, + sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); }, + lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); }, + lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); }, + polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); }, + polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); } + }; +} + +// A composite projection for the United States, configured by default for +// 960×500. The projection also works quite well at 960×600 if you change the +// scale to 1285 and adjust the translate accordingly. The set of standard +// parallels for each region comes from USGS, which is published here: +// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers +var albersUsa = function() { + var cache, + cacheStream, + lower48 = albers(), lower48Point, + alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, // EPSG:3338 + hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, // ESRI:102007 + point, pointStream = {point: function(x, y) { point = [x, y]; }}; + + function albersUsa(coordinates) { + var x = coordinates[0], y = coordinates[1]; + return point = null, + (lower48Point.point(x, y), point) + || (alaskaPoint.point(x, y), point) + || (hawaiiPoint.point(x, y), point); + } + + albersUsa.invert = function(coordinates) { + var k = lower48.scale(), + t = lower48.translate(), + x = (coordinates[0] - t[0]) / k, + y = (coordinates[1] - t[1]) / k; + return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska + : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii + : lower48).invert(coordinates); + }; + + albersUsa.stream = function(stream) { + return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); + }; + + albersUsa.precision = function(_) { + if (!arguments.length) return lower48.precision(); + lower48.precision(_), alaska.precision(_), hawaii.precision(_); + return reset(); + }; + + albersUsa.scale = function(_) { + if (!arguments.length) return lower48.scale(); + lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); + return albersUsa.translate(lower48.translate()); + }; + + albersUsa.translate = function(_) { + if (!arguments.length) return lower48.translate(); + var k = lower48.scale(), x = +_[0], y = +_[1]; + + lower48Point = lower48 + .translate(_) + .clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]) + .stream(pointStream); + + alaskaPoint = alaska + .translate([x - 0.307 * k, y + 0.201 * k]) + .clipExtent([[x - 0.425 * k + epsilon$2, y + 0.120 * k + epsilon$2], [x - 0.214 * k - epsilon$2, y + 0.234 * k - epsilon$2]]) + .stream(pointStream); + + hawaiiPoint = hawaii + .translate([x - 0.205 * k, y + 0.212 * k]) + .clipExtent([[x - 0.214 * k + epsilon$2, y + 0.166 * k + epsilon$2], [x - 0.115 * k - epsilon$2, y + 0.234 * k - epsilon$2]]) + .stream(pointStream); + + return reset(); + }; + + albersUsa.fitExtent = function(extent, object) { + return fitExtent(albersUsa, extent, object); + }; + + albersUsa.fitSize = function(size, object) { + return fitSize(albersUsa, size, object); + }; + + function reset() { + cache = cacheStream = null; + return albersUsa; + } + + return albersUsa.scale(1070); +}; + +function azimuthalRaw(scale) { + return function(x, y) { + var cx = cos$1(x), + cy = cos$1(y), + k = scale(cx * cy); + return [ + k * cy * sin$1(x), + k * sin$1(y) + ]; + } +} + +function azimuthalInvert(angle) { + return function(x, y) { + var z = sqrt(x * x + y * y), + c = angle(z), + sc = sin$1(c), + cc = cos$1(c); + return [ + atan2(x * sc, z * cc), + asin(z && y * sc / z) + ]; + } +} + +var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { + return sqrt(2 / (1 + cxcy)); +}); + +azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { + return 2 * asin(z / 2); +}); + +var azimuthalEqualArea = function() { + return projection(azimuthalEqualAreaRaw) + .scale(124.75) + .clipAngle(180 - 1e-3); +}; + +var azimuthalEquidistantRaw = azimuthalRaw(function(c) { + return (c = acos(c)) && c / sin$1(c); +}); + +azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { + return z; +}); + +var azimuthalEquidistant = function() { + return projection(azimuthalEquidistantRaw) + .scale(79.4188) + .clipAngle(180 - 1e-3); +}; + +function mercatorRaw(lambda, phi) { + return [lambda, log(tan((halfPi$2 + phi) / 2))]; +} + +mercatorRaw.invert = function(x, y) { + return [x, 2 * atan(exp(y)) - halfPi$2]; +}; + +var mercator = function() { + return mercatorProjection(mercatorRaw) + .scale(961 / tau$3); +}; + +function mercatorProjection(project) { + var m = projection(project), + center = m.center, + scale = m.scale, + translate = m.translate, + clipExtent = m.clipExtent, + x0 = null, y0, x1, y1; // clip extent + + m.scale = function(_) { + return arguments.length ? (scale(_), reclip()) : scale(); + }; + + m.translate = function(_) { + return arguments.length ? (translate(_), reclip()) : translate(); + }; + + m.center = function(_) { + return arguments.length ? (center(_), reclip()) : center(); + }; + + m.clipExtent = function(_) { + return arguments.length ? ((_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1])), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; + }; + + function reclip() { + var k = pi$3 * scale(), + t = m(rotation(m.rotate()).invert([0, 0])); + return clipExtent(x0 == null + ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw + ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] + : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]); + } + + return reclip(); +} + +function tany(y) { + return tan((halfPi$2 + y) / 2); +} + +function conicConformalRaw(y0, y1) { + var cy0 = cos$1(y0), + n = y0 === y1 ? sin$1(y0) : log(cy0 / cos$1(y1)) / log(tany(y1) / tany(y0)), + f = cy0 * pow(tany(y0), n) / n; + + if (!n) return mercatorRaw; + + function project(x, y) { + if (f > 0) { if (y < -halfPi$2 + epsilon$2) y = -halfPi$2 + epsilon$2; } + else { if (y > halfPi$2 - epsilon$2) y = halfPi$2 - epsilon$2; } + var r = f / pow(tany(y), n); + return [r * sin$1(n * x), f - r * cos$1(n * x)]; + } + + project.invert = function(x, y) { + var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy); + return [atan2(x, abs(fy)) / n * sign(fy), 2 * atan(pow(f / r, 1 / n)) - halfPi$2]; + }; + + return project; +} + +var conicConformal = function() { + return conicProjection(conicConformalRaw) + .scale(109.5) + .parallels([30, 30]); +}; + +function equirectangularRaw(lambda, phi) { + return [lambda, phi]; +} + +equirectangularRaw.invert = equirectangularRaw; + +var equirectangular = function() { + return projection(equirectangularRaw) + .scale(152.63); +}; + +function conicEquidistantRaw(y0, y1) { + var cy0 = cos$1(y0), + n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0), + g = cy0 / n + y0; + + if (abs(n) < epsilon$2) return equirectangularRaw; + + function project(x, y) { + var gy = g - y, nx = n * x; + return [gy * sin$1(nx), g - gy * cos$1(nx)]; + } + + project.invert = function(x, y) { + var gy = g - y; + return [atan2(x, abs(gy)) / n * sign(gy), g - sign(n) * sqrt(x * x + gy * gy)]; + }; + + return project; +} + +var conicEquidistant = function() { + return conicProjection(conicEquidistantRaw) + .scale(131.154) + .center([0, 13.9389]); +}; + +function gnomonicRaw(x, y) { + var cy = cos$1(y), k = cos$1(x) * cy; + return [cy * sin$1(x) / k, sin$1(y) / k]; +} + +gnomonicRaw.invert = azimuthalInvert(atan); + +var gnomonic = function() { + return projection(gnomonicRaw) + .scale(144.049) + .clipAngle(60); +}; + +function scaleTranslate(kx, ky, tx, ty) { + return kx === 1 && ky === 1 && tx === 0 && ty === 0 ? identity$4 : transformer({ + point: function(x, y) { + this.stream.point(x * kx + tx, y * ky + ty); + } + }); +} + +var identity$5 = function() { + var k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform = identity$4, // scale, translate and reflect + x0 = null, y0, x1, y1, clip = identity$4, // clip extent + cache, + cacheStream, + projection; + + function reset() { + cache = cacheStream = null; + return projection; + } + + return projection = { + stream: function(stream) { + return cache && cacheStream === stream ? cache : cache = transform(clip(cacheStream = stream)); + }, + clipExtent: function(_) { + return arguments.length ? (clip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$4) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; + }, + scale: function(_) { + return arguments.length ? (transform = scaleTranslate((k = +_) * sx, k * sy, tx, ty), reset()) : k; + }, + translate: function(_) { + return arguments.length ? (transform = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), reset()) : [tx, ty]; + }, + reflectX: function(_) { + return arguments.length ? (transform = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), reset()) : sx < 0; + }, + reflectY: function(_) { + return arguments.length ? (transform = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), reset()) : sy < 0; + }, + fitExtent: function(extent, object) { + return fitExtent(projection, extent, object); + }, + fitSize: function(size, object) { + return fitSize(projection, size, object); + } + }; +}; + +function orthographicRaw(x, y) { + return [cos$1(y) * sin$1(x), sin$1(y)]; +} + +orthographicRaw.invert = azimuthalInvert(asin); + +var orthographic = function() { + return projection(orthographicRaw) + .scale(249.5) + .clipAngle(90 + epsilon$2); +}; + +function stereographicRaw(x, y) { + var cy = cos$1(y), k = 1 + cos$1(x) * cy; + return [cy * sin$1(x) / k, sin$1(y) / k]; +} + +stereographicRaw.invert = azimuthalInvert(function(z) { + return 2 * atan(z); +}); + +var stereographic = function() { + return projection(stereographicRaw) + .scale(250) + .clipAngle(142); +}; + +function transverseMercatorRaw(lambda, phi) { + return [log(tan((halfPi$2 + phi) / 2)), -lambda]; +} + +transverseMercatorRaw.invert = function(x, y) { + return [-y, 2 * atan(exp(x)) - halfPi$2]; +}; + +var transverseMercator = function() { + var m = mercatorProjection(transverseMercatorRaw), + center = m.center, + rotate = m.rotate; + + m.center = function(_) { + return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); + }; + + m.rotate = function(_) { + return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); + }; + + return rotate([0, 0, 90]) + .scale(159.155); +}; + +function defaultSeparation(a, b) { + return a.parent === b.parent ? 1 : 2; +} + +function meanX(children) { + return children.reduce(meanXReduce, 0) / children.length; +} + +function meanXReduce(x, c) { + return x + c.x; +} + +function maxY(children) { + return 1 + children.reduce(maxYReduce, 0); +} + +function maxYReduce(y, c) { + return Math.max(y, c.y); +} + +function leafLeft(node) { + var children; + while (children = node.children) node = children[0]; + return node; +} + +function leafRight(node) { + var children; + while (children = node.children) node = children[children.length - 1]; + return node; +} + +var cluster = function() { + var separation = defaultSeparation, + dx = 1, + dy = 1, + nodeSize = false; + + function cluster(root) { + var previousNode, + x = 0; + + // First walk, computing the initial x & y values. + root.eachAfter(function(node) { + var children = node.children; + if (children) { + node.x = meanX(children); + node.y = maxY(children); + } else { + node.x = previousNode ? x += separation(node, previousNode) : 0; + node.y = 0; + previousNode = node; + } + }); + + var left = leafLeft(root), + right = leafRight(root), + x0 = left.x - separation(left, right) / 2, + x1 = right.x + separation(right, left) / 2; + + // Second walk, normalizing x & y to the desired size. + return root.eachAfter(nodeSize ? function(node) { + node.x = (node.x - root.x) * dx; + node.y = (root.y - node.y) * dy; + } : function(node) { + node.x = (node.x - x0) / (x1 - x0) * dx; + node.y = (1 - (root.y ? node.y / root.y : 1)) * dy; + }); + } + + cluster.separation = function(x) { + return arguments.length ? (separation = x, cluster) : separation; + }; + + cluster.size = function(x) { + return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]); + }; + + cluster.nodeSize = function(x) { + return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null); + }; + + return cluster; +}; + +function count(node) { + var sum = 0, + children = node.children, + i = children && children.length; + if (!i) sum = 1; + else while (--i >= 0) sum += children[i].value; + node.value = sum; +} + +var node_count = function() { + return this.eachAfter(count); +}; + +var node_each = function(callback) { + var node = this, current, next = [node], children, i, n; + do { + current = next.reverse(), next = []; + while (node = current.pop()) { + callback(node), children = node.children; + if (children) for (i = 0, n = children.length; i < n; ++i) { + next.push(children[i]); + } + } + } while (next.length); + return this; +}; + +var node_eachBefore = function(callback) { + var node = this, nodes = [node], children, i; + while (node = nodes.pop()) { + callback(node), children = node.children; + if (children) for (i = children.length - 1; i >= 0; --i) { + nodes.push(children[i]); + } + } + return this; +}; + +var node_eachAfter = function(callback) { + var node = this, nodes = [node], next = [], children, i, n; + while (node = nodes.pop()) { + next.push(node), children = node.children; + if (children) for (i = 0, n = children.length; i < n; ++i) { + nodes.push(children[i]); + } + } + while (node = next.pop()) { + callback(node); + } + return this; +}; + +var node_sum = function(value) { + return this.eachAfter(function(node) { + var sum = +value(node.data) || 0, + children = node.children, + i = children && children.length; + while (--i >= 0) sum += children[i].value; + node.value = sum; + }); +}; + +var node_sort = function(compare) { + return this.eachBefore(function(node) { + if (node.children) { + node.children.sort(compare); + } + }); +}; + +var node_path = function(end) { + var start = this, + ancestor = leastCommonAncestor(start, end), + nodes = [start]; + while (start !== ancestor) { + start = start.parent; + nodes.push(start); + } + var k = nodes.length; + while (end !== ancestor) { + nodes.splice(k, 0, end); + end = end.parent; + } + return nodes; +}; + +function leastCommonAncestor(a, b) { + if (a === b) return a; + var aNodes = a.ancestors(), + bNodes = b.ancestors(), + c = null; + a = aNodes.pop(); + b = bNodes.pop(); + while (a === b) { + c = a; + a = aNodes.pop(); + b = bNodes.pop(); + } + return c; +} + +var node_ancestors = function() { + var node = this, nodes = [node]; + while (node = node.parent) { + nodes.push(node); + } + return nodes; +}; + +var node_descendants = function() { + var nodes = []; + this.each(function(node) { + nodes.push(node); + }); + return nodes; +}; + +var node_leaves = function() { + var leaves = []; + this.eachBefore(function(node) { + if (!node.children) { + leaves.push(node); + } + }); + return leaves; +}; + +var node_links = function() { + var root = this, links = []; + root.each(function(node) { + if (node !== root) { // Don’t include the root’s parent, if any. + links.push({source: node.parent, target: node}); + } + }); + return links; +}; + +function hierarchy(data, children) { + var root = new Node(data), + valued = +data.value && (root.value = data.value), + node, + nodes = [root], + child, + childs, + i, + n; + + if (children == null) children = defaultChildren; + + while (node = nodes.pop()) { + if (valued) node.value = +node.data.value; + if ((childs = children(node.data)) && (n = childs.length)) { + node.children = new Array(n); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new Node(childs[i])); + child.parent = node; + child.depth = node.depth + 1; + } + } + } + + return root.eachBefore(computeHeight); +} + +function node_copy() { + return hierarchy(this).eachBefore(copyData); +} + +function defaultChildren(d) { + return d.children; +} + +function copyData(node) { + node.data = node.data.data; +} + +function computeHeight(node) { + var height = 0; + do node.height = height; + while ((node = node.parent) && (node.height < ++height)); +} + +function Node(data) { + this.data = data; + this.depth = + this.height = 0; + this.parent = null; +} + +Node.prototype = hierarchy.prototype = { + constructor: Node, + count: node_count, + each: node_each, + eachAfter: node_eachAfter, + eachBefore: node_eachBefore, + sum: node_sum, + sort: node_sort, + path: node_path, + ancestors: node_ancestors, + descendants: node_descendants, + leaves: node_leaves, + links: node_links, + copy: node_copy +}; + +function Node$2(value) { + this._ = value; + this.next = null; +} + +var shuffle$1 = function(array) { + var i, + n = (array = array.slice()).length, + head = null, + node = head; + + while (n) { + var next = new Node$2(array[n - 1]); + if (node) node = node.next = next; + else node = head = next; + array[i] = array[--n]; + } + + return { + head: head, + tail: node + }; +}; + +var enclose = function(circles) { + return encloseN(shuffle$1(circles), []); +}; + +function encloses(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r - b.r; + return dr * dr + 1e-6 > dx * dx + dy * dy; +} + +// Returns the smallest circle that contains circles L and intersects circles B. +function encloseN(L, B) { + var circle, + l0 = null, + l1 = L.head, + l2, + p1; + + switch (B.length) { + case 1: circle = enclose1(B[0]); break; + case 2: circle = enclose2(B[0], B[1]); break; + case 3: circle = enclose3(B[0], B[1], B[2]); break; + } + + while (l1) { + p1 = l1._, l2 = l1.next; + if (!circle || !encloses(circle, p1)) { + + // Temporarily truncate L before l1. + if (l0) L.tail = l0, l0.next = null; + else L.head = L.tail = null; + + B.push(p1); + circle = encloseN(L, B); // Note: reorders L! + B.pop(); + + // Move l1 to the front of L and reconnect the truncated list L. + if (L.head) l1.next = L.head, L.head = l1; + else l1.next = null, L.head = L.tail = l1; + l0 = L.tail, l0.next = l2; + + } else { + l0 = l1; + } + l1 = l2; + } + + L.tail = l0; + return circle; +} + +function enclose1(a) { + return { + x: a.x, + y: a.y, + r: a.r + }; +} + +function enclose2(a, b) { + var x1 = a.x, y1 = a.y, r1 = a.r, + x2 = b.x, y2 = b.y, r2 = b.r, + x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, + l = Math.sqrt(x21 * x21 + y21 * y21); + return { + x: (x1 + x2 + x21 / l * r21) / 2, + y: (y1 + y2 + y21 / l * r21) / 2, + r: (l + r1 + r2) / 2 + }; +} + +function enclose3(a, b, c) { + var x1 = a.x, y1 = a.y, r1 = a.r, + x2 = b.x, y2 = b.y, r2 = b.r, + x3 = c.x, y3 = c.y, r3 = c.r, + a2 = 2 * (x1 - x2), + b2 = 2 * (y1 - y2), + c2 = 2 * (r2 - r1), + d2 = x1 * x1 + y1 * y1 - r1 * r1 - x2 * x2 - y2 * y2 + r2 * r2, + a3 = 2 * (x1 - x3), + b3 = 2 * (y1 - y3), + c3 = 2 * (r3 - r1), + d3 = x1 * x1 + y1 * y1 - r1 * r1 - x3 * x3 - y3 * y3 + r3 * r3, + ab = a3 * b2 - a2 * b3, + xa = (b2 * d3 - b3 * d2) / ab - x1, + xb = (b3 * c2 - b2 * c3) / ab, + ya = (a3 * d2 - a2 * d3) / ab - y1, + yb = (a2 * c3 - a3 * c2) / ab, + A = xb * xb + yb * yb - 1, + B = 2 * (xa * xb + ya * yb + r1), + C = xa * xa + ya * ya - r1 * r1, + r = (-B - Math.sqrt(B * B - 4 * A * C)) / (2 * A); + return { + x: xa + xb * r + x1, + y: ya + yb * r + y1, + r: r + }; +} + +function place(a, b, c) { + var ax = a.x, + ay = a.y, + da = b.r + c.r, + db = a.r + c.r, + dx = b.x - ax, + dy = b.y - ay, + dc = dx * dx + dy * dy; + if (dc) { + var x = 0.5 + ((db *= db) - (da *= da)) / (2 * dc), + y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc); + c.x = ax + x * dx + y * dy; + c.y = ay + x * dy - y * dx; + } else { + c.x = ax + db; + c.y = ay; + } +} + +function intersects(a, b) { + var dx = b.x - a.x, + dy = b.y - a.y, + dr = a.r + b.r; + return dr * dr - 1e-6 > dx * dx + dy * dy; +} + +function distance2(node, x, y) { + var a = node._, + b = node.next._, + ab = a.r + b.r, + dx = (a.x * b.r + b.x * a.r) / ab - x, + dy = (a.y * b.r + b.y * a.r) / ab - y; + return dx * dx + dy * dy; +} + +function Node$1(circle) { + this._ = circle; + this.next = null; + this.previous = null; +} + +function packEnclose(circles) { + if (!(n = circles.length)) return 0; + + var a, b, c, n; + + // Place the first circle. + a = circles[0], a.x = 0, a.y = 0; + if (!(n > 1)) return a.r; + + // Place the second circle. + b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0; + if (!(n > 2)) return a.r + b.r; + + // Place the third circle. + place(b, a, c = circles[2]); + + // Initialize the weighted centroid. + var aa = a.r * a.r, + ba = b.r * b.r, + ca = c.r * c.r, + oa = aa + ba + ca, + ox = aa * a.x + ba * b.x + ca * c.x, + oy = aa * a.y + ba * b.y + ca * c.y, + cx, cy, i, j, k, sj, sk; + + // Initialize the front-chain using the first three circles a, b and c. + a = new Node$1(a), b = new Node$1(b), c = new Node$1(c); + a.next = c.previous = b; + b.next = a.previous = c; + c.next = b.previous = a; + + // Attempt to place each remaining circle… + pack: for (i = 3; i < n; ++i) { + place(a._, b._, c = circles[i]), c = new Node$1(c); + + // Find the closest intersecting circle on the front-chain, if any. + // “Closeness” is determined by linear distance along the front-chain. + // “Ahead” or “behind” is likewise determined by linear distance. + j = b.next, k = a.previous, sj = b._.r, sk = a._.r; + do { + if (sj <= sk) { + if (intersects(j._, c._)) { + b = j, a.next = b, b.previous = a, --i; + continue pack; + } + sj += j._.r, j = j.next; + } else { + if (intersects(k._, c._)) { + a = k, a.next = b, b.previous = a, --i; + continue pack; + } + sk += k._.r, k = k.previous; + } + } while (j !== k.next); + + // Success! Insert the new circle c between a and b. + c.previous = a, c.next = b, a.next = b.previous = b = c; + + // Update the weighted centroid. + oa += ca = c._.r * c._.r; + ox += ca * c._.x; + oy += ca * c._.y; + + // Compute the new closest circle pair to the centroid. + aa = distance2(a, cx = ox / oa, cy = oy / oa); + while ((c = c.next) !== b) { + if ((ca = distance2(c, cx, cy)) < aa) { + a = c, aa = ca; + } + } + b = a.next; + } + + // Compute the enclosing circle of the front chain. + a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a); + + // Translate the circles to put the enclosing circle around the origin. + for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y; + + return c.r; +} + +var siblings = function(circles) { + packEnclose(circles); + return circles; +}; + +function optional(f) { + return f == null ? null : required(f); +} + +function required(f) { + if (typeof f !== "function") throw new Error; + return f; +} + +function constantZero() { + return 0; +} + +var constant$8 = function(x) { + return function() { + return x; + }; +}; + +function defaultRadius$1(d) { + return Math.sqrt(d.value); +} + +var index$2 = function() { + var radius = null, + dx = 1, + dy = 1, + padding = constantZero; + + function pack(root) { + root.x = dx / 2, root.y = dy / 2; + if (radius) { + root.eachBefore(radiusLeaf(radius)) + .eachAfter(packChildren(padding, 0.5)) + .eachBefore(translateChild(1)); + } else { + root.eachBefore(radiusLeaf(defaultRadius$1)) + .eachAfter(packChildren(constantZero, 1)) + .eachAfter(packChildren(padding, root.r / Math.min(dx, dy))) + .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))); + } + return root; + } + + pack.radius = function(x) { + return arguments.length ? (radius = optional(x), pack) : radius; + }; + + pack.size = function(x) { + return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy]; + }; + + pack.padding = function(x) { + return arguments.length ? (padding = typeof x === "function" ? x : constant$8(+x), pack) : padding; + }; + + return pack; +}; + +function radiusLeaf(radius) { + return function(node) { + if (!node.children) { + node.r = Math.max(0, +radius(node) || 0); + } + }; +} + +function packChildren(padding, k) { + return function(node) { + if (children = node.children) { + var children, + i, + n = children.length, + r = padding(node) * k || 0, + e; + + if (r) for (i = 0; i < n; ++i) children[i].r += r; + e = packEnclose(children); + if (r) for (i = 0; i < n; ++i) children[i].r -= r; + node.r = e + r; + } + }; +} + +function translateChild(k) { + return function(node) { + var parent = node.parent; + node.r *= k; + if (parent) { + node.x = parent.x + k * node.x; + node.y = parent.y + k * node.y; + } + }; +} + +var roundNode = function(node) { + node.x0 = Math.round(node.x0); + node.y0 = Math.round(node.y0); + node.x1 = Math.round(node.x1); + node.y1 = Math.round(node.y1); +}; + +var treemapDice = function(parent, x0, y0, x1, y1) { + var nodes = parent.children, + node, + i = -1, + n = nodes.length, + k = parent.value && (x1 - x0) / parent.value; + + while (++i < n) { + node = nodes[i], node.y0 = y0, node.y1 = y1; + node.x0 = x0, node.x1 = x0 += node.value * k; + } +}; + +var partition = function() { + var dx = 1, + dy = 1, + padding = 0, + round = false; + + function partition(root) { + var n = root.height + 1; + root.x0 = + root.y0 = padding; + root.x1 = dx; + root.y1 = dy / n; + root.eachBefore(positionNode(dy, n)); + if (round) root.eachBefore(roundNode); + return root; + } + + function positionNode(dy, n) { + return function(node) { + if (node.children) { + treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n); + } + var x0 = node.x0, + y0 = node.y0, + x1 = node.x1 - padding, + y1 = node.y1 - padding; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + node.x0 = x0; + node.y0 = y0; + node.x1 = x1; + node.y1 = y1; + }; + } + + partition.round = function(x) { + return arguments.length ? (round = !!x, partition) : round; + }; + + partition.size = function(x) { + return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy]; + }; + + partition.padding = function(x) { + return arguments.length ? (padding = +x, partition) : padding; + }; + + return partition; +}; + +var keyPrefix$1 = "$"; +var preroot = {depth: -1}; +var ambiguous = {}; + +function defaultId(d) { + return d.id; +} + +function defaultParentId(d) { + return d.parentId; +} + +var stratify = function() { + var id = defaultId, + parentId = defaultParentId; + + function stratify(data) { + var d, + i, + n = data.length, + root, + parent, + node, + nodes = new Array(n), + nodeId, + nodeKey, + nodeByKey = {}; + + for (i = 0; i < n; ++i) { + d = data[i], node = nodes[i] = new Node(d); + if ((nodeId = id(d, i, data)) != null && (nodeId += "")) { + nodeKey = keyPrefix$1 + (node.id = nodeId); + nodeByKey[nodeKey] = nodeKey in nodeByKey ? ambiguous : node; + } + } + + for (i = 0; i < n; ++i) { + node = nodes[i], nodeId = parentId(data[i], i, data); + if (nodeId == null || !(nodeId += "")) { + if (root) throw new Error("multiple roots"); + root = node; + } else { + parent = nodeByKey[keyPrefix$1 + nodeId]; + if (!parent) throw new Error("missing: " + nodeId); + if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); + if (parent.children) parent.children.push(node); + else parent.children = [node]; + node.parent = parent; + } + } + + if (!root) throw new Error("no root"); + root.parent = preroot; + root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight); + root.parent = null; + if (n > 0) throw new Error("cycle"); + + return root; + } + + stratify.id = function(x) { + return arguments.length ? (id = required(x), stratify) : id; + }; + + stratify.parentId = function(x) { + return arguments.length ? (parentId = required(x), stratify) : parentId; + }; + + return stratify; +}; + +function defaultSeparation$1(a, b) { + return a.parent === b.parent ? 1 : 2; +} + +// function radialSeparation(a, b) { +// return (a.parent === b.parent ? 1 : 2) / a.depth; +// } + +// This function is used to traverse the left contour of a subtree (or +// subforest). It returns the successor of v on this contour. This successor is +// either given by the leftmost child of v or by the thread of v. The function +// returns null if and only if v is on the highest level of its subtree. +function nextLeft(v) { + var children = v.children; + return children ? children[0] : v.t; +} + +// This function works analogously to nextLeft. +function nextRight(v) { + var children = v.children; + return children ? children[children.length - 1] : v.t; +} + +// Shifts the current subtree rooted at w+. This is done by increasing +// prelim(w+) and mod(w+) by shift. +function moveSubtree(wm, wp, shift) { + var change = shift / (wp.i - wm.i); + wp.c -= change; + wp.s += shift; + wm.c += change; + wp.z += shift; + wp.m += shift; +} + +// All other shifts, applied to the smaller subtrees between w- and w+, are +// performed by this function. To prepare the shifts, we have to adjust +// change(w+), shift(w+), and change(w-). +function executeShifts(v) { + var shift = 0, + change = 0, + children = v.children, + i = children.length, + w; + while (--i >= 0) { + w = children[i]; + w.z += shift; + w.m += shift; + shift += w.s + (change += w.c); + } +} + +// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise, +// returns the specified (default) ancestor. +function nextAncestor(vim, v, ancestor) { + return vim.a.parent === v.parent ? vim.a : ancestor; +} + +function TreeNode(node, i) { + this._ = node; + this.parent = null; + this.children = null; + this.A = null; // default ancestor + this.a = this; // ancestor + this.z = 0; // prelim + this.m = 0; // mod + this.c = 0; // change + this.s = 0; // shift + this.t = null; // thread + this.i = i; // number +} + +TreeNode.prototype = Object.create(Node.prototype); + +function treeRoot(root) { + var tree = new TreeNode(root, 0), + node, + nodes = [tree], + child, + children, + i, + n; + + while (node = nodes.pop()) { + if (children = node._.children) { + node.children = new Array(n = children.length); + for (i = n - 1; i >= 0; --i) { + nodes.push(child = node.children[i] = new TreeNode(children[i], i)); + child.parent = node; + } + } + } + + (tree.parent = new TreeNode(null, 0)).children = [tree]; + return tree; +} + +// Node-link tree diagram using the Reingold-Tilford "tidy" algorithm +var tree = function() { + var separation = defaultSeparation$1, + dx = 1, + dy = 1, + nodeSize = null; + + function tree(root) { + var t = treeRoot(root); + + // Compute the layout using Buchheim et al.’s algorithm. + t.eachAfter(firstWalk), t.parent.m = -t.z; + t.eachBefore(secondWalk); + + // If a fixed node size is specified, scale x and y. + if (nodeSize) root.eachBefore(sizeNode); + + // If a fixed tree size is specified, scale x and y based on the extent. + // Compute the left-most, right-most, and depth-most nodes for extents. + else { + var left = root, + right = root, + bottom = root; + root.eachBefore(function(node) { + if (node.x < left.x) left = node; + if (node.x > right.x) right = node; + if (node.depth > bottom.depth) bottom = node; + }); + var s = left === right ? 1 : separation(left, right) / 2, + tx = s - left.x, + kx = dx / (right.x + s + tx), + ky = dy / (bottom.depth || 1); + root.eachBefore(function(node) { + node.x = (node.x + tx) * kx; + node.y = node.depth * ky; + }); + } + + return root; + } + + // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is + // applied recursively to the children of v, as well as the function + // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the + // node v is placed to the midpoint of its outermost children. + function firstWalk(v) { + var children = v.children, + siblings = v.parent.children, + w = v.i ? siblings[v.i - 1] : null; + if (children) { + executeShifts(v); + var midpoint = (children[0].z + children[children.length - 1].z) / 2; + if (w) { + v.z = w.z + separation(v._, w._); + v.m = v.z - midpoint; + } else { + v.z = midpoint; + } + } else if (w) { + v.z = w.z + separation(v._, w._); + } + v.parent.A = apportion(v, w, v.parent.A || siblings[0]); + } + + // Computes all real x-coordinates by summing up the modifiers recursively. + function secondWalk(v) { + v._.x = v.z + v.parent.m; + v.m += v.parent.m; + } + + // The core of the algorithm. Here, a new subtree is combined with the + // previous subtrees. Threads are used to traverse the inside and outside + // contours of the left and right subtree up to the highest common level. The + // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the + // superscript o means outside and i means inside, the subscript - means left + // subtree and + means right subtree. For summing up the modifiers along the + // contour, we use respective variables si+, si-, so-, and so+. Whenever two + // nodes of the inside contours conflict, we compute the left one of the + // greatest uncommon ancestors using the function ANCESTOR and call MOVE + // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees. + // Finally, we add a new thread (if necessary). + function apportion(v, w, ancestor) { + if (w) { + var vip = v, + vop = v, + vim = w, + vom = vip.parent.children[0], + sip = vip.m, + sop = vop.m, + sim = vim.m, + som = vom.m, + shift; + while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { + vom = nextLeft(vom); + vop = nextRight(vop); + vop.a = v; + shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); + if (shift > 0) { + moveSubtree(nextAncestor(vim, v, ancestor), v, shift); + sip += shift; + sop += shift; + } + sim += vim.m; + sip += vip.m; + som += vom.m; + sop += vop.m; + } + if (vim && !nextRight(vop)) { + vop.t = vim; + vop.m += sim - sop; + } + if (vip && !nextLeft(vom)) { + vom.t = vip; + vom.m += sip - som; + ancestor = v; + } + } + return ancestor; + } + + function sizeNode(node) { + node.x *= dx; + node.y = node.depth * dy; + } + + tree.separation = function(x) { + return arguments.length ? (separation = x, tree) : separation; + }; + + tree.size = function(x) { + return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]); + }; + + tree.nodeSize = function(x) { + return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); + }; + + return tree; +}; + +var treemapSlice = function(parent, x0, y0, x1, y1) { + var nodes = parent.children, + node, + i = -1, + n = nodes.length, + k = parent.value && (y1 - y0) / parent.value; + + while (++i < n) { + node = nodes[i], node.x0 = x0, node.x1 = x1; + node.y0 = y0, node.y1 = y0 += node.value * k; + } +}; + +var phi = (1 + Math.sqrt(5)) / 2; + +function squarifyRatio(ratio, parent, x0, y0, x1, y1) { + var rows = [], + nodes = parent.children, + row, + nodeValue, + i0 = 0, + i1 = 0, + n = nodes.length, + dx, dy, + value = parent.value, + sumValue, + minValue, + maxValue, + newRatio, + minRatio, + alpha, + beta; + + while (i0 < n) { + dx = x1 - x0, dy = y1 - y0; + + // Find the next non-empty node. + do sumValue = nodes[i1++].value; while (!sumValue && i1 < n); + minValue = maxValue = sumValue; + alpha = Math.max(dy / dx, dx / dy) / (value * ratio); + beta = sumValue * sumValue * alpha; + minRatio = Math.max(maxValue / beta, beta / minValue); + + // Keep adding nodes while the aspect ratio maintains or improves. + for (; i1 < n; ++i1) { + sumValue += nodeValue = nodes[i1].value; + if (nodeValue < minValue) minValue = nodeValue; + if (nodeValue > maxValue) maxValue = nodeValue; + beta = sumValue * sumValue * alpha; + newRatio = Math.max(maxValue / beta, beta / minValue); + if (newRatio > minRatio) { sumValue -= nodeValue; break; } + minRatio = newRatio; + } + + // Position and record the row orientation. + rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)}); + if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1); + else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1); + value -= sumValue, i0 = i1; + } + + return rows; +} + +var squarify = ((function custom(ratio) { + + function squarify(parent, x0, y0, x1, y1) { + squarifyRatio(ratio, parent, x0, y0, x1, y1); + } + + squarify.ratio = function(x) { + return custom((x = +x) > 1 ? x : 1); + }; + + return squarify; +}))(phi); + +var index$3 = function() { + var tile = squarify, + round = false, + dx = 1, + dy = 1, + paddingStack = [0], + paddingInner = constantZero, + paddingTop = constantZero, + paddingRight = constantZero, + paddingBottom = constantZero, + paddingLeft = constantZero; + + function treemap(root) { + root.x0 = + root.y0 = 0; + root.x1 = dx; + root.y1 = dy; + root.eachBefore(positionNode); + paddingStack = [0]; + if (round) root.eachBefore(roundNode); + return root; + } + + function positionNode(node) { + var p = paddingStack[node.depth], + x0 = node.x0 + p, + y0 = node.y0 + p, + x1 = node.x1 - p, + y1 = node.y1 - p; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + node.x0 = x0; + node.y0 = y0; + node.x1 = x1; + node.y1 = y1; + if (node.children) { + p = paddingStack[node.depth + 1] = paddingInner(node) / 2; + x0 += paddingLeft(node) - p; + y0 += paddingTop(node) - p; + x1 -= paddingRight(node) - p; + y1 -= paddingBottom(node) - p; + if (x1 < x0) x0 = x1 = (x0 + x1) / 2; + if (y1 < y0) y0 = y1 = (y0 + y1) / 2; + tile(node, x0, y0, x1, y1); + } + } + + treemap.round = function(x) { + return arguments.length ? (round = !!x, treemap) : round; + }; + + treemap.size = function(x) { + return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy]; + }; + + treemap.tile = function(x) { + return arguments.length ? (tile = required(x), treemap) : tile; + }; + + treemap.padding = function(x) { + return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner(); + }; + + treemap.paddingInner = function(x) { + return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$8(+x), treemap) : paddingInner; + }; + + treemap.paddingOuter = function(x) { + return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop(); + }; + + treemap.paddingTop = function(x) { + return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$8(+x), treemap) : paddingTop; + }; + + treemap.paddingRight = function(x) { + return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$8(+x), treemap) : paddingRight; + }; + + treemap.paddingBottom = function(x) { + return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$8(+x), treemap) : paddingBottom; + }; + + treemap.paddingLeft = function(x) { + return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$8(+x), treemap) : paddingLeft; + }; + + return treemap; +}; + +var binary = function(parent, x0, y0, x1, y1) { + var nodes = parent.children, + i, n = nodes.length, + sum, sums = new Array(n + 1); + + for (sums[0] = sum = i = 0; i < n; ++i) { + sums[i + 1] = sum += nodes[i].value; + } + + partition(0, n, parent.value, x0, y0, x1, y1); + + function partition(i, j, value, x0, y0, x1, y1) { + if (i >= j - 1) { + var node = nodes[i]; + node.x0 = x0, node.y0 = y0; + node.x1 = x1, node.y1 = y1; + return; + } + + var valueOffset = sums[i], + valueTarget = (value / 2) + valueOffset, + k = i + 1, + hi = j - 1; + + while (k < hi) { + var mid = k + hi >>> 1; + if (sums[mid] < valueTarget) k = mid + 1; + else hi = mid; + } + + if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k; + + var valueLeft = sums[k] - valueOffset, + valueRight = value - valueLeft; + + if ((x1 - x0) > (y1 - y0)) { + var xk = (x0 * valueRight + x1 * valueLeft) / value; + partition(i, k, valueLeft, x0, y0, xk, y1); + partition(k, j, valueRight, xk, y0, x1, y1); + } else { + var yk = (y0 * valueRight + y1 * valueLeft) / value; + partition(i, k, valueLeft, x0, y0, x1, yk); + partition(k, j, valueRight, x0, yk, x1, y1); + } + } +}; + +var sliceDice = function(parent, x0, y0, x1, y1) { + (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); +}; + +var resquarify = ((function custom(ratio) { + + function resquarify(parent, x0, y0, x1, y1) { + if ((rows = parent._squarify) && (rows.ratio === ratio)) { + var rows, + row, + nodes, + i, + j = -1, + n, + m = rows.length, + value = parent.value; + + while (++j < m) { + row = rows[j], nodes = row.children; + for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; + if (row.dice) treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value); + else treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1); + value -= row.value; + } + } else { + parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1); + rows.ratio = ratio; + } + } + + resquarify.ratio = function(x) { + return custom((x = +x) > 1 ? x : 1); + }; + + return resquarify; +}))(phi); + +var area$1 = function(polygon) { + var i = -1, + n = polygon.length, + a, + b = polygon[n - 1], + area = 0; + + while (++i < n) { + a = b; + b = polygon[i]; + area += a[1] * b[0] - a[0] * b[1]; + } + + return area / 2; +}; + +var centroid$1 = function(polygon) { + var i = -1, + n = polygon.length, + x = 0, + y = 0, + a, + b = polygon[n - 1], + c, + k = 0; + + while (++i < n) { + a = b; + b = polygon[i]; + k += c = a[0] * b[1] - b[0] * a[1]; + x += (a[0] + b[0]) * c; + y += (a[1] + b[1]) * c; + } + + return k *= 3, [x / k, y / k]; +}; + +// Returns the 2D cross product of AB and AC vectors, i.e., the z-component of +// the 3D cross product in a quadrant I Cartesian coordinate system (+x is +// right, +y is up). Returns a positive value if ABC is counter-clockwise, +// negative if clockwise, and zero if the points are collinear. +var cross$1 = function(a, b, c) { + return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); +}; + +function lexicographicOrder(a, b) { + return a[0] - b[0] || a[1] - b[1]; +} + +// Computes the upper convex hull per the monotone chain algorithm. +// Assumes points.length >= 3, is sorted by x, unique in y. +// Returns an array of indices into points in left-to-right order. +function computeUpperHullIndexes(points) { + var n = points.length, + indexes = [0, 1], + size = 2; + + for (var i = 2; i < n; ++i) { + while (size > 1 && cross$1(points[indexes[size - 2]], points[indexes[size - 1]], points[i]) <= 0) --size; + indexes[size++] = i; + } + + return indexes.slice(0, size); // remove popped points +} + +var hull = function(points) { + if ((n = points.length) < 3) return null; + + var i, + n, + sortedPoints = new Array(n), + flippedPoints = new Array(n); + + for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i]; + sortedPoints.sort(lexicographicOrder); + for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]]; + + var upperIndexes = computeUpperHullIndexes(sortedPoints), + lowerIndexes = computeUpperHullIndexes(flippedPoints); + + // Construct the hull polygon, removing possible duplicate endpoints. + var skipLeft = lowerIndexes[0] === upperIndexes[0], + skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], + hull = []; + + // Add upper hull in right-to-l order. + // Then add lower hull in left-to-right order. + for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]); + for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]); + + return hull; +}; + +var contains$1 = function(polygon, point) { + var n = polygon.length, + p = polygon[n - 1], + x = point[0], y = point[1], + x0 = p[0], y0 = p[1], + x1, y1, + inside = false; + + for (var i = 0; i < n; ++i) { + p = polygon[i], x1 = p[0], y1 = p[1]; + if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside; + x0 = x1, y0 = y1; + } + + return inside; +}; + +var length$2 = function(polygon) { + var i = -1, + n = polygon.length, + b = polygon[n - 1], + xa, + ya, + xb = b[0], + yb = b[1], + perimeter = 0; + + while (++i < n) { + xa = xb; + ya = yb; + b = polygon[i]; + xb = b[0]; + yb = b[1]; + xa -= xb; + ya -= yb; + perimeter += Math.sqrt(xa * xa + ya * ya); + } + + return perimeter; +}; + +var slice$3 = [].slice; + +var noabort = {}; + +function Queue(size) { + this._size = size; + this._call = + this._error = null; + this._tasks = []; + this._data = []; + this._waiting = + this._active = + this._ended = + this._start = 0; // inside a synchronous task callback? +} + +Queue.prototype = queue.prototype = { + constructor: Queue, + defer: function(callback) { + if (typeof callback !== "function") throw new Error("invalid callback"); + if (this._call) throw new Error("defer after await"); + if (this._error != null) return this; + var t = slice$3.call(arguments, 1); + t.push(callback); + ++this._waiting, this._tasks.push(t); + poke$1(this); + return this; + }, + abort: function() { + if (this._error == null) abort(this, new Error("abort")); + return this; + }, + await: function(callback) { + if (typeof callback !== "function") throw new Error("invalid callback"); + if (this._call) throw new Error("multiple await"); + this._call = function(error, results) { callback.apply(null, [error].concat(results)); }; + maybeNotify(this); + return this; + }, + awaitAll: function(callback) { + if (typeof callback !== "function") throw new Error("invalid callback"); + if (this._call) throw new Error("multiple await"); + this._call = callback; + maybeNotify(this); + return this; + } +}; + +function poke$1(q) { + if (!q._start) { + try { start$1(q); } // let the current task complete + catch (e) { + if (q._tasks[q._ended + q._active - 1]) abort(q, e); // task errored synchronously + else if (!q._data) throw e; // await callback errored synchronously + } + } +} + +function start$1(q) { + while (q._start = q._waiting && q._active < q._size) { + var i = q._ended + q._active, + t = q._tasks[i], + j = t.length - 1, + c = t[j]; + t[j] = end(q, i); + --q._waiting, ++q._active; + t = c.apply(null, t); + if (!q._tasks[i]) continue; // task finished synchronously + q._tasks[i] = t || noabort; + } +} + +function end(q, i) { + return function(e, r) { + if (!q._tasks[i]) return; // ignore multiple callbacks + --q._active, ++q._ended; + q._tasks[i] = null; + if (q._error != null) return; // ignore secondary errors + if (e != null) { + abort(q, e); + } else { + q._data[i] = r; + if (q._waiting) poke$1(q); + else maybeNotify(q); + } + }; +} + +function abort(q, e) { + var i = q._tasks.length, t; + q._error = e; // ignore active callbacks + q._data = undefined; // allow gc + q._waiting = NaN; // prevent starting + + while (--i >= 0) { + if (t = q._tasks[i]) { + q._tasks[i] = null; + if (t.abort) { + try { t.abort(); } + catch (e) { /* ignore */ } + } + } + } + + q._active = NaN; // allow notification + maybeNotify(q); +} + +function maybeNotify(q) { + if (!q._active && q._call) { + var d = q._data; + q._data = undefined; // allow gc + q._call(q._error, d); + } +} + +function queue(concurrency) { + if (concurrency == null) concurrency = Infinity; + else if (!((concurrency = +concurrency) >= 1)) throw new Error("invalid concurrency"); + return new Queue(concurrency); +} + +var defaultSource$1 = function() { + return Math.random(); +}; + +var uniform = ((function sourceRandomUniform(source) { + function randomUniform(min, max) { + min = min == null ? 0 : +min; + max = max == null ? 1 : +max; + if (arguments.length === 1) max = min, min = 0; + else max -= min; + return function() { + return source() * max + min; + }; + } + + randomUniform.source = sourceRandomUniform; + + return randomUniform; +}))(defaultSource$1); + +var normal = ((function sourceRandomNormal(source) { + function randomNormal(mu, sigma) { + var x, r; + mu = mu == null ? 0 : +mu; + sigma = sigma == null ? 1 : +sigma; + return function() { + var y; + + // If available, use the second previously-generated uniform random. + if (x != null) y = x, x = null; + + // Otherwise, generate a new x and y. + else do { + x = source() * 2 - 1; + y = source() * 2 - 1; + r = x * x + y * y; + } while (!r || r > 1); + + return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r); + }; + } + + randomNormal.source = sourceRandomNormal; + + return randomNormal; +}))(defaultSource$1); + +var logNormal = ((function sourceRandomLogNormal(source) { + function randomLogNormal() { + var randomNormal = normal.source(source).apply(this, arguments); + return function() { + return Math.exp(randomNormal()); + }; + } + + randomLogNormal.source = sourceRandomLogNormal; + + return randomLogNormal; +}))(defaultSource$1); + +var irwinHall = ((function sourceRandomIrwinHall(source) { + function randomIrwinHall(n) { + return function() { + for (var sum = 0, i = 0; i < n; ++i) sum += source(); + return sum; + }; + } + + randomIrwinHall.source = sourceRandomIrwinHall; + + return randomIrwinHall; +}))(defaultSource$1); + +var bates = ((function sourceRandomBates(source) { + function randomBates(n) { + var randomIrwinHall = irwinHall.source(source)(n); + return function() { + return randomIrwinHall() / n; + }; + } + + randomBates.source = sourceRandomBates; + + return randomBates; +}))(defaultSource$1); + +var exponential$1 = ((function sourceRandomExponential(source) { + function randomExponential(lambda) { + return function() { + return -Math.log(1 - source()) / lambda; + }; + } + + randomExponential.source = sourceRandomExponential; + + return randomExponential; +}))(defaultSource$1); + +var request = function(url, callback) { + var request, + event = dispatch("beforesend", "progress", "load", "error"), + mimeType, + headers = map$1(), + xhr = new XMLHttpRequest, + user = null, + password = null, + response, + responseType, + timeout = 0; + + // If IE does not support CORS, use XDomainRequest. + if (typeof XDomainRequest !== "undefined" + && !("withCredentials" in xhr) + && /^(http(s)?:)?\/\//.test(url)) xhr = new XDomainRequest; + + "onload" in xhr + ? xhr.onload = xhr.onerror = xhr.ontimeout = respond + : xhr.onreadystatechange = function(o) { xhr.readyState > 3 && respond(o); }; + + function respond(o) { + var status = xhr.status, result; + if (!status && hasResponse(xhr) + || status >= 200 && status < 300 + || status === 304) { + if (response) { + try { + result = response.call(request, xhr); + } catch (e) { + event.call("error", request, e); + return; + } + } else { + result = xhr; + } + event.call("load", request, result); + } else { + event.call("error", request, o); + } + } + + xhr.onprogress = function(e) { + event.call("progress", request, e); + }; + + request = { + header: function(name, value) { + name = (name + "").toLowerCase(); + if (arguments.length < 2) return headers.get(name); + if (value == null) headers.remove(name); + else headers.set(name, value + ""); + return request; + }, + + // If mimeType is non-null and no Accept header is set, a default is used. + mimeType: function(value) { + if (!arguments.length) return mimeType; + mimeType = value == null ? null : value + ""; + return request; + }, + + // Specifies what type the response value should take; + // for instance, arraybuffer, blob, document, or text. + responseType: function(value) { + if (!arguments.length) return responseType; + responseType = value; + return request; + }, + + timeout: function(value) { + if (!arguments.length) return timeout; + timeout = +value; + return request; + }, + + user: function(value) { + return arguments.length < 1 ? user : (user = value == null ? null : value + "", request); + }, + + password: function(value) { + return arguments.length < 1 ? password : (password = value == null ? null : value + "", request); + }, + + // Specify how to convert the response content to a specific type; + // changes the callback value on "load" events. + response: function(value) { + response = value; + return request; + }, + + // Alias for send("GET", …). + get: function(data, callback) { + return request.send("GET", data, callback); + }, + + // Alias for send("POST", …). + post: function(data, callback) { + return request.send("POST", data, callback); + }, + + // If callback is non-null, it will be used for error and load events. + send: function(method, data, callback) { + xhr.open(method, url, true, user, password); + if (mimeType != null && !headers.has("accept")) headers.set("accept", mimeType + ",*/*"); + if (xhr.setRequestHeader) headers.each(function(value, name) { xhr.setRequestHeader(name, value); }); + if (mimeType != null && xhr.overrideMimeType) xhr.overrideMimeType(mimeType); + if (responseType != null) xhr.responseType = responseType; + if (timeout > 0) xhr.timeout = timeout; + if (callback == null && typeof data === "function") callback = data, data = null; + if (callback != null && callback.length === 1) callback = fixCallback(callback); + if (callback != null) request.on("error", callback).on("load", function(xhr) { callback(null, xhr); }); + event.call("beforesend", request, xhr); + xhr.send(data == null ? null : data); + return request; + }, + + abort: function() { + xhr.abort(); + return request; + }, + + on: function() { + var value = event.on.apply(event, arguments); + return value === event ? request : value; + } + }; + + if (callback != null) { + if (typeof callback !== "function") throw new Error("invalid callback: " + callback); + return request.get(callback); + } + + return request; +}; + +function fixCallback(callback) { + return function(error, xhr) { + callback(error == null ? xhr : null); + }; +} + +function hasResponse(xhr) { + var type = xhr.responseType; + return type && type !== "text" + ? xhr.response // null on error + : xhr.responseText; // "" on error +} + +var type$1 = function(defaultMimeType, response) { + return function(url, callback) { + var r = request(url).mimeType(defaultMimeType).response(response); + if (callback != null) { + if (typeof callback !== "function") throw new Error("invalid callback: " + callback); + return r.get(callback); + } + return r; + }; +}; + +var html = type$1("text/html", function(xhr) { + return document.createRange().createContextualFragment(xhr.responseText); +}); + +var json = type$1("application/json", function(xhr) { + return JSON.parse(xhr.responseText); +}); + +var text = type$1("text/plain", function(xhr) { + return xhr.responseText; +}); + +var xml = type$1("application/xml", function(xhr) { + var xml = xhr.responseXML; + if (!xml) throw new Error("parse error"); + return xml; +}); + +var dsv$1 = function(defaultMimeType, parse) { + return function(url, row, callback) { + if (arguments.length < 3) callback = row, row = null; + var r = request(url).mimeType(defaultMimeType); + r.row = function(_) { return arguments.length ? r.response(responseOf(parse, row = _)) : row; }; + r.row(row); + return callback ? r.get(callback) : r; + }; +}; + +function responseOf(parse, row) { + return function(request$$1) { + return parse(request$$1.responseText, row); + }; +} + +var csv$1 = dsv$1("text/csv", csvParse); + +var tsv$1 = dsv$1("text/tab-separated-values", tsvParse); + +var array$2 = Array.prototype; + +var map$3 = array$2.map; +var slice$4 = array$2.slice; + +var implicit = {name: "implicit"}; + +function ordinal(range) { + var index = map$1(), + domain = [], + unknown = implicit; + + range = range == null ? [] : slice$4.call(range); + + function scale(d) { + var key = d + "", i = index.get(key); + if (!i) { + if (unknown !== implicit) return unknown; + index.set(key, i = domain.push(d)); + } + return range[(i - 1) % range.length]; + } + + scale.domain = function(_) { + if (!arguments.length) return domain.slice(); + domain = [], index = map$1(); + var i = -1, n = _.length, d, key; + while (++i < n) if (!index.has(key = (d = _[i]) + "")) index.set(key, domain.push(d)); + return scale; + }; + + scale.range = function(_) { + return arguments.length ? (range = slice$4.call(_), scale) : range.slice(); + }; + + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + + scale.copy = function() { + return ordinal() + .domain(domain) + .range(range) + .unknown(unknown); + }; + + return scale; +} + +function band() { + var scale = ordinal().unknown(undefined), + domain = scale.domain, + ordinalRange = scale.range, + range$$1 = [0, 1], + step, + bandwidth, + round = false, + paddingInner = 0, + paddingOuter = 0, + align = 0.5; + + delete scale.unknown; + + function rescale() { + var n = domain().length, + reverse = range$$1[1] < range$$1[0], + start = range$$1[reverse - 0], + stop = range$$1[1 - reverse]; + step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2); + if (round) step = Math.floor(step); + start += (stop - start - step * (n - paddingInner)) * align; + bandwidth = step * (1 - paddingInner); + if (round) start = Math.round(start), bandwidth = Math.round(bandwidth); + var values = sequence(n).map(function(i) { return start + step * i; }); + return ordinalRange(reverse ? values.reverse() : values); + } + + scale.domain = function(_) { + return arguments.length ? (domain(_), rescale()) : domain(); + }; + + scale.range = function(_) { + return arguments.length ? (range$$1 = [+_[0], +_[1]], rescale()) : range$$1.slice(); + }; + + scale.rangeRound = function(_) { + return range$$1 = [+_[0], +_[1]], round = true, rescale(); + }; + + scale.bandwidth = function() { + return bandwidth; + }; + + scale.step = function() { + return step; + }; + + scale.round = function(_) { + return arguments.length ? (round = !!_, rescale()) : round; + }; + + scale.padding = function(_) { + return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; + }; + + scale.paddingInner = function(_) { + return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner; + }; + + scale.paddingOuter = function(_) { + return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter; + }; + + scale.align = function(_) { + return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align; + }; + + scale.copy = function() { + return band() + .domain(domain()) + .range(range$$1) + .round(round) + .paddingInner(paddingInner) + .paddingOuter(paddingOuter) + .align(align); + }; + + return rescale(); +} + +function pointish(scale) { + var copy = scale.copy; + + scale.padding = scale.paddingOuter; + delete scale.paddingInner; + delete scale.paddingOuter; + + scale.copy = function() { + return pointish(copy()); + }; + + return scale; +} + +function point$1() { + return pointish(band().paddingInner(1)); +} + +var constant$9 = function(x) { + return function() { + return x; + }; +}; + +var number$1 = function(x) { + return +x; +}; + +var unit = [0, 1]; + +function deinterpolateLinear(a, b) { + return (b -= (a = +a)) + ? function(x) { return (x - a) / b; } + : constant$9(b); +} + +function deinterpolateClamp(deinterpolate) { + return function(a, b) { + var d = deinterpolate(a = +a, b = +b); + return function(x) { return x <= a ? 0 : x >= b ? 1 : d(x); }; + }; +} + +function reinterpolateClamp(reinterpolate) { + return function(a, b) { + var r = reinterpolate(a = +a, b = +b); + return function(t) { return t <= 0 ? a : t >= 1 ? b : r(t); }; + }; +} + +function bimap(domain, range$$1, deinterpolate, reinterpolate) { + var d0 = domain[0], d1 = domain[1], r0 = range$$1[0], r1 = range$$1[1]; + if (d1 < d0) d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0); + else d0 = deinterpolate(d0, d1), r0 = reinterpolate(r0, r1); + return function(x) { return r0(d0(x)); }; +} + +function polymap(domain, range$$1, deinterpolate, reinterpolate) { + var j = Math.min(domain.length, range$$1.length) - 1, + d = new Array(j), + r = new Array(j), + i = -1; + + // Reverse descending domains. + if (domain[j] < domain[0]) { + domain = domain.slice().reverse(); + range$$1 = range$$1.slice().reverse(); + } + + while (++i < j) { + d[i] = deinterpolate(domain[i], domain[i + 1]); + r[i] = reinterpolate(range$$1[i], range$$1[i + 1]); + } + + return function(x) { + var i = bisectRight(domain, x, 1, j) - 1; + return r[i](d[i](x)); + }; +} + +function copy(source, target) { + return target + .domain(source.domain()) + .range(source.range()) + .interpolate(source.interpolate()) + .clamp(source.clamp()); +} + +// deinterpolate(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. +// reinterpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding domain value x in [a,b]. +function continuous(deinterpolate, reinterpolate) { + var domain = unit, + range$$1 = unit, + interpolate$$1 = interpolateValue, + clamp = false, + piecewise, + output, + input; + + function rescale() { + piecewise = Math.min(domain.length, range$$1.length) > 2 ? polymap : bimap; + output = input = null; + return scale; + } + + function scale(x) { + return (output || (output = piecewise(domain, range$$1, clamp ? deinterpolateClamp(deinterpolate) : deinterpolate, interpolate$$1)))(+x); + } + + scale.invert = function(y) { + return (input || (input = piecewise(range$$1, domain, deinterpolateLinear, clamp ? reinterpolateClamp(reinterpolate) : reinterpolate)))(+y); + }; + + scale.domain = function(_) { + return arguments.length ? (domain = map$3.call(_, number$1), rescale()) : domain.slice(); + }; + + scale.range = function(_) { + return arguments.length ? (range$$1 = slice$4.call(_), rescale()) : range$$1.slice(); + }; + + scale.rangeRound = function(_) { + return range$$1 = slice$4.call(_), interpolate$$1 = interpolateRound, rescale(); + }; + + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, rescale()) : clamp; + }; + + scale.interpolate = function(_) { + return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1; + }; + + return rescale(); +} + +var tickFormat = function(domain, count, specifier) { + var start = domain[0], + stop = domain[domain.length - 1], + step = tickStep(start, stop, count == null ? 10 : count), + precision; + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value = Math.max(Math.abs(start), Math.abs(stop)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; + return exports.formatPrefix(specifier, value); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); + break; + } + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; + break; + } + } + return exports.format(specifier); +}; + +function linearish(scale) { + var domain = scale.domain; + + scale.ticks = function(count) { + var d = domain(); + return ticks(d[0], d[d.length - 1], count == null ? 10 : count); + }; + + scale.tickFormat = function(count, specifier) { + return tickFormat(domain(), count, specifier); + }; + + scale.nice = function(count) { + if (count == null) count = 10; + + var d = domain(), + i0 = 0, + i1 = d.length - 1, + start = d[i0], + stop = d[i1], + step; + + if (stop < start) { + step = start, start = stop, stop = step; + step = i0, i0 = i1, i1 = step; + } + + step = tickIncrement(start, stop, count); + + if (step > 0) { + start = Math.floor(start / step) * step; + stop = Math.ceil(stop / step) * step; + step = tickIncrement(start, stop, count); + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop = Math.floor(stop * step) / step; + step = tickIncrement(start, stop, count); + } + + if (step > 0) { + d[i0] = Math.floor(start / step) * step; + d[i1] = Math.ceil(stop / step) * step; + domain(d); + } else if (step < 0) { + d[i0] = Math.ceil(start * step) / step; + d[i1] = Math.floor(stop * step) / step; + domain(d); + } + + return scale; + }; + + return scale; +} + +function linear$2() { + var scale = continuous(deinterpolateLinear, reinterpolate); + + scale.copy = function() { + return copy(scale, linear$2()); + }; + + return linearish(scale); +} + +function identity$6() { + var domain = [0, 1]; + + function scale(x) { + return +x; + } + + scale.invert = scale; + + scale.domain = scale.range = function(_) { + return arguments.length ? (domain = map$3.call(_, number$1), scale) : domain.slice(); + }; + + scale.copy = function() { + return identity$6().domain(domain); + }; + + return linearish(scale); +} + +var nice = function(domain, interval) { + domain = domain.slice(); + + var i0 = 0, + i1 = domain.length - 1, + x0 = domain[i0], + x1 = domain[i1], + t; + + if (x1 < x0) { + t = i0, i0 = i1, i1 = t; + t = x0, x0 = x1, x1 = t; + } + + domain[i0] = interval.floor(x0); + domain[i1] = interval.ceil(x1); + return domain; +}; + +function deinterpolate(a, b) { + return (b = Math.log(b / a)) + ? function(x) { return Math.log(x / a) / b; } + : constant$9(b); +} + +function reinterpolate$1(a, b) { + return a < 0 + ? function(t) { return -Math.pow(-b, t) * Math.pow(-a, 1 - t); } + : function(t) { return Math.pow(b, t) * Math.pow(a, 1 - t); }; +} + +function pow10(x) { + return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x; +} + +function powp(base) { + return base === 10 ? pow10 + : base === Math.E ? Math.exp + : function(x) { return Math.pow(base, x); }; +} + +function logp(base) { + return base === Math.E ? Math.log + : base === 10 && Math.log10 + || base === 2 && Math.log2 + || (base = Math.log(base), function(x) { return Math.log(x) / base; }); +} + +function reflect(f) { + return function(x) { + return -f(-x); + }; +} + +function log$1() { + var scale = continuous(deinterpolate, reinterpolate$1).domain([1, 10]), + domain = scale.domain, + base = 10, + logs = logp(10), + pows = powp(10); + + function rescale() { + logs = logp(base), pows = powp(base); + if (domain()[0] < 0) logs = reflect(logs), pows = reflect(pows); + return scale; + } + + scale.base = function(_) { + return arguments.length ? (base = +_, rescale()) : base; + }; + + scale.domain = function(_) { + return arguments.length ? (domain(_), rescale()) : domain(); + }; + + scale.ticks = function(count) { + var d = domain(), + u = d[0], + v = d[d.length - 1], + r; + + if (r = v < u) i = u, u = v, v = i; + + var i = logs(u), + j = logs(v), + p, + k, + t, + n = count == null ? 10 : +count, + z = []; + + if (!(base % 1) && j - i < n) { + i = Math.round(i) - 1, j = Math.round(j) + 1; + if (u > 0) for (; i < j; ++i) { + for (k = 1, p = pows(i); k < base; ++k) { + t = p * k; + if (t < u) continue; + if (t > v) break; + z.push(t); + } + } else for (; i < j; ++i) { + for (k = base - 1, p = pows(i); k >= 1; --k) { + t = p * k; + if (t < u) continue; + if (t > v) break; + z.push(t); + } + } + } else { + z = ticks(i, j, Math.min(j - i, n)).map(pows); + } + + return r ? z.reverse() : z; + }; + + scale.tickFormat = function(count, specifier) { + if (specifier == null) specifier = base === 10 ? ".0e" : ","; + if (typeof specifier !== "function") specifier = exports.format(specifier); + if (count === Infinity) return specifier; + if (count == null) count = 10; + var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate? + return function(d) { + var i = d / pows(Math.round(logs(d))); + if (i * base < base - 0.5) i *= base; + return i <= k ? specifier(d) : ""; + }; + }; + + scale.nice = function() { + return domain(nice(domain(), { + floor: function(x) { return pows(Math.floor(logs(x))); }, + ceil: function(x) { return pows(Math.ceil(logs(x))); } + })); + }; + + scale.copy = function() { + return copy(scale, log$1().base(base)); + }; + + return scale; +} + +function raise$1(x, exponent) { + return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent); +} + +function pow$1() { + var exponent = 1, + scale = continuous(deinterpolate, reinterpolate), + domain = scale.domain; + + function deinterpolate(a, b) { + return (b = raise$1(b, exponent) - (a = raise$1(a, exponent))) + ? function(x) { return (raise$1(x, exponent) - a) / b; } + : constant$9(b); + } + + function reinterpolate(a, b) { + b = raise$1(b, exponent) - (a = raise$1(a, exponent)); + return function(t) { return raise$1(a + b * t, 1 / exponent); }; + } + + scale.exponent = function(_) { + return arguments.length ? (exponent = +_, domain(domain())) : exponent; + }; + + scale.copy = function() { + return copy(scale, pow$1().exponent(exponent)); + }; + + return linearish(scale); +} + +function sqrt$1() { + return pow$1().exponent(0.5); +} + +function quantile$$1() { + var domain = [], + range$$1 = [], + thresholds = []; + + function rescale() { + var i = 0, n = Math.max(1, range$$1.length); + thresholds = new Array(n - 1); + while (++i < n) thresholds[i - 1] = threshold(domain, i / n); + return scale; + } + + function scale(x) { + if (!isNaN(x = +x)) return range$$1[bisectRight(thresholds, x)]; + } + + scale.invertExtent = function(y) { + var i = range$$1.indexOf(y); + return i < 0 ? [NaN, NaN] : [ + i > 0 ? thresholds[i - 1] : domain[0], + i < thresholds.length ? thresholds[i] : domain[domain.length - 1] + ]; + }; + + scale.domain = function(_) { + if (!arguments.length) return domain.slice(); + domain = []; + for (var i = 0, n = _.length, d; i < n; ++i) if (d = _[i], d != null && !isNaN(d = +d)) domain.push(d); + domain.sort(ascending); + return rescale(); + }; + + scale.range = function(_) { + return arguments.length ? (range$$1 = slice$4.call(_), rescale()) : range$$1.slice(); + }; + + scale.quantiles = function() { + return thresholds.slice(); + }; + + scale.copy = function() { + return quantile$$1() + .domain(domain) + .range(range$$1); + }; + + return scale; +} + +function quantize$1() { + var x0 = 0, + x1 = 1, + n = 1, + domain = [0.5], + range$$1 = [0, 1]; + + function scale(x) { + if (x <= x) return range$$1[bisectRight(domain, x, 0, n)]; + } + + function rescale() { + var i = -1; + domain = new Array(n); + while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1); + return scale; + } + + scale.domain = function(_) { + return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [x0, x1]; + }; + + scale.range = function(_) { + return arguments.length ? (n = (range$$1 = slice$4.call(_)).length - 1, rescale()) : range$$1.slice(); + }; + + scale.invertExtent = function(y) { + var i = range$$1.indexOf(y); + return i < 0 ? [NaN, NaN] + : i < 1 ? [x0, domain[0]] + : i >= n ? [domain[n - 1], x1] + : [domain[i - 1], domain[i]]; + }; + + scale.copy = function() { + return quantize$1() + .domain([x0, x1]) + .range(range$$1); + }; + + return linearish(scale); +} + +function threshold$1() { + var domain = [0.5], + range$$1 = [0, 1], + n = 1; + + function scale(x) { + if (x <= x) return range$$1[bisectRight(domain, x, 0, n)]; + } + + scale.domain = function(_) { + return arguments.length ? (domain = slice$4.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : domain.slice(); + }; + + scale.range = function(_) { + return arguments.length ? (range$$1 = slice$4.call(_), n = Math.min(domain.length, range$$1.length - 1), scale) : range$$1.slice(); + }; + + scale.invertExtent = function(y) { + var i = range$$1.indexOf(y); + return [domain[i - 1], domain[i]]; + }; + + scale.copy = function() { + return threshold$1() + .domain(domain) + .range(range$$1); + }; + + return scale; +} + +var t0$1 = new Date; +var t1$1 = new Date; + +function newInterval(floori, offseti, count, field) { + + function interval(date) { + return floori(date = new Date(+date)), date; + } + + interval.floor = interval; + + interval.ceil = function(date) { + return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date; + }; + + interval.round = function(date) { + var d0 = interval(date), + d1 = interval.ceil(date); + return date - d0 < d1 - date ? d0 : d1; + }; + + interval.offset = function(date, step) { + return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date; + }; + + interval.range = function(start, stop, step) { + var range = []; + start = interval.ceil(start); + step = step == null ? 1 : Math.floor(step); + if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date + do range.push(new Date(+start)); while (offseti(start, step), floori(start), start < stop) + return range; + }; + + interval.filter = function(test) { + return newInterval(function(date) { + if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1); + }, function(date, step) { + if (date >= date) while (--step >= 0) while (offseti(date, 1), !test(date)) {} // eslint-disable-line no-empty + }); + }; + + if (count) { + interval.count = function(start, end) { + t0$1.setTime(+start), t1$1.setTime(+end); + floori(t0$1), floori(t1$1); + return Math.floor(count(t0$1, t1$1)); + }; + + interval.every = function(step) { + step = Math.floor(step); + return !isFinite(step) || !(step > 0) ? null + : !(step > 1) ? interval + : interval.filter(field + ? function(d) { return field(d) % step === 0; } + : function(d) { return interval.count(0, d) % step === 0; }); + }; + } + + return interval; +} + +var millisecond = newInterval(function() { + // noop +}, function(date, step) { + date.setTime(+date + step); +}, function(start, end) { + return end - start; +}); + +// An optimized implementation for this simple case. +millisecond.every = function(k) { + k = Math.floor(k); + if (!isFinite(k) || !(k > 0)) return null; + if (!(k > 1)) return millisecond; + return newInterval(function(date) { + date.setTime(Math.floor(date / k) * k); + }, function(date, step) { + date.setTime(+date + step * k); + }, function(start, end) { + return (end - start) / k; + }); +}; + +var milliseconds = millisecond.range; + +var durationSecond$1 = 1e3; +var durationMinute$1 = 6e4; +var durationHour$1 = 36e5; +var durationDay$1 = 864e5; +var durationWeek$1 = 6048e5; + +var second = newInterval(function(date) { + date.setTime(Math.floor(date / durationSecond$1) * durationSecond$1); +}, function(date, step) { + date.setTime(+date + step * durationSecond$1); +}, function(start, end) { + return (end - start) / durationSecond$1; +}, function(date) { + return date.getUTCSeconds(); +}); + +var seconds = second.range; + +var minute = newInterval(function(date) { + date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1); +}, function(date, step) { + date.setTime(+date + step * durationMinute$1); +}, function(start, end) { + return (end - start) / durationMinute$1; +}, function(date) { + return date.getMinutes(); +}); + +var minutes = minute.range; + +var hour = newInterval(function(date) { + var offset = date.getTimezoneOffset() * durationMinute$1 % durationHour$1; + if (offset < 0) offset += durationHour$1; + date.setTime(Math.floor((+date - offset) / durationHour$1) * durationHour$1 + offset); +}, function(date, step) { + date.setTime(+date + step * durationHour$1); +}, function(start, end) { + return (end - start) / durationHour$1; +}, function(date) { + return date.getHours(); +}); + +var hours = hour.range; + +var day = newInterval(function(date) { + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setDate(date.getDate() + step); +}, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1; +}, function(date) { + return date.getDate() - 1; +}); + +var days = day.range; + +function weekday(i) { + return newInterval(function(date) { + date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7); + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setDate(date.getDate() + step * 7); + }, function(start, end) { + return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1; + }); +} + +var sunday = weekday(0); +var monday = weekday(1); +var tuesday = weekday(2); +var wednesday = weekday(3); +var thursday = weekday(4); +var friday = weekday(5); +var saturday = weekday(6); + +var sundays = sunday.range; +var mondays = monday.range; +var tuesdays = tuesday.range; +var wednesdays = wednesday.range; +var thursdays = thursday.range; +var fridays = friday.range; +var saturdays = saturday.range; + +var month = newInterval(function(date) { + date.setDate(1); + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setMonth(date.getMonth() + step); +}, function(start, end) { + return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12; +}, function(date) { + return date.getMonth(); +}); + +var months = month.range; + +var year = newInterval(function(date) { + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); +}, function(date, step) { + date.setFullYear(date.getFullYear() + step); +}, function(start, end) { + return end.getFullYear() - start.getFullYear(); +}, function(date) { + return date.getFullYear(); +}); + +// An optimized implementation for this simple case. +year.every = function(k) { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { + date.setFullYear(Math.floor(date.getFullYear() / k) * k); + date.setMonth(0, 1); + date.setHours(0, 0, 0, 0); + }, function(date, step) { + date.setFullYear(date.getFullYear() + step * k); + }); +}; + +var years = year.range; + +var utcMinute = newInterval(function(date) { + date.setUTCSeconds(0, 0); +}, function(date, step) { + date.setTime(+date + step * durationMinute$1); +}, function(start, end) { + return (end - start) / durationMinute$1; +}, function(date) { + return date.getUTCMinutes(); +}); + +var utcMinutes = utcMinute.range; + +var utcHour = newInterval(function(date) { + date.setUTCMinutes(0, 0, 0); +}, function(date, step) { + date.setTime(+date + step * durationHour$1); +}, function(start, end) { + return (end - start) / durationHour$1; +}, function(date) { + return date.getUTCHours(); +}); + +var utcHours = utcHour.range; + +var utcDay = newInterval(function(date) { + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCDate(date.getUTCDate() + step); +}, function(start, end) { + return (end - start) / durationDay$1; +}, function(date) { + return date.getUTCDate() - 1; +}); + +var utcDays = utcDay.range; + +function utcWeekday(i) { + return newInterval(function(date) { + date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7); + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCDate(date.getUTCDate() + step * 7); + }, function(start, end) { + return (end - start) / durationWeek$1; + }); +} + +var utcSunday = utcWeekday(0); +var utcMonday = utcWeekday(1); +var utcTuesday = utcWeekday(2); +var utcWednesday = utcWeekday(3); +var utcThursday = utcWeekday(4); +var utcFriday = utcWeekday(5); +var utcSaturday = utcWeekday(6); + +var utcSundays = utcSunday.range; +var utcMondays = utcMonday.range; +var utcTuesdays = utcTuesday.range; +var utcWednesdays = utcWednesday.range; +var utcThursdays = utcThursday.range; +var utcFridays = utcFriday.range; +var utcSaturdays = utcSaturday.range; + +var utcMonth = newInterval(function(date) { + date.setUTCDate(1); + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCMonth(date.getUTCMonth() + step); +}, function(start, end) { + return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12; +}, function(date) { + return date.getUTCMonth(); +}); + +var utcMonths = utcMonth.range; + +var utcYear = newInterval(function(date) { + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); +}, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step); +}, function(start, end) { + return end.getUTCFullYear() - start.getUTCFullYear(); +}, function(date) { + return date.getUTCFullYear(); +}); + +// An optimized implementation for this simple case. +utcYear.every = function(k) { + return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) { + date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k); + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + }, function(date, step) { + date.setUTCFullYear(date.getUTCFullYear() + step * k); + }); +}; + +var utcYears = utcYear.range; + +function localDate(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); + date.setFullYear(d.y); + return date; + } + return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); +} + +function utcDate(d) { + if (0 <= d.y && d.y < 100) { + var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); + date.setUTCFullYear(d.y); + return date; + } + return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); +} + +function newYear(y) { + return {y: y, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0}; +} + +function formatLocale$1(locale) { + var locale_dateTime = locale.dateTime, + locale_date = locale.date, + locale_time = locale.time, + locale_periods = locale.periods, + locale_weekdays = locale.days, + locale_shortWeekdays = locale.shortDays, + locale_months = locale.months, + locale_shortMonths = locale.shortMonths; + + var periodRe = formatRe(locale_periods), + periodLookup = formatLookup(locale_periods), + weekdayRe = formatRe(locale_weekdays), + weekdayLookup = formatLookup(locale_weekdays), + shortWeekdayRe = formatRe(locale_shortWeekdays), + shortWeekdayLookup = formatLookup(locale_shortWeekdays), + monthRe = formatRe(locale_months), + monthLookup = formatLookup(locale_months), + shortMonthRe = formatRe(locale_shortMonths), + shortMonthLookup = formatLookup(locale_shortMonths); + + var formats = { + "a": formatShortWeekday, + "A": formatWeekday, + "b": formatShortMonth, + "B": formatMonth, + "c": null, + "d": formatDayOfMonth, + "e": formatDayOfMonth, + "H": formatHour24, + "I": formatHour12, + "j": formatDayOfYear, + "L": formatMilliseconds, + "m": formatMonthNumber, + "M": formatMinutes, + "p": formatPeriod, + "S": formatSeconds, + "U": formatWeekNumberSunday, + "w": formatWeekdayNumber, + "W": formatWeekNumberMonday, + "x": null, + "X": null, + "y": formatYear, + "Y": formatFullYear, + "Z": formatZone, + "%": formatLiteralPercent + }; + + var utcFormats = { + "a": formatUTCShortWeekday, + "A": formatUTCWeekday, + "b": formatUTCShortMonth, + "B": formatUTCMonth, + "c": null, + "d": formatUTCDayOfMonth, + "e": formatUTCDayOfMonth, + "H": formatUTCHour24, + "I": formatUTCHour12, + "j": formatUTCDayOfYear, + "L": formatUTCMilliseconds, + "m": formatUTCMonthNumber, + "M": formatUTCMinutes, + "p": formatUTCPeriod, + "S": formatUTCSeconds, + "U": formatUTCWeekNumberSunday, + "w": formatUTCWeekdayNumber, + "W": formatUTCWeekNumberMonday, + "x": null, + "X": null, + "y": formatUTCYear, + "Y": formatUTCFullYear, + "Z": formatUTCZone, + "%": formatLiteralPercent + }; + + var parses = { + "a": parseShortWeekday, + "A": parseWeekday, + "b": parseShortMonth, + "B": parseMonth, + "c": parseLocaleDateTime, + "d": parseDayOfMonth, + "e": parseDayOfMonth, + "H": parseHour24, + "I": parseHour24, + "j": parseDayOfYear, + "L": parseMilliseconds, + "m": parseMonthNumber, + "M": parseMinutes, + "p": parsePeriod, + "S": parseSeconds, + "U": parseWeekNumberSunday, + "w": parseWeekdayNumber, + "W": parseWeekNumberMonday, + "x": parseLocaleDate, + "X": parseLocaleTime, + "y": parseYear, + "Y": parseFullYear, + "Z": parseZone, + "%": parseLiteralPercent + }; + + // These recursive directive definitions must be deferred. + formats.x = newFormat(locale_date, formats); + formats.X = newFormat(locale_time, formats); + formats.c = newFormat(locale_dateTime, formats); + utcFormats.x = newFormat(locale_date, utcFormats); + utcFormats.X = newFormat(locale_time, utcFormats); + utcFormats.c = newFormat(locale_dateTime, utcFormats); + + function newFormat(specifier, formats) { + return function(date) { + var string = [], + i = -1, + j = 0, + n = specifier.length, + c, + pad, + format; + + if (!(date instanceof Date)) date = new Date(+date); + + while (++i < n) { + if (specifier.charCodeAt(i) === 37) { + string.push(specifier.slice(j, i)); + if ((pad = pads[c = specifier.charAt(++i)]) != null) c = specifier.charAt(++i); + else pad = c === "e" ? " " : "0"; + if (format = formats[c]) c = format(date, pad); + string.push(c); + j = i + 1; + } + } + + string.push(specifier.slice(j, i)); + return string.join(""); + }; + } + + function newParse(specifier, newDate) { + return function(string) { + var d = newYear(1900), + i = parseSpecifier(d, specifier, string += "", 0); + if (i != string.length) return null; + + // The am-pm flag is 0 for AM, and 1 for PM. + if ("p" in d) d.H = d.H % 12 + d.p * 12; + + // Convert day-of-week and week-of-year to day-of-year. + if ("W" in d || "U" in d) { + if (!("w" in d)) d.w = "W" in d ? 1 : 0; + var day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay(); + d.m = 0; + d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$$1 + 5) % 7 : d.w + d.U * 7 - (day$$1 + 6) % 7; + } + + // If a time zone is specified, all fields are interpreted as UTC and then + // offset according to the specified time zone. + if ("Z" in d) { + d.H += d.Z / 100 | 0; + d.M += d.Z % 100; + return utcDate(d); + } + + // Otherwise, all fields are in local time. + return newDate(d); + }; + } + + function parseSpecifier(d, specifier, string, j) { + var i = 0, + n = specifier.length, + m = string.length, + c, + parse; + + while (i < n) { + if (j >= m) return -1; + c = specifier.charCodeAt(i++); + if (c === 37) { + c = specifier.charAt(i++); + parse = parses[c in pads ? specifier.charAt(i++) : c]; + if (!parse || ((j = parse(d, string, j)) < 0)) return -1; + } else if (c != string.charCodeAt(j++)) { + return -1; + } + } + + return j; + } + + function parsePeriod(d, string, i) { + var n = periodRe.exec(string.slice(i)); + return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseShortWeekday(d, string, i) { + var n = shortWeekdayRe.exec(string.slice(i)); + return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseWeekday(d, string, i) { + var n = weekdayRe.exec(string.slice(i)); + return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseShortMonth(d, string, i) { + var n = shortMonthRe.exec(string.slice(i)); + return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseMonth(d, string, i) { + var n = monthRe.exec(string.slice(i)); + return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1; + } + + function parseLocaleDateTime(d, string, i) { + return parseSpecifier(d, locale_dateTime, string, i); + } + + function parseLocaleDate(d, string, i) { + return parseSpecifier(d, locale_date, string, i); + } + + function parseLocaleTime(d, string, i) { + return parseSpecifier(d, locale_time, string, i); + } + + function formatShortWeekday(d) { + return locale_shortWeekdays[d.getDay()]; + } + + function formatWeekday(d) { + return locale_weekdays[d.getDay()]; + } + + function formatShortMonth(d) { + return locale_shortMonths[d.getMonth()]; + } + + function formatMonth(d) { + return locale_months[d.getMonth()]; + } + + function formatPeriod(d) { + return locale_periods[+(d.getHours() >= 12)]; + } + + function formatUTCShortWeekday(d) { + return locale_shortWeekdays[d.getUTCDay()]; + } + + function formatUTCWeekday(d) { + return locale_weekdays[d.getUTCDay()]; + } + + function formatUTCShortMonth(d) { + return locale_shortMonths[d.getUTCMonth()]; + } + + function formatUTCMonth(d) { + return locale_months[d.getUTCMonth()]; + } + + function formatUTCPeriod(d) { + return locale_periods[+(d.getUTCHours() >= 12)]; + } + + return { + format: function(specifier) { + var f = newFormat(specifier += "", formats); + f.toString = function() { return specifier; }; + return f; + }, + parse: function(specifier) { + var p = newParse(specifier += "", localDate); + p.toString = function() { return specifier; }; + return p; + }, + utcFormat: function(specifier) { + var f = newFormat(specifier += "", utcFormats); + f.toString = function() { return specifier; }; + return f; + }, + utcParse: function(specifier) { + var p = newParse(specifier, utcDate); + p.toString = function() { return specifier; }; + return p; + } + }; +} + +var pads = {"-": "", "_": " ", "0": "0"}; +var numberRe = /^\s*\d+/; +var percentRe = /^%/; +var requoteRe = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g; + +function pad(value, fill, width) { + var sign = value < 0 ? "-" : "", + string = (sign ? -value : value) + "", + length = string.length; + return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string); +} + +function requote(s) { + return s.replace(requoteRe, "\\$&"); +} + +function formatRe(names) { + return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); +} + +function formatLookup(names) { + var map = {}, i = -1, n = names.length; + while (++i < n) map[names[i].toLowerCase()] = i; + return map; +} + +function parseWeekdayNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 1)); + return n ? (d.w = +n[0], i + n[0].length) : -1; +} + +function parseWeekNumberSunday(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.U = +n[0], i + n[0].length) : -1; +} + +function parseWeekNumberMonday(d, string, i) { + var n = numberRe.exec(string.slice(i)); + return n ? (d.W = +n[0], i + n[0].length) : -1; +} + +function parseFullYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 4)); + return n ? (d.y = +n[0], i + n[0].length) : -1; +} + +function parseYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2000), i + n[0].length) : -1; +} + +function parseZone(d, string, i) { + var n = /^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(string.slice(i, i + 6)); + return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; +} + +function parseMonthNumber(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.m = n[0] - 1, i + n[0].length) : -1; +} + +function parseDayOfMonth(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.d = +n[0], i + n[0].length) : -1; +} + +function parseDayOfYear(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; +} + +function parseHour24(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.H = +n[0], i + n[0].length) : -1; +} + +function parseMinutes(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.M = +n[0], i + n[0].length) : -1; +} + +function parseSeconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 2)); + return n ? (d.S = +n[0], i + n[0].length) : -1; +} + +function parseMilliseconds(d, string, i) { + var n = numberRe.exec(string.slice(i, i + 3)); + return n ? (d.L = +n[0], i + n[0].length) : -1; +} + +function parseLiteralPercent(d, string, i) { + var n = percentRe.exec(string.slice(i, i + 1)); + return n ? i + n[0].length : -1; +} + +function formatDayOfMonth(d, p) { + return pad(d.getDate(), p, 2); +} + +function formatHour24(d, p) { + return pad(d.getHours(), p, 2); +} + +function formatHour12(d, p) { + return pad(d.getHours() % 12 || 12, p, 2); +} + +function formatDayOfYear(d, p) { + return pad(1 + day.count(year(d), d), p, 3); +} + +function formatMilliseconds(d, p) { + return pad(d.getMilliseconds(), p, 3); +} + +function formatMonthNumber(d, p) { + return pad(d.getMonth() + 1, p, 2); +} + +function formatMinutes(d, p) { + return pad(d.getMinutes(), p, 2); +} + +function formatSeconds(d, p) { + return pad(d.getSeconds(), p, 2); +} + +function formatWeekNumberSunday(d, p) { + return pad(sunday.count(year(d), d), p, 2); +} + +function formatWeekdayNumber(d) { + return d.getDay(); +} + +function formatWeekNumberMonday(d, p) { + return pad(monday.count(year(d), d), p, 2); +} + +function formatYear(d, p) { + return pad(d.getFullYear() % 100, p, 2); +} + +function formatFullYear(d, p) { + return pad(d.getFullYear() % 10000, p, 4); +} + +function formatZone(d) { + var z = d.getTimezoneOffset(); + return (z > 0 ? "-" : (z *= -1, "+")) + + pad(z / 60 | 0, "0", 2) + + pad(z % 60, "0", 2); +} + +function formatUTCDayOfMonth(d, p) { + return pad(d.getUTCDate(), p, 2); +} + +function formatUTCHour24(d, p) { + return pad(d.getUTCHours(), p, 2); +} + +function formatUTCHour12(d, p) { + return pad(d.getUTCHours() % 12 || 12, p, 2); +} + +function formatUTCDayOfYear(d, p) { + return pad(1 + utcDay.count(utcYear(d), d), p, 3); +} + +function formatUTCMilliseconds(d, p) { + return pad(d.getUTCMilliseconds(), p, 3); +} + +function formatUTCMonthNumber(d, p) { + return pad(d.getUTCMonth() + 1, p, 2); +} + +function formatUTCMinutes(d, p) { + return pad(d.getUTCMinutes(), p, 2); +} + +function formatUTCSeconds(d, p) { + return pad(d.getUTCSeconds(), p, 2); +} + +function formatUTCWeekNumberSunday(d, p) { + return pad(utcSunday.count(utcYear(d), d), p, 2); +} + +function formatUTCWeekdayNumber(d) { + return d.getUTCDay(); +} + +function formatUTCWeekNumberMonday(d, p) { + return pad(utcMonday.count(utcYear(d), d), p, 2); +} + +function formatUTCYear(d, p) { + return pad(d.getUTCFullYear() % 100, p, 2); +} + +function formatUTCFullYear(d, p) { + return pad(d.getUTCFullYear() % 10000, p, 4); +} + +function formatUTCZone() { + return "+0000"; +} + +function formatLiteralPercent() { + return "%"; +} + +var locale$2; + + + + + +defaultLocale$1({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] +}); + +function defaultLocale$1(definition) { + locale$2 = formatLocale$1(definition); + exports.timeFormat = locale$2.format; + exports.timeParse = locale$2.parse; + exports.utcFormat = locale$2.utcFormat; + exports.utcParse = locale$2.utcParse; + return locale$2; +} + +var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; + +function formatIsoNative(date) { + return date.toISOString(); +} + +var formatIso = Date.prototype.toISOString + ? formatIsoNative + : exports.utcFormat(isoSpecifier); + +function parseIsoNative(string) { + var date = new Date(string); + return isNaN(date) ? null : date; +} + +var parseIso = +new Date("2000-01-01T00:00:00.000Z") + ? parseIsoNative + : exports.utcParse(isoSpecifier); + +var durationSecond = 1000; +var durationMinute = durationSecond * 60; +var durationHour = durationMinute * 60; +var durationDay = durationHour * 24; +var durationWeek = durationDay * 7; +var durationMonth = durationDay * 30; +var durationYear = durationDay * 365; + +function date$1(t) { + return new Date(t); +} + +function number$2(t) { + return t instanceof Date ? +t : +new Date(+t); +} + +function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) { + var scale = continuous(deinterpolateLinear, reinterpolate), + invert = scale.invert, + domain = scale.domain; + + var formatMillisecond = format(".%L"), + formatSecond = format(":%S"), + formatMinute = format("%I:%M"), + formatHour = format("%I %p"), + formatDay = format("%a %d"), + formatWeek = format("%b %d"), + formatMonth = format("%B"), + formatYear = format("%Y"); + + var tickIntervals = [ + [second$$1, 1, durationSecond], + [second$$1, 5, 5 * durationSecond], + [second$$1, 15, 15 * durationSecond], + [second$$1, 30, 30 * durationSecond], + [minute$$1, 1, durationMinute], + [minute$$1, 5, 5 * durationMinute], + [minute$$1, 15, 15 * durationMinute], + [minute$$1, 30, 30 * durationMinute], + [ hour$$1, 1, durationHour ], + [ hour$$1, 3, 3 * durationHour ], + [ hour$$1, 6, 6 * durationHour ], + [ hour$$1, 12, 12 * durationHour ], + [ day$$1, 1, durationDay ], + [ day$$1, 2, 2 * durationDay ], + [ week, 1, durationWeek ], + [ month$$1, 1, durationMonth ], + [ month$$1, 3, 3 * durationMonth ], + [ year$$1, 1, durationYear ] + ]; + + function tickFormat(date) { + return (second$$1(date) < date ? formatMillisecond + : minute$$1(date) < date ? formatSecond + : hour$$1(date) < date ? formatMinute + : day$$1(date) < date ? formatHour + : month$$1(date) < date ? (week(date) < date ? formatDay : formatWeek) + : year$$1(date) < date ? formatMonth + : formatYear)(date); + } + + function tickInterval(interval, start, stop, step) { + if (interval == null) interval = 10; + + // If a desired tick count is specified, pick a reasonable tick interval + // based on the extent of the domain and a rough estimate of tick size. + // Otherwise, assume interval is already a time interval and use it. + if (typeof interval === "number") { + var target = Math.abs(stop - start) / interval, + i = bisector(function(i) { return i[2]; }).right(tickIntervals, target); + if (i === tickIntervals.length) { + step = tickStep(start / durationYear, stop / durationYear, interval); + interval = year$$1; + } else if (i) { + i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; + step = i[1]; + interval = i[0]; + } else { + step = tickStep(start, stop, interval); + interval = millisecond$$1; + } + } + + return step == null ? interval : interval.every(step); + } + + scale.invert = function(y) { + return new Date(invert(y)); + }; + + scale.domain = function(_) { + return arguments.length ? domain(map$3.call(_, number$2)) : domain().map(date$1); + }; + + scale.ticks = function(interval, step) { + var d = domain(), + t0 = d[0], + t1 = d[d.length - 1], + r = t1 < t0, + t; + if (r) t = t0, t0 = t1, t1 = t; + t = tickInterval(interval, t0, t1, step); + t = t ? t.range(t0, t1 + 1) : []; // inclusive stop + return r ? t.reverse() : t; + }; + + scale.tickFormat = function(count, specifier) { + return specifier == null ? tickFormat : format(specifier); + }; + + scale.nice = function(interval, step) { + var d = domain(); + return (interval = tickInterval(interval, d[0], d[d.length - 1], step)) + ? domain(nice(d, interval)) + : scale; + }; + + scale.copy = function() { + return copy(scale, calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format)); + }; + + return scale; +} + +var time = function() { + return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]); +}; + +var utcTime = function() { + return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]); +}; + +var colors = function(s) { + return s.match(/.{6}/g).map(function(x) { + return "#" + x; + }); +}; + +var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); + +var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"); + +var category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"); + +var category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"); + +var cubehelix$3 = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0)); + +var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8)); + +var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8)); + +var rainbow = cubehelix(); + +var rainbow$1 = function(t) { + if (t < 0 || t > 1) t -= Math.floor(t); + var ts = Math.abs(t - 0.5); + rainbow.h = 360 * t - 100; + rainbow.s = 1.5 - 1.5 * ts; + rainbow.l = 0.8 - 0.9 * ts; + return rainbow + ""; +}; + +function ramp(range) { + var n = range.length; + return function(t) { + return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; + }; +} + +var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); + +var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); + +var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); + +var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); + +function sequential(interpolator) { + var x0 = 0, + x1 = 1, + clamp = false; + + function scale(x) { + var t = (x - x0) / (x1 - x0); + return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t); + } + + scale.domain = function(_) { + return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [x0, x1]; + }; + + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, scale) : clamp; + }; + + scale.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale) : interpolator; + }; + + scale.copy = function() { + return sequential(interpolator).domain([x0, x1]).clamp(clamp); + }; + + return linearish(scale); +} + +var constant$10 = function(x) { + return function constant() { + return x; + }; +}; + +var abs$1 = Math.abs; +var atan2$1 = Math.atan2; +var cos$2 = Math.cos; +var max$2 = Math.max; +var min$1 = Math.min; +var sin$2 = Math.sin; +var sqrt$2 = Math.sqrt; + +var epsilon$3 = 1e-12; +var pi$4 = Math.PI; +var halfPi$3 = pi$4 / 2; +var tau$4 = 2 * pi$4; + +function acos$1(x) { + return x > 1 ? 0 : x < -1 ? pi$4 : Math.acos(x); +} + +function asin$1(x) { + return x >= 1 ? halfPi$3 : x <= -1 ? -halfPi$3 : Math.asin(x); +} + +function arcInnerRadius(d) { + return d.innerRadius; +} + +function arcOuterRadius(d) { + return d.outerRadius; +} + +function arcStartAngle(d) { + return d.startAngle; +} + +function arcEndAngle(d) { + return d.endAngle; +} + +function arcPadAngle(d) { + return d && d.padAngle; // Note: optional! +} + +function intersect(x0, y0, x1, y1, x2, y2, x3, y3) { + var x10 = x1 - x0, y10 = y1 - y0, + x32 = x3 - x2, y32 = y3 - y2, + t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10); + return [x0 + t * x10, y0 + t * y10]; +} + +// Compute perpendicular offset line of length rc. +// http://mathworld.wolfram.com/Circle-LineIntersection.html +function cornerTangents(x0, y0, x1, y1, r1, rc, cw) { + var x01 = x0 - x1, + y01 = y0 - y1, + lo = (cw ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01), + ox = lo * y01, + oy = -lo * x01, + x11 = x0 + ox, + y11 = y0 + oy, + x10 = x1 + ox, + y10 = y1 + oy, + x00 = (x11 + x10) / 2, + y00 = (y11 + y10) / 2, + dx = x10 - x11, + dy = y10 - y11, + d2 = dx * dx + dy * dy, + r = r1 - rc, + D = x11 * y10 - x10 * y11, + d = (dy < 0 ? -1 : 1) * sqrt$2(max$2(0, r * r * d2 - D * D)), + cx0 = (D * dy - dx * d) / d2, + cy0 = (-D * dx - dy * d) / d2, + cx1 = (D * dy + dx * d) / d2, + cy1 = (-D * dx + dy * d) / d2, + dx0 = cx0 - x00, + dy0 = cy0 - y00, + dx1 = cx1 - x00, + dy1 = cy1 - y00; + + // Pick the closer of the two intersection points. + // TODO Is there a faster way to determine which intersection to use? + if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; + + return { + cx: cx0, + cy: cy0, + x01: -ox, + y01: -oy, + x11: cx0 * (r1 / r - 1), + y11: cy0 * (r1 / r - 1) + }; +} + +var arc = function() { + var innerRadius = arcInnerRadius, + outerRadius = arcOuterRadius, + cornerRadius = constant$10(0), + padRadius = null, + startAngle = arcStartAngle, + endAngle = arcEndAngle, + padAngle = arcPadAngle, + context = null; + + function arc() { + var buffer, + r, + r0 = +innerRadius.apply(this, arguments), + r1 = +outerRadius.apply(this, arguments), + a0 = startAngle.apply(this, arguments) - halfPi$3, + a1 = endAngle.apply(this, arguments) - halfPi$3, + da = abs$1(a1 - a0), + cw = a1 > a0; + + if (!context) context = buffer = path(); + + // Ensure that the outer radius is always larger than the inner radius. + if (r1 < r0) r = r1, r1 = r0, r0 = r; + + // Is it a point? + if (!(r1 > epsilon$3)) context.moveTo(0, 0); + + // Or is it a circle or annulus? + else if (da > tau$4 - epsilon$3) { + context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)); + context.arc(0, 0, r1, a0, a1, !cw); + if (r0 > epsilon$3) { + context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)); + context.arc(0, 0, r0, a1, a0, cw); + } + } + + // Or is it a circular or annular sector? + else { + var a01 = a0, + a11 = a1, + a00 = a0, + a10 = a1, + da0 = da, + da1 = da, + ap = padAngle.apply(this, arguments) / 2, + rp = (ap > epsilon$3) && (padRadius ? +padRadius.apply(this, arguments) : sqrt$2(r0 * r0 + r1 * r1)), + rc = min$1(abs$1(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), + rc0 = rc, + rc1 = rc, + t0, + t1; + + // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0. + if (rp > epsilon$3) { + var p0 = asin$1(rp / r0 * sin$2(ap)), + p1 = asin$1(rp / r1 * sin$2(ap)); + if ((da0 -= p0 * 2) > epsilon$3) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0; + else da0 = 0, a00 = a10 = (a0 + a1) / 2; + if ((da1 -= p1 * 2) > epsilon$3) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1; + else da1 = 0, a01 = a11 = (a0 + a1) / 2; + } + + var x01 = r1 * cos$2(a01), + y01 = r1 * sin$2(a01), + x10 = r0 * cos$2(a10), + y10 = r0 * sin$2(a10); + + // Apply rounded corners? + if (rc > epsilon$3) { + var x11 = r1 * cos$2(a11), + y11 = r1 * sin$2(a11), + x00 = r0 * cos$2(a00), + y00 = r0 * sin$2(a00); + + // Restrict the corner radius according to the sector angle. + if (da < pi$4) { + var oc = da0 > epsilon$3 ? intersect(x01, y01, x00, y00, x11, y11, x10, y10) : [x10, y10], + ax = x01 - oc[0], + ay = y01 - oc[1], + bx = x11 - oc[0], + by = y11 - oc[1], + kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) / 2), + lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]); + rc0 = min$1(rc, (r0 - lc) / (kc - 1)); + rc1 = min$1(rc, (r1 - lc) / (kc + 1)); + } + } + + // Is the sector collapsed to a line? + if (!(da1 > epsilon$3)) context.moveTo(x01, y01); + + // Does the sector’s outer ring have rounded corners? + else if (rc1 > epsilon$3) { + t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw); + t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); + + context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); + + // Have the corners merged? + if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw); + + // Otherwise, draw the two corners and the ring. + else { + context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw); + context.arc(0, 0, r1, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), !cw); + context.arc(t1.cx, t1.cy, rc1, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw); + } + } + + // Or is the outer ring just a circular arc? + else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); + + // Is there no inner ring, and it’s a circular sector? + // Or perhaps it’s an annular sector collapsed due to padding? + if (!(r0 > epsilon$3) || !(da0 > epsilon$3)) context.lineTo(x10, y10); + + // Does the sector’s inner ring (or point) have rounded corners? + else if (rc0 > epsilon$3) { + t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); + t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw); + + context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); + + // Have the corners merged? + if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw); + + // Otherwise, draw the two corners and the ring. + else { + context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw); + context.arc(0, 0, r0, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), cw); + context.arc(t1.cx, t1.cy, rc0, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw); + } + } + + // Or is the inner ring just a circular arc? + else context.arc(0, 0, r0, a10, a00, cw); + } + + context.closePath(); + + if (buffer) return context = null, buffer + "" || null; + } + + arc.centroid = function() { + var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, + a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$4 / 2; + return [cos$2(a) * r, sin$2(a) * r]; + }; + + arc.innerRadius = function(_) { + return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$10(+_), arc) : innerRadius; + }; + + arc.outerRadius = function(_) { + return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$10(+_), arc) : outerRadius; + }; + + arc.cornerRadius = function(_) { + return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$10(+_), arc) : cornerRadius; + }; + + arc.padRadius = function(_) { + return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$10(+_), arc) : padRadius; + }; + + arc.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$10(+_), arc) : startAngle; + }; + + arc.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$10(+_), arc) : endAngle; + }; + + arc.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$10(+_), arc) : padAngle; + }; + + arc.context = function(_) { + return arguments.length ? ((context = _ == null ? null : _), arc) : context; + }; + + return arc; +}; + +function Linear(context) { + this._context = context; +} + +Linear.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; // proceed + default: this._context.lineTo(x, y); break; + } + } +}; + +var curveLinear = function(context) { + return new Linear(context); +}; + +function x$3(p) { + return p[0]; +} + +function y$3(p) { + return p[1]; +} + +var line = function() { + var x$$1 = x$3, + y$$1 = y$3, + defined = constant$10(true), + context = null, + curve = curveLinear, + output = null; + + function line(data) { + var i, + n = data.length, + d, + defined0 = false, + buffer; + + if (context == null) output = curve(buffer = path()); + + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data[i], i, data)) === defined0) { + if (defined0 = !defined0) output.lineStart(); + else output.lineEnd(); + } + if (defined0) output.point(+x$$1(d, i, data), +y$$1(d, i, data)); + } + + if (buffer) return output = null, buffer + "" || null; + } + + line.x = function(_) { + return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$10(+_), line) : x$$1; + }; + + line.y = function(_) { + return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$10(+_), line) : y$$1; + }; + + line.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$10(!!_), line) : defined; + }; + + line.curve = function(_) { + return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve; + }; + + line.context = function(_) { + return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; + }; + + return line; +}; + +var area$2 = function() { + var x0 = x$3, + x1 = null, + y0 = constant$10(0), + y1 = y$3, + defined = constant$10(true), + context = null, + curve = curveLinear, + output = null; + + function area(data) { + var i, + j, + k, + n = data.length, + d, + defined0 = false, + buffer, + x0z = new Array(n), + y0z = new Array(n); + + if (context == null) output = curve(buffer = path()); + + for (i = 0; i <= n; ++i) { + if (!(i < n && defined(d = data[i], i, data)) === defined0) { + if (defined0 = !defined0) { + j = i; + output.areaStart(); + output.lineStart(); + } else { + output.lineEnd(); + output.lineStart(); + for (k = i - 1; k >= j; --k) { + output.point(x0z[k], y0z[k]); + } + output.lineEnd(); + output.areaEnd(); + } + } + if (defined0) { + x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data); + output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]); + } + } + + if (buffer) return output = null, buffer + "" || null; + } + + function arealine() { + return line().defined(defined).curve(curve).context(context); + } + + area.x = function(_) { + return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$10(+_), x1 = null, area) : x0; + }; + + area.x0 = function(_) { + return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$10(+_), area) : x0; + }; + + area.x1 = function(_) { + return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$10(+_), area) : x1; + }; + + area.y = function(_) { + return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$10(+_), y1 = null, area) : y0; + }; + + area.y0 = function(_) { + return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$10(+_), area) : y0; + }; + + area.y1 = function(_) { + return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$10(+_), area) : y1; + }; + + area.lineX0 = + area.lineY0 = function() { + return arealine().x(x0).y(y0); + }; + + area.lineY1 = function() { + return arealine().x(x0).y(y1); + }; + + area.lineX1 = function() { + return arealine().x(x1).y(y0); + }; + + area.defined = function(_) { + return arguments.length ? (defined = typeof _ === "function" ? _ : constant$10(!!_), area) : defined; + }; + + area.curve = function(_) { + return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve; + }; + + area.context = function(_) { + return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; + }; + + return area; +}; + +var descending$1 = function(a, b) { + return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; +}; + +var identity$7 = function(d) { + return d; +}; + +var pie = function() { + var value = identity$7, + sortValues = descending$1, + sort = null, + startAngle = constant$10(0), + endAngle = constant$10(tau$4), + padAngle = constant$10(0); + + function pie(data) { + var i, + n = data.length, + j, + k, + sum = 0, + index = new Array(n), + arcs = new Array(n), + a0 = +startAngle.apply(this, arguments), + da = Math.min(tau$4, Math.max(-tau$4, endAngle.apply(this, arguments) - a0)), + a1, + p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), + pa = p * (da < 0 ? -1 : 1), + v; + + for (i = 0; i < n; ++i) { + if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) { + sum += v; + } + } + + // Optionally sort the arcs by previously-computed values or by data. + if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); }); + else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); }); + + // Compute the arcs! They are stored in the original data's order. + for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) { + j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = { + data: data[j], + index: i, + value: v, + startAngle: a0, + endAngle: a1, + padAngle: p + }; + } + + return arcs; + } + + pie.value = function(_) { + return arguments.length ? (value = typeof _ === "function" ? _ : constant$10(+_), pie) : value; + }; + + pie.sortValues = function(_) { + return arguments.length ? (sortValues = _, sort = null, pie) : sortValues; + }; + + pie.sort = function(_) { + return arguments.length ? (sort = _, sortValues = null, pie) : sort; + }; + + pie.startAngle = function(_) { + return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : startAngle; + }; + + pie.endAngle = function(_) { + return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : endAngle; + }; + + pie.padAngle = function(_) { + return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$10(+_), pie) : padAngle; + }; + + return pie; +}; + +var curveRadialLinear = curveRadial(curveLinear); + +function Radial(curve) { + this._curve = curve; +} + +Radial.prototype = { + areaStart: function() { + this._curve.areaStart(); + }, + areaEnd: function() { + this._curve.areaEnd(); + }, + lineStart: function() { + this._curve.lineStart(); + }, + lineEnd: function() { + this._curve.lineEnd(); + }, + point: function(a, r) { + this._curve.point(r * Math.sin(a), r * -Math.cos(a)); + } +}; + +function curveRadial(curve) { + + function radial(context) { + return new Radial(curve(context)); + } + + radial._curve = curve; + + return radial; +} + +function radialLine(l) { + var c = l.curve; + + l.angle = l.x, delete l.x; + l.radius = l.y, delete l.y; + + l.curve = function(_) { + return arguments.length ? c(curveRadial(_)) : c()._curve; + }; + + return l; +} + +var radialLine$1 = function() { + return radialLine(line().curve(curveRadialLinear)); +}; + +var radialArea = function() { + var a = area$2().curve(curveRadialLinear), + c = a.curve, + x0 = a.lineX0, + x1 = a.lineX1, + y0 = a.lineY0, + y1 = a.lineY1; + + a.angle = a.x, delete a.x; + a.startAngle = a.x0, delete a.x0; + a.endAngle = a.x1, delete a.x1; + a.radius = a.y, delete a.y; + a.innerRadius = a.y0, delete a.y0; + a.outerRadius = a.y1, delete a.y1; + a.lineStartAngle = function() { return radialLine(x0()); }, delete a.lineX0; + a.lineEndAngle = function() { return radialLine(x1()); }, delete a.lineX1; + a.lineInnerRadius = function() { return radialLine(y0()); }, delete a.lineY0; + a.lineOuterRadius = function() { return radialLine(y1()); }, delete a.lineY1; + + a.curve = function(_) { + return arguments.length ? c(curveRadial(_)) : c()._curve; + }; + + return a; +}; + +var slice$5 = Array.prototype.slice; + +var radialPoint = function(x, y) { + return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)]; +}; + +function linkSource(d) { + return d.source; +} + +function linkTarget(d) { + return d.target; +} + +function link$2(curve) { + var source = linkSource, + target = linkTarget, + x$$1 = x$3, + y$$1 = y$3, + context = null; + + function link() { + var buffer, argv = slice$5.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv); + if (!context) context = buffer = path(); + curve(context, +x$$1.apply(this, (argv[0] = s, argv)), +y$$1.apply(this, argv), +x$$1.apply(this, (argv[0] = t, argv)), +y$$1.apply(this, argv)); + if (buffer) return context = null, buffer + "" || null; + } + + link.source = function(_) { + return arguments.length ? (source = _, link) : source; + }; + + link.target = function(_) { + return arguments.length ? (target = _, link) : target; + }; + + link.x = function(_) { + return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$10(+_), link) : x$$1; + }; + + link.y = function(_) { + return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$10(+_), link) : y$$1; + }; + + link.context = function(_) { + return arguments.length ? ((context = _ == null ? null : _), link) : context; + }; + + return link; +} + +function curveHorizontal(context, x0, y0, x1, y1) { + context.moveTo(x0, y0); + context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1); +} + +function curveVertical(context, x0, y0, x1, y1) { + context.moveTo(x0, y0); + context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1); +} + +function curveRadial$1(context, x0, y0, x1, y1) { + var p0 = radialPoint(x0, y0), + p1 = radialPoint(x0, y0 = (y0 + y1) / 2), + p2 = radialPoint(x1, y0), + p3 = radialPoint(x1, y1); + context.moveTo(p0[0], p0[1]); + context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]); +} + +function linkHorizontal() { + return link$2(curveHorizontal); +} + +function linkVertical() { + return link$2(curveVertical); +} + +function linkRadial() { + var l = link$2(curveRadial$1); + l.angle = l.x, delete l.x; + l.radius = l.y, delete l.y; + return l; +} + +var circle$2 = { + draw: function(context, size) { + var r = Math.sqrt(size / pi$4); + context.moveTo(r, 0); + context.arc(0, 0, r, 0, tau$4); + } +}; + +var cross$2 = { + draw: function(context, size) { + var r = Math.sqrt(size / 5) / 2; + context.moveTo(-3 * r, -r); + context.lineTo(-r, -r); + context.lineTo(-r, -3 * r); + context.lineTo(r, -3 * r); + context.lineTo(r, -r); + context.lineTo(3 * r, -r); + context.lineTo(3 * r, r); + context.lineTo(r, r); + context.lineTo(r, 3 * r); + context.lineTo(-r, 3 * r); + context.lineTo(-r, r); + context.lineTo(-3 * r, r); + context.closePath(); + } +}; + +var tan30 = Math.sqrt(1 / 3); +var tan30_2 = tan30 * 2; + +var diamond = { + draw: function(context, size) { + var y = Math.sqrt(size / tan30_2), + x = y * tan30; + context.moveTo(0, -y); + context.lineTo(x, 0); + context.lineTo(0, y); + context.lineTo(-x, 0); + context.closePath(); + } +}; + +var ka = 0.89081309152928522810; +var kr = Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10); +var kx = Math.sin(tau$4 / 10) * kr; +var ky = -Math.cos(tau$4 / 10) * kr; + +var star = { + draw: function(context, size) { + var r = Math.sqrt(size * ka), + x = kx * r, + y = ky * r; + context.moveTo(0, -r); + context.lineTo(x, y); + for (var i = 1; i < 5; ++i) { + var a = tau$4 * i / 5, + c = Math.cos(a), + s = Math.sin(a); + context.lineTo(s * r, -c * r); + context.lineTo(c * x - s * y, s * x + c * y); + } + context.closePath(); + } +}; + +var square = { + draw: function(context, size) { + var w = Math.sqrt(size), + x = -w / 2; + context.rect(x, x, w, w); + } +}; + +var sqrt3 = Math.sqrt(3); + +var triangle = { + draw: function(context, size) { + var y = -Math.sqrt(size / (sqrt3 * 3)); + context.moveTo(0, y * 2); + context.lineTo(-sqrt3 * y, -y); + context.lineTo(sqrt3 * y, -y); + context.closePath(); + } +}; + +var c = -0.5; +var s = Math.sqrt(3) / 2; +var k = 1 / Math.sqrt(12); +var a = (k / 2 + 1) * 3; + +var wye = { + draw: function(context, size) { + var r = Math.sqrt(size / a), + x0 = r / 2, + y0 = r * k, + x1 = x0, + y1 = r * k + r, + x2 = -x1, + y2 = y1; + context.moveTo(x0, y0); + context.lineTo(x1, y1); + context.lineTo(x2, y2); + context.lineTo(c * x0 - s * y0, s * x0 + c * y0); + context.lineTo(c * x1 - s * y1, s * x1 + c * y1); + context.lineTo(c * x2 - s * y2, s * x2 + c * y2); + context.lineTo(c * x0 + s * y0, c * y0 - s * x0); + context.lineTo(c * x1 + s * y1, c * y1 - s * x1); + context.lineTo(c * x2 + s * y2, c * y2 - s * x2); + context.closePath(); + } +}; + +var symbols = [ + circle$2, + cross$2, + diamond, + square, + star, + triangle, + wye +]; + +var symbol = function() { + var type = constant$10(circle$2), + size = constant$10(64), + context = null; + + function symbol() { + var buffer; + if (!context) context = buffer = path(); + type.apply(this, arguments).draw(context, +size.apply(this, arguments)); + if (buffer) return context = null, buffer + "" || null; + } + + symbol.type = function(_) { + return arguments.length ? (type = typeof _ === "function" ? _ : constant$10(_), symbol) : type; + }; + + symbol.size = function(_) { + return arguments.length ? (size = typeof _ === "function" ? _ : constant$10(+_), symbol) : size; + }; + + symbol.context = function(_) { + return arguments.length ? (context = _ == null ? null : _, symbol) : context; + }; + + return symbol; +}; + +var noop$2 = function() {}; + +function point$2(that, x, y) { + that._context.bezierCurveTo( + (2 * that._x0 + that._x1) / 3, + (2 * that._y0 + that._y1) / 3, + (that._x0 + 2 * that._x1) / 3, + (that._y0 + 2 * that._y1) / 3, + (that._x0 + 4 * that._x1 + x) / 6, + (that._y0 + 4 * that._y1 + y) / 6 + ); +} + +function Basis(context) { + this._context = context; +} + +Basis.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = + this._y0 = this._y1 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 3: point$2(this, this._x1, this._y1); // proceed + case 2: this._context.lineTo(this._x1, this._y1); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; break; + case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); // proceed + default: point$2(this, x, y); break; + } + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + } +}; + +var basis$2 = function(context) { + return new Basis(context); +}; + +function BasisClosed(context) { + this._context = context; +} + +BasisClosed.prototype = { + areaStart: noop$2, + areaEnd: noop$2, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = + this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x2, this._y2); + this._context.closePath(); + break; + } + case 2: { + this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); + this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x2, this._y2); + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + break; + } + } + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._x2 = x, this._y2 = y; break; + case 1: this._point = 2; this._x3 = x, this._y3 = y; break; + case 2: this._point = 3; this._x4 = x, this._y4 = y; this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6); break; + default: point$2(this, x, y); break; + } + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + } +}; + +var basisClosed$1 = function(context) { + return new BasisClosed(context); +}; + +function BasisOpen(context) { + this._context = context; +} + +BasisOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = + this._y0 = this._y1 = NaN; + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; break; + case 1: this._point = 2; break; + case 2: this._point = 3; var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6; this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0); break; + case 3: this._point = 4; // proceed + default: point$2(this, x, y); break; + } + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + } +}; + +var basisOpen = function(context) { + return new BasisOpen(context); +}; + +function Bundle(context, beta) { + this._basis = new Basis(context); + this._beta = beta; +} + +Bundle.prototype = { + lineStart: function() { + this._x = []; + this._y = []; + this._basis.lineStart(); + }, + lineEnd: function() { + var x = this._x, + y = this._y, + j = x.length - 1; + + if (j > 0) { + var x0 = x[0], + y0 = y[0], + dx = x[j] - x0, + dy = y[j] - y0, + i = -1, + t; + + while (++i <= j) { + t = i / j; + this._basis.point( + this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), + this._beta * y[i] + (1 - this._beta) * (y0 + t * dy) + ); + } + } + + this._x = this._y = null; + this._basis.lineEnd(); + }, + point: function(x, y) { + this._x.push(+x); + this._y.push(+y); + } +}; + +var bundle = ((function custom(beta) { + + function bundle(context) { + return beta === 1 ? new Basis(context) : new Bundle(context, beta); + } + + bundle.beta = function(beta) { + return custom(+beta); + }; + + return bundle; +}))(0.85); + +function point$3(that, x, y) { + that._context.bezierCurveTo( + that._x1 + that._k * (that._x2 - that._x0), + that._y1 + that._k * (that._y2 - that._y0), + that._x2 + that._k * (that._x1 - x), + that._y2 + that._k * (that._y1 - y), + that._x2, + that._y2 + ); +} + +function Cardinal(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; +} + +Cardinal.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: this._context.lineTo(this._x2, this._y2); break; + case 3: point$3(this, this._x1, this._y1); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; this._x1 = x, this._y1 = y; break; + case 2: this._point = 3; // proceed + default: point$3(this, x, y); break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var cardinal = ((function custom(tension) { + + function cardinal(context) { + return new Cardinal(context, tension); + } + + cardinal.tension = function(tension) { + return custom(+tension); + }; + + return cardinal; +}))(0); + +function CardinalClosed(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; +} + +CardinalClosed.prototype = { + areaStart: noop$2, + areaEnd: noop$2, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = + this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._x3 = x, this._y3 = y; break; + case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; + case 2: this._point = 3; this._x5 = x, this._y5 = y; break; + default: point$3(this, x, y); break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var cardinalClosed = ((function custom(tension) { + + function cardinal(context) { + return new CardinalClosed(context, tension); + } + + cardinal.tension = function(tension) { + return custom(+tension); + }; + + return cardinal; +}))(0); + +function CardinalOpen(context, tension) { + this._context = context; + this._k = (1 - tension) / 6; +} + +CardinalOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; break; + case 1: this._point = 2; break; + case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; + case 3: this._point = 4; // proceed + default: point$3(this, x, y); break; + } + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var cardinalOpen = ((function custom(tension) { + + function cardinal(context) { + return new CardinalOpen(context, tension); + } + + cardinal.tension = function(tension) { + return custom(+tension); + }; + + return cardinal; +}))(0); + +function point$4(that, x, y) { + var x1 = that._x1, + y1 = that._y1, + x2 = that._x2, + y2 = that._y2; + + if (that._l01_a > epsilon$3) { + var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, + n = 3 * that._l01_a * (that._l01_a + that._l12_a); + x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; + y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; + } + + if (that._l23_a > epsilon$3) { + var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, + m = 3 * that._l23_a * (that._l23_a + that._l12_a); + x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m; + y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m; + } + + that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2); +} + +function CatmullRom(context, alpha) { + this._context = context; + this._alpha = alpha; +} + +CatmullRom.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = + this._l01_2a = this._l12_2a = this._l23_2a = + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: this._context.lineTo(this._x2, this._y2); break; + case 3: this.point(this._x2, this._y2); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + + if (this._point) { + var x23 = this._x2 - x, + y23 = this._y2 - y; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; break; + case 2: this._point = 3; // proceed + default: point$4(this, x, y); break; + } + + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var catmullRom = ((function custom(alpha) { + + function catmullRom(context) { + return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); + } + + catmullRom.alpha = function(alpha) { + return custom(+alpha); + }; + + return catmullRom; +}))(0.5); + +function CatmullRomClosed(context, alpha) { + this._context = context; + this._alpha = alpha; +} + +CatmullRomClosed.prototype = { + areaStart: noop$2, + areaEnd: noop$2, + lineStart: function() { + this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = + this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; + this._l01_a = this._l12_a = this._l23_a = + this._l01_2a = this._l12_2a = this._l23_2a = + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 1: { + this._context.moveTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 2: { + this._context.lineTo(this._x3, this._y3); + this._context.closePath(); + break; + } + case 3: { + this.point(this._x3, this._y3); + this.point(this._x4, this._y4); + this.point(this._x5, this._y5); + break; + } + } + }, + point: function(x, y) { + x = +x, y = +y; + + if (this._point) { + var x23 = this._x2 - x, + y23 = this._y2 - y; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + + switch (this._point) { + case 0: this._point = 1; this._x3 = x, this._y3 = y; break; + case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break; + case 2: this._point = 3; this._x5 = x, this._y5 = y; break; + default: point$4(this, x, y); break; + } + + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var catmullRomClosed = ((function custom(alpha) { + + function catmullRom(context) { + return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); + } + + catmullRom.alpha = function(alpha) { + return custom(+alpha); + }; + + return catmullRom; +}))(0.5); + +function CatmullRomOpen(context, alpha) { + this._context = context; + this._alpha = alpha; +} + +CatmullRomOpen.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = this._x2 = + this._y0 = this._y1 = this._y2 = NaN; + this._l01_a = this._l12_a = this._l23_a = + this._l01_2a = this._l12_2a = this._l23_2a = + this._point = 0; + }, + lineEnd: function() { + if (this._line || (this._line !== 0 && this._point === 3)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + + if (this._point) { + var x23 = this._x2 - x, + y23 = this._y2 - y; + this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); + } + + switch (this._point) { + case 0: this._point = 1; break; + case 1: this._point = 2; break; + case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; + case 3: this._point = 4; // proceed + default: point$4(this, x, y); break; + } + + this._l01_a = this._l12_a, this._l12_a = this._l23_a; + this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; + this._x0 = this._x1, this._x1 = this._x2, this._x2 = x; + this._y0 = this._y1, this._y1 = this._y2, this._y2 = y; + } +}; + +var catmullRomOpen = ((function custom(alpha) { + + function catmullRom(context) { + return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); + } + + catmullRom.alpha = function(alpha) { + return custom(+alpha); + }; + + return catmullRom; +}))(0.5); + +function LinearClosed(context) { + this._context = context; +} + +LinearClosed.prototype = { + areaStart: noop$2, + areaEnd: noop$2, + lineStart: function() { + this._point = 0; + }, + lineEnd: function() { + if (this._point) this._context.closePath(); + }, + point: function(x, y) { + x = +x, y = +y; + if (this._point) this._context.lineTo(x, y); + else this._point = 1, this._context.moveTo(x, y); + } +}; + +var linearClosed = function(context) { + return new LinearClosed(context); +}; + +function sign$1(x) { + return x < 0 ? -1 : 1; +} + +// Calculate the slopes of the tangents (Hermite-type interpolation) based on +// the following paper: Steffen, M. 1990. A Simple Method for Monotonic +// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO. +// NOV(II), P. 443, 1990. +function slope3(that, x2, y2) { + var h0 = that._x1 - that._x0, + h1 = x2 - that._x1, + s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), + s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), + p = (s0 * h1 + s1 * h0) / (h0 + h1); + return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; +} + +// Calculate a one-sided slope. +function slope2(that, t) { + var h = that._x1 - that._x0; + return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; +} + +// According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations +// "you can express cubic Hermite interpolation in terms of cubic Bézier curves +// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1". +function point$5(that, t0, t1) { + var x0 = that._x0, + y0 = that._y0, + x1 = that._x1, + y1 = that._y1, + dx = (x1 - x0) / 3; + that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1); +} + +function MonotoneX(context) { + this._context = context; +} + +MonotoneX.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x0 = this._x1 = + this._y0 = this._y1 = + this._t0 = NaN; + this._point = 0; + }, + lineEnd: function() { + switch (this._point) { + case 2: this._context.lineTo(this._x1, this._y1); break; + case 3: point$5(this, this._t0, slope2(this, this._t0)); break; + } + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + this._line = 1 - this._line; + }, + point: function(x, y) { + var t1 = NaN; + + x = +x, y = +y; + if (x === this._x1 && y === this._y1) return; // Ignore coincident points. + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; break; + case 2: this._point = 3; point$5(this, slope2(this, t1 = slope3(this, x, y)), t1); break; + default: point$5(this, this._t0, t1 = slope3(this, x, y)); break; + } + + this._x0 = this._x1, this._x1 = x; + this._y0 = this._y1, this._y1 = y; + this._t0 = t1; + } +}; + +function MonotoneY(context) { + this._context = new ReflectContext(context); +} + +(MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) { + MonotoneX.prototype.point.call(this, y, x); +}; + +function ReflectContext(context) { + this._context = context; +} + +ReflectContext.prototype = { + moveTo: function(x, y) { this._context.moveTo(y, x); }, + closePath: function() { this._context.closePath(); }, + lineTo: function(x, y) { this._context.lineTo(y, x); }, + bezierCurveTo: function(x1, y1, x2, y2, x, y) { this._context.bezierCurveTo(y1, x1, y2, x2, y, x); } +}; + +function monotoneX(context) { + return new MonotoneX(context); +} + +function monotoneY(context) { + return new MonotoneY(context); +} + +function Natural(context) { + this._context = context; +} + +Natural.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = []; + this._y = []; + }, + lineEnd: function() { + var x = this._x, + y = this._y, + n = x.length; + + if (n) { + this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]); + if (n === 2) { + this._context.lineTo(x[1], y[1]); + } else { + var px = controlPoints(x), + py = controlPoints(y); + for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { + this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]); + } + } + } + + if (this._line || (this._line !== 0 && n === 1)) this._context.closePath(); + this._line = 1 - this._line; + this._x = this._y = null; + }, + point: function(x, y) { + this._x.push(+x); + this._y.push(+y); + } +}; + +// See https://www.particleincell.com/2012/bezier-splines/ for derivation. +function controlPoints(x) { + var i, + n = x.length - 1, + m, + a = new Array(n), + b = new Array(n), + r = new Array(n); + a[0] = 0, b[0] = 2, r[0] = x[0] + 2 * x[1]; + for (i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, r[i] = 4 * x[i] + 2 * x[i + 1]; + a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n]; + for (i = 1; i < n; ++i) m = a[i] / b[i - 1], b[i] -= m, r[i] -= m * r[i - 1]; + a[n - 1] = r[n - 1] / b[n - 1]; + for (i = n - 2; i >= 0; --i) a[i] = (r[i] - a[i + 1]) / b[i]; + b[n - 1] = (x[n] + a[n - 1]) / 2; + for (i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1]; + return [a, b]; +} + +var natural = function(context) { + return new Natural(context); +}; + +function Step(context, t) { + this._context = context; + this._t = t; +} + +Step.prototype = { + areaStart: function() { + this._line = 0; + }, + areaEnd: function() { + this._line = NaN; + }, + lineStart: function() { + this._x = this._y = NaN; + this._point = 0; + }, + lineEnd: function() { + if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); + if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath(); + if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; + }, + point: function(x, y) { + x = +x, y = +y; + switch (this._point) { + case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break; + case 1: this._point = 2; // proceed + default: { + if (this._t <= 0) { + this._context.lineTo(this._x, y); + this._context.lineTo(x, y); + } else { + var x1 = this._x * (1 - this._t) + x * this._t; + this._context.lineTo(x1, this._y); + this._context.lineTo(x1, y); + } + break; + } + } + this._x = x, this._y = y; + } +}; + +var step = function(context) { + return new Step(context, 0.5); +}; + +function stepBefore(context) { + return new Step(context, 0); +} + +function stepAfter(context) { + return new Step(context, 1); +} + +var none$1 = function(series, order) { + if (!((n = series.length) > 1)) return; + for (var i = 1, j, s0, s1 = series[order[0]], n, m = s1.length; i < n; ++i) { + s0 = s1, s1 = series[order[i]]; + for (j = 0; j < m; ++j) { + s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; + } + } +}; + +var none$2 = function(series) { + var n = series.length, o = new Array(n); + while (--n >= 0) o[n] = n; + return o; +}; + +function stackValue(d, key) { + return d[key]; +} + +var stack = function() { + var keys = constant$10([]), + order = none$2, + offset = none$1, + value = stackValue; + + function stack(data) { + var kz = keys.apply(this, arguments), + i, + m = data.length, + n = kz.length, + sz = new Array(n), + oz; + + for (i = 0; i < n; ++i) { + for (var ki = kz[i], si = sz[i] = new Array(m), j = 0, sij; j < m; ++j) { + si[j] = sij = [0, +value(data[j], ki, j, data)]; + sij.data = data[j]; + } + si.key = ki; + } + + for (i = 0, oz = order(sz); i < n; ++i) { + sz[oz[i]].index = i; + } + + offset(sz, oz); + return sz; + } + + stack.keys = function(_) { + return arguments.length ? (keys = typeof _ === "function" ? _ : constant$10(slice$5.call(_)), stack) : keys; + }; + + stack.value = function(_) { + return arguments.length ? (value = typeof _ === "function" ? _ : constant$10(+_), stack) : value; + }; + + stack.order = function(_) { + return arguments.length ? (order = _ == null ? none$2 : typeof _ === "function" ? _ : constant$10(slice$5.call(_)), stack) : order; + }; + + stack.offset = function(_) { + return arguments.length ? (offset = _ == null ? none$1 : _, stack) : offset; + }; + + return stack; +}; + +var expand = function(series, order) { + if (!((n = series.length) > 0)) return; + for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { + for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; + if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; + } + none$1(series, order); +}; + +var diverging = function(series, order) { + if (!((n = series.length) > 1)) return; + for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) { + for (yp = yn = 0, i = 0; i < n; ++i) { + if ((dy = (d = series[order[i]][j])[1] - d[0]) >= 0) { + d[0] = yp, d[1] = yp += dy; + } else if (dy < 0) { + d[1] = yn, d[0] = yn += dy; + } else { + d[0] = yp; + } + } + } +}; + +var silhouette = function(series, order) { + if (!((n = series.length) > 0)) return; + for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { + for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; + s0[j][1] += s0[j][0] = -y / 2; + } + none$1(series, order); +}; + +var wiggle = function(series, order) { + if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; + for (var y = 0, j = 1, s0, m, n; j < m; ++j) { + for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { + var si = series[order[i]], + sij0 = si[j][1] || 0, + sij1 = si[j - 1][1] || 0, + s3 = (sij0 - sij1) / 2; + for (var k = 0; k < i; ++k) { + var sk = series[order[k]], + skj0 = sk[j][1] || 0, + skj1 = sk[j - 1][1] || 0; + s3 += skj0 - skj1; + } + s1 += sij0, s2 += s3 * sij0; + } + s0[j - 1][1] += s0[j - 1][0] = y; + if (s1) y -= s2 / s1; + } + s0[j - 1][1] += s0[j - 1][0] = y; + none$1(series, order); +}; + +var ascending$2 = function(series) { + var sums = series.map(sum$2); + return none$2(series).sort(function(a, b) { return sums[a] - sums[b]; }); +}; + +function sum$2(series) { + var s = 0, i = -1, n = series.length, v; + while (++i < n) if (v = +series[i][1]) s += v; + return s; +} + +var descending$2 = function(series) { + return ascending$2(series).reverse(); +}; + +var insideOut = function(series) { + var n = series.length, + i, + j, + sums = series.map(sum$2), + order = none$2(series).sort(function(a, b) { return sums[b] - sums[a]; }), + top = 0, + bottom = 0, + tops = [], + bottoms = []; + + for (i = 0; i < n; ++i) { + j = order[i]; + if (top < bottom) { + top += sums[j]; + tops.push(j); + } else { + bottom += sums[j]; + bottoms.push(j); + } + } + + return bottoms.reverse().concat(tops); +}; + +var reverse = function(series) { + return none$2(series).reverse(); +}; + +var constant$11 = function(x) { + return function() { + return x; + }; +}; + +function x$4(d) { + return d[0]; +} + +function y$4(d) { + return d[1]; +} + +function RedBlackTree() { + this._ = null; // root node +} + +function RedBlackNode(node) { + node.U = // parent node + node.C = // color - true for red, false for black + node.L = // left node + node.R = // right node + node.P = // previous node + node.N = null; // next node +} + +RedBlackTree.prototype = { + constructor: RedBlackTree, + + insert: function(after, node) { + var parent, grandpa, uncle; + + if (after) { + node.P = after; + node.N = after.N; + if (after.N) after.N.P = node; + after.N = node; + if (after.R) { + after = after.R; + while (after.L) after = after.L; + after.L = node; + } else { + after.R = node; + } + parent = after; + } else if (this._) { + after = RedBlackFirst(this._); + node.P = null; + node.N = after; + after.P = after.L = node; + parent = after; + } else { + node.P = node.N = null; + this._ = node; + parent = null; + } + node.L = node.R = null; + node.U = parent; + node.C = true; + + after = node; + while (parent && parent.C) { + grandpa = parent.U; + if (parent === grandpa.L) { + uncle = grandpa.R; + if (uncle && uncle.C) { + parent.C = uncle.C = false; + grandpa.C = true; + after = grandpa; + } else { + if (after === parent.R) { + RedBlackRotateLeft(this, parent); + after = parent; + parent = after.U; + } + parent.C = false; + grandpa.C = true; + RedBlackRotateRight(this, grandpa); + } + } else { + uncle = grandpa.L; + if (uncle && uncle.C) { + parent.C = uncle.C = false; + grandpa.C = true; + after = grandpa; + } else { + if (after === parent.L) { + RedBlackRotateRight(this, parent); + after = parent; + parent = after.U; + } + parent.C = false; + grandpa.C = true; + RedBlackRotateLeft(this, grandpa); + } + } + parent = after.U; + } + this._.C = false; + }, + + remove: function(node) { + if (node.N) node.N.P = node.P; + if (node.P) node.P.N = node.N; + node.N = node.P = null; + + var parent = node.U, + sibling, + left = node.L, + right = node.R, + next, + red; + + if (!left) next = right; + else if (!right) next = left; + else next = RedBlackFirst(right); + + if (parent) { + if (parent.L === node) parent.L = next; + else parent.R = next; + } else { + this._ = next; + } + + if (left && right) { + red = next.C; + next.C = node.C; + next.L = left; + left.U = next; + if (next !== right) { + parent = next.U; + next.U = node.U; + node = next.R; + parent.L = node; + next.R = right; + right.U = next; + } else { + next.U = parent; + parent = next; + node = next.R; + } + } else { + red = node.C; + node = next; + } + + if (node) node.U = parent; + if (red) return; + if (node && node.C) { node.C = false; return; } + + do { + if (node === this._) break; + if (node === parent.L) { + sibling = parent.R; + if (sibling.C) { + sibling.C = false; + parent.C = true; + RedBlackRotateLeft(this, parent); + sibling = parent.R; + } + if ((sibling.L && sibling.L.C) + || (sibling.R && sibling.R.C)) { + if (!sibling.R || !sibling.R.C) { + sibling.L.C = false; + sibling.C = true; + RedBlackRotateRight(this, sibling); + sibling = parent.R; + } + sibling.C = parent.C; + parent.C = sibling.R.C = false; + RedBlackRotateLeft(this, parent); + node = this._; + break; + } + } else { + sibling = parent.L; + if (sibling.C) { + sibling.C = false; + parent.C = true; + RedBlackRotateRight(this, parent); + sibling = parent.L; + } + if ((sibling.L && sibling.L.C) + || (sibling.R && sibling.R.C)) { + if (!sibling.L || !sibling.L.C) { + sibling.R.C = false; + sibling.C = true; + RedBlackRotateLeft(this, sibling); + sibling = parent.L; + } + sibling.C = parent.C; + parent.C = sibling.L.C = false; + RedBlackRotateRight(this, parent); + node = this._; + break; + } + } + sibling.C = true; + node = parent; + parent = parent.U; + } while (!node.C); + + if (node) node.C = false; + } +}; + +function RedBlackRotateLeft(tree, node) { + var p = node, + q = node.R, + parent = p.U; + + if (parent) { + if (parent.L === p) parent.L = q; + else parent.R = q; + } else { + tree._ = q; + } + + q.U = parent; + p.U = q; + p.R = q.L; + if (p.R) p.R.U = p; + q.L = p; +} + +function RedBlackRotateRight(tree, node) { + var p = node, + q = node.L, + parent = p.U; + + if (parent) { + if (parent.L === p) parent.L = q; + else parent.R = q; + } else { + tree._ = q; + } + + q.U = parent; + p.U = q; + p.L = q.R; + if (p.L) p.L.U = p; + q.R = p; +} + +function RedBlackFirst(node) { + while (node.L) node = node.L; + return node; +} + +function createEdge(left, right, v0, v1) { + var edge = [null, null], + index = edges.push(edge) - 1; + edge.left = left; + edge.right = right; + if (v0) setEdgeEnd(edge, left, right, v0); + if (v1) setEdgeEnd(edge, right, left, v1); + cells[left.index].halfedges.push(index); + cells[right.index].halfedges.push(index); + return edge; +} + +function createBorderEdge(left, v0, v1) { + var edge = [v0, v1]; + edge.left = left; + return edge; +} + +function setEdgeEnd(edge, left, right, vertex) { + if (!edge[0] && !edge[1]) { + edge[0] = vertex; + edge.left = left; + edge.right = right; + } else if (edge.left === right) { + edge[1] = vertex; + } else { + edge[0] = vertex; + } +} + +// Liang–Barsky line clipping. +function clipEdge(edge, x0, y0, x1, y1) { + var a = edge[0], + b = edge[1], + ax = a[0], + ay = a[1], + bx = b[0], + by = b[1], + t0 = 0, + t1 = 1, + dx = bx - ax, + dy = by - ay, + r; + + r = x0 - ax; + if (!dx && r > 0) return; + r /= dx; + if (dx < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dx > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + + r = x1 - ax; + if (!dx && r < 0) return; + r /= dx; + if (dx < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dx > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + + r = y0 - ay; + if (!dy && r > 0) return; + r /= dy; + if (dy < 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } else if (dy > 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } + + r = y1 - ay; + if (!dy && r < 0) return; + r /= dy; + if (dy < 0) { + if (r > t1) return; + if (r > t0) t0 = r; + } else if (dy > 0) { + if (r < t0) return; + if (r < t1) t1 = r; + } + + if (!(t0 > 0) && !(t1 < 1)) return true; // TODO Better check? + + if (t0 > 0) edge[0] = [ax + t0 * dx, ay + t0 * dy]; + if (t1 < 1) edge[1] = [ax + t1 * dx, ay + t1 * dy]; + return true; +} + +function connectEdge(edge, x0, y0, x1, y1) { + var v1 = edge[1]; + if (v1) return true; + + var v0 = edge[0], + left = edge.left, + right = edge.right, + lx = left[0], + ly = left[1], + rx = right[0], + ry = right[1], + fx = (lx + rx) / 2, + fy = (ly + ry) / 2, + fm, + fb; + + if (ry === ly) { + if (fx < x0 || fx >= x1) return; + if (lx > rx) { + if (!v0) v0 = [fx, y0]; + else if (v0[1] >= y1) return; + v1 = [fx, y1]; + } else { + if (!v0) v0 = [fx, y1]; + else if (v0[1] < y0) return; + v1 = [fx, y0]; + } + } else { + fm = (lx - rx) / (ry - ly); + fb = fy - fm * fx; + if (fm < -1 || fm > 1) { + if (lx > rx) { + if (!v0) v0 = [(y0 - fb) / fm, y0]; + else if (v0[1] >= y1) return; + v1 = [(y1 - fb) / fm, y1]; + } else { + if (!v0) v0 = [(y1 - fb) / fm, y1]; + else if (v0[1] < y0) return; + v1 = [(y0 - fb) / fm, y0]; + } + } else { + if (ly < ry) { + if (!v0) v0 = [x0, fm * x0 + fb]; + else if (v0[0] >= x1) return; + v1 = [x1, fm * x1 + fb]; + } else { + if (!v0) v0 = [x1, fm * x1 + fb]; + else if (v0[0] < x0) return; + v1 = [x0, fm * x0 + fb]; + } + } + } + + edge[0] = v0; + edge[1] = v1; + return true; +} + +function clipEdges(x0, y0, x1, y1) { + var i = edges.length, + edge; + + while (i--) { + if (!connectEdge(edge = edges[i], x0, y0, x1, y1) + || !clipEdge(edge, x0, y0, x1, y1) + || !(Math.abs(edge[0][0] - edge[1][0]) > epsilon$4 + || Math.abs(edge[0][1] - edge[1][1]) > epsilon$4)) { + delete edges[i]; + } + } +} + +function createCell(site) { + return cells[site.index] = { + site: site, + halfedges: [] + }; +} + +function cellHalfedgeAngle(cell, edge) { + var site = cell.site, + va = edge.left, + vb = edge.right; + if (site === vb) vb = va, va = site; + if (vb) return Math.atan2(vb[1] - va[1], vb[0] - va[0]); + if (site === va) va = edge[1], vb = edge[0]; + else va = edge[0], vb = edge[1]; + return Math.atan2(va[0] - vb[0], vb[1] - va[1]); +} + +function cellHalfedgeStart(cell, edge) { + return edge[+(edge.left !== cell.site)]; +} + +function cellHalfedgeEnd(cell, edge) { + return edge[+(edge.left === cell.site)]; +} + +function sortCellHalfedges() { + for (var i = 0, n = cells.length, cell, halfedges, j, m; i < n; ++i) { + if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) { + var index = new Array(m), + array = new Array(m); + for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]); + index.sort(function(i, j) { return array[j] - array[i]; }); + for (j = 0; j < m; ++j) array[j] = halfedges[index[j]]; + for (j = 0; j < m; ++j) halfedges[j] = array[j]; + } + } +} + +function clipCells(x0, y0, x1, y1) { + var nCells = cells.length, + iCell, + cell, + site, + iHalfedge, + halfedges, + nHalfedges, + start, + startX, + startY, + end, + endX, + endY, + cover = true; + + for (iCell = 0; iCell < nCells; ++iCell) { + if (cell = cells[iCell]) { + site = cell.site; + halfedges = cell.halfedges; + iHalfedge = halfedges.length; + + // Remove any dangling clipped edges. + while (iHalfedge--) { + if (!edges[halfedges[iHalfedge]]) { + halfedges.splice(iHalfedge, 1); + } + } + + // Insert any border edges as necessary. + iHalfedge = 0, nHalfedges = halfedges.length; + while (iHalfedge < nHalfedges) { + end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]), endX = end[0], endY = end[1]; + start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]), startX = start[0], startY = start[1]; + if (Math.abs(endX - startX) > epsilon$4 || Math.abs(endY - startY) > epsilon$4) { + halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end, + Math.abs(endX - x0) < epsilon$4 && y1 - endY > epsilon$4 ? [x0, Math.abs(startX - x0) < epsilon$4 ? startY : y1] + : Math.abs(endY - y1) < epsilon$4 && x1 - endX > epsilon$4 ? [Math.abs(startY - y1) < epsilon$4 ? startX : x1, y1] + : Math.abs(endX - x1) < epsilon$4 && endY - y0 > epsilon$4 ? [x1, Math.abs(startX - x1) < epsilon$4 ? startY : y0] + : Math.abs(endY - y0) < epsilon$4 && endX - x0 > epsilon$4 ? [Math.abs(startY - y0) < epsilon$4 ? startX : x0, y0] + : null)) - 1); + ++nHalfedges; + } + } + + if (nHalfedges) cover = false; + } + } + + // If there weren’t any edges, have the closest site cover the extent. + // It doesn’t matter which corner of the extent we measure! + if (cover) { + var dx, dy, d2, dc = Infinity; + + for (iCell = 0, cover = null; iCell < nCells; ++iCell) { + if (cell = cells[iCell]) { + site = cell.site; + dx = site[0] - x0; + dy = site[1] - y0; + d2 = dx * dx + dy * dy; + if (d2 < dc) dc = d2, cover = cell; + } + } + + if (cover) { + var v00 = [x0, y0], v01 = [x0, y1], v11 = [x1, y1], v10 = [x1, y0]; + cover.halfedges.push( + edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1, + edges.push(createBorderEdge(site, v01, v11)) - 1, + edges.push(createBorderEdge(site, v11, v10)) - 1, + edges.push(createBorderEdge(site, v10, v00)) - 1 + ); + } + } + + // Lastly delete any cells with no edges; these were entirely clipped. + for (iCell = 0; iCell < nCells; ++iCell) { + if (cell = cells[iCell]) { + if (!cell.halfedges.length) { + delete cells[iCell]; + } + } + } +} + +var circlePool = []; + +var firstCircle; + +function Circle() { + RedBlackNode(this); + this.x = + this.y = + this.arc = + this.site = + this.cy = null; +} + +function attachCircle(arc) { + var lArc = arc.P, + rArc = arc.N; + + if (!lArc || !rArc) return; + + var lSite = lArc.site, + cSite = arc.site, + rSite = rArc.site; + + if (lSite === rSite) return; + + var bx = cSite[0], + by = cSite[1], + ax = lSite[0] - bx, + ay = lSite[1] - by, + cx = rSite[0] - bx, + cy = rSite[1] - by; + + var d = 2 * (ax * cy - ay * cx); + if (d >= -epsilon2$2) return; + + var ha = ax * ax + ay * ay, + hc = cx * cx + cy * cy, + x = (cy * ha - ay * hc) / d, + y = (ax * hc - cx * ha) / d; + + var circle = circlePool.pop() || new Circle; + circle.arc = arc; + circle.site = cSite; + circle.x = x + bx; + circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y); // y bottom + + arc.circle = circle; + + var before = null, + node = circles._; + + while (node) { + if (circle.y < node.y || (circle.y === node.y && circle.x <= node.x)) { + if (node.L) node = node.L; + else { before = node.P; break; } + } else { + if (node.R) node = node.R; + else { before = node; break; } + } + } + + circles.insert(before, circle); + if (!before) firstCircle = circle; +} + +function detachCircle(arc) { + var circle = arc.circle; + if (circle) { + if (!circle.P) firstCircle = circle.N; + circles.remove(circle); + circlePool.push(circle); + RedBlackNode(circle); + arc.circle = null; + } +} + +var beachPool = []; + +function Beach() { + RedBlackNode(this); + this.edge = + this.site = + this.circle = null; +} + +function createBeach(site) { + var beach = beachPool.pop() || new Beach; + beach.site = site; + return beach; +} + +function detachBeach(beach) { + detachCircle(beach); + beaches.remove(beach); + beachPool.push(beach); + RedBlackNode(beach); +} + +function removeBeach(beach) { + var circle = beach.circle, + x = circle.x, + y = circle.cy, + vertex = [x, y], + previous = beach.P, + next = beach.N, + disappearing = [beach]; + + detachBeach(beach); + + var lArc = previous; + while (lArc.circle + && Math.abs(x - lArc.circle.x) < epsilon$4 + && Math.abs(y - lArc.circle.cy) < epsilon$4) { + previous = lArc.P; + disappearing.unshift(lArc); + detachBeach(lArc); + lArc = previous; + } + + disappearing.unshift(lArc); + detachCircle(lArc); + + var rArc = next; + while (rArc.circle + && Math.abs(x - rArc.circle.x) < epsilon$4 + && Math.abs(y - rArc.circle.cy) < epsilon$4) { + next = rArc.N; + disappearing.push(rArc); + detachBeach(rArc); + rArc = next; + } + + disappearing.push(rArc); + detachCircle(rArc); + + var nArcs = disappearing.length, + iArc; + for (iArc = 1; iArc < nArcs; ++iArc) { + rArc = disappearing[iArc]; + lArc = disappearing[iArc - 1]; + setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex); + } + + lArc = disappearing[0]; + rArc = disappearing[nArcs - 1]; + rArc.edge = createEdge(lArc.site, rArc.site, null, vertex); + + attachCircle(lArc); + attachCircle(rArc); +} + +function addBeach(site) { + var x = site[0], + directrix = site[1], + lArc, + rArc, + dxl, + dxr, + node = beaches._; + + while (node) { + dxl = leftBreakPoint(node, directrix) - x; + if (dxl > epsilon$4) node = node.L; else { + dxr = x - rightBreakPoint(node, directrix); + if (dxr > epsilon$4) { + if (!node.R) { + lArc = node; + break; + } + node = node.R; + } else { + if (dxl > -epsilon$4) { + lArc = node.P; + rArc = node; + } else if (dxr > -epsilon$4) { + lArc = node; + rArc = node.N; + } else { + lArc = rArc = node; + } + break; + } + } + } + + createCell(site); + var newArc = createBeach(site); + beaches.insert(lArc, newArc); + + if (!lArc && !rArc) return; + + if (lArc === rArc) { + detachCircle(lArc); + rArc = createBeach(lArc.site); + beaches.insert(newArc, rArc); + newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site); + attachCircle(lArc); + attachCircle(rArc); + return; + } + + if (!rArc) { // && lArc + newArc.edge = createEdge(lArc.site, newArc.site); + return; + } + + // else lArc !== rArc + detachCircle(lArc); + detachCircle(rArc); + + var lSite = lArc.site, + ax = lSite[0], + ay = lSite[1], + bx = site[0] - ax, + by = site[1] - ay, + rSite = rArc.site, + cx = rSite[0] - ax, + cy = rSite[1] - ay, + d = 2 * (bx * cy - by * cx), + hb = bx * bx + by * by, + hc = cx * cx + cy * cy, + vertex = [(cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay]; + + setEdgeEnd(rArc.edge, lSite, rSite, vertex); + newArc.edge = createEdge(lSite, site, null, vertex); + rArc.edge = createEdge(site, rSite, null, vertex); + attachCircle(lArc); + attachCircle(rArc); +} + +function leftBreakPoint(arc, directrix) { + var site = arc.site, + rfocx = site[0], + rfocy = site[1], + pby2 = rfocy - directrix; + + if (!pby2) return rfocx; + + var lArc = arc.P; + if (!lArc) return -Infinity; + + site = lArc.site; + var lfocx = site[0], + lfocy = site[1], + plby2 = lfocy - directrix; + + if (!plby2) return lfocx; + + var hl = lfocx - rfocx, + aby2 = 1 / pby2 - 1 / plby2, + b = hl / plby2; + + if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx; + + return (rfocx + lfocx) / 2; +} + +function rightBreakPoint(arc, directrix) { + var rArc = arc.N; + if (rArc) return leftBreakPoint(rArc, directrix); + var site = arc.site; + return site[1] === directrix ? site[0] : Infinity; +} + +var epsilon$4 = 1e-6; +var epsilon2$2 = 1e-12; +var beaches; +var cells; +var circles; +var edges; + +function triangleArea(a, b, c) { + return (a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]); +} + +function lexicographic(a, b) { + return b[1] - a[1] + || b[0] - a[0]; +} + +function Diagram(sites, extent) { + var site = sites.sort(lexicographic).pop(), + x, + y, + circle; + + edges = []; + cells = new Array(sites.length); + beaches = new RedBlackTree; + circles = new RedBlackTree; + + while (true) { + circle = firstCircle; + if (site && (!circle || site[1] < circle.y || (site[1] === circle.y && site[0] < circle.x))) { + if (site[0] !== x || site[1] !== y) { + addBeach(site); + x = site[0], y = site[1]; + } + site = sites.pop(); + } else if (circle) { + removeBeach(circle.arc); + } else { + break; + } + } + + sortCellHalfedges(); + + if (extent) { + var x0 = +extent[0][0], + y0 = +extent[0][1], + x1 = +extent[1][0], + y1 = +extent[1][1]; + clipEdges(x0, y0, x1, y1); + clipCells(x0, y0, x1, y1); + } + + this.edges = edges; + this.cells = cells; + + beaches = + circles = + edges = + cells = null; +} + +Diagram.prototype = { + constructor: Diagram, + + polygons: function() { + var edges = this.edges; + + return this.cells.map(function(cell) { + var polygon = cell.halfedges.map(function(i) { return cellHalfedgeStart(cell, edges[i]); }); + polygon.data = cell.site.data; + return polygon; + }); + }, + + triangles: function() { + var triangles = [], + edges = this.edges; + + this.cells.forEach(function(cell, i) { + if (!(m = (halfedges = cell.halfedges).length)) return; + var site = cell.site, + halfedges, + j = -1, + m, + s0, + e1 = edges[halfedges[m - 1]], + s1 = e1.left === site ? e1.right : e1.left; + + while (++j < m) { + s0 = s1; + e1 = edges[halfedges[j]]; + s1 = e1.left === site ? e1.right : e1.left; + if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) { + triangles.push([site.data, s0.data, s1.data]); + } + } + }); + + return triangles; + }, + + links: function() { + return this.edges.filter(function(edge) { + return edge.right; + }).map(function(edge) { + return { + source: edge.left.data, + target: edge.right.data + }; + }); + }, + + find: function(x, y, radius) { + var that = this, i0, i1 = that._found || 0, n = that.cells.length, cell; + + // Use the previously-found cell, or start with an arbitrary one. + while (!(cell = that.cells[i1])) if (++i1 >= n) return null; + var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy; + + // Traverse the half-edges to find a closer cell, if any. + do { + cell = that.cells[i0 = i1], i1 = null; + cell.halfedges.forEach(function(e) { + var edge = that.edges[e], v = edge.left; + if ((v === cell.site || !v) && !(v = edge.right)) return; + var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy; + if (v2 < d2) d2 = v2, i1 = v.index; + }); + } while (i1 !== null); + + that._found = i0; + + return radius == null || d2 <= radius * radius ? cell.site : null; + } +}; + +var voronoi = function() { + var x$$1 = x$4, + y$$1 = y$4, + extent = null; + + function voronoi(data) { + return new Diagram(data.map(function(d, i) { + var s = [Math.round(x$$1(d, i, data) / epsilon$4) * epsilon$4, Math.round(y$$1(d, i, data) / epsilon$4) * epsilon$4]; + s.index = i; + s.data = d; + return s; + }), extent); + } + + voronoi.polygons = function(data) { + return voronoi(data).polygons(); + }; + + voronoi.links = function(data) { + return voronoi(data).links(); + }; + + voronoi.triangles = function(data) { + return voronoi(data).triangles(); + }; + + voronoi.x = function(_) { + return arguments.length ? (x$$1 = typeof _ === "function" ? _ : constant$11(+_), voronoi) : x$$1; + }; + + voronoi.y = function(_) { + return arguments.length ? (y$$1 = typeof _ === "function" ? _ : constant$11(+_), voronoi) : y$$1; + }; + + voronoi.extent = function(_) { + return arguments.length ? (extent = _ == null ? null : [[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]], voronoi) : extent && [[extent[0][0], extent[0][1]], [extent[1][0], extent[1][1]]]; + }; + + voronoi.size = function(_) { + return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]]; + }; + + return voronoi; +}; + +var constant$12 = function(x) { + return function() { + return x; + }; +}; + +function ZoomEvent(target, type, transform) { + this.target = target; + this.type = type; + this.transform = transform; +} + +function Transform(k, x, y) { + this.k = k; + this.x = x; + this.y = y; +} + +Transform.prototype = { + constructor: Transform, + scale: function(k) { + return k === 1 ? this : new Transform(this.k * k, this.x, this.y); + }, + translate: function(x, y) { + return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y); + }, + apply: function(point) { + return [point[0] * this.k + this.x, point[1] * this.k + this.y]; + }, + applyX: function(x) { + return x * this.k + this.x; + }, + applyY: function(y) { + return y * this.k + this.y; + }, + invert: function(location) { + return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k]; + }, + invertX: function(x) { + return (x - this.x) / this.k; + }, + invertY: function(y) { + return (y - this.y) / this.k; + }, + rescaleX: function(x) { + return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x)); + }, + rescaleY: function(y) { + return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y)); + }, + toString: function() { + return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; + } +}; + +var identity$8 = new Transform(1, 0, 0); + +transform$1.prototype = Transform.prototype; + +function transform$1(node) { + return node.__zoom || identity$8; +} + +function nopropagation$2() { + exports.event.stopImmediatePropagation(); +} + +var noevent$2 = function() { + exports.event.preventDefault(); + exports.event.stopImmediatePropagation(); +}; + +// Ignore right-click, since that should open the context menu. +function defaultFilter$2() { + return !exports.event.button; +} + +function defaultExtent$1() { + var e = this, w, h; + if (e instanceof SVGElement) { + e = e.ownerSVGElement || e; + w = e.width.baseVal.value; + h = e.height.baseVal.value; + } else { + w = e.clientWidth; + h = e.clientHeight; + } + return [[0, 0], [w, h]]; +} + +function defaultTransform() { + return this.__zoom || identity$8; +} + +var zoom = function() { + var filter = defaultFilter$2, + extent = defaultExtent$1, + k0 = 0, + k1 = Infinity, + x0 = -k1, + x1 = k1, + y0 = x0, + y1 = x1, + duration = 250, + interpolate$$1 = interpolateZoom, + gestures = [], + listeners = dispatch("start", "zoom", "end"), + touchstarting, + touchending, + touchDelay = 500, + wheelDelay = 150, + clickDistance2 = 0; + + function zoom(selection$$1) { + selection$$1 + .on("wheel.zoom", wheeled) + .on("mousedown.zoom", mousedowned) + .on("dblclick.zoom", dblclicked) + .on("touchstart.zoom", touchstarted) + .on("touchmove.zoom", touchmoved) + .on("touchend.zoom touchcancel.zoom", touchended) + .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)") + .property("__zoom", defaultTransform); + } + + zoom.transform = function(collection, transform) { + var selection$$1 = collection.selection ? collection.selection() : collection; + selection$$1.property("__zoom", defaultTransform); + if (collection !== selection$$1) { + schedule(collection, transform); + } else { + selection$$1.interrupt().each(function() { + gesture(this, arguments) + .start() + .zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform) + .end(); + }); + } + }; + + zoom.scaleBy = function(selection$$1, k) { + zoom.scaleTo(selection$$1, function() { + var k0 = this.__zoom.k, + k1 = typeof k === "function" ? k.apply(this, arguments) : k; + return k0 * k1; + }); + }; + + zoom.scaleTo = function(selection$$1, k) { + zoom.transform(selection$$1, function() { + var e = extent.apply(this, arguments), + t0 = this.__zoom, + p0 = centroid(e), + p1 = t0.invert(p0), + k1 = typeof k === "function" ? k.apply(this, arguments) : k; + return constrain(translate(scale(t0, k1), p0, p1), e); + }); + }; + + zoom.translateBy = function(selection$$1, x, y) { + zoom.transform(selection$$1, function() { + return constrain(this.__zoom.translate( + typeof x === "function" ? x.apply(this, arguments) : x, + typeof y === "function" ? y.apply(this, arguments) : y + ), extent.apply(this, arguments)); + }); + }; + + function scale(transform, k) { + k = Math.max(k0, Math.min(k1, k)); + return k === transform.k ? transform : new Transform(k, transform.x, transform.y); + } + + function translate(transform, p0, p1) { + var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k; + return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y); + } + + function constrain(transform, extent) { + var dx0 = transform.invertX(extent[0][0]) - x0, + dx1 = transform.invertX(extent[1][0]) - x1, + dy0 = transform.invertY(extent[0][1]) - y0, + dy1 = transform.invertY(extent[1][1]) - y1; + return transform.translate( + dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), + dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1) + ); + } + + function centroid(extent) { + return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2]; + } + + function schedule(transition$$1, transform, center) { + transition$$1 + .on("start.zoom", function() { gesture(this, arguments).start(); }) + .on("interrupt.zoom end.zoom", function() { gesture(this, arguments).end(); }) + .tween("zoom", function() { + var that = this, + args = arguments, + g = gesture(that, args), + e = extent.apply(that, args), + p = center || centroid(e), + w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), + a = that.__zoom, + b = typeof transform === "function" ? transform.apply(that, args) : transform, + i = interpolate$$1(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k)); + return function(t) { + if (t === 1) t = b; // Avoid rounding error on end. + else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); } + g.zoom(null, t); + }; + }); + } + + function gesture(that, args) { + for (var i = 0, n = gestures.length, g; i < n; ++i) { + if ((g = gestures[i]).that === that) { + return g; + } + } + return new Gesture(that, args); + } + + function Gesture(that, args) { + this.that = that; + this.args = args; + this.index = -1; + this.active = 0; + this.extent = extent.apply(that, args); + } + + Gesture.prototype = { + start: function() { + if (++this.active === 1) { + this.index = gestures.push(this) - 1; + this.emit("start"); + } + return this; + }, + zoom: function(key, transform) { + if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]); + if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]); + if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]); + this.that.__zoom = transform; + this.emit("zoom"); + return this; + }, + end: function() { + if (--this.active === 0) { + gestures.splice(this.index, 1); + this.index = -1; + this.emit("end"); + } + return this; + }, + emit: function(type) { + customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]); + } + }; + + function wheeled() { + if (!filter.apply(this, arguments)) return; + var g = gesture(this, arguments), + t = this.__zoom, + k = Math.max(k0, Math.min(k1, t.k * Math.pow(2, -exports.event.deltaY * (exports.event.deltaMode ? 120 : 1) / 500))), + p = mouse(this); + + // If the mouse is in the same location as before, reuse it. + // If there were recent wheel events, reset the wheel idle timeout. + if (g.wheel) { + if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) { + g.mouse[1] = t.invert(g.mouse[0] = p); + } + clearTimeout(g.wheel); + } + + // If this wheel event won’t trigger a transform change, ignore it. + else if (t.k === k) return; + + // Otherwise, capture the mouse point and location at the start. + else { + g.mouse = [p, t.invert(p)]; + interrupt(this); + g.start(); + } + + noevent$2(); + g.wheel = setTimeout(wheelidled, wheelDelay); + g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent)); + + function wheelidled() { + g.wheel = null; + g.end(); + } + } + + function mousedowned() { + if (touchending || !filter.apply(this, arguments)) return; + var g = gesture(this, arguments), + v = select(exports.event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), + p = mouse(this), + x0 = exports.event.clientX, + y0 = exports.event.clientY; + + dragDisable(exports.event.view); + nopropagation$2(); + g.mouse = [p, this.__zoom.invert(p)]; + interrupt(this); + g.start(); + + function mousemoved() { + noevent$2(); + if (!g.moved) { + var dx = exports.event.clientX - x0, dy = exports.event.clientY - y0; + g.moved = dx * dx + dy * dy > clickDistance2; + } + g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent)); + } + + function mouseupped() { + v.on("mousemove.zoom mouseup.zoom", null); + yesdrag(exports.event.view, g.moved); + noevent$2(); + g.end(); + } + } + + function dblclicked() { + if (!filter.apply(this, arguments)) return; + var t0 = this.__zoom, + p0 = mouse(this), + p1 = t0.invert(p0), + k1 = t0.k * (exports.event.shiftKey ? 0.5 : 2), + t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments)); + + noevent$2(); + if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0); + else select(this).call(zoom.transform, t1); + } + + function touchstarted() { + if (!filter.apply(this, arguments)) return; + var g = gesture(this, arguments), + touches$$1 = exports.event.changedTouches, + started, + n = touches$$1.length, i, t, p; + + nopropagation$2(); + for (i = 0; i < n; ++i) { + t = touches$$1[i], p = touch(this, touches$$1, t.identifier); + p = [p, this.__zoom.invert(p), t.identifier]; + if (!g.touch0) g.touch0 = p, started = true; + else if (!g.touch1) g.touch1 = p; + } + + // If this is a dbltap, reroute to the (optional) dblclick.zoom handler. + if (touchstarting) { + touchstarting = clearTimeout(touchstarting); + if (!g.touch1) { + g.end(); + p = select(this).on("dblclick.zoom"); + if (p) p.apply(this, arguments); + return; + } + } + + if (started) { + touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay); + interrupt(this); + g.start(); + } + } + + function touchmoved() { + var g = gesture(this, arguments), + touches$$1 = exports.event.changedTouches, + n = touches$$1.length, i, t, p, l; + + noevent$2(); + if (touchstarting) touchstarting = clearTimeout(touchstarting); + for (i = 0; i < n; ++i) { + t = touches$$1[i], p = touch(this, touches$$1, t.identifier); + if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p; + else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p; + } + t = g.that.__zoom; + if (g.touch1) { + var p0 = g.touch0[0], l0 = g.touch0[1], + p1 = g.touch1[0], l1 = g.touch1[1], + dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp, + dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl; + t = scale(t, Math.sqrt(dp / dl)); + p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2]; + l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2]; + } + else if (g.touch0) p = g.touch0[0], l = g.touch0[1]; + else return; + g.zoom("touch", constrain(translate(t, p, l), g.extent)); + } + + function touchended() { + var g = gesture(this, arguments), + touches$$1 = exports.event.changedTouches, + n = touches$$1.length, i, t; + + nopropagation$2(); + if (touchending) clearTimeout(touchending); + touchending = setTimeout(function() { touchending = null; }, touchDelay); + for (i = 0; i < n; ++i) { + t = touches$$1[i]; + if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0; + else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1; + } + if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1; + if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]); + else g.end(); + } + + zoom.filter = function(_) { + return arguments.length ? (filter = typeof _ === "function" ? _ : constant$12(!!_), zoom) : filter; + }; + + zoom.extent = function(_) { + return arguments.length ? (extent = typeof _ === "function" ? _ : constant$12([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent; + }; + + zoom.scaleExtent = function(_) { + return arguments.length ? (k0 = +_[0], k1 = +_[1], zoom) : [k0, k1]; + }; + + zoom.translateExtent = function(_) { + return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], zoom) : [[x0, y0], [x1, y1]]; + }; + + zoom.duration = function(_) { + return arguments.length ? (duration = +_, zoom) : duration; + }; + + zoom.interpolate = function(_) { + return arguments.length ? (interpolate$$1 = _, zoom) : interpolate$$1; + }; + + zoom.on = function() { + var value = listeners.on.apply(listeners, arguments); + return value === listeners ? zoom : value; + }; + + zoom.clickDistance = function(_) { + return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2); + }; + + return zoom; +}; + +exports.version = version; +exports.bisect = bisectRight; +exports.bisectRight = bisectRight; +exports.bisectLeft = bisectLeft; +exports.ascending = ascending; +exports.bisector = bisector; +exports.cross = cross; +exports.descending = descending; +exports.deviation = deviation; +exports.extent = extent; +exports.histogram = histogram; +exports.thresholdFreedmanDiaconis = freedmanDiaconis; +exports.thresholdScott = scott; +exports.thresholdSturges = sturges; +exports.max = max; +exports.mean = mean; +exports.median = median; +exports.merge = merge; +exports.min = min; +exports.pairs = pairs; +exports.permute = permute; +exports.quantile = threshold; +exports.range = sequence; +exports.scan = scan; +exports.shuffle = shuffle; +exports.sum = sum; +exports.ticks = ticks; +exports.tickIncrement = tickIncrement; +exports.tickStep = tickStep; +exports.transpose = transpose; +exports.variance = variance; +exports.zip = zip; +exports.axisTop = axisTop; +exports.axisRight = axisRight; +exports.axisBottom = axisBottom; +exports.axisLeft = axisLeft; +exports.brush = brush; +exports.brushX = brushX; +exports.brushY = brushY; +exports.brushSelection = brushSelection; +exports.chord = chord; +exports.ribbon = ribbon; +exports.nest = nest; +exports.set = set$2; +exports.map = map$1; +exports.keys = keys; +exports.values = values; +exports.entries = entries; +exports.color = color; +exports.rgb = rgb; +exports.hsl = hsl; +exports.lab = lab; +exports.hcl = hcl; +exports.cubehelix = cubehelix; +exports.dispatch = dispatch; +exports.drag = drag; +exports.dragDisable = dragDisable; +exports.dragEnable = yesdrag; +exports.dsvFormat = dsv; +exports.csvParse = csvParse; +exports.csvParseRows = csvParseRows; +exports.csvFormat = csvFormat; +exports.csvFormatRows = csvFormatRows; +exports.tsvParse = tsvParse; +exports.tsvParseRows = tsvParseRows; +exports.tsvFormat = tsvFormat; +exports.tsvFormatRows = tsvFormatRows; +exports.easeLinear = linear$1; +exports.easeQuad = quadInOut; +exports.easeQuadIn = quadIn; +exports.easeQuadOut = quadOut; +exports.easeQuadInOut = quadInOut; +exports.easeCubic = cubicInOut; +exports.easeCubicIn = cubicIn; +exports.easeCubicOut = cubicOut; +exports.easeCubicInOut = cubicInOut; +exports.easePoly = polyInOut; +exports.easePolyIn = polyIn; +exports.easePolyOut = polyOut; +exports.easePolyInOut = polyInOut; +exports.easeSin = sinInOut; +exports.easeSinIn = sinIn; +exports.easeSinOut = sinOut; +exports.easeSinInOut = sinInOut; +exports.easeExp = expInOut; +exports.easeExpIn = expIn; +exports.easeExpOut = expOut; +exports.easeExpInOut = expInOut; +exports.easeCircle = circleInOut; +exports.easeCircleIn = circleIn; +exports.easeCircleOut = circleOut; +exports.easeCircleInOut = circleInOut; +exports.easeBounce = bounceOut; +exports.easeBounceIn = bounceIn; +exports.easeBounceOut = bounceOut; +exports.easeBounceInOut = bounceInOut; +exports.easeBack = backInOut; +exports.easeBackIn = backIn; +exports.easeBackOut = backOut; +exports.easeBackInOut = backInOut; +exports.easeElastic = elasticOut; +exports.easeElasticIn = elasticIn; +exports.easeElasticOut = elasticOut; +exports.easeElasticInOut = elasticInOut; +exports.forceCenter = center$1; +exports.forceCollide = collide; +exports.forceLink = link; +exports.forceManyBody = manyBody; +exports.forceSimulation = simulation; +exports.forceX = x$2; +exports.forceY = y$2; +exports.formatDefaultLocale = defaultLocale; +exports.formatLocale = formatLocale; +exports.formatSpecifier = formatSpecifier; +exports.precisionFixed = precisionFixed; +exports.precisionPrefix = precisionPrefix; +exports.precisionRound = precisionRound; +exports.geoArea = area; +exports.geoBounds = bounds; +exports.geoCentroid = centroid; +exports.geoCircle = circle; +exports.geoClipExtent = extent$1; +exports.geoContains = contains; +exports.geoDistance = distance; +exports.geoGraticule = graticule; +exports.geoGraticule10 = graticule10; +exports.geoInterpolate = interpolate$1; +exports.geoLength = length$1; +exports.geoPath = index$1; +exports.geoAlbers = albers; +exports.geoAlbersUsa = albersUsa; +exports.geoAzimuthalEqualArea = azimuthalEqualArea; +exports.geoAzimuthalEqualAreaRaw = azimuthalEqualAreaRaw; +exports.geoAzimuthalEquidistant = azimuthalEquidistant; +exports.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw; +exports.geoConicConformal = conicConformal; +exports.geoConicConformalRaw = conicConformalRaw; +exports.geoConicEqualArea = conicEqualArea; +exports.geoConicEqualAreaRaw = conicEqualAreaRaw; +exports.geoConicEquidistant = conicEquidistant; +exports.geoConicEquidistantRaw = conicEquidistantRaw; +exports.geoEquirectangular = equirectangular; +exports.geoEquirectangularRaw = equirectangularRaw; +exports.geoGnomonic = gnomonic; +exports.geoGnomonicRaw = gnomonicRaw; +exports.geoIdentity = identity$5; +exports.geoProjection = projection; +exports.geoProjectionMutator = projectionMutator; +exports.geoMercator = mercator; +exports.geoMercatorRaw = mercatorRaw; +exports.geoOrthographic = orthographic; +exports.geoOrthographicRaw = orthographicRaw; +exports.geoStereographic = stereographic; +exports.geoStereographicRaw = stereographicRaw; +exports.geoTransverseMercator = transverseMercator; +exports.geoTransverseMercatorRaw = transverseMercatorRaw; +exports.geoRotation = rotation; +exports.geoStream = geoStream; +exports.geoTransform = transform; +exports.cluster = cluster; +exports.hierarchy = hierarchy; +exports.pack = index$2; +exports.packSiblings = siblings; +exports.packEnclose = enclose; +exports.partition = partition; +exports.stratify = stratify; +exports.tree = tree; +exports.treemap = index$3; +exports.treemapBinary = binary; +exports.treemapDice = treemapDice; +exports.treemapSlice = treemapSlice; +exports.treemapSliceDice = sliceDice; +exports.treemapSquarify = squarify; +exports.treemapResquarify = resquarify; +exports.interpolate = interpolateValue; +exports.interpolateArray = array$1; +exports.interpolateBasis = basis$1; +exports.interpolateBasisClosed = basisClosed; +exports.interpolateDate = date; +exports.interpolateNumber = reinterpolate; +exports.interpolateObject = object; +exports.interpolateRound = interpolateRound; +exports.interpolateString = interpolateString; +exports.interpolateTransformCss = interpolateTransformCss; +exports.interpolateTransformSvg = interpolateTransformSvg; +exports.interpolateZoom = interpolateZoom; +exports.interpolateRgb = interpolateRgb; +exports.interpolateRgbBasis = rgbBasis; +exports.interpolateRgbBasisClosed = rgbBasisClosed; +exports.interpolateHsl = hsl$2; +exports.interpolateHslLong = hslLong; +exports.interpolateLab = lab$1; +exports.interpolateHcl = hcl$2; +exports.interpolateHclLong = hclLong; +exports.interpolateCubehelix = cubehelix$2; +exports.interpolateCubehelixLong = cubehelixLong; +exports.quantize = quantize; +exports.path = path; +exports.polygonArea = area$1; +exports.polygonCentroid = centroid$1; +exports.polygonHull = hull; +exports.polygonContains = contains$1; +exports.polygonLength = length$2; +exports.quadtree = quadtree; +exports.queue = queue; +exports.randomUniform = uniform; +exports.randomNormal = normal; +exports.randomLogNormal = logNormal; +exports.randomBates = bates; +exports.randomIrwinHall = irwinHall; +exports.randomExponential = exponential$1; +exports.request = request; +exports.html = html; +exports.json = json; +exports.text = text; +exports.xml = xml; +exports.csv = csv$1; +exports.tsv = tsv$1; +exports.scaleBand = band; +exports.scalePoint = point$1; +exports.scaleIdentity = identity$6; +exports.scaleLinear = linear$2; +exports.scaleLog = log$1; +exports.scaleOrdinal = ordinal; +exports.scaleImplicit = implicit; +exports.scalePow = pow$1; +exports.scaleSqrt = sqrt$1; +exports.scaleQuantile = quantile$$1; +exports.scaleQuantize = quantize$1; +exports.scaleThreshold = threshold$1; +exports.scaleTime = time; +exports.scaleUtc = utcTime; +exports.schemeCategory10 = category10; +exports.schemeCategory20b = category20b; +exports.schemeCategory20c = category20c; +exports.schemeCategory20 = category20; +exports.interpolateCubehelixDefault = cubehelix$3; +exports.interpolateRainbow = rainbow$1; +exports.interpolateWarm = warm; +exports.interpolateCool = cool; +exports.interpolateViridis = viridis; +exports.interpolateMagma = magma; +exports.interpolateInferno = inferno; +exports.interpolatePlasma = plasma; +exports.scaleSequential = sequential; +exports.creator = creator; +exports.local = local$1; +exports.matcher = matcher$1; +exports.mouse = mouse; +exports.namespace = namespace; +exports.namespaces = namespaces; +exports.select = select; +exports.selectAll = selectAll; +exports.selection = selection; +exports.selector = selector; +exports.selectorAll = selectorAll; +exports.style = styleValue; +exports.touch = touch; +exports.touches = touches; +exports.window = defaultView; +exports.customEvent = customEvent; +exports.arc = arc; +exports.area = area$2; +exports.line = line; +exports.pie = pie; +exports.radialArea = radialArea; +exports.radialLine = radialLine$1; +exports.linkHorizontal = linkHorizontal; +exports.linkVertical = linkVertical; +exports.linkRadial = linkRadial; +exports.symbol = symbol; +exports.symbols = symbols; +exports.symbolCircle = circle$2; +exports.symbolCross = cross$2; +exports.symbolDiamond = diamond; +exports.symbolSquare = square; +exports.symbolStar = star; +exports.symbolTriangle = triangle; +exports.symbolWye = wye; +exports.curveBasisClosed = basisClosed$1; +exports.curveBasisOpen = basisOpen; +exports.curveBasis = basis$2; +exports.curveBundle = bundle; +exports.curveCardinalClosed = cardinalClosed; +exports.curveCardinalOpen = cardinalOpen; +exports.curveCardinal = cardinal; +exports.curveCatmullRomClosed = catmullRomClosed; +exports.curveCatmullRomOpen = catmullRomOpen; +exports.curveCatmullRom = catmullRom; +exports.curveLinearClosed = linearClosed; +exports.curveLinear = curveLinear; +exports.curveMonotoneX = monotoneX; +exports.curveMonotoneY = monotoneY; +exports.curveNatural = natural; +exports.curveStep = step; +exports.curveStepAfter = stepAfter; +exports.curveStepBefore = stepBefore; +exports.stack = stack; +exports.stackOffsetExpand = expand; +exports.stackOffsetDiverging = diverging; +exports.stackOffsetNone = none$1; +exports.stackOffsetSilhouette = silhouette; +exports.stackOffsetWiggle = wiggle; +exports.stackOrderAscending = ascending$2; +exports.stackOrderDescending = descending$2; +exports.stackOrderInsideOut = insideOut; +exports.stackOrderNone = none$2; +exports.stackOrderReverse = reverse; +exports.timeInterval = newInterval; +exports.timeMillisecond = millisecond; +exports.timeMilliseconds = milliseconds; +exports.utcMillisecond = millisecond; +exports.utcMilliseconds = milliseconds; +exports.timeSecond = second; +exports.timeSeconds = seconds; +exports.utcSecond = second; +exports.utcSeconds = seconds; +exports.timeMinute = minute; +exports.timeMinutes = minutes; +exports.timeHour = hour; +exports.timeHours = hours; +exports.timeDay = day; +exports.timeDays = days; +exports.timeWeek = sunday; +exports.timeWeeks = sundays; +exports.timeSunday = sunday; +exports.timeSundays = sundays; +exports.timeMonday = monday; +exports.timeMondays = mondays; +exports.timeTuesday = tuesday; +exports.timeTuesdays = tuesdays; +exports.timeWednesday = wednesday; +exports.timeWednesdays = wednesdays; +exports.timeThursday = thursday; +exports.timeThursdays = thursdays; +exports.timeFriday = friday; +exports.timeFridays = fridays; +exports.timeSaturday = saturday; +exports.timeSaturdays = saturdays; +exports.timeMonth = month; +exports.timeMonths = months; +exports.timeYear = year; +exports.timeYears = years; +exports.utcMinute = utcMinute; +exports.utcMinutes = utcMinutes; +exports.utcHour = utcHour; +exports.utcHours = utcHours; +exports.utcDay = utcDay; +exports.utcDays = utcDays; +exports.utcWeek = utcSunday; +exports.utcWeeks = utcSundays; +exports.utcSunday = utcSunday; +exports.utcSundays = utcSundays; +exports.utcMonday = utcMonday; +exports.utcMondays = utcMondays; +exports.utcTuesday = utcTuesday; +exports.utcTuesdays = utcTuesdays; +exports.utcWednesday = utcWednesday; +exports.utcWednesdays = utcWednesdays; +exports.utcThursday = utcThursday; +exports.utcThursdays = utcThursdays; +exports.utcFriday = utcFriday; +exports.utcFridays = utcFridays; +exports.utcSaturday = utcSaturday; +exports.utcSaturdays = utcSaturdays; +exports.utcMonth = utcMonth; +exports.utcMonths = utcMonths; +exports.utcYear = utcYear; +exports.utcYears = utcYears; +exports.timeFormatDefaultLocale = defaultLocale$1; +exports.timeFormatLocale = formatLocale$1; +exports.isoFormat = formatIso; +exports.isoParse = parseIso; +exports.now = now; +exports.timer = timer; +exports.timerFlush = timerFlush; +exports.timeout = timeout$1; +exports.interval = interval$1; +exports.transition = transition; +exports.active = active; +exports.interrupt = interrupt; +exports.voronoi = voronoi; +exports.zoom = zoom; +exports.zoomTransform = transform$1; +exports.zoomIdentity = identity$8; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); + + +/***/ }), + +/***/ "a5a2": +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_a5a2__; + +/***/ }), + +/***/ "fae3": +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +// ESM COMPAT FLAG +__webpack_require__.r(__webpack_exports__); + +// EXPORTS +__webpack_require__.d(__webpack_exports__, "Visualization", function() { return /* reexport */ Visualization; }); +__webpack_require__.d(__webpack_exports__, "GetUsersFlow", function() { return /* reexport */ GetUsersFlow; }); + +// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js +// This file is imported into lib/wc client bundles. + +if (typeof window !== 'undefined') { + var currentScript = window.document.currentScript + if (false) { var getCurrentScript; } + + var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/) + if (src) { + __webpack_require__.p = src[1] // eslint-disable-line + } +} + +// Indicate to webpack that this file can be concatenated +/* harmony default export */ var setPublicPath = (null); + +// EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"} +var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__("8bbf"); + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersFlow/vue/src/Visualization/Visualization.vue?vue&type=template&id=64e5b0ac + +var _hoisted_1 = { + class: "piwikUsersFlowVisualization", + ref: "root" +}; +var _hoisted_2 = { + class: "usersFlowActionBar" +}; +var _hoisted_3 = { + class: "levelOfDetail", + name: "levelOfDetail" +}; +var _hoisted_4 = { + class: "actionsPerStep", + name: "actionsPerStep" +}; +var _hoisted_5 = { + class: "userFlowSource", + name: "userFlowSource" +}; +var _hoisted_6 = { + class: "sankeyChartOuter" +}; + +var _hoisted_7 = /*#__PURE__*/Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "usersFlowPopupMenu" +}, null, -1); + +function render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_Field = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Field"); + + var _component_ActivityIndicator = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("ActivityIndicator"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", _hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_2, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "levelOfDetail", + "model-value": _ctx.actualLevelOfDetail, + "onUpdate:modelValue": _cache[0] || (_cache[0] = function ($event) { + _ctx.actualLevelOfDetail = $event; + + _ctx.updateViewParams(); + }), + title: _ctx.translate('UsersFlow_OptionLevelOfDetail'), + "full-width": true, + options: _ctx.levelOfDetailOptions + }, null, 8, ["model-value", "title", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "actionsPerStep", + title: _ctx.translate('UsersFlow_OptionNumActionsPerStep'), + modelValue: _ctx.numActionsPerStep, + "onUpdate:modelValue": _cache[1] || (_cache[1] = function ($event) { + return _ctx.numActionsPerStep = $event; + }), + "full-width": true, + options: _ctx.actionsPerStepOptions + }, null, 8, ["title", "modelValue", "options"])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Field, { + uicontrol: "select", + name: "userFlowSource", + title: _ctx.translate('General_Source'), + modelValue: _ctx.actualUserFlowSource, + "onUpdate:modelValue": _cache[2] || (_cache[2] = function ($event) { + return _ctx.actualUserFlowSource = $event; + }), + "full-width": true, + options: _ctx.flowSources + }, null, 8, ["title", "modelValue", "options"])])]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "exploringTraffic alert alert-info " + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersFlow_ExploringInfo', _ctx.exploreUrl, _ctx.exploreStep)), 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], _ctx.exploreStep && _ctx.exploreUrl]]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_ActivityIndicator, { + loading: _ctx.isLoading + }, null, 8, ["loading"]), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", _hoisted_6, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["normalizeClass"])(["sankeyChart", "linkDetail".concat(_ctx.actualLevelOfDetail)]), + ref: "sankeyChart" + }, null, 2)], 512), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.isLoading]]), _hoisted_7, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withDirectives"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", { + class: "pk-emptyDataTable" + }, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('CoreHome_ThereIsNoDataForThisReport')), 513), [[external_commonjs_vue_commonjs2_vue_root_Vue_["vShow"], !_ctx.hasData]])], 512); +} +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/Visualization/Visualization.vue?vue&type=template&id=64e5b0ac + +// EXTERNAL MODULE: ./plugins/UsersFlow/node_modules/d3/build/d3.js +var d3 = __webpack_require__("9314"); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/map.js +var map_prefix = "$"; + +function Map() {} + +Map.prototype = map.prototype = { + constructor: Map, + has: function(key) { + return (map_prefix + key) in this; + }, + get: function(key) { + return this[map_prefix + key]; + }, + set: function(key, value) { + this[map_prefix + key] = value; + return this; + }, + remove: function(key) { + var property = map_prefix + key; + return property in this && delete this[property]; + }, + clear: function() { + for (var property in this) if (property[0] === map_prefix) delete this[property]; + }, + keys: function() { + var keys = []; + for (var property in this) if (property[0] === map_prefix) keys.push(property.slice(1)); + return keys; + }, + values: function() { + var values = []; + for (var property in this) if (property[0] === map_prefix) values.push(this[property]); + return values; + }, + entries: function() { + var entries = []; + for (var property in this) if (property[0] === map_prefix) entries.push({key: property.slice(1), value: this[property]}); + return entries; + }, + size: function() { + var size = 0; + for (var property in this) if (property[0] === map_prefix) ++size; + return size; + }, + empty: function() { + for (var property in this) if (property[0] === map_prefix) return false; + return true; + }, + each: function(f) { + for (var property in this) if (property[0] === map_prefix) f(this[property], property.slice(1), this); + } +}; + +function map(object, f) { + var map = new Map; + + // Copy constructor. + if (object instanceof Map) object.each(function(value, key) { map.set(key, value); }); + + // Index array by numeric index or specified key function. + else if (Array.isArray(object)) { + var i = -1, + n = object.length, + o; + + if (f == null) while (++i < n) map.set(i, object[i]); + else while (++i < n) map.set(f(o = object[i], i, object), o); + } + + // Convert object to map. + else if (object) for (var key in object) map.set(key, object[key]); + + return map; +} + +/* harmony default export */ var src_map = (map); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/nest.js + + +/* harmony default export */ var src_nest = (function() { + var keys = [], + sortKeys = [], + sortValues, + rollup, + nest; + + function apply(array, depth, createResult, setResult) { + if (depth >= keys.length) { + if (sortValues != null) array.sort(sortValues); + return rollup != null ? rollup(array) : array; + } + + var i = -1, + n = array.length, + key = keys[depth++], + keyValue, + value, + valuesByKey = src_map(), + values, + result = createResult(); + + while (++i < n) { + if (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) { + values.push(value); + } else { + valuesByKey.set(keyValue, [value]); + } + } + + valuesByKey.each(function(values, key) { + setResult(result, key, apply(values, depth, createResult, setResult)); + }); + + return result; + } + + function entries(map, depth) { + if (++depth > keys.length) return map; + var array, sortKey = sortKeys[depth - 1]; + if (rollup != null && depth >= keys.length) array = map.entries(); + else array = [], map.each(function(v, k) { array.push({key: k, values: entries(v, depth)}); }); + return sortKey != null ? array.sort(function(a, b) { return sortKey(a.key, b.key); }) : array; + } + + return nest = { + object: function(array) { return apply(array, 0, createObject, setObject); }, + map: function(array) { return apply(array, 0, createMap, setMap); }, + entries: function(array) { return entries(apply(array, 0, createMap, setMap), 0); }, + key: function(d) { keys.push(d); return nest; }, + sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, + sortValues: function(order) { sortValues = order; return nest; }, + rollup: function(f) { rollup = f; return nest; } + }; +}); + +function createObject() { + return {}; +} + +function setObject(object, key, value) { + object[key] = value; +} + +function createMap() { + return src_map(); +} + +function setMap(map, key, value) { + map.set(key, value); +} + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/set.js + + +function Set() {} + +var proto = src_map.prototype; + +Set.prototype = set.prototype = { + constructor: Set, + has: proto.has, + add: function(value) { + value += ""; + this[map_prefix + value] = value; + return this; + }, + remove: proto.remove, + clear: proto.clear, + values: proto.keys, + size: proto.size, + empty: proto.empty, + each: proto.each +}; + +function set(object, f) { + var set = new Set; + + // Copy constructor. + if (object instanceof Set) object.each(function(value) { set.add(value); }); + + // Otherwise, assume it’s an array. + else if (object) { + var i = -1, n = object.length; + if (f == null) while (++i < n) set.add(object[i]); + else while (++i < n) set.add(f(object[i], i, object)); + } + + return set; +} + +/* harmony default export */ var src_set = (set); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/keys.js +/* harmony default export */ var src_keys = (function(map) { + var keys = []; + for (var key in map) keys.push(key); + return keys; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/values.js +/* harmony default export */ var src_values = (function(map) { + var values = []; + for (var key in map) values.push(map[key]); + return values; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/entries.js +/* harmony default export */ var src_entries = (function(map) { + var entries = []; + for (var key in map) entries.push({key: key, value: map[key]}); + return entries; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-collection/src/index.js + + + + + + + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selector.js +function none() {} + +/* harmony default export */ var src_selector = (function(selector) { + return selector == null ? none : function() { + return this.querySelector(selector); + }; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/select.js + + + +/* harmony default export */ var selection_select = (function(select) { + if (typeof select !== "function") select = src_selector(select); + + for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) { + if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) { + if ("__data__" in node) subnode.__data__ = node.__data__; + subgroup[i] = subnode; + } + } + } + + return new Selection(subgroups, this._parents); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selectorAll.js +function empty() { + return []; +} + +/* harmony default export */ var selectorAll = (function(selector) { + return selector == null ? empty : function() { + return this.querySelectorAll(selector); + }; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/selectAll.js + + + +/* harmony default export */ var selectAll = (function(select) { + if (typeof select !== "function") select = selectorAll(select); + + for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) { + if (node = group[i]) { + subgroups.push(select.call(node, node.__data__, i, group)); + parents.push(node); + } + } + } + + return new Selection(subgroups, parents); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/matcher.js +/* harmony default export */ var matcher = (function(selector) { + return function() { + return this.matches(selector); + }; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/filter.js + + + +/* harmony default export */ var filter = (function(match) { + if (typeof match !== "function") match = matcher(match); + + for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) { + if ((node = group[i]) && match.call(node, node.__data__, i, group)) { + subgroup.push(node); + } + } + } + + return new Selection(subgroups, this._parents); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/sparse.js +/* harmony default export */ var sparse = (function(update) { + return new Array(update.length); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/enter.js + + + +/* harmony default export */ var selection_enter = (function() { + return new Selection(this._enter || this._groups.map(sparse), this._parents); +}); + +function EnterNode(parent, datum) { + this.ownerDocument = parent.ownerDocument; + this.namespaceURI = parent.namespaceURI; + this._next = null; + this._parent = parent; + this.__data__ = datum; +} + +EnterNode.prototype = { + constructor: EnterNode, + appendChild: function(child) { return this._parent.insertBefore(child, this._next); }, + insertBefore: function(child, next) { return this._parent.insertBefore(child, next); }, + querySelector: function(selector) { return this._parent.querySelector(selector); }, + querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); } +}; + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/constant.js +/* harmony default export */ var constant = (function(x) { + return function() { + return x; + }; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/data.js + + + + +var keyPrefix = "$"; // Protect against keys like “__proto__”. + +function bindIndex(parent, group, enter, update, exit, data) { + var i = 0, + node, + groupLength = group.length, + dataLength = data.length; + + // Put any non-null nodes that fit into update. + // Put any null nodes into enter. + // Put any remaining data into enter. + for (; i < dataLength; ++i) { + if (node = group[i]) { + node.__data__ = data[i]; + update[i] = node; + } else { + enter[i] = new EnterNode(parent, data[i]); + } + } + + // Put any non-null nodes that don’t fit into exit. + for (; i < groupLength; ++i) { + if (node = group[i]) { + exit[i] = node; + } + } +} + +function bindKey(parent, group, enter, update, exit, data, key) { + var i, + node, + nodeByKeyValue = {}, + groupLength = group.length, + dataLength = data.length, + keyValues = new Array(groupLength), + keyValue; + + // Compute the key for each node. + // If multiple nodes have the same key, the duplicates are added to exit. + for (i = 0; i < groupLength; ++i) { + if (node = group[i]) { + keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group); + if (keyValue in nodeByKeyValue) { + exit[i] = node; + } else { + nodeByKeyValue[keyValue] = node; + } + } + } + + // Compute the key for each datum. + // If there a node associated with this key, join and add it to update. + // If there is not (or the key is a duplicate), add it to enter. + for (i = 0; i < dataLength; ++i) { + keyValue = keyPrefix + key.call(parent, data[i], i, data); + if (node = nodeByKeyValue[keyValue]) { + update[i] = node; + node.__data__ = data[i]; + nodeByKeyValue[keyValue] = null; + } else { + enter[i] = new EnterNode(parent, data[i]); + } + } + + // Add any remaining nodes that were not bound to data to exit. + for (i = 0; i < groupLength; ++i) { + if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) { + exit[i] = node; + } + } +} + +/* harmony default export */ var selection_data = (function(value, key) { + if (!value) { + data = new Array(this.size()), j = -1; + this.each(function(d) { data[++j] = d; }); + return data; + } + + var bind = key ? bindKey : bindIndex, + parents = this._parents, + groups = this._groups; + + if (typeof value !== "function") value = constant(value); + + for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) { + var parent = parents[j], + group = groups[j], + groupLength = group.length, + data = value.call(parent, parent && parent.__data__, j, parents), + dataLength = data.length, + enterGroup = enter[j] = new Array(dataLength), + updateGroup = update[j] = new Array(dataLength), + exitGroup = exit[j] = new Array(groupLength); + + bind(parent, group, enterGroup, updateGroup, exitGroup, data, key); + + // Now connect the enter nodes to their following update node, such that + // appendChild can insert the materialized enter node before this node, + // rather than at the end of the parent node. + for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) { + if (previous = enterGroup[i0]) { + if (i0 >= i1) i1 = i0 + 1; + while (!(next = updateGroup[i1]) && ++i1 < dataLength); + previous._next = next || null; + } + } + } + + update = new Selection(update, parents); + update._enter = enter; + update._exit = exit; + return update; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/exit.js + + + +/* harmony default export */ var selection_exit = (function() { + return new Selection(this._exit || this._groups.map(sparse), this._parents); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/join.js +/* harmony default export */ var join = (function(onenter, onupdate, onexit) { + var enter = this.enter(), update = this, exit = this.exit(); + enter = typeof onenter === "function" ? onenter(enter) : enter.append(onenter + ""); + if (onupdate != null) update = onupdate(update); + if (onexit == null) exit.remove(); else onexit(exit); + return enter && update ? enter.merge(update).order() : update; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/merge.js + + +/* harmony default export */ var selection_merge = (function(selection) { + + for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { + for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { + if (node = group0[i] || group1[i]) { + merge[i] = node; + } + } + } + + for (; j < m0; ++j) { + merges[j] = groups0[j]; + } + + return new Selection(merges, this._parents); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/order.js +/* harmony default export */ var order = (function() { + + for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) { + for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) { + if (node = group[i]) { + if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next); + next = node; + } + } + } + + return this; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/sort.js + + +/* harmony default export */ var sort = (function(compare) { + if (!compare) compare = ascending; + + function compareNode(a, b) { + return a && b ? compare(a.__data__, b.__data__) : !a - !b; + } + + for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) { + for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) { + if (node = group[i]) { + sortgroup[i] = node; + } + } + sortgroup.sort(compareNode); + } + + return new Selection(sortgroups, this._parents).order(); +}); + +function ascending(a, b) { + return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; +} + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/call.js +/* harmony default export */ var call = (function() { + var callback = arguments[0]; + arguments[0] = this; + callback.apply(null, arguments); + return this; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/nodes.js +/* harmony default export */ var selection_nodes = (function() { + var nodes = new Array(this.size()), i = -1; + this.each(function() { nodes[++i] = this; }); + return nodes; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/node.js +/* harmony default export */ var selection_node = (function() { + + for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { + for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { + var node = group[i]; + if (node) return node; + } + } + + return null; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/size.js +/* harmony default export */ var size = (function() { + var size = 0; + this.each(function() { ++size; }); + return size; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/empty.js +/* harmony default export */ var selection_empty = (function() { + return !this.node(); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/each.js +/* harmony default export */ var each = (function(callback) { + + for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { + for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { + if (node = group[i]) callback.call(node, node.__data__, i, group); + } + } + + return this; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/namespaces.js +var xhtml = "http://www.w3.org/1999/xhtml"; + +/* harmony default export */ var namespaces = ({ + svg: "http://www.w3.org/2000/svg", + xhtml: xhtml, + xlink: "http://www.w3.org/1999/xlink", + xml: "http://www.w3.org/XML/1998/namespace", + xmlns: "http://www.w3.org/2000/xmlns/" +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/namespace.js + + +/* harmony default export */ var namespace = (function(name) { + var prefix = name += "", i = prefix.indexOf(":"); + if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); + return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/attr.js + + +function attrRemove(name) { + return function() { + this.removeAttribute(name); + }; +} + +function attrRemoveNS(fullname) { + return function() { + this.removeAttributeNS(fullname.space, fullname.local); + }; +} + +function attrConstant(name, value) { + return function() { + this.setAttribute(name, value); + }; +} + +function attrConstantNS(fullname, value) { + return function() { + this.setAttributeNS(fullname.space, fullname.local, value); + }; +} + +function attrFunction(name, value) { + return function() { + var v = value.apply(this, arguments); + if (v == null) this.removeAttribute(name); + else this.setAttribute(name, v); + }; +} + +function attrFunctionNS(fullname, value) { + return function() { + var v = value.apply(this, arguments); + if (v == null) this.removeAttributeNS(fullname.space, fullname.local); + else this.setAttributeNS(fullname.space, fullname.local, v); + }; +} + +/* harmony default export */ var attr = (function(name, value) { + var fullname = namespace(name); + + if (arguments.length < 2) { + var node = this.node(); + return fullname.local + ? node.getAttributeNS(fullname.space, fullname.local) + : node.getAttribute(fullname); + } + + return this.each((value == null + ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function" + ? (fullname.local ? attrFunctionNS : attrFunction) + : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/window.js +/* harmony default export */ var src_window = (function(node) { + return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node + || (node.document && node) // node is a Window + || node.defaultView; // node is a Document +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/style.js + + +function styleRemove(name) { + return function() { + this.style.removeProperty(name); + }; +} + +function styleConstant(name, value, priority) { + return function() { + this.style.setProperty(name, value, priority); + }; +} + +function styleFunction(name, value, priority) { + return function() { + var v = value.apply(this, arguments); + if (v == null) this.style.removeProperty(name); + else this.style.setProperty(name, v, priority); + }; +} + +/* harmony default export */ var style = (function(name, value, priority) { + return arguments.length > 1 + ? this.each((value == null + ? styleRemove : typeof value === "function" + ? styleFunction + : styleConstant)(name, value, priority == null ? "" : priority)) + : styleValue(this.node(), name); +}); + +function styleValue(node, name) { + return node.style.getPropertyValue(name) + || src_window(node).getComputedStyle(node, null).getPropertyValue(name); +} + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/property.js +function propertyRemove(name) { + return function() { + delete this[name]; + }; +} + +function propertyConstant(name, value) { + return function() { + this[name] = value; + }; +} + +function propertyFunction(name, value) { + return function() { + var v = value.apply(this, arguments); + if (v == null) delete this[name]; + else this[name] = v; + }; +} + +/* harmony default export */ var property = (function(name, value) { + return arguments.length > 1 + ? this.each((value == null + ? propertyRemove : typeof value === "function" + ? propertyFunction + : propertyConstant)(name, value)) + : this.node()[name]; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/classed.js +function classArray(string) { + return string.trim().split(/^|\s+/); +} + +function classList(node) { + return node.classList || new ClassList(node); +} + +function ClassList(node) { + this._node = node; + this._names = classArray(node.getAttribute("class") || ""); +} + +ClassList.prototype = { + add: function(name) { + var i = this._names.indexOf(name); + if (i < 0) { + this._names.push(name); + this._node.setAttribute("class", this._names.join(" ")); + } + }, + remove: function(name) { + var i = this._names.indexOf(name); + if (i >= 0) { + this._names.splice(i, 1); + this._node.setAttribute("class", this._names.join(" ")); + } + }, + contains: function(name) { + return this._names.indexOf(name) >= 0; + } +}; + +function classedAdd(node, names) { + var list = classList(node), i = -1, n = names.length; + while (++i < n) list.add(names[i]); +} + +function classedRemove(node, names) { + var list = classList(node), i = -1, n = names.length; + while (++i < n) list.remove(names[i]); +} + +function classedTrue(names) { + return function() { + classedAdd(this, names); + }; +} + +function classedFalse(names) { + return function() { + classedRemove(this, names); + }; +} + +function classedFunction(names, value) { + return function() { + (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names); + }; +} + +/* harmony default export */ var classed = (function(name, value) { + var names = classArray(name + ""); + + if (arguments.length < 2) { + var list = classList(this.node()), i = -1, n = names.length; + while (++i < n) if (!list.contains(names[i])) return false; + return true; + } + + return this.each((typeof value === "function" + ? classedFunction : value + ? classedTrue + : classedFalse)(names, value)); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/text.js +function textRemove() { + this.textContent = ""; +} + +function textConstant(value) { + return function() { + this.textContent = value; + }; +} + +function textFunction(value) { + return function() { + var v = value.apply(this, arguments); + this.textContent = v == null ? "" : v; + }; +} + +/* harmony default export */ var selection_text = (function(value) { + return arguments.length + ? this.each(value == null + ? textRemove : (typeof value === "function" + ? textFunction + : textConstant)(value)) + : this.node().textContent; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/html.js +function htmlRemove() { + this.innerHTML = ""; +} + +function htmlConstant(value) { + return function() { + this.innerHTML = value; + }; +} + +function htmlFunction(value) { + return function() { + var v = value.apply(this, arguments); + this.innerHTML = v == null ? "" : v; + }; +} + +/* harmony default export */ var selection_html = (function(value) { + return arguments.length + ? this.each(value == null + ? htmlRemove : (typeof value === "function" + ? htmlFunction + : htmlConstant)(value)) + : this.node().innerHTML; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/raise.js +function raise() { + if (this.nextSibling) this.parentNode.appendChild(this); +} + +/* harmony default export */ var selection_raise = (function() { + return this.each(raise); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/lower.js +function lower() { + if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); +} + +/* harmony default export */ var selection_lower = (function() { + return this.each(lower); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/creator.js + + + +function creatorInherit(name) { + return function() { + var document = this.ownerDocument, + uri = this.namespaceURI; + return uri === xhtml && document.documentElement.namespaceURI === xhtml + ? document.createElement(name) + : document.createElementNS(uri, name); + }; +} + +function creatorFixed(fullname) { + return function() { + return this.ownerDocument.createElementNS(fullname.space, fullname.local); + }; +} + +/* harmony default export */ var creator = (function(name) { + var fullname = namespace(name); + return (fullname.local + ? creatorFixed + : creatorInherit)(fullname); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/append.js + + +/* harmony default export */ var append = (function(name) { + var create = typeof name === "function" ? name : creator(name); + return this.select(function() { + return this.appendChild(create.apply(this, arguments)); + }); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/insert.js + + + +function constantNull() { + return null; +} + +/* harmony default export */ var insert = (function(name, before) { + var create = typeof name === "function" ? name : creator(name), + select = before == null ? constantNull : typeof before === "function" ? before : src_selector(before); + return this.select(function() { + return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null); + }); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/remove.js +function remove() { + var parent = this.parentNode; + if (parent) parent.removeChild(this); +} + +/* harmony default export */ var selection_remove = (function() { + return this.each(remove); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/clone.js +function selection_cloneShallow() { + var clone = this.cloneNode(false), parent = this.parentNode; + return parent ? parent.insertBefore(clone, this.nextSibling) : clone; +} + +function selection_cloneDeep() { + var clone = this.cloneNode(true), parent = this.parentNode; + return parent ? parent.insertBefore(clone, this.nextSibling) : clone; +} + +/* harmony default export */ var clone = (function(deep) { + return this.select(deep ? selection_cloneDeep : selection_cloneShallow); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/datum.js +/* harmony default export */ var datum = (function(value) { + return arguments.length + ? this.property("__data__", value) + : this.node().__data__; +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/on.js +var filterEvents = {}; + +var on_event = null; + +if (typeof document !== "undefined") { + var on_element = document.documentElement; + if (!("onmouseenter" in on_element)) { + filterEvents = {mouseenter: "mouseover", mouseleave: "mouseout"}; + } +} + +function filterContextListener(listener, index, group) { + listener = contextListener(listener, index, group); + return function(event) { + var related = event.relatedTarget; + if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) { + listener.call(this, event); + } + }; +} + +function contextListener(listener, index, group) { + return function(event1) { + var event0 = on_event; // Events can be reentrant (e.g., focus). + on_event = event1; + try { + listener.call(this, this.__data__, index, group); + } finally { + on_event = event0; + } + }; +} + +function parseTypenames(typenames) { + return typenames.trim().split(/^|\s+/).map(function(t) { + var name = "", i = t.indexOf("."); + if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i); + return {type: t, name: name}; + }); +} + +function onRemove(typename) { + return function() { + var on = this.__on; + if (!on) return; + for (var j = 0, i = -1, m = on.length, o; j < m; ++j) { + if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { + this.removeEventListener(o.type, o.listener, o.capture); + } else { + on[++i] = o; + } + } + if (++i) on.length = i; + else delete this.__on; + }; +} + +function onAdd(typename, value, capture) { + var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener; + return function(d, i, group) { + var on = this.__on, o, listener = wrap(value, i, group); + if (on) for (var j = 0, m = on.length; j < m; ++j) { + if ((o = on[j]).type === typename.type && o.name === typename.name) { + this.removeEventListener(o.type, o.listener, o.capture); + this.addEventListener(o.type, o.listener = listener, o.capture = capture); + o.value = value; + return; + } + } + this.addEventListener(typename.type, listener, capture); + o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture}; + if (!on) this.__on = [o]; + else on.push(o); + }; +} + +/* harmony default export */ var on = (function(typename, value, capture) { + var typenames = parseTypenames(typename + ""), i, n = typenames.length, t; + + if (arguments.length < 2) { + var on = this.node().__on; + if (on) for (var j = 0, m = on.length, o; j < m; ++j) { + for (i = 0, o = on[j]; i < n; ++i) { + if ((t = typenames[i]).type === o.type && t.name === o.name) { + return o.value; + } + } + } + return; + } + + on = value ? onAdd : onRemove; + if (capture == null) capture = false; + for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture)); + return this; +}); + +function customEvent(event1, listener, that, args) { + var event0 = on_event; + event1.sourceEvent = on_event; + on_event = event1; + try { + return listener.apply(that, args); + } finally { + on_event = event0; + } +} + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/dispatch.js + + +function dispatchEvent(node, type, params) { + var window = src_window(node), + event = window.CustomEvent; + + if (typeof event === "function") { + event = new event(type, params); + } else { + event = window.document.createEvent("Event"); + if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail; + else event.initEvent(type, false, false); + } + + node.dispatchEvent(event); +} + +function dispatchConstant(type, params) { + return function() { + return dispatchEvent(this, type, params); + }; +} + +function dispatchFunction(type, params) { + return function() { + return dispatchEvent(this, type, params.apply(this, arguments)); + }; +} + +/* harmony default export */ var dispatch = (function(type, params) { + return this.each((typeof params === "function" + ? dispatchFunction + : dispatchConstant)(type, params)); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/selection/index.js + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +var root = [null]; + +function Selection(groups, parents) { + this._groups = groups; + this._parents = parents; +} + +function selection_selection() { + return new Selection([[document.documentElement]], root); +} + +Selection.prototype = selection_selection.prototype = { + constructor: Selection, + select: selection_select, + selectAll: selectAll, + filter: filter, + data: selection_data, + enter: selection_enter, + exit: selection_exit, + join: join, + merge: selection_merge, + order: order, + sort: sort, + call: call, + nodes: selection_nodes, + node: selection_node, + size: size, + empty: selection_empty, + each: each, + attr: attr, + style: style, + property: property, + classed: classed, + text: selection_text, + html: selection_html, + raise: selection_raise, + lower: selection_lower, + append: append, + insert: insert, + remove: selection_remove, + clone: clone, + datum: datum, + on: on, + dispatch: dispatch +}; + +/* harmony default export */ var src_selection = (selection_selection); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/node_modules/d3-selection/src/select.js + + +/* harmony default export */ var src_select = (function(selector) { + return typeof selector === "string" + ? new Selection([[document.querySelector(selector)]], [document.documentElement]) + : new Selection([[selector]], root); +}); + +// CONCATENATED MODULE: ./plugins/UsersFlow/node_modules/d3-tip/index.js +/** + * d3.tip + * Copyright (c) 2013-2017 Justin Palmer + * + * Tooltips for d3.js SVG visualizations + */ +// eslint-disable-next-line no-extra-semi + + +// Public - constructs a new tooltip +// +// Returns a tip +/* harmony default export */ var d3_tip = (function() { + var direction = d3TipDirection, + offset = d3TipOffset, + html = d3TipHTML, + rootElement = document.body, + node = initNode(), + svg = null, + point = null, + target = null + + function tip(vis) { + svg = getSVGNode(vis) + if (!svg) return + point = svg.createSVGPoint() + rootElement.appendChild(node) + } + + // Public - show the tooltip on the screen + // + // Returns a tip + tip.show = function() { + var args = Array.prototype.slice.call(arguments) + if (args[args.length - 1] instanceof SVGElement) target = args.pop() + + var content = html.apply(this, args), + poffset = offset.apply(this, args), + dir = direction.apply(this, args), + nodel = getNodeEl(), + i = directions.length, + coords, + scrollTop = document.documentElement.scrollTop || + rootElement.scrollTop, + scrollLeft = document.documentElement.scrollLeft || + rootElement.scrollLeft + + nodel.html(content) + .style('opacity', 1).style('pointer-events', 'all') + + while (i--) nodel.classed(directions[i], false) + coords = directionCallbacks.get(dir).apply(this) + nodel.classed(dir, true) + .style('top', (coords.top + poffset[0]) + scrollTop + 'px') + .style('left', (coords.left + poffset[1]) + scrollLeft + 'px') + + return tip + } + + // Public - hide the tooltip + // + // Returns a tip + tip.hide = function() { + var nodel = getNodeEl() + nodel.style('opacity', 0).style('pointer-events', 'none') + return tip + } + + // Public: Proxy attr calls to the d3 tip container. + // Sets or gets attribute value. + // + // n - name of the attribute + // v - value of the attribute + // + // Returns tip or attribute value + // eslint-disable-next-line no-unused-vars + tip.attr = function(n, v) { + if (arguments.length < 2 && typeof n === 'string') { + return getNodeEl().attr(n) + } + + var args = Array.prototype.slice.call(arguments) + src_selection.prototype.attr.apply(getNodeEl(), args) + return tip + } + + // Public: Proxy style calls to the d3 tip container. + // Sets or gets a style value. + // + // n - name of the property + // v - value of the property + // + // Returns tip or style property value + // eslint-disable-next-line no-unused-vars + tip.style = function(n, v) { + if (arguments.length < 2 && typeof n === 'string') { + return getNodeEl().style(n) + } + + var args = Array.prototype.slice.call(arguments) + src_selection.prototype.style.apply(getNodeEl(), args) + return tip + } + + // Public: Set or get the direction of the tooltip + // + // v - One of n(north), s(south), e(east), or w(west), nw(northwest), + // sw(southwest), ne(northeast) or se(southeast) + // + // Returns tip or direction + tip.direction = function(v) { + if (!arguments.length) return direction + direction = v == null ? v : functor(v) + + return tip + } + + // Public: Sets or gets the offset of the tip + // + // v - Array of [x, y] offset + // + // Returns offset or + tip.offset = function(v) { + if (!arguments.length) return offset + offset = v == null ? v : functor(v) + + return tip + } + + // Public: sets or gets the html value of the tooltip + // + // v - String value of the tip + // + // Returns html value or tip + tip.html = function(v) { + if (!arguments.length) return html + html = v == null ? v : functor(v) + + return tip + } + + // Public: sets or gets the root element anchor of the tooltip + // + // v - root element of the tooltip + // + // Returns root node of tip + tip.rootElement = function(v) { + if (!arguments.length) return rootElement + rootElement = v == null ? v : functor(v) + + return tip + } + + // Public: destroys the tooltip and removes it from the DOM + // + // Returns a tip + tip.destroy = function() { + if (node) { + getNodeEl().remove() + node = null + } + return tip + } + + function d3TipDirection() { return 'n' } + function d3TipOffset() { return [0, 0] } + function d3TipHTML() { return ' ' } + + var directionCallbacks = src_map({ + n: directionNorth, + s: directionSouth, + e: directionEast, + w: directionWest, + nw: directionNorthWest, + ne: directionNorthEast, + sw: directionSouthWest, + se: directionSouthEast + }), + directions = directionCallbacks.keys() + + function directionNorth() { + var bbox = getScreenBBox(this) + return { + top: bbox.n.y - node.offsetHeight, + left: bbox.n.x - node.offsetWidth / 2 + } + } + + function directionSouth() { + var bbox = getScreenBBox(this) + return { + top: bbox.s.y, + left: bbox.s.x - node.offsetWidth / 2 + } + } + + function directionEast() { + var bbox = getScreenBBox(this) + return { + top: bbox.e.y - node.offsetHeight / 2, + left: bbox.e.x + } + } + + function directionWest() { + var bbox = getScreenBBox(this) + return { + top: bbox.w.y - node.offsetHeight / 2, + left: bbox.w.x - node.offsetWidth + } + } + + function directionNorthWest() { + var bbox = getScreenBBox(this) + return { + top: bbox.nw.y - node.offsetHeight, + left: bbox.nw.x - node.offsetWidth + } + } + + function directionNorthEast() { + var bbox = getScreenBBox(this) + return { + top: bbox.ne.y - node.offsetHeight, + left: bbox.ne.x + } + } + + function directionSouthWest() { + var bbox = getScreenBBox(this) + return { + top: bbox.sw.y, + left: bbox.sw.x - node.offsetWidth + } + } + + function directionSouthEast() { + var bbox = getScreenBBox(this) + return { + top: bbox.se.y, + left: bbox.se.x + } + } + + function initNode() { + var div = src_select(document.createElement('div')) + div + .style('position', 'absolute') + .style('top', 0) + .style('opacity', 0) + .style('pointer-events', 'none') + .style('box-sizing', 'border-box') + + return div.node() + } + + function getSVGNode(element) { + var svgNode = element.node() + if (!svgNode) return null + if (svgNode.tagName.toLowerCase() === 'svg') return svgNode + return svgNode.ownerSVGElement + } + + function getNodeEl() { + if (node == null) { + node = initNode() + // re-add node to DOM + rootElement.appendChild(node) + } + return src_select(node) + } + + // Private - gets the screen coordinates of a shape + // + // Given a shape on the screen, will return an SVGPoint for the directions + // n(north), s(south), e(east), w(west), ne(northeast), se(southeast), + // nw(northwest), sw(southwest). + // + // +-+-+ + // | | + // + + + // | | + // +-+-+ + // + // Returns an Object {n, s, e, w, nw, sw, ne, se} + function getScreenBBox(targetShape) { + var targetel = target || targetShape + + while (targetel.getScreenCTM == null && targetel.parentNode != null) { + targetel = targetel.parentNode + } + + var bbox = {}, + matrix = targetel.getScreenCTM(), + tbbox = targetel.getBBox(), + width = tbbox.width, + height = tbbox.height, + x = tbbox.x, + y = tbbox.y + + point.x = x + point.y = y + bbox.nw = point.matrixTransform(matrix) + point.x += width + bbox.ne = point.matrixTransform(matrix) + point.y += height + bbox.se = point.matrixTransform(matrix) + point.x -= width + bbox.sw = point.matrixTransform(matrix) + point.y -= height / 2 + bbox.w = point.matrixTransform(matrix) + point.x += width + bbox.e = point.matrixTransform(matrix) + point.x -= width / 2 + point.y -= height / 2 + bbox.n = point.matrixTransform(matrix) + point.y += height + bbox.s = point.matrixTransform(matrix) + + return bbox + } + + // Private - replace D3JS 3.X d3.functor() function + function functor(v) { + return typeof v === 'function' ? v : function() { + return v + } + } + + return tip +}); + +// EXTERNAL MODULE: external "CoreHome" +var external_CoreHome_ = __webpack_require__("19dc"); + +// EXTERNAL MODULE: external "CorePluginsAdmin" +var external_CorePluginsAdmin_ = __webpack_require__("a5a2"); + +// CONCATENATED MODULE: ./plugins/UsersFlow/libs/sankey/sankey.js +/* eslint-disable */ +// from https://github.com/d3/d3-plugins with custom modifications from our side +// to fix heights and ordering of nodes and links as well as out nodes and summary nodes +/* harmony default export */ var sankey_sankey = (function (d3) { + d3.sankey = function () { + function isOutNode(name) { + return name && name === '_out_'; + } + + function isSummaryNode(node) { + return node.isSummaryNode; + } + + var sankey = {}, + nodeWidth = 24, + nodePadding = 8, + size = [1, 1], + nodes = [], + links = []; + + sankey.nodeWidth = function (_) { + if (!arguments.length) return nodeWidth; + nodeWidth = +_; + return sankey; + }; + + sankey.nodePadding = function (_) { + if (!arguments.length) return nodePadding; + nodePadding = +_; + return sankey; + }; + + sankey.nodes = function (_) { + if (!arguments.length) return nodes; + nodes = _; + return sankey; + }; + + sankey.links = function (_) { + if (!arguments.length) return links; + links = _; + return sankey; + }; + + sankey.size = function (_) { + if (!arguments.length) return size; + size = _; + return sankey; + }; + + sankey.layout = function (iterations) { + computeNodeLinks(); + computeNodeValues(); + computeNodeBreadths(); + computeNodeDepths(iterations); + computeLinkDepths(); + return sankey; + }; + + sankey.relayout = function () { + computeLinkDepths(); + return sankey; + }; + + sankey.link = function () { + var curvature = .5; + + function link(d) { + if (isOutNode(d.target.name)) { + // we only show a square for exits + var x0 = d.source.x + d.source.dx, + y0 = d.source.y + d.sy + d.dy / 2; + /** + * + return "M" + x0 + "," + (y0) + + " V" + y0 + 15 + + " H " + (x0 + 15); + */ + + return "M" + x0 + "," + y0 + " L" + (x0 + 15) + "," + y0; + } + + var x0 = d.source.x + d.source.dx, + x1 = d.target.x, + xi = d3.interpolateNumber(x0, x1), + x2 = xi(curvature), + x3 = xi(1 - curvature), + y0 = d.source.y + d.sy + d.dy / 2, + y1 = d.target.y + d.ty + d.dy / 2; + return "M" + x0 + "," + y0 + "C" + x2 + "," + y0 + " " + x3 + "," + y1 + " " + x1 + "," + y1; + } + + link.curvature = function (_) { + if (!arguments.length) return curvature; + curvature = +_; + return link; + }; + + return link; + }; + + function computeNodeLinks() { + nodes.forEach(function (node) { + node.sourceLinks = []; + node.targetLinks = []; + }); + links.forEach(function (link) { + var source = link.source, + target = link.target; + if (typeof source === 'number') source = link.source = nodes[link.source]; + if (typeof target === 'number') target = link.target = nodes[link.target]; + source.sourceLinks.push(link); + target.targetLinks.push(link); + }); + } + + function computeNodeValues() { + nodes.forEach(function (node) { + node.value = Math.max(d3.sum(node.sourceLinks, value), d3.sum(node.targetLinks, value)); + }); + } + + function computeNodeBreadths() { + var x = 0; + nodes.forEach(function (node) { + node.x = node.depth; + node.dx = nodeWidth; + + if (node.depth > x) { + x = node.depth; + } + }); + scaleNodeBreadths((size[0] - nodeWidth) / x); + } + + function moveSourcesRight() { + nodes.forEach(function (node) { + if (!node.targetLinks.length) { + node.x = d3.min(node.sourceLinks, function (d) { + return d.target.x; + }) - 1; + } + }); + } + + function scaleNodeBreadths(kx) { + nodes.forEach(function (node) { + node.x *= kx; + }); + } + + function computeNodeDepths(iterations) { + var nodesByBreadth = d3.nest().key(function (d) { + return d.x; + }).sortKeys(d3.ascending).entries(nodes).map(function (d) { + return d.values; + }); // + + initializeNodeDepth(); + resolveCollisions(); + + for (var alpha = 1; iterations > 0; --iterations) { + relaxRightToLeft(alpha *= .99); + resolveCollisions(); + relaxLeftToRight(alpha); + resolveCollisions(); + } + + function initializeNodeDepth() { + var ky = d3.min(nodesByBreadth, function (nodes) { + var sumNodes = d3.sum(nodes, value); + + if (!sumNodes) { + return 0; + } + + return (size[1] - (nodes.length - 1) * nodePadding) / sumNodes; + }); + nodesByBreadth.forEach(function (nodes) { + nodes.forEach(function (node, i) { + node.y = i; + node.dy = node.value * ky; + + if (isSummaryNode(node)) { + // we also need to scale the links in this case + node.sourceLinks.forEach(function (link) { + link.scaleNodeDy = 25 / node.dy; + link.scaleNodeMax = 25; + }); + node.dy = 25; + return; + } + + if (node.dy < 4) { + // we also need to scale the links in this case + node.sourceLinks.forEach(function (link) { + link.scaleNodeDy = 4 / node.dy; + link.scaleNodeMax = 4; + }); + node.dy = 4; + } + }); + }); + links.forEach(function (link) { + link.dy = link.value * ky; + + if (link.scaleNodeDy) { + link.dy *= link.scaleNodeDy; + } + + if (link.scaleNodeMax && link.dy > link.scaleNodeMax) { + link.dy = link.scaleNodeMax; + } + }); + } + + function relaxLeftToRight(alpha) { + nodesByBreadth.forEach(function (nodes, breadth) { + nodes.forEach(function (node) { + if (node.targetLinks.length) { + var y = d3.sum(node.targetLinks, weightedSource) / d3.sum(node.targetLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedSource(link) { + return center(link.source) * link.value; + } + } + + function relaxRightToLeft(alpha) { + nodesByBreadth.slice().reverse().forEach(function (nodes) { + nodes.forEach(function (node) { + if (node.sourceLinks.length) { + var y = d3.sum(node.sourceLinks, weightedTarget) / d3.sum(node.sourceLinks, value); + node.y += (y - center(node)) * alpha; + } + }); + }); + + function weightedTarget(link) { + return center(link.target) * link.value; + } + } + + function resolveCollisions() { + nodesByBreadth.forEach(function (nodes) { + var node, + dy, + y0 = 0, + n = nodes.length, + i; // Push any overlapping nodes down. + + for (i = 0; i < n; ++i) { + node = nodes[i]; + dy = y0 - node.y; + if (dy > 0) node.y += dy; + y0 = node.y + node.dy + nodePadding; + } // push it back up if the bottommost node goes outside the bounds + + /* removed by us, we do not want to push them back up + dy = y0 - nodePadding - size[1]; + if (dy > 0) { + y0 = node.y -= dy; + // Pushin back up any overlapping nodes. + for (i = n - 2; i >= 0; --i) { + node = nodes[i]; + dy = node.y + node.dy + nodePadding - y0; + if (dy > 0) node.y -= dy; + y0 = node.y; + } + } + */ + + }); + } + + function ascendingDepth(a, b) { + return a.y - b.y; + } + } + + function computeLinkDepths() { + nodes.forEach(function (node) { + node.sourceLinks.sort(ascendingTargetDepth); + node.targetLinks.sort(ascendingSourceDepth); + }); + nodes.forEach(function (node) { + var sy = 0, + ty = 0; + node.sourceLinks.forEach(function (link) { + link.sy = sy; + sy += link.dy; + }); + node.targetLinks.forEach(function (link) { + link.ty = ty; + ty += link.dy; + }); + }); + + function ascendingSourceDepth(a, b) { + return a.source.y - b.source.y; + } + + function ascendingTargetDepth(a, b) { + return a.target.y - b.target.y; + } + } + + function center(node) { + return 0; + } + + function value(link) { + return link.value; + } + + return sankey; + }; +}); +; +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersFlow/vue/src/Visualization/Visualization.vue?vue&type=script&lang=ts +/* eslint-disable @typescript-eslint/no-explicit-any */ + + + + + // eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore + + +sankey_sankey(d3); +var OUT_NODE_NAME = '_out_'; +var SUMMARY_NODE_NAME = 'Others'; +var SUMMARY_NODE_NAME_TRANSLATED = Object(external_CoreHome_["translate"])('General_Others'); +var _window = window, + $ = _window.$; + +function isOutNode(name) { + return name === OUT_NODE_NAME; +} + +function isSummaryNode(name) { + return name === SUMMARY_NODE_NAME || name === SUMMARY_NODE_NAME_TRANSLATED; +} + +/* harmony default export */ var Visualizationvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + actionsPerStep: Number, + levelOfDetail: Number, + userFlowSource: String + }, + components: { + Field: external_CorePluginsAdmin_["Field"], + ActivityIndicator: external_CoreHome_["ActivityIndicator"] + }, + data: function data() { + return { + numSteps: 4, + hasData: true, + isLoading: false, + maxSankeyChartDepth: 0, + maxNodeLength: 0, + isExploringTraffic: false, + exploreStep: false, + exploreUrl: false, + flowSources: [], + numActionsPerStep: this.actionsPerStep || 5, + rawResponse: null, + actualLevelOfDetail: this.levelOfDetail || 5, + actualUserFlowSource: this.userFlowSource + }; + }, + watch: { + numActionsPerStep: function numActionsPerStep(newValue) { + if (newValue === null) { + return; + } + + this.fetchData(); + this.updateViewParams(); + }, + actualUserFlowSource: function actualUserFlowSource(newValue) { + if (newValue === null) { + return; + } + + this.fetchData(); + this.updateViewParams(); + } + }, + created: function created() { + var _this = this; + + external_CoreHome_["AjaxHelper"].fetch({ + method: 'UsersFlow.getAvailableDataSources' + }).then(function (dataSources) { + _this.flowSources = dataSources.map(function (ds) { + return { + key: ds.value, + value: ds.name + }; + }); + }); + this.fetchData(); + }, + beforeUnmount: function beforeUnmount() { + this.clearSankeyChart(); + }, + methods: { + isUrlLike: function isUrlLike(name) { + if (!name) { + return false; + } + + if (this.actualUserFlowSource !== 'page_url') { + return false; + } + + return /^(.+)[.](.+)\/(.*)$/.test(name); + }, + completeUrl: function completeUrl(name) { + if (name.indexOf('http') === 0) { + return name; + } // piwik stores urls without eg http://www. + + + return "".concat(window.location.protocol, "//").concat(name); + }, + showGroupDetails: function showGroupDetails(rowLabel, depth, onlyOthers, idSubtable) { + var url = external_CoreHome_["MatomoUrl"].stringify({ + showtitle: 1, + widget: 1, + module: 'UsersFlow', + action: 'getInteractionActions', + interactionPosition: depth, + offsetActionsPerStep: onlyOthers ? this.numActionsPerStep : undefined, + rowLabel: rowLabel || undefined, + idSubtable: idSubtable || undefined, + dataSource: this.actualUserFlowSource || undefined + }); + window.Piwik_Popover.createPopupAndLoadUrl(url, Object(external_CoreHome_["translate"])('UsersFlow_Interactions')); + }, + setSankeyStep: function setSankeyStep(setStep) { + if (setStep > this.maxSankeyChartDepth) { + this.numSteps = 1; + } else if (setStep < 1) { + this.numSteps = 1; + } else { + this.numSteps = setStep; + } + + this.clearSankeyChart(); + var nodesAndLinks = this.buildNodesAndIndexes(this.rawResponse || []); + this.drawSankeyChart(nodesAndLinks); + }, + addSankeyStep: function addSankeyStep() { + this.setSankeyStep(this.numSteps + 1); + }, + clearSankeyChart: function clearSankeyChart() { + var node = this.$refs.sankeyChart; + + if (node) { + var svg = d3["select"](node).selectAll('svg'); + + if (svg) { + d3["select"](node).selectAll('svg').remove(); + } + } + }, + makeToolTip: function makeToolTip(message) { + return "".concat(message, ""); + }, + setMaxSankeyChartDepth: function setMaxSankeyChartDepth(maxDepth) { + this.maxSankeyChartDepth = parseInt(maxDepth, 10); + }, + setMaxNodeLength: function setMaxNodeLength(maxLength) { + this.maxNodeLength = parseInt(maxLength, 10); + }, + getPercentage: function getPercentage(val1, val2) { + var percentage = Math.round(val1 / val2 * 100 * 100) / 100; + return "".concat(percentage, "%"); + }, + drawSankeyChart: function drawSankeyChart(_ref) { + var _this3 = this; + + var nodes = _ref.nodes, + links = _ref.links, + depthNodes = _ref.depthNodes; + var self = this; + var popupExitHandlerSetup = false; + + function highlightLink(id, doHighlight) { + d3["select"]("#link-".concat(id)).classed('highlightedLink', doHighlight); + } + + function highlightNodeTraffic(node) { + var remainingNodes = []; + var $this = d3["select"](this); + var doHighlight; + + if ($this.attr('data-clicked') === '1') { + $this.attr('data-clicked', '0'); + doHighlight = false; + } else { + d3["select"](this).attr('data-clicked', '1'); + doHighlight = true; + } + + $this.classed('highlightedNode', doHighlight); + var traverse = [{ + linkType: 'sourceLinks', + nodeType: 'target' + }, { + linkType: 'targetLinks', + nodeType: 'source' + }]; + + var traverseNode = function traverseNode(nodeLink, step, nodeList) { + if (isOutNode(nodeLink.target.name)) { + return; + } + + nodeList.push(nodeLink[step.nodeType]); + highlightLink(nodeLink.id, doHighlight); + }; + + traverse.forEach(function (step) { + node[step.linkType].forEach(function (nodeLink) { + return traverseNode(nodeLink, step, remainingNodes); + }); + + var _loop = function _loop() { + var nextNodes = []; + remainingNodes.forEach(function (theNode) { + theNode[step.linkType].forEach(function (nodeLink) { + return traverseNode(nodeLink, step, nextNodes); + }); + }); + remainingNodes = nextNodes; + }; + + while (remainingNodes.length) { + _loop(); + } + }); + } + + function showNodeDetails(theNode) { + // TODO: check this and other instances are actually numbers + var depth = theNode.depth + 1; + + if (isSummaryNode(theNode.name)) { + self.showGroupDetails(theNode.name, depth, true); + return; + } + + if (theNode.idSubtable) { + self.showGroupDetails(theNode.name, depth, false, theNode.idSubtable); + } + } + + function showPopup(theNode) { + var _this2 = this; + + var event = d3["event"]; + event.preventDefault(); + event.stopPropagation(); + var isHighlighted = d3["select"](this).attr('data-clicked') === '1'; + + if (!popupExitHandlerSetup) { + if (!$('body > .usersFlowPopupMenu').length) { + $('.usersFlowPopupMenu').appendTo('body'); + } + + popupExitHandlerSetup = true; + d3["select"]('body').on('click', function () { + var popupMenu = d3["select"]('body > .usersFlowPopupMenu'); + popupMenu.style('display', 'none'); + popupMenu.html(''); + }); + } + + var trafficTitle = 'UsersFlow_ActionHighlightTraffic'; + + if (isHighlighted) { + trafficTitle = 'UsersFlow_ActionClearHighlight'; + } + + var popupMenu = d3["select"]('body > .usersFlowPopupMenu'); + popupMenu.html(''); + var list = popupMenu.append('ul'); + list.append('li').attr('class', 'highlightTraffic').on('click', function () { + highlightNodeTraffic.call(_this2, theNode); + }).text(Object(external_CoreHome_["translate"])(trafficTitle)); + + if (self.canEnableExploreTraffic && !isSummaryNode(theNode.name)) { + list.append('li').attr('class', 'divider').html('
'); + list.append('li').attr('class', 'exploreTraffic').on('click', function () { + self.exploreStep = theNode.depth + 1; + self.exploreUrl = theNode.name; + self.numSteps = self.exploreStep + 2; + self.fetchData(); + }).text(Object(external_CoreHome_["translate"])('UsersFlow_ExploreTraffic')); + } + + if (self.isExploringTraffic) { + list.append('li').attr('class', 'divider').html('
'); + list.append('li').attr('class', 'unexploreTraffic').on('click', function () { + self.exploreStep = false; + self.exploreUrl = false; + self.fetchData(); + }).text(Object(external_CoreHome_["translate"])('UsersFlow_UnexploreTraffic')); + } else if (theNode.idSubtable || isSummaryNode(theNode.name)) { + list.append('li').attr('class', 'divider').html('
'); + list.append('li').attr('class', 'showNodeDetails').on('click', function () { + showNodeDetails.apply(_this2, [theNode]); + }).text(Object(external_CoreHome_["translate"])('UsersFlow_ActionShowDetails')); + } + + if (self.isUrlLike(theNode.name) && !isSummaryNode(theNode.name)) { + list.append('li').attr('class', 'divider').html('
'); + list.append('li').attr('class', 'openPageUrl').append('a').attr('href', self.completeUrl(theNode.name)).attr('rel', 'noreferrer').attr('target', '_blank').text(Object(external_CoreHome_["translate"])('Installation_SystemCheckOpenURL')); + } + + popupMenu.style('left', "".concat(event.pageX - 2, "px")).style('top', "".concat(event.pageY - 2, "px")).style('display', 'block'); + } + + var NODE_WIDTH = 200; + var NODE_PADDING = 40; + var DEPTH_WIDTH = 350; + var margin = { + top: 70, + right: 20, + bottom: 20, + left: 5 + }; + var width = 550 + (this.numSteps - 2) * DEPTH_WIDTH + 150; + var sankeyWidth = width - 150; // for next button + + var height = this.maxNodeLength * 100 + margin.top; + var sankeyNode = this.$refs.sankeyChart; + $(sankeyNode).css('width', width + margin.left + margin.right).css('height', height + margin.top + margin.bottom + 5); + var formatNumber = d3["format"](',.0f'); + + var format = function format(d) { + return formatNumber(d); + }; + + var svg = d3["select"](sankeyNode).append('svg').attr('width', width + margin.left + margin.right).attr('height', height + margin.top + margin.bottom).append('g').attr('transform', "translate(".concat(margin.left, ",").concat(margin.top, ")")); + var normalGradient = svg.append('svg:defs').append('svg:linearGradient').attr('id', 'normalGradient').attr('x1', '0%').attr('y1', '0%').attr('x2', '0%').attr('y2', '100%').attr('spreadMethod', 'pad'); + normalGradient.append('svg:stop').attr('offset', '0%').attr('stop-color', '#F2FFE9').attr('stop-opacity', 1); + normalGradient.append('svg:stop').attr('offset', '100%').attr('stop-color', '#84D04D').attr('stop-opacity', 1); + var pageOutGradient = svg.append('svg:defs').append('svg:linearGradient').attr('id', 'pageOutGradient').attr('x1', '0%').attr('y1', '0%').attr('x2', '0%').attr('y2', '100%').attr('spreadMethod', 'pad'); + pageOutGradient.append('svg:stop').attr('offset', '0%').attr('stop-color', '#FCE8E8').attr('stop-opacity', 1); + pageOutGradient.append('svg:stop').attr('offset', '100%').attr('stop-color', '#FA5858').attr('stop-opacity', 1); + var sankey = d3["sankey"]() // using custom sankey so no typings + .nodeWidth(NODE_WIDTH).nodePadding(NODE_PADDING).size([sankeyWidth, height]); + var path = sankey.link(); + + if (nodes && links && depthNodes) { + var depthInfo = svg.append('g').selectAll('.depthInfo').data(depthNodes).enter().append('g').attr('class', function (node) { + return "depthInfo depth".concat(node.depth + 1); + }); + depthInfo.append('rect').attr('height', 50).attr('width', NODE_WIDTH).attr('x', function (d) { + return d.depth * DEPTH_WIDTH; + }).attr('y', -80).style('fill', 'none'); + var depthText = depthInfo.append('text').attr('y', -60); + + if (this.numSteps > 1) { + var closebuttonSvg = depthInfo.append('svg').attr('viewBox', '-100 -100 1500 1500').attr('width', '18').attr('height', '18').attr('y', '-68').attr('x', function (d) { + return d.depth * DEPTH_WIDTH + NODE_WIDTH - 10; + } + /* plus padding */ + ).attr('class', 'removeStep').on('click', function (d) { + _this3.setSankeyStep(d.depth); + }).style('visibility', function (d) { + if (d.depth > 1) { + return 'visible'; + } + + return 'hidden'; + }).attr('dy', 1); + closebuttonSvg.append('path').attr('d', 'M874.048 810.048c-199.936 199.936-524.16 199.936-724.096 ' + '0s-199.936-524.16 0-724.096c199.936-199.936 524.16-199.936 724.096 0s199.936 ' + '524.16 0 724.096zM692.992 267.008c-33.344-33.344-87.36-33.344-120.64 0l-60.352 ' + '60.288-60.352-60.352c-33.344-33.344-87.36-33.344-120.64 0-33.344 33.344-33.344 ' + '87.36 0 120.704l60.352 60.352-60.352 60.352c-33.344 33.344-33.344 87.36 0 ' + '120.704s87.36 33.344 120.64 0l60.352-60.352 60.352 60.352c33.344 33.344 87.36 ' + '33.344 120.64 0 33.344-33.344 33.344-87.36 0-120.704l-60.288-60.352 60.352-' + '60.352c33.28-33.344 33.28-87.36-0.064-120.64z').attr('fill', '#999').append('title').text(Object(external_CoreHome_["translate"])('UsersFlow_ActionRemoveStep')); + closebuttonSvg.append('rect').attr('fill', 'transparent').attr('width', '900').attr('height', '900').attr('x', 50).append('title').text(Object(external_CoreHome_["translate"])('UsersFlow_ActionRemoveStep')); + } + + depthText.append('svg:tspan').attr('x', function (d) { + return d.depth * DEPTH_WIDTH; + }).attr('dy', 5).attr('fill', 'black').style('font-weight', 'bold').attr('class', 'depthContainerTitle').text(function (d) { + return "".concat(Object(external_CoreHome_["translate"])('UsersFlow_ColumnInteraction'), " ").concat(d.depth + 1); + }).on('click', function (d) { + var depth = parseInt(d.depth, 10) + 1; + + _this3.showGroupDetails('', depth, false); + }).append('svg:tspan').attr('x', function (d) { + return d.depth * DEPTH_WIDTH; + }).attr('dy', 20).style('font-weight', 'normal').style('font-size', '13px').text(function (d) { + if (typeof d.totalIn === 'undefined') { + return null; + } + + var message = "".concat(Object(external_CoreHome_["translate"])('General_NVisits', d.totalIn), ", "); + message += "".concat(Object(external_CoreHome_["translate"])('UsersFlow_NProceededInline', d.totalOut), ", "); + message += Object(external_CoreHome_["translate"])('Transitions_ExitsInline', d.totalExits); + return message; + }).attr('fill', 'black'); + sankey.nodes(nodes).links(links).layout(32); + var tipLink = d3_tip().attr('class', 'd3-tip').offset([-10, 0]).html(function (d) { + var bottom = format(d.value); + + if (d.source && d.source.totalIn) { + bottom += " (".concat(_this3.getPercentage(d.value, d.source.totalIn), ")"); + } + + if (isOutNode(d.target.name)) { + var _message = Object(external_CoreHome_["translate"])('Transitions_ExitsInline', bottom); + + var name = external_CoreHome_["Matomo"].helper.htmlEntities(window.vueSanitize(d.source.name)); + return _this3.makeToolTip("".concat(name, ": ").concat(_message, "")); + } + + var from = "\"".concat(external_CoreHome_["Matomo"].helper.htmlEntities(external_CoreHome_["Matomo"].helper.escape(d.source.name)), "\""); + var to = "\"".concat(external_CoreHome_["Matomo"].helper.htmlEntities(external_CoreHome_["Matomo"].helper.escape(d.target.name)), "\""); + var message = Object(external_CoreHome_["translate"])('UsersFlow_InteractionXToY', from, to); + return _this3.makeToolTip("".concat(message, "
").concat(bottom)); + }); + var link = svg.append('g').selectAll('.link').data(links).enter().append('path').attr('class', function (d) { + var className = 'link '; + + if (isOutNode(d.target.name)) { + return "".concat(className, " outNodeLink"); + } + + var percentage = 0; + + if (d.source.totalOut > 0) { + percentage = d.value / d.source.totalOut * 100; + } // we check how much it contributed in percentage + // to the total outgoing + + + if (percentage <= 8) { + className += ' linkSize1'; + } else if (percentage <= 16) { + className += ' linkSize2'; + } else if (percentage <= 24) { + className += ' linkSize3'; + } else if (percentage <= 32) { + className += ' linkSize4'; + } else if (percentage <= 42) { + className += ' linkSize5'; + } else { + className += ' linkSize6'; + } + + return className; + }).attr('d', path).attr('id', function (d, i) { + d.id = i; + return "link-".concat(i); + }).style('stroke', function (d) { + if (isOutNode(d.target.name)) { + return '#ec5540'; + } + + return '#A9E2F3'; + }).style('stroke-width', function (d) { + return Math.max(1, d.dy); + }).sort(function (a, b) { + return b.dy - a.dy; + }); + + if (link && !link.empty()) { + link.call(tipLink).on('mouseover', tipLink.show).on('mouseout', tipLink.hide); + } + /** d3-tip set */ + + + var tip = d3_tip().attr('class', 'd3-tip').offset([-10, 0]).html(function (d) { + if (isOutNode(d.name)) { + return ''; + } + + var name = external_CoreHome_["Matomo"].helper.htmlEntities(external_CoreHome_["Matomo"].helper.escape(d.name)); + var visits = Object(external_CoreHome_["translate"])('General_ColumnNbVisits'); + var proceededValue = "\n".concat(d.totalOut, " (").concat(_this3.getPercentage(d.totalOut, d.totalIn), ")\n"); + var exitsValue = "\n".concat(d.totalExits, " (").concat(_this3.getPercentage(d.totalExits, d.totalIn), ")\n"); + return _this3.makeToolTip("".concat(name, "
\n").concat(visits, ": ").concat(d.totalIn, "
\n").concat(Object(external_CoreHome_["translate"])('UsersFlow_ColumnProceeded'), ": ").concat(proceededValue, "
\n").concat(Object(external_CoreHome_["translate"])('General_ColumnExits'), ": ").concat(exitsValue)); + }); + var node = svg.append('g').selectAll('.node').data(nodes).enter().append('g').attr('class', function (d) { + var classNames = "node nodeDepth".concat(d.depth + 1); + + if (isOutNode(d.name)) { + classNames += ' outNode'; + } + + return classNames; + }).attr('transform', function (d) { + return "translate(".concat(d.x, ",").concat(d.y, ")"); + }); + node.on('click', showPopup); + node.call(tip).on('mouseover', tip.show).on('mouseout', tip.hide); + node.append('rect').attr('height', function (d) { + return d.dy; + }).attr('width', sankey.nodeWidth()).style('fill', function (d) { + if (isOutNode(d.name)) { + return 'url(#pageOutGradient)'; + } + + return 'url(#normalGradient)'; + }).style('stroke', '#333'); + node.append('text').attr('x', 4).attr('y', -5).attr('text-anchor', 'left').attr('transform', 'rotate(0)').text(function (d) { + if (isOutNode(d.name)) { + return ''; + } + + var name = d.name; + + if (isSummaryNode(name)) { + if (d.pagesInGroup) { + name += " (>".concat(Object(external_CoreHome_["translate"])('VisitorInterest_NPages', d.pagesInGroup), ")"); + } + + return name; + } + + if (_this3.isUrlLike(name)) { + // if name is like a url, eg erer.com/... then we remove the domain + name = name.substr(name.indexOf('/')); + } + + if (name.length > 33) { + return "".concat(name.substr(0, 15), "...").concat(name.substr(-15)); + } + + return name; + }).attr('fill', 'black'); + node.append('text').attr('x', 4).attr('y', 18).attr('transform', 'rotate(0)').attr('text-anchor', 'left').text(function (i) { + return format(i.totalIn); + }).attr('fill', 'black'); + + if (this.numSteps < this.maxSankeyChartDepth) { + var btnNextStep = svg.append('g').attr('class', 'addNewStepContainer').on('click', function () { + self.addSankeyStep(); + setTimeout(function () { + var chartWidth = $('.sankeyChartOuter > div').width(); + + if (chartWidth) { + $('.sankeyChartOuter').animate({ + scrollLeft: chartWidth - 3 + }); + } + }, 20); + }); + btnNextStep.append('path').attr('d', 'M512 960c-282.752 0-512-229.248-512-512s229.248-512 512-512 512 229.248 512 ' + '512-229.248 512-512 512zM682.688 362.688h-85.376v-85.312c0-47.168-38.208-85.376-85' + '.312-85.376s-85.312 38.208-85.312 85.312v85.376h-85.376c-47.104 0-85.312 38.208-85' + '.312 85.312s38.208 85.312 85.312 85.312h85.312v85.376c0.064 47.104 38.272 85.312 ' + '85.376 85.312s85.312-38.208 85.312-85.312v-85.312h85.312c47.168-0.064 85.376-38.' + '272 85.376-85.376s-38.208-85.312-85.312-85.312z').attr('dx', width - 50).attr('dy', -30).attr('transform', "translate(".concat(width - 50, ",-66) scale(0.04)")).attr('text-anchor', 'middle').attr('class', 'addNewStep').append('title').text(Object(external_CoreHome_["translate"])('UsersFlow_ActionAddStep')); + btnNextStep.append('rect').attr('x', width - 50).attr('y', '-69').attr('width', '40').attr('height', '40').attr('fill', 'transparent').style('cursor', 'pointer').append('title').text(Object(external_CoreHome_["translate"])('UsersFlow_ActionAddStep')); + } + } + }, + buildNodesAndIndexes: function buildNodesAndIndexes(response) { + var _this4 = this; + + this.maxSankeyChartDepth = 0; + this.maxNodeLength = 0; + var links = []; + var nodes = []; + var depthNodes = []; + var depth; + response.forEach(function (row) { + depth = parseInt(row.label, 10); + + if (depth > _this4.maxSankeyChartDepth) { + _this4.maxSankeyChartDepth = depth; + } + }); + + if (this.numSteps > this.maxSankeyChartDepth) { + // we need to reset numsteps automatically if api for some reason returns less steps + // eg when exploring traffic + this.numSteps = this.maxSankeyChartDepth; + } + + var nodeIndex = 0; + response.forEach(function (depthRow) { + depth = parseInt(depthRow.label, 10); + + if (!depthRow.subtable) { + return; + } + + if (depthRow.subtable.length + 1 > _this4.maxNodeLength) { + _this4.maxNodeLength = depthRow.subtable.length + 1; // +1 for out node + } + + if (depth > _this4.numSteps) { + // we make sure to only show as many interactions as requested + return; + } + + var depthNode = { + depth: depth - 1, + in: 0, + out: 0, + totalIn: depthRow.nb_visits, + totalOut: depthRow.nb_proceeded, + totalExits: depthRow.nb_exits + }; + depthRow.subtable.forEach(function (sourceRow) { + var sourceLabel = sourceRow.label; + + if (!isSummaryNode(sourceLabel)) { + // here we want to count the values only for the nodes shown + depthNode.in += sourceRow.nb_visits; + depthNode.out += sourceRow.nb_proceeded; + } + + nodes.push({ + depth: depth - 1, + name: sourceLabel, + node: nodeIndex, + totalIn: sourceRow.nb_visits, + totalOut: sourceRow.nb_proceeded, + totalExits: sourceRow.nb_exits, + pagesInGroup: sourceRow.nb_pages_in_group ? sourceRow.nb_pages_in_group : 0, + isSummaryNode: isSummaryNode(sourceLabel), + idSubtable: sourceRow.idsubdatatable ? sourceRow.idsubdatatable : null + }); // nb_pages_in_group is available for summary rows only so far + + nodeIndex += 1; + + if (depth >= _this4.numSteps) { + // we do not add links for the last interaction position + return; + } + + if (!sourceRow.subtable) { + // no subtable, no links + return; + } + + (sourceRow.subtable || []).forEach(function (targetRow) { + links.push({ + depth: depth, + source: nodeIndex - 1, + // -1 cause we already did nodeIndex++ before + target: targetRow.label, + value: targetRow.nb_visits + }); + }); + + if (sourceRow.nb_exits) { + // we are also adding a link to the out node of the next step if there were exits + links.push({ + depth: depth, + source: nodeIndex - 1, + // -1 cause we already did nodeIndex++ before + target: OUT_NODE_NAME, + value: sourceRow.nb_exits + }); + } + }); + depthNodes.push(depthNode); + + if (depth > 1) { + nodes.push({ + depth: depth - 1, + name: OUT_NODE_NAME, + node: nodeIndex, + value: 0, + totalIn: 0 + }); + nodeIndex += 1; + } + }); // now we need to replace the target labels with proper target node ids + + links.forEach(function (link) { + nodes.some(function (element) { + if (link.target === element.name && link.depth === element.depth) { + link.target = element.node; + return true; + } + + return false; + }); + }); + return { + nodes: nodes, + links: links, + depthNodes: depthNodes + }; + }, + fetchData: function fetchData() { + var _this5 = this; + + this.clearSankeyChart(); + this.isExploringTraffic = !!(this.exploreStep && this.exploreUrl); + this.isLoading = true; + this.rawResponse = []; + external_CoreHome_["AjaxHelper"].fetch({ + method: 'UsersFlow.getUsersFlow', + expanded: '1', + filter_limit: '-1', + dataSource: this.actualUserFlowSource, + limitActionsPerStep: this.numActionsPerStep, + exploreStep: this.isExploringTraffic ? this.exploreStep : undefined, + exploreUrl: this.isExploringTraffic ? this.exploreUrl : undefined + }).then(function (response) { + _this5.isLoading = false; + _this5.rawResponse = response; + + _this5.clearSankeyChart(); + + if ((response === null || response === void 0 ? void 0 : response.length) > 0) { + var nodesAndLinks = _this5.buildNodesAndIndexes(_this5.rawResponse); + + _this5.drawSankeyChart(nodesAndLinks); + } else { + _this5.hasData = false; + } + }); + }, + updateViewParams: function updateViewParams() { + var parameters = { + numActionsPerStep: this.numActionsPerStep, + levelOfDetail: this.actualLevelOfDetail, + userFlowSource: this.actualUserFlowSource + }; + external_CoreHome_["AjaxHelper"].post({ + module: 'CoreHome', + action: 'saveViewDataTableParameters', + report_id: 'UsersFlow.getUsersFlow', + segment: '' + }, { + parameters: JSON.stringify(parameters) + }, { + withTokenInUrl: true, + format: 'html' + }).catch(function () {// ignore + }); + } + }, + computed: { + canEnableExploreTraffic: function canEnableExploreTraffic() { + return external_CoreHome_["Matomo"].period !== 'year'; + }, + actionsPerStepOptions: function actionsPerStepOptions() { + var result = [{ + key: 4, + value: 4 + }, { + key: 5, + value: 5 + }]; + + for (var i = 6; i <= 20; i += 2) { + result.push({ + key: i, + value: i + }); + } + + return result; + }, + levelOfDetailOptions: function levelOfDetailOptions() { + return [{ + key: 1, + value: Object(external_CoreHome_["translate"])('UsersFlow_OptionLevelOfDetail1') + }, { + key: 2, + value: Object(external_CoreHome_["translate"])('UsersFlow_OptionLevelOfDetail2') + }, { + key: 3, + value: Object(external_CoreHome_["translate"])('UsersFlow_OptionLevelOfDetail3') + }, { + key: 4, + value: Object(external_CoreHome_["translate"])('UsersFlow_OptionLevelOfDetail4') + }, { + key: 5, + value: Object(external_CoreHome_["translate"])('UsersFlow_OptionLevelOfDetail5') + }, { + key: 6, + value: Object(external_CoreHome_["translate"])('UsersFlow_OptionLevelOfDetail6') + }]; + } + } +})); +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/Visualization/Visualization.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/Visualization/Visualization.vue + + + +Visualizationvue_type_script_lang_ts.render = render + +/* harmony default export */ var Visualization = (Visualizationvue_type_script_lang_ts); +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-babel/node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/@vue/cli-plugin-babel/node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist/templateLoader.js??ref--6!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersFlow/vue/src/GetUsersFlow/GetUsersFlow.vue?vue&type=template&id=69e76762 + +var GetUsersFlowvue_type_template_id_69e76762_hoisted_1 = { + key: 0 +}; +var GetUsersFlowvue_type_template_id_69e76762_hoisted_2 = { + class: "widgetBody usersFlowIntroduction" +}; +var GetUsersFlowvue_type_template_id_69e76762_hoisted_3 = { + key: 1, + class: "card" +}; +var GetUsersFlowvue_type_template_id_69e76762_hoisted_4 = { + class: "card-content" +}; +var GetUsersFlowvue_type_template_id_69e76762_hoisted_5 = { + key: 2, + class: "widgetBody" +}; +function GetUsersFlowvue_type_template_id_69e76762_render(_ctx, _cache, $props, $setup, $data, $options) { + var _component_EnrichedHeadline = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("EnrichedHeadline"); + + var _component_Visualization = Object(external_commonjs_vue_commonjs2_vue_root_Vue_["resolveComponent"])("Visualization"); + + return Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])(external_commonjs_vue_commonjs2_vue_root_Vue_["Fragment"], null, [_ctx.showTitle ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("h2", GetUsersFlowvue_type_template_id_69e76762_hoisted_1, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_EnrichedHeadline, null, { + default: Object(external_commonjs_vue_commonjs2_vue_root_Vue_["withCtx"])(function () { + return [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createTextVNode"])(Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersFlow_UsersFlow')), 1)]; + }), + _: 1 + })])) : Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createCommentVNode"])("", true), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("p", GetUsersFlowvue_type_template_id_69e76762_hoisted_2, Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.translate('UsersFlow_UsersFlowVisualizationDescription1')) + " " + Object(external_commonjs_vue_commonjs2_vue_root_Vue_["toDisplayString"])(_ctx.usersFlowDesc2), 1), _ctx.showTitle ? (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", GetUsersFlowvue_type_template_id_69e76762_hoisted_3, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementVNode"])("div", GetUsersFlowvue_type_template_id_69e76762_hoisted_4, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Visualization, { + "actions-per-step": _ctx.actionsPerStep, + "level-of-detail": _ctx.levelOfDetail, + "user-flow-source": _ctx.userFlowSource + }, null, 8, ["actions-per-step", "level-of-detail", "user-flow-source"])])])) : (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["openBlock"])(), Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createElementBlock"])("div", GetUsersFlowvue_type_template_id_69e76762_hoisted_5, [Object(external_commonjs_vue_commonjs2_vue_root_Vue_["createVNode"])(_component_Visualization, { + "actions-per-step": _ctx.actionsPerStep, + "level-of-detail": _ctx.levelOfDetail, + "user-flow-source": _ctx.userFlowSource + }, null, 8, ["actions-per-step", "level-of-detail", "user-flow-source"])]))], 64); +} +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/GetUsersFlow/GetUsersFlow.vue?vue&type=template&id=69e76762 + +// CONCATENATED MODULE: ./node_modules/@vue/cli-plugin-typescript/node_modules/cache-loader/dist/cjs.js??ref--14-0!./node_modules/babel-loader/lib!./node_modules/@vue/cli-plugin-typescript/node_modules/ts-loader??ref--14-2!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader-v16/dist??ref--0-1!./plugins/UsersFlow/vue/src/GetUsersFlow/GetUsersFlow.vue?vue&type=script&lang=ts + + + +/* harmony default export */ var GetUsersFlowvue_type_script_lang_ts = (Object(external_commonjs_vue_commonjs2_vue_root_Vue_["defineComponent"])({ + props: { + showTitle: String, + actionsPerStep: Number, + levelOfDetail: Number, + userFlowSource: String + }, + components: { + EnrichedHeadline: external_CoreHome_["EnrichedHeadline"], + Visualization: Visualization + }, + computed: { + usersFlowDesc2: function usersFlowDesc2() { + return Object(external_CoreHome_["translate"])('UsersFlow_UsersFlowVisualizationDescription2', Object(external_CoreHome_["translate"])('General_Others'), Object(external_CoreHome_["translate"])('UsersFlow_ColumnInteraction'), Object(external_CoreHome_["translate"])('UsersFlow_ActionShowDetails'), Object(external_CoreHome_["translate"])('UsersFlow_ExploreTraffic')); + } + } +})); +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/GetUsersFlow/GetUsersFlow.vue?vue&type=script&lang=ts + +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/GetUsersFlow/GetUsersFlow.vue + + + +GetUsersFlowvue_type_script_lang_ts.render = GetUsersFlowvue_type_template_id_69e76762_render + +/* harmony default export */ var GetUsersFlow = (GetUsersFlowvue_type_script_lang_ts); +// CONCATENATED MODULE: ./plugins/UsersFlow/vue/src/index.ts +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + + +// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib-no-default.js + + + + +/***/ }) + +/******/ }); +}); +//# sourceMappingURL=UsersFlow.umd.js.map \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/vue/dist/UsersFlow.umd.min.js b/files/plugin-UsersFlow-5.0.6/vue/dist/UsersFlow.umd.min.js new file mode 100644 index 0000000..42713e2 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/dist/UsersFlow.umd.min.js @@ -0,0 +1,16 @@ +(function(t,n){"object"===typeof exports&&"object"===typeof module?module.exports=n(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):"function"===typeof define&&define.amd?define(["CoreHome",,"CorePluginsAdmin"],n):"object"===typeof exports?exports["UsersFlow"]=n(require("CoreHome"),require("vue"),require("CorePluginsAdmin")):t["UsersFlow"]=n(t["CoreHome"],t["Vue"],t["CorePluginsAdmin"])})("undefined"!==typeof self?self:this,(function(t,n,e){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"===typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(r,i,function(n){return t[n]}.bind(null,i));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t["default"]}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="plugins/UsersFlow/vue/dist/",e(e.s="fae3")}({"19dc":function(n,e){n.exports=t},"8bbf":function(t,e){t.exports=n},9314:function(t,n,e){(function(t,e){e(n)})(0,(function(t){"use strict";var n="4.9.1",e=function(t,n){return tn?1:t>=n?0:NaN},r=function(t){return 1===t.length&&(t=i(t)),{left:function(n,e,r,i){null==r&&(r=0),null==i&&(i=n.length);while(r>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){null==r&&(r=0),null==i&&(i=n.length);while(r>>1;t(n[o],e)>0?i=o:r=o+1}return r}}};function i(t){return function(n,r){return e(t(n),r)}}var o=r(e),a=o.right,u=o.left,c=function(t,n){null==n&&(n=s);var e=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);while(et?1:n>=t?0:NaN},h=function(t){return null===t?NaN:+t},p=function(t,n){var e,r,i=t.length,o=0,a=-1,u=0,c=0;if(null==n)while(++a1)return c/(o-1)},d=function(t,n){var e=p(t,n);return e?Math.sqrt(e):e},v=function(t,n){var e,r,i,o=t.length,a=-1;if(null==n){while(++a=e){r=i=e;while(++ae&&(r=e),i=e){r=i=e;while(++ae&&(r=e),i0){t=Math.ceil(t/o),n=Math.floor(n/o),i=new Array(r=Math.ceil(n-t+1));while(++u=0?(o>=b?10:o>=M?5:o>=k?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=b?10:o>=M?5:o>=k?2:1)}function N(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=b?i*=10:o>=M?i*=5:o>=k&&(i*=2),nf)h.pop(),--p;var d,v=new Array(p+1);for(i=0;i<=p;++i)d=v[i]=[],d.x0=i>0?h[i-1]:l,d.x1=i=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t),u=+e(t[o+1],o+1,t);return a+(u-a)*(i-o)}},O=function(t,n,r){return t=_.call(t,h).sort(e),Math.ceil((r-n)/(2*(C(t,.75)-C(t,.25))*Math.pow(t.length,-1/3)))},P=function(t,n,e){return Math.ceil((e-n)/(3.5*d(t)*Math.pow(t.length,-1/3)))},L=function(t,n){var e,r,i=t.length,o=-1;if(null==n){while(++o=e){r=e;while(++or&&(r=e)}}else while(++o=e){r=e;while(++or&&(r=e)}return r},U=function(t,n){var e,r=t.length,i=r,o=-1,a=0;if(null==n)while(++o=0){r=t[i],n=r.length;while(--n>=0)e[--a]=r[n]}return e},F=function(t,n){var e,r,i=t.length,o=-1;if(null==n){while(++o=e){r=e;while(++oe&&(r=e)}}else while(++o=e){r=e;while(++oe&&(r=e)}return r},j=function(t,n){var e=n.length,r=new Array(e);while(e--)r[e]=t[n[e]];return r},R=function(t,n){if(r=t.length){var r,i,o=0,a=0,u=t[a];null==n&&(n=e);while(++o=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function ft(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),dt.hasOwnProperty(n)?{space:dt[n],local:t}:t};function yt(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===pt&&n.documentElement.namespaceURI===pt?n.createElement(t):n.createElementNS(e,t)}}function gt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}var _t=function(t){var n=vt(t);return(n.local?gt:yt)(n)},mt=0;function xt(){return new wt}function wt(){this._="@"+(++mt).toString(36)}wt.prototype=xt.prototype={constructor:wt,get:function(t){var n=this._;while(!(n in t))if(!(t=t.parentNode))return;return t[n]},set:function(t,n){return t[this._]=n},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var bt=function(t){return function(){return this.matches(t)}};if("undefined"!==typeof document){var Mt=document.documentElement;if(!Mt.matches){var kt=Mt.webkitMatchesSelector||Mt.msMatchesSelector||Mt.mozMatchesSelector||Mt.oMatchesSelector;bt=function(t){return function(){return kt.call(this,t)}}}}var St=bt,Et={};if(t.event=null,"undefined"!==typeof document){var Nt=document.documentElement;"onmouseenter"in Nt||(Et={mouseenter:"mouseover",mouseleave:"mouseout"})}function Tt(t,n,e){return t=At(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function At(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function Ct(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function Ot(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=w&&(w=x+1);while(!(m=y[w])&&++w=0;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},en=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=rn);for(var e=this._groups,r=e.length,i=new Array(r),o=0;on?1:t>=n?0:NaN}var on=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},an=function(){var t=new Array(this.size()),n=-1;return this.each((function(){t[++n]=this})),t},un=function(){for(var t=this._groups,n=0,e=t.length;n1?this.each((null==n?mn:"function"===typeof n?wn:xn)(t,n,null==e?"":e)):Mn(this.node(),t)};function Mn(t,n){return t.style.getPropertyValue(n)||_n(t).getComputedStyle(t,null).getPropertyValue(n)}function kn(t){return function(){delete this[t]}}function Sn(t,n){return function(){this[t]=n}}function En(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}var Nn=function(t,n){return arguments.length>1?this.each((null==n?kn:"function"===typeof n?En:Sn)(t,n)):this.node()[t]};function Tn(t){return t.trim().split(/^|\s+/)}function An(t){return t.classList||new Cn(t)}function Cn(t){this._node=t,this._names=Tn(t.getAttribute("class")||"")}function On(t,n){var e=An(t),r=-1,i=n.length;while(++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var zn=function(t,n){var e=Tn(t+"");if(arguments.length<2){var r=An(this.node()),i=-1,o=e.length;while(++if}c.mouse("drag")}function v(){ce(t.event.view).on("mousemove.drag mouseup.drag",null),ve(t.event.view,r),pe(),c.mouse("end")}function y(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=a.apply(this,arguments),u=r.length;for(n=0;n>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Oe.exec(t))?Ie(parseInt(n[1],16)):(n=Pe.exec(t))?new Ve(n[1],n[2],n[3],1):(n=Le.exec(t))?new Ve(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ue.exec(t))?qe(n[1],n[2],n[3],n[4]):(n=De.exec(t))?qe(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=ze.exec(t))?Ye(n[1],n[2]/100,n[3]/100,1):(n=Fe.exec(t))?Ye(n[1],n[2]/100,n[3]/100,n[4]):je.hasOwnProperty(t)?Ie(je[t]):"transparent"===t?new Ve(NaN,NaN,NaN,0):null}function Ie(t){return new Ve(t>>16&255,t>>8&255,255&t,1)}function qe(t,n,e,r){return r<=0&&(t=n=e=NaN),new Ve(t,n,e,r)}function Be(t){return t instanceof ke||(t=Re(t)),t?(t=t.rgb(),new Ve(t.r,t.g,t.b,t.opacity)):new Ve}function He(t,n,e,r){return 1===arguments.length?Be(t):new Ve(t,n,e,null==r?1:r)}function Ve(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ye(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new We(t,n,e,r)}function Xe(t){if(t instanceof We)return new We(t.h,t.s,t.l,t.opacity);if(t instanceof ke||(t=Re(t)),!t)return new We;if(t instanceof We)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,c=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e0&&c<1?0:a,new We(a,u,c,t.opacity)}function Ge(t,n,e,r){return 1===arguments.length?Xe(t):new We(t,n,e,null==r?1:r)}function We(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function $e(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}be(ke,Re,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),be(Ve,He,Me(ke,{brighter:function(t){return t=null==t?Ee:Math.pow(Ee,t),new Ve(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Se:Math.pow(Se,t),new Ve(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),be(We,Ge,Me(ke,{brighter:function(t){return t=null==t?Ee:Math.pow(Ee,t),new We(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Se:Math.pow(Se,t),new We(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Ve($e(t>=240?t-240:t+120,i,r),$e(t,i,r),$e(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var Ze=Math.PI/180,Je=180/Math.PI,Qe=18,Ke=.95047,tr=1,nr=1.08883,er=4/29,rr=6/29,ir=3*rr*rr,or=rr*rr*rr;function ar(t){if(t instanceof cr)return new cr(t.l,t.a,t.b,t.opacity);if(t instanceof vr){var n=t.h*Ze;return new cr(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof Ve||(t=Be(t));var e=hr(t.r),r=hr(t.g),i=hr(t.b),o=sr((.4124564*e+.3575761*r+.1804375*i)/Ke),a=sr((.2126729*e+.7151522*r+.072175*i)/tr),u=sr((.0193339*e+.119192*r+.9503041*i)/nr);return new cr(116*a-16,500*(o-a),200*(a-u),t.opacity)}function ur(t,n,e,r){return 1===arguments.length?ar(t):new cr(t,n,e,null==r?1:r)}function cr(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function sr(t){return t>or?Math.pow(t,1/3):t/ir+er}function lr(t){return t>rr?t*t*t:ir*(t-er)}function fr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function hr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function pr(t){if(t instanceof vr)return new vr(t.h,t.c,t.l,t.opacity);t instanceof cr||(t=ar(t));var n=Math.atan2(t.b,t.a)*Je;return new vr(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function dr(t,n,e,r){return 1===arguments.length?pr(t):new vr(t,n,e,null==r?1:r)}function vr(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}be(cr,ur,Me(ke,{brighter:function(t){return new cr(this.l+Qe*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new cr(this.l-Qe*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return t=tr*lr(t),n=Ke*lr(n),e=nr*lr(e),new Ve(fr(3.2404542*n-1.5371385*t-.4985314*e),fr(-.969266*n+1.8760108*t+.041556*e),fr(.0556434*n-.2040259*t+1.0572252*e),this.opacity)}})),be(vr,dr,Me(ke,{brighter:function(t){return new vr(this.h,this.c,this.l+Qe*(null==t?1:t),this.opacity)},darker:function(t){return new vr(this.h,this.c,this.l-Qe*(null==t?1:t),this.opacity)},rgb:function(){return ar(this).rgb()}}));var yr=-.14861,gr=1.78277,_r=-.29227,mr=-.90649,xr=1.97294,wr=xr*mr,br=xr*gr,Mr=gr*_r-mr*yr;function kr(t){if(t instanceof Er)return new Er(t.h,t.s,t.l,t.opacity);t instanceof Ve||(t=Be(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Mr*r+wr*n-br*e)/(Mr+wr-br),o=r-i,a=(xr*(e-i)-_r*o)/mr,u=Math.sqrt(a*a+o*o)/(xr*i*(1-i)),c=u?Math.atan2(a,o)*Je-120:NaN;return new Er(c<0?c+360:c,u,i,t.opacity)}function Sr(t,n,e,r){return 1===arguments.length?kr(t):new Er(t,n,e,null==r?1:r)}function Er(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Nr(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}be(Er,Sr,Me(ke,{brighter:function(t){return t=null==t?Ee:Math.pow(Ee,t),new Er(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Se:Math.pow(Se,t),new Er(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Ze,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new Ve(255*(n+e*(yr*r+gr*i)),255*(n+e*(_r*r+mr*i)),255*(n+e*(xr*r)),this.opacity)}}));var Tr=function(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r180||e<-180?e-360*Math.round(e/360):e):Cr(isNaN(t)?n:t)}function Ur(t){return 1===(t=+t)?Dr:function(n,e){return e-n?Pr(n,e,t):Cr(isNaN(n)?e:n)}}function Dr(t,n){var e=n-t;return e?Or(t,e):Cr(isNaN(t)?n:t)}var zr=function t(n){var e=Ur(n);function r(t,n){var r=e((t=He(t)).r,(n=He(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Dr(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function Fr(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;eo&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:Br(e,r)})),o=Yr.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Br(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}function u(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Br(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}function c(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Br(t,e)},{i:u-2,x:Br(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}return function(n,e){var r=[],i=[];return n=t(n),e=t(e),o(n.translateX,n.translateY,e.translateX,e.translateY,r,i),a(n.rotate,e.rotate,r,i),u(n.skewX,e.skewX,r,i),c(n.scaleX,n.scaleY,e.scaleX,e.scaleY,r,i),n=e=null,function(t){var n,e=-1,o=i.length;while(++e=0&&n._call.call(null,t),n=n._next;--Ci}function Vi(){Di=(Ui=Fi.now())+zi,Ci=Oi=0;try{Hi()}finally{Ci=0,Xi(),Di=0}}function Yi(){var t=Fi.now(),n=t-Ui;n>Li&&(zi-=n,Ui=t)}function Xi(){var t,n,e=Si,r=1/0;while(e)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Si=n);Ei=t,Gi(r)}function Gi(t){if(!Ci){Oi&&(Oi=clearTimeout(Oi));var n=t-Di;n>24?(t<1/0&&(Oi=setTimeout(Vi,n)),Pi&&(Pi=clearInterval(Pi))):(Pi||(Ui=Di,Pi=setInterval(Yi,Li)),Ci=1,ji(Vi))}}qi.prototype=Bi.prototype={constructor:qi,restart:function(t,n,e){if("function"!==typeof t)throw new TypeError("callback is not a function");e=(null==e?Ri():+e)+(null==n?0:+n),this._next||Ei===this||(Ei?Ei._next=this:Si=this,Ei=this),this._call=t,this._time=e,Gi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gi())}};var Wi=function(t,n,e){var r=new qi;return n=null==n?0:+n,r.restart((function(e){r.stop(),t(e+n)}),n,e),r},$i=function(t,n,e){var r=new qi,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?Ri():+e,r.restart((function o(a){a+=i,r.restart(o,i+=n,e),t(a)}),n,e),r)},Zi=ct("start","end","interrupt"),Ji=[],Qi=0,Ki=1,to=2,no=3,eo=4,ro=5,io=6,oo=function(t,n,e,r,i,o){var a=t.__transition;if(a){if(e in a)return}else t.__transition={};so(t,e,{name:n,index:r,group:i,on:Zi,tween:Ji,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Qi})};function ao(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>Qi)throw new Error("too late");return e}function uo(t,n){var e=t.__transition;if(!e||!(e=e[n])||e.state>to)throw new Error("too late");return e}function co(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("too late");return e}function so(t,n,e){var r,i=t.__transition;function o(t){e.state=Ki,e.timer.restart(a,e.delay,e.time),e.delay<=t&&a(t-e.delay)}function a(o){var s,l,f,h;if(e.state!==Ki)return c();for(s in i)if(h=i[s],h.name===e.name){if(h.state===no)return Wi(a);h.state===eo?(h.state=io,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete i[s]):+sto&&e.state=0&&(t=t.slice(0,n)),!t||"start"===t}))}function Ro(t,n,e){var r,i,o=jo(n)?ao:uo;return function(){var a=o(this,t),u=a.on;u!==r&&(i=(r=u).copy()).on(n,e),a.on=i}}var Io=function(t,n){var e=this._id;return arguments.length<2?co(this.node(),e).on.on(t):this.each(Ro(e,t,n))};function qo(t){return function(){var n=this.parentNode;for(var e in this.__transition)if(+e!==t)return;n&&n.removeChild(this)}}var Bo=function(){return this.on("end.remove",qo(this._id))},Ho=function(t){var n=this._name,e=this._id;"function"!==typeof t&&(t=Rt(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;aKi&&e.name===n)return new oa([[t]],ru,n,+r);return null},ou=function(t){return function(){return t}},au=function(t,n,e){this.target=t,this.type=n,this.selection=e};function uu(){t.event.stopImmediatePropagation()}var cu=function(){t.event.preventDefault(),t.event.stopImmediatePropagation()},su={name:"drag"},lu={name:"space"},fu={name:"handle"},hu={name:"center"},pu={name:"x",handles:["e","w"].map(wu),input:function(t,n){return t&&[[t[0],n[0][1]],[t[1],n[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},du={name:"y",handles:["n","s"].map(wu),input:function(t,n){return t&&[[n[0][0],t[0]],[n[1][0],t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},vu={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(wu),input:function(t){return t},output:function(t){return t}},yu={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},gu={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},_u={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},mu={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},xu={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function wu(t){return{type:t}}function bu(){return!t.event.button}function Mu(){var t=this.ownerSVGElement||this;return[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function ku(t){while(!t.__brush)if(!(t=t.parentNode))return;return t.__brush}function Su(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}function Eu(t){var n=t.__brush;return n?n.dim.output(n.selection):null}function Nu(){return Cu(pu)}function Tu(){return Cu(du)}var Au=function(){return Cu(vu)};function Cu(n){var e,r=Mu,i=bu,o=ct(u,"start","brush","end"),a=6;function u(t){var e=t.property("__brush",h).selectAll(".overlay").data([wu("overlay")]);e.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",yu.overlay).merge(e).each((function(){var t=ku(this).extent;ce(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])})),t.selectAll(".selection").data([wu("selection")]).enter().append("rect").attr("class","selection").attr("cursor",yu.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(n.handles,(function(t){return t.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(t){return"handle handle--"+t.type})).attr("cursor",(function(t){return yu[t.type]})),t.each(c).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",f)}function c(){var t=ce(this),n=ku(this).selection;n?(t.selectAll(".selection").style("display",null).attr("x",n[0][0]).attr("y",n[0][1]).attr("width",n[1][0]-n[0][0]).attr("height",n[1][1]-n[0][1]),t.selectAll(".handle").style("display",null).attr("x",(function(t){return"e"===t.type[t.type.length-1]?n[1][0]-a/2:n[0][0]-a/2})).attr("y",(function(t){return"s"===t.type[0]?n[1][1]-a/2:n[0][1]-a/2})).attr("width",(function(t){return"n"===t.type||"s"===t.type?n[1][0]-n[0][0]+a:a})).attr("height",(function(t){return"e"===t.type||"w"===t.type?n[1][1]-n[0][1]+a:a}))):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(t,n){return t.__brush.emitter||new l(t,n)}function l(t,n){this.that=t,this.args=n,this.state=t.__brush,this.active=0}function f(){if(t.event.touches){if(t.event.changedTouches.lengthMath.abs(t[1]-L[1])?_=!0:g=!0),L=t,y=!0,cu(),R()}function R(){var t;switch(d=L[0]-P[0],v=L[1]-P[1],w){case lu:case su:b&&(d=Math.max(N-r,Math.min(A-l,d)),o=r+d,f=l+d),M&&(v=Math.max(T-a,Math.min(C-h,v)),u=a+v,p=h+v);break;case fu:b<0?(d=Math.max(N-r,Math.min(A-r,d)),o=r+d,f=l):b>0&&(d=Math.max(N-l,Math.min(A-l,d)),o=r,f=l+d),M<0?(v=Math.max(T-a,Math.min(C-a,v)),u=a+v,p=h):M>0&&(v=Math.max(T-h,Math.min(C-h,v)),u=a,p=h+v);break;case hu:b&&(o=Math.max(N,Math.min(A,r-d*b)),f=Math.max(N,Math.min(A,l+d*b))),M&&(u=Math.max(T,Math.min(C,a-v*M)),p=Math.max(T,Math.min(C,h+v*M)));break}f0&&(r=o-d),M<0?h=p-v:M>0&&(a=u-v),w=lu,z.attr("cursor",yu.selection),R());break;default:return}cu()}function B(){switch(t.event.keyCode){case 16:O&&(g=_=O=!1,R());break;case 18:w===hu&&(b<0?l=f:b>0&&(r=o),M<0?h=p:M>0&&(a=u),w=fu,R());break;case 32:w===lu&&(t.event.altKey?(b&&(l=f-d*b,r=o+d*b),M&&(h=p-v*M,a=u+v*M),w=hu):(b<0?l=f:b>0&&(r=o),M<0?h=p:M>0&&(a=u),w=fu),z.attr("cursor",yu[x]),R());break;default:return}cu()}}function h(){var t=this.__brush||{selection:null};return t.extent=r.apply(this,arguments),t.dim=n,t}return u.move=function(t,e){t.selection?t.on("start.brush",(function(){s(this,arguments).beforestart().start()})).on("interrupt.brush end.brush",(function(){s(this,arguments).end()})).tween("brush",(function(){var t=this,r=t.__brush,i=s(t,arguments),o=r.selection,a=n.input("function"===typeof e?e.apply(this,arguments):e,r.extent),u=Kr(o,a);function l(n){r.selection=1===n&&Su(a)?null:u(n),c.call(t),i.brush()}return o&&a?l:l(1)})):t.each((function(){var t=this,r=arguments,i=t.__brush,o=n.input("function"===typeof e?e.apply(t,r):e,i.extent),a=s(t,r).beforestart();lo(t),i.selection=null==o||Su(o)?null:o,c.call(t),a.start().brush().end()}))},l.prototype={beforestart:function(){return 1===++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting&&(this.starting=!1,this.emit("start")),this},brush:function(){return this.emit("brush"),this},end:function(){return 0===--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){Ut(new au(u,t,n.output(this.state.selection)),o.apply,o,[t,this.that,this.args])}},u.extent=function(t){return arguments.length?(r="function"===typeof t?t:ou([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),u):r},u.filter=function(t){return arguments.length?(i="function"===typeof t?t:ou(!!t),u):i},u.handleSize=function(t){return arguments.length?(a=+t,u):a},u.on=function(){var t=o.on.apply(o,arguments);return t===o?u:t},u}var Ou=Math.cos,Pu=Math.sin,Lu=Math.PI,Uu=Lu/2,Du=2*Lu,zu=Math.max;function Fu(t){return function(n,e){return t(n.source.value+n.target.value,e.source.value+e.target.value)}}var ju=function(){var t=0,n=null,e=null,r=null;function i(i){var o,a,u,c,s,l,f=i.length,h=[],p=w(f),d=[],v=[],y=v.groups=new Array(f),g=new Array(f*f);o=0,s=-1;while(++sHu)if(Math.abs(l*u-c*s)>Hu&&i){var h=e-o,p=r-a,d=u*u+c*c,v=h*h+p*p,y=Math.sqrt(d),g=Math.sqrt(f),_=i*Math.tan((qu-Math.acos((d+f-v)/(2*y*g)))/2),m=_/g,x=_/y;Math.abs(m-1)>Hu&&(this._+="L"+(t+m*s)+","+(n+m*l)),this._+="A"+i+","+i+",0,0,"+ +(l*h>s*p)+","+(this._x1=t+x*u)+","+(this._y1=n+x*c)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,e=+e;var a=e*Math.cos(r),u=e*Math.sin(r),c=t+a,s=n+u,l=1^o,f=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+c+","+s:(Math.abs(this._x1-c)>Hu||Math.abs(this._y1-s)>Hu)&&(this._+="L"+c+","+s),e&&(f<0&&(f=f%Bu+Bu),f>Vu?this._+="A"+e+","+e+",0,1,"+l+","+(t-a)+","+(n-u)+"A"+e+","+e+",0,1,"+l+","+(this._x1=c)+","+(this._y1=s):f>Hu&&(this._+="A"+e+","+e+",0,"+ +(f>=qu)+","+l+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Qu=function(){var t=Gu,n=Wu,e=$u,r=Zu,i=Ju,o=null;function a(){var a,u=Ru.call(arguments),c=t.apply(this,u),s=n.apply(this,u),l=+e.apply(this,(u[0]=c,u)),f=r.apply(this,u)-Uu,h=i.apply(this,u)-Uu,p=l*Ou(f),d=l*Pu(f),v=+e.apply(this,(u[0]=s,u)),y=r.apply(this,u)-Uu,g=i.apply(this,u)-Uu;if(o||(o=a=Xu()),o.moveTo(p,d),o.arc(0,0,l,f,h),f===y&&h===g||(o.quadraticCurveTo(0,0,v*Ou(y),v*Pu(y)),o.arc(0,0,v,y,g)),o.quadraticCurveTo(0,0,p,d),o.closePath(),a)return o=null,a+""||null}return a.radius=function(t){return arguments.length?(e="function"===typeof t?t:Iu(+t),a):e},a.startAngle=function(t){return arguments.length?(r="function"===typeof t?t:Iu(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"===typeof t?t:Iu(+t),a):i},a.source=function(n){return arguments.length?(t=n,a):t},a.target=function(t){return arguments.length?(n=t,a):n},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a},Ku="$";function tc(){}function nc(t,n){var e=new tc;if(t instanceof tc)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)while(++i=r.length)return null!=n?n(e):null!=t?e.sort(t):e;var c,s,l,f=-1,h=e.length,p=r[i++],d=nc(),v=a();while(++fr.length)return t;var o,u=i[e-1];return null!=n&&e>=r.length?o=t.entries():(o=[],t.each((function(t,n){o.push({key:n,values:a(t,e)})}))),null!=u?o.sort((function(t,n){return u(t.key,n.key)})):o}return e={object:function(t){return o(t,0,rc,ic)},map:function(t){return o(t,0,oc,ac)},entries:function(t){return a(o(t,0,oc,ac),0)},key:function(t){return r.push(t),e},sortKeys:function(t){return i[r.length-1]=t,e},sortValues:function(n){return t=n,e},rollup:function(t){return n=t,e}}};function rc(){return{}}function ic(t,n,e){t[n]=e}function oc(){return nc()}function ac(t,n,e){t.set(n,e)}function uc(){}var cc=nc.prototype;function sc(t,n){var e=new uc;if(t instanceof uc)t.each((function(t){e.add(t)}));else if(t){var r=-1,i=t.length;if(null==n)while(++r=c)return a;if(i)return i=!1,o;var n,r=s;if(34===t.charCodeAt(r)){var u=r;while(u++=(o=(v+g)/2))?v=o:g=o,(l=e>=(a=(y+_)/2))?y=a:_=a,i=p,!(p=p[f=l<<1|s]))return i[f]=d,t;if(u=+t._x.call(null,p.data),c=+t._y.call(null,p.data),n===u&&e===c)return d.next=p,i?i[f]=d:t._root=d,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(s=n>=(o=(v+g)/2))?v=o:g=o,(l=e>=(a=(y+_)/2))?y=a:_=a}while((f=l<<1|s)===(h=(c>=a)<<1|u>=o));return i[h]=p,i[f]=d,t}function Pc(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),c=1/0,s=1/0,l=-1/0,f=-1/0;for(e=0;el&&(l=r),if&&(f=i));for(lt||t>i||r>n||n>o))return this;var a,u,c=i-e,s=this._root;switch(u=(n<(r+o)/2)<<1|t<(e+i)/2){case 0:do{a=new Array(4),a[u]=s,s=a}while(c*=2,i=e+c,o=r+c,t>i||n>o);break;case 1:do{a=new Array(4),a[u]=s,s=a}while(c*=2,e=i-c,o=r+c,e>t||n>o);break;case 2:do{a=new Array(4),a[u]=s,s=a}while(c*=2,i=e+c,r=o-c,t>i||r>n);break;case 3:do{a=new Array(4),a[u]=s,s=a}while(c*=2,e=i-c,r=o-c,e>t||r>n);break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},Uc=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},Dc=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},zc=function(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i},Fc=function(t,n,e){var r,i,o,a,u,c,s,l=this._x0,f=this._y0,h=this._x1,p=this._y1,d=[],v=this._root;v&&d.push(new zc(v,l,f,h,p)),null==e?e=1/0:(l=t-e,f=n-e,h=t+e,p=n+e,e*=e);while(c=d.pop())if(!(!(v=c.node)||(i=c.x0)>h||(o=c.y0)>p||(a=c.x1)=g)<<1|t>=y)&&(c=d[d.length-1],d[d.length-1]=d[d.length-1-s],d[d.length-1-s]=c)}else{var _=t-+this._x.call(null,v.data),m=n-+this._y.call(null,v.data),x=_*_+m*m;if(x=(u=(d+y)/2))?d=u:y=u,(l=a>=(c=(v+g)/2))?v=c:g=c,n=p,!(p=p[f=l<<1|s]))return this;if(!p.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,h=f)}while(p.data!==t)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[h]=p:this._root=p),this):(this._root=i,this)};function Rc(t){for(var n=0,e=t.length;nc+p||is+p||ou.index){var d=c-a.x-a.vx,v=s-a.y-a.vy,y=d*d+v*v;yt.r&&(t.r=t[n].r)}function u(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r1?(null==e?u.remove(t):u.set(t,p(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,c,s=0,l=t.length;for(null==r?r=1/0:r*=r,s=0;s1?(s.on(t,e),n):s.on(t)}}},ls=function(){var t,n,e,r,i=Tc(-30),o=1,a=1/0,u=.81;function c(r){var i,o=t.length,a=Wc(t,is,os).visitAfter(l);for(e=r,i=0;i=a)){(t.data!==n||t.next)&&(0===l&&(l=Ac(),p+=l*l),0===f&&(f=Ac(),p+=f*f),p1?r[0]+r.slice(2):r,+t.slice(e+1)]},ds=function(t){return t=ps(Math.abs(t)),t?t[1]:NaN},vs=function(t,n){return function(e,r){var i=e.length,o=[],a=0,u=t[0],c=0;while(i>0&&u>0){if(c+u+1>r&&(u=Math.max(1,r-c)),o.push(e.substring(i-=u,i+u)),(c+=u+1)>r)break;u=t[a=(a+1)%t.length]}return o.reverse().join(n)}},ys=function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}},gs=function(t,n){t=t.toPrecision(n);t:for(var e,r=t.length,i=1,o=-1;i0&&(o=0);break}return o>0?t.slice(0,o)+t.slice(e+1):t},_s=function(t,n){var e=ps(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(as=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ps(t,Math.max(0,n+o-1))[0]},ms=function(t,n){var e=ps(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},xs={"":gs,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return ms(100*t,n)},r:ms,s:_s,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},ws=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function bs(t){return new Ms(t)}function Ms(t){if(!(n=ws.exec(t)))throw new Error("invalid format: "+t);var n,e=n[1]||" ",r=n[2]||">",i=n[3]||"-",o=n[4]||"",a=!!n[5],u=n[6]&&+n[6],c=!!n[7],s=n[8]&&+n[8].slice(1),l=n[9]||"";"n"===l?(c=!0,l="g"):xs[l]||(l=""),(a||"0"===e&&"="===r)&&(a=!0,e="0",r="="),this.fill=e,this.align=r,this.sign=i,this.symbol=o,this.zero=a,this.width=u,this.comma=c,this.precision=s,this.type=l}bs.prototype=Ms.prototype,Ms.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var ks,Ss=function(t){return t},Es=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],Ns=function(t){var n=t.grouping&&t.thousands?vs(t.grouping,t.thousands):Ss,e=t.currency,r=t.decimal,i=t.numerals?ys(t.numerals):Ss,o=t.percent||"%";function a(t){t=bs(t);var a=t.fill,u=t.align,c=t.sign,s=t.symbol,l=t.zero,f=t.width,h=t.comma,p=t.precision,d=t.type,v="$"===s?e[0]:"#"===s&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",y="$"===s?e[1]:/[%p]/.test(d)?o:"",g=xs[d],_=!d||/[defgprs%]/.test(d);function m(t){var e,o,s,m=v,x=y;if("c"===d)x=g(t)+x,t="";else{t=+t;var w=t<0;if(t=g(Math.abs(t),p),w&&0===+t&&(w=!1),m=(w?"("===c?c:"-":"-"===c||"("===c?"":c)+m,x=x+("s"===d?Es[8+as/3]:"")+(w&&"("===c?")":""),_){e=-1,o=t.length;while(++es||s>57){x=(46===s?r+t.slice(e+1):t.slice(e))+x,t=t.slice(0,e);break}}}h&&!l&&(t=n(t,1/0));var b=m.length+t.length+x.length,M=b>1)+m+t+x+M.slice(b);break;default:t=M+m+t+x;break}return i(t)}return p=null==p?d?6:12:/[gprs]/.test(d)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),m.toString=function(){return t+""},m}function u(t,n){var e=a((t=bs(t),t.type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(ds(n)/3))),i=Math.pow(10,-r),o=Es[8+r/3];return function(t){return e(i*t)+o}}return{format:a,formatPrefix:u}};function Ts(n){return ks=Ns(n),t.format=ks.format,t.formatPrefix=ks.formatPrefix,ks}Ts({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var As=function(t){return Math.max(0,-ds(Math.abs(t)))},Cs=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(ds(n)/3)))-ds(Math.abs(t)))},Os=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,ds(n)-ds(t))+1},Ps=function(){return new Ls};function Ls(){this.reset()}Ls.prototype={constructor:Ls,reset:function(){this.s=this.t=0},add:function(t){Ds(Us,t,this.t),Ds(this,Us.s,this.s),this.s?this.t+=Us.t:this.s=Us.t},valueOf:function(){return this.s}};var Us=new Ls;function Ds(t,n,e){var r=t.s=n+e,i=r-n,o=r-i;t.t=n-o+(e-i)}var zs=1e-6,Fs=1e-12,js=Math.PI,Rs=js/2,Is=js/4,qs=2*js,Bs=180/js,Hs=js/180,Vs=Math.abs,Ys=Math.atan,Xs=Math.atan2,Gs=Math.cos,Ws=Math.ceil,$s=Math.exp,Zs=Math.log,Js=Math.pow,Qs=Math.sin,Ks=Math.sign||function(t){return t>0?1:t<0?-1:0},tl=Math.sqrt,nl=Math.tan;function el(t){return t>1?0:t<-1?js:Math.acos(t)}function rl(t){return t>1?Rs:t<-1?-Rs:Math.asin(t)}function il(t){return(t=Qs(t/2))*t}function ol(){}function al(t,n){t&&cl.hasOwnProperty(t.type)&&cl[t.type](t,n)}var ul={Feature:function(t,n){al(t.geometry,n)},FeatureCollection:function(t,n){var e=t.features,r=-1,i=e.length;while(++r=0?1:-1,i=r*e,o=Gs(n),a=Qs(n),u=vl*a,c=dl*o+u*Gs(i),s=u*r*Qs(i);gl.add(Xs(s,c)),pl=t,dl=o,vl=a}var kl,Sl,El,Nl,Tl,Al,Cl,Ol,Pl=function(t){return _l.reset(),yl(t,ml),2*_l};function Ll(t){return[Xs(t[1],t[0]),rl(t[2])]}function Ul(t){var n=t[0],e=t[1],r=Gs(e);return[r*Gs(n),r*Qs(n),Qs(e)]}function Dl(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function zl(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Fl(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function jl(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Rl(t){var n=tl(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Il,ql,Bl=Ps(),Hl={point:Vl,lineStart:Xl,lineEnd:Gl,polygonStart:function(){Hl.point=Wl,Hl.lineStart=$l,Hl.lineEnd=Zl,Bl.reset(),ml.polygonStart()},polygonEnd:function(){ml.polygonEnd(),Hl.point=Vl,Hl.lineStart=Xl,Hl.lineEnd=Gl,gl<0?(kl=-(El=180),Sl=-(Nl=90)):Bl>zs?Nl=90:Bl<-zs&&(Sl=-90),ql[0]=kl,ql[1]=El}};function Vl(t,n){Il.push(ql=[kl=t,El=t]),nNl&&(Nl=n)}function Yl(t,n){var e=Ul([t*Hs,n*Hs]);if(Ol){var r=zl(Ol,e),i=[r[1],-r[0],0],o=zl(i,r);Rl(o),o=Ll(o);var a,u=t-Tl,c=u>0?1:-1,s=o[0]*Bs*c,l=Vs(u)>180;l^(c*TlNl&&(Nl=a)):(s=(s+360)%360-180,l^(c*TlNl&&(Nl=n))),l?tJl(kl,El)&&(El=t):Jl(t,El)>Jl(kl,El)&&(kl=t):El>=kl?(tEl&&(El=t)):t>Tl?Jl(kl,t)>Jl(kl,El)&&(El=t):Jl(t,El)>Jl(kl,El)&&(kl=t)}else Il.push(ql=[kl=t,El=t]);nNl&&(Nl=n),Ol=e,Tl=t}function Xl(){Hl.point=Yl}function Gl(){ql[0]=kl,ql[1]=El,Hl.point=Vl,Ol=null}function Wl(t,n){if(Ol){var e=t-Tl;Bl.add(Vs(e)>180?e+(e>0?360:-360):e)}else Al=t,Cl=n;ml.point(t,n),Yl(t,n)}function $l(){ml.lineStart()}function Zl(){Wl(Al,Cl),ml.lineEnd(),Vs(Bl)>zs&&(kl=-(El=180)),ql[0]=kl,ql[1]=El,Ol=null}function Jl(t,n){return(n-=t)<0?n+360:n}function Ql(t,n){return t[0]-n[0]}function Kl(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:nJl(r[0],r[1])&&(r[1]=i[1]),Jl(i[0],r[1])>Jl(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=o.length-1,n=0,r=o[e];n<=e;r=i,++n)i=o[n],(u=Jl(r[1],i[0]))>a&&(a=u,kl=i[0],El=r[1])}return Il=ql=null,kl===1/0||Sl===1/0?[[NaN,NaN],[NaN,NaN]]:[[kl,Sl],[El,Nl]]},_f={sphere:ol,point:mf,lineStart:wf,lineEnd:kf,polygonStart:function(){_f.lineStart=Sf,_f.lineEnd=Ef},polygonEnd:function(){_f.lineStart=wf,_f.lineEnd=kf}};function mf(t,n){t*=Hs,n*=Hs;var e=Gs(n);xf(e*Gs(t),e*Qs(t),Qs(n))}function xf(t,n,e){++tf,ef+=(t-ef)/tf,rf+=(n-rf)/tf,of+=(e-of)/tf}function wf(){_f.point=bf}function bf(t,n){t*=Hs,n*=Hs;var e=Gs(n);df=e*Gs(t),vf=e*Qs(t),yf=Qs(n),_f.point=Mf,xf(df,vf,yf)}function Mf(t,n){t*=Hs,n*=Hs;var e=Gs(n),r=e*Gs(t),i=e*Qs(t),o=Qs(n),a=Xs(tl((a=vf*o-yf*i)*a+(a=yf*r-df*o)*a+(a=df*i-vf*r)*a),df*r+vf*i+yf*o);nf+=a,af+=a*(df+(df=r)),uf+=a*(vf+(vf=i)),cf+=a*(yf+(yf=o)),xf(df,vf,yf)}function kf(){_f.point=mf}function Sf(){_f.point=Nf}function Ef(){Tf(hf,pf),_f.point=mf}function Nf(t,n){hf=t,pf=n,t*=Hs,n*=Hs,_f.point=Tf;var e=Gs(n);df=e*Gs(t),vf=e*Qs(t),yf=Qs(n),xf(df,vf,yf)}function Tf(t,n){t*=Hs,n*=Hs;var e=Gs(n),r=e*Gs(t),i=e*Qs(t),o=Qs(n),a=vf*o-yf*i,u=yf*r-df*o,c=df*i-vf*r,s=tl(a*a+u*u+c*c),l=rl(s),f=s&&-l/s;sf+=f*a,lf+=f*u,ff+=f*c,nf+=l,af+=l*(df+(df=r)),uf+=l*(vf+(vf=i)),cf+=l*(yf+(yf=o)),xf(df,vf,yf)}var Af=function(t){tf=nf=ef=rf=of=af=uf=cf=sf=lf=ff=0,yl(t,_f);var n=sf,e=lf,r=ff,i=n*n+e*e+r*r;return ijs?t-qs:t<-js?t+qs:t,n]}function Lf(t,n,e){return(t%=qs)?n||e?Of(Df(t),zf(n,e)):Df(t):n||e?zf(n,e):Pf}function Uf(t){return function(n,e){return n+=t,[n>js?n-qs:n<-js?n+qs:n,e]}}function Df(t){var n=Uf(t);return n.invert=Uf(-t),n}function zf(t,n){var e=Gs(t),r=Qs(t),i=Gs(n),o=Qs(n);function a(t,n){var a=Gs(n),u=Gs(t)*a,c=Qs(t)*a,s=Qs(n),l=s*e+u*r;return[Xs(c*i-l*o,u*e-s*r),rl(l*i+c*o)]}return a.invert=function(t,n){var a=Gs(n),u=Gs(t)*a,c=Qs(t)*a,s=Qs(n),l=s*i-c*o;return[Xs(c*i+s*o,u*e+l*r),rl(l*e-u*r)]},a}Pf.invert=Pf;var Ff=function(t){function n(n){return n=t(n[0]*Hs,n[1]*Hs),n[0]*=Bs,n[1]*=Bs,n}return t=Lf(t[0]*Hs,t[1]*Hs,t.length>2?t[2]*Hs:0),n.invert=function(n){return n=t.invert(n[0]*Hs,n[1]*Hs),n[0]*=Bs,n[1]*=Bs,n},n};function jf(t,n,e,r,i,o){if(e){var a=Gs(n),u=Qs(n),c=r*e;null==i?(i=n+r*qs,o=n-c/2):(i=Rf(a,i),o=Rf(a,o),(r>0?io)&&(i+=r*qs));for(var s,l=i;r>0?l>o:l1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}},Bf=function(t,n,e,r,i,o){var a,u=t[0],c=t[1],s=n[0],l=n[1],f=0,h=1,p=s-u,d=l-c;if(a=e-u,p||!(a>0)){if(a/=p,p<0){if(a0){if(a>h)return;a>f&&(f=a)}if(a=i-u,p||!(a<0)){if(a/=p,p<0){if(a>h)return;a>f&&(f=a)}else if(p>0){if(a0)){if(a/=d,d<0){if(a0){if(a>h)return;a>f&&(f=a)}if(a=o-c,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>f&&(f=a)}else if(d>0){if(a0&&(t[0]=u+f*p,t[1]=c+f*d),h<1&&(n[0]=u+h*p,n[1]=c+h*d),!0}}}}},Hf=function(t,n){return Vs(t[0]-n[0])=0;--o)i.point((l=s[o])[0],l[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,s=h.z,p=!p}while(!h.v);i.lineEnd()}}};function Xf(t){if(n=t.length){var n,e,r=0,i=t[0];while(++r0)do{s.point(0===l||3===l?t:e,l>1?r:n)}while((l=(l+u+4)%4)!==f);else s.point(o[0],o[1])}function a(r,i){return Vs(r[0]-t)0?0:3:Vs(r[0]-e)0?2:1:Vs(r[1]-n)0?1:0:i>0?3:2}function u(t,n){return c(t.x,n.x)}function c(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var c,s,l,f,h,p,d,v,y,g,_,m=a,x=qf(),w={point:b,lineStart:E,lineEnd:N,polygonStart:k,polygonEnd:S};function b(t,n){i(t,n)&&m.point(t,n)}function M(){for(var n=0,e=0,i=s.length;er&&(h-o)*(r-a)>(p-a)*(t-o)&&++n:p<=r&&(h-o)*(r-a)<(p-a)*(t-o)&&--n;return n}function k(){m=x,c=[],s=[],_=!0}function S(){var t=M(),n=_&&t,e=(c=z(c)).length;(n||e)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),e&&Yf(c,u,t,o,a),a.polygonEnd()),m=a,c=s=l=null}function E(){w.point=T,s&&s.push(l=[]),g=!0,y=!1,d=v=NaN}function N(){c&&(T(f,h),p&&y&&x.rejoin(),c.push(x.result())),w.point=b,y&&m.lineEnd()}function T(o,a){var u=i(o,a);if(s&&l.push([o,a]),g)f=o,h=a,p=u,g=!1,u&&(m.lineStart(),m.point(o,a));else if(u&&y)m.point(o,a);else{var c=[d=Math.max(Wf,Math.min(Gf,d)),v=Math.max(Wf,Math.min(Gf,v))],x=[o=Math.max(Wf,Math.min(Gf,o)),a=Math.max(Wf,Math.min(Gf,a))];Bf(c,x,t,n,e,r)?(y||(m.lineStart(),m.point(c[0],c[1])),m.point(x[0],x[1]),u||m.lineEnd(),_=!1):u&&(m.lineStart(),m.point(o,a),_=!1)}d=o,v=a,y=u}return w}}var Zf,Jf,Qf,Kf=function(){var t,n,e,r=0,i=0,o=960,a=500;return e={stream:function(e){return t&&n===e?t:t=$f(r,i,o,a)(n=e)},extent:function(u){return arguments.length?(r=+u[0][0],i=+u[0][1],o=+u[1][0],a=+u[1][1],t=n=null,e):[[r,i],[o,a]]}}},th=Ps(),nh=function(t,n){var e=n[0],r=n[1],i=[Qs(e),-Gs(e),0],o=0,a=0;th.reset();for(var u=0,c=t.length;u=0?1:-1,k=M*b,S=k>js,E=d*x;if(th.add(Xs(E*M*Qs(k),v*w+E*Gs(k))),o+=S?b+M*qs:b,S^h>=e^_>=e){var N=zl(Ul(f),Ul(g));Rl(N);var T=zl(i,N);Rl(T);var A=(S^b>=0?-1:1)*rl(T[2]);(r>A||r===A&&(N[0]||N[1]))&&(a+=S^b>=0?1:-1)}}return(o<-zs||ozs})).map(c)).concat(w(Ws(o/p)*p,i,p).filter((function(t){return Vs(t%v)>zs})).map(s))}return g.lines=function(){return _().map((function(t){return{type:"LineString",coordinates:t}}))},g.outline=function(){return{type:"Polygon",coordinates:[l(r).concat(f(a).slice(1),l(e).reverse().slice(1),f(u).reverse().slice(1))]}},g.extent=function(t){return arguments.length?g.extentMajor(t).extentMinor(t):g.extentMinor()},g.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],u=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),g.precision(y)):[[r,u],[e,a]]},g.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],o=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),g.precision(y)):[[n,o],[t,i]]},g.step=function(t){return arguments.length?g.stepMajor(t).stepMinor(t):g.stepMinor()},g.stepMajor=function(t){return arguments.length?(d=+t[0],v=+t[1],g):[d,v]},g.stepMinor=function(t){return arguments.length?(h=+t[0],p=+t[1],g):[h,p]},g.precision=function(h){return arguments.length?(y=+h,c=wh(o,i,90),s=bh(n,t,y),l=wh(u,a,90),f=bh(r,e,y),g):y},g.extentMajor([[-180,-90+zs],[180,90-zs]]).extentMinor([[-180,-80-zs],[180,80+zs]])}function kh(){return Mh()()}var Sh,Eh,Nh,Th,Ah=function(t,n){var e=t[0]*Hs,r=t[1]*Hs,i=n[0]*Hs,o=n[1]*Hs,a=Gs(r),u=Qs(r),c=Gs(o),s=Qs(o),l=a*Gs(e),f=a*Qs(e),h=c*Gs(i),p=c*Qs(i),d=2*rl(tl(il(o-r)+a*c*il(i-e))),v=Qs(d),y=d?function(t){var n=Qs(t*=d)/v,e=Qs(d-t)/v,r=e*l+n*h,i=e*f+n*p,o=e*u+n*s;return[Xs(i,r)*Bs,Xs(o,tl(r*r+i*i))*Bs]}:function(){return[e*Bs,r*Bs]};return y.distance=d,y},Ch=function(t){return t},Oh=Ps(),Ph=Ps(),Lh={point:ol,lineStart:ol,lineEnd:ol,polygonStart:function(){Lh.lineStart=Uh,Lh.lineEnd=Fh},polygonEnd:function(){Lh.lineStart=Lh.lineEnd=Lh.point=ol,Oh.add(Vs(Ph)),Ph.reset()},result:function(){var t=Oh/2;return Oh.reset(),t}};function Uh(){Lh.point=Dh}function Dh(t,n){Lh.point=zh,Sh=Nh=t,Eh=Th=n}function zh(t,n){Ph.add(Th*t-Nh*n),Nh=t,Th=n}function Fh(){zh(Sh,Eh)}var jh=1/0,Rh=jh,Ih=-jh,qh=Ih,Bh={point:Hh,lineStart:ol,lineEnd:ol,polygonStart:ol,polygonEnd:ol,result:function(){var t=[[jh,Rh],[Ih,qh]];return Ih=qh=-(Rh=jh=1/0),t}};function Hh(t,n){tIh&&(Ih=t),nqh&&(qh=n)}var Vh,Yh,Xh,Gh,Wh=0,$h=0,Zh=0,Jh=0,Qh=0,Kh=0,tp=0,np=0,ep=0,rp={point:ip,lineStart:op,lineEnd:cp,polygonStart:function(){rp.lineStart=sp,rp.lineEnd=lp},polygonEnd:function(){rp.point=ip,rp.lineStart=op,rp.lineEnd=cp},result:function(){var t=ep?[tp/ep,np/ep]:Kh?[Jh/Kh,Qh/Kh]:Zh?[Wh/Zh,$h/Zh]:[NaN,NaN];return Wh=$h=Zh=Jh=Qh=Kh=tp=np=ep=0,t}};function ip(t,n){Wh+=t,$h+=n,++Zh}function op(){rp.point=ap}function ap(t,n){rp.point=up,ip(Xh=t,Gh=n)}function up(t,n){var e=t-Xh,r=n-Gh,i=tl(e*e+r*r);Jh+=i*(Xh+t)/2,Qh+=i*(Gh+n)/2,Kh+=i,ip(Xh=t,Gh=n)}function cp(){rp.point=ip}function sp(){rp.point=fp}function lp(){hp(Vh,Yh)}function fp(t,n){rp.point=hp,ip(Vh=Xh=t,Yh=Gh=n)}function hp(t,n){var e=t-Xh,r=n-Gh,i=tl(e*e+r*r);Jh+=i*(Xh+t)/2,Qh+=i*(Gh+n)/2,Kh+=i,i=Gh*t-Xh*n,tp+=i*(Xh+t),np+=i*(Gh+n),ep+=3*i,ip(Xh=t,Gh=n)}function pp(t){this._context=t}pp.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,qs);break}},result:ol};var dp,vp,yp,gp,_p,mp=Ps(),xp={point:ol,lineStart:function(){xp.point=wp},lineEnd:function(){dp&&bp(vp,yp),xp.point=ol},polygonStart:function(){dp=!0},polygonEnd:function(){dp=null},result:function(){var t=+mp;return mp.reset(),t}};function wp(t,n){xp.point=bp,vp=gp=t,yp=_p=n}function bp(t,n){gp-=t,_p-=n,mp.add(tl(gp*gp+_p*_p)),gp=t,_p=n}function Mp(){this._string=[]}function kp(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}Mp.prototype={_radius:4.5,_circle:kp(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=kp(this._radius)),this._string.push("M",t,",",n,this._circle);break}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}};var Sp=function(t,n){var e,r,i=4.5;function o(t){return t&&("function"===typeof i&&r.pointRadius(+i.apply(this,arguments)),yl(t,e(r))),r.result()}return o.area=function(t){return yl(t,e(Lh)),Lh.result()},o.measure=function(t){return yl(t,e(xp)),xp.result()},o.bounds=function(t){return yl(t,e(Bh)),Bh.result()},o.centroid=function(t){return yl(t,e(rp)),rp.result()},o.projection=function(n){return arguments.length?(e=null==n?(t=null,Ch):(t=n).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(n=null,new Mp):new pp(n=t),"function"!==typeof i&&r.pointRadius(i),o):n},o.pointRadius=function(t){return arguments.length?(i="function"===typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(n)},Ep=function(t,n,e,r){return function(i,o){var a,u,c,s=n(o),l=i.invert(r[0],r[1]),f=qf(),h=n(f),p=!1,d={point:v,lineStart:g,lineEnd:_,polygonStart:function(){d.point=m,d.lineStart=x,d.lineEnd=w,u=[],a=[]},polygonEnd:function(){d.point=v,d.lineStart=g,d.lineEnd=_,u=z(u);var t=nh(a,l);u.length?(p||(o.polygonStart(),p=!0),Yf(u,Tp,t,e,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),u=a=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function v(n,e){var r=i(n,e);t(n=r[0],e=r[1])&&o.point(n,e)}function y(t,n){var e=i(t,n);s.point(e[0],e[1])}function g(){d.point=y,s.lineStart()}function _(){d.point=v,s.lineEnd()}function m(t,n){c.push([t,n]);var e=i(t,n);h.point(e[0],e[1])}function x(){h.lineStart(),c=[]}function w(){m(c[0][0],c[0][1]),h.lineEnd();var t,n,e,r,i=h.clean(),s=f.result(),l=s.length;if(c.pop(),a.push(c),c=null,l)if(1&i){if(e=s[0],(n=e.length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t1&&2&i&&s.push(s.pop().concat(s.shift())),u.push(s.filter(Np))}return d}};function Np(t){return t.length>1}function Tp(t,n){return((t=t.x)[0]<0?t[1]-Rs-zs:Rs-t[1])-((n=n.x)[0]<0?n[1]-Rs-zs:Rs-n[1])}var Ap=Ep((function(){return!0}),Cp,Pp,[-js,-Rs]);function Cp(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?js:-js,c=Vs(o-e);Vs(c-js)0?Rs:-Rs),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&c>=js&&(Vs(e-i)zs?Ys((Qs(n)*(o=Gs(r))*Qs(e)-Qs(r)*(i=Gs(n))*Qs(t))/(i*o*a)):(n+r)/2}function Pp(t,n,e,r){var i;if(null==t)i=e*Rs,r.point(-js,i),r.point(0,i),r.point(js,i),r.point(js,0),r.point(js,-i),r.point(0,-i),r.point(-js,-i),r.point(-js,0),r.point(-js,i);else if(Vs(t[0]-n[0])>zs){var o=t[0]0,i=Vs(e)>zs;function o(e,r,i,o){jf(o,t,n,i,e,r)}function a(t,n){return Gs(t)*Gs(n)>e}function u(t){var n,e,o,u,l;return{lineStart:function(){u=o=!1,l=1},point:function(f,h){var p,d=[f,h],v=a(f,h),y=r?v?0:s(f,h):v?s(f+(f<0?js:-js),h):0;if(!n&&(u=o=v)&&t.lineStart(),v!==o&&(p=c(n,d),(!p||Hf(n,p)||Hf(d,p))&&(d[0]+=zs,d[1]+=zs,v=a(d[0],d[1]))),v!==o)l=0,v?(t.lineStart(),p=c(d,n),t.point(p[0],p[1])):(p=c(n,d),t.point(p[0],p[1]),t.lineEnd()),n=p;else if(i&&n&&r^v){var g;y&e||!(g=c(d,n,!0))||(l=0,r?(t.lineStart(),t.point(g[0][0],g[0][1]),t.point(g[1][0],g[1][1]),t.lineEnd()):(t.point(g[1][0],g[1][1]),t.lineEnd(),t.lineStart(),t.point(g[0][0],g[0][1])))}!v||n&&Hf(n,d)||t.point(d[0],d[1]),n=d,o=v,e=y},lineEnd:function(){o&&t.lineEnd(),n=null},clean:function(){return l|(u&&o)<<1}}}function c(t,n,r){var i=Ul(t),o=Ul(n),a=[1,0,0],u=zl(i,o),c=Dl(u,u),s=u[0],l=c-s*s;if(!l)return!r&&t;var f=e*c/l,h=-e*s/l,p=zl(a,u),d=jl(a,f),v=jl(u,h);Fl(d,v);var y=p,g=Dl(d,y),_=Dl(y,y),m=g*g-_*(Dl(d,d)-1);if(!(m<0)){var x=tl(m),w=jl(y,(-g-x)/_);if(Fl(w,d),w=Ll(w),!r)return w;var b,M=t[0],k=n[0],S=t[1],E=n[1];k0^w[1]<(Vs(w[0]-M)js^(M<=w[0]&&w[0]<=k)){var C=jl(y,(-g+x)/_);return Fl(C,d),[w,Ll(C)]}}}function s(n,e){var i=r?t:js-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return Ep(a,u,o,r?[0,-t]:[-js,t-js])},Up=function(t){return{stream:Dp(t)}};function Dp(t){return function(n){var e=new zp;for(var r in t)e[r]=t[r];return e.stream=n,e}}function zp(){}function Fp(t,n,e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),yl(e,t.stream(Bh));var a=Bh.result(),u=Math.min(r/(a[1][0]-a[0][0]),i/(a[1][1]-a[0][1])),c=+n[0][0]+(r-u*(a[1][0]+a[0][0]))/2,s=+n[0][1]+(i-u*(a[1][1]+a[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*u).translate([c,s])}function jp(t,n,e){return Fp(t,[[0,0],n],e)}zp.prototype={constructor:zp,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Rp=16,Ip=Gs(30*Hs),qp=function(t,n){return+n?Hp(t,n):Bp(t)};function Bp(t){return Dp({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}function Hp(t,n){function e(r,i,o,a,u,c,s,l,f,h,p,d,v,y){var g=s-r,_=l-i,m=g*g+_*_;if(m>4*n&&v--){var x=a+h,w=u+p,b=c+d,M=tl(x*x+w*w+b*b),k=rl(b/=M),S=Vs(Vs(b)-1)n||Vs((g*A+_*C)/m-.5)>.3||a*h+u*p+c*d2?t[2]%360*Hs:0,T()):[y*Bs,g*Bs,_*Bs]},S.precision=function(t){return arguments.length?(k=qp(N,M=t*t),A()):tl(M)},S.fitExtent=function(t,n){return Fp(S,t,n)},S.fitSize=function(t,n){return jp(S,t,n)},function(){return n=t.apply(this,arguments),S.invert=n.invert&&E,T()}}function Gp(t){var n=0,e=js/3,r=Xp(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Hs,e=t[1]*Hs):[n*Bs,e*Bs]},i}function Wp(t){var n=Gs(t);function e(t,e){return[t*n,Qs(e)/n]}return e.invert=function(t,e){return[t/n,rl(e*n)]},e}function $p(t,n){var e=Qs(t),r=(e+Qs(n))/2;if(Vs(r)=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?c:a).invert(t)},l.stream=function(e){return t&&n===e?t:t=Qp([a.stream(n=e),u.stream(e),c.stream(e)])},l.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),c.precision(t),f()):a.precision()},l.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),c.scale(t),l.translate(a.translate())):a.scale()},l.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],l=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,l-.238*n],[o+.455*n,l+.238*n]]).stream(s),r=u.translate([o-.307*n,l+.201*n]).clipExtent([[o-.425*n+zs,l+.12*n+zs],[o-.214*n-zs,l+.234*n-zs]]).stream(s),i=c.translate([o-.205*n,l+.212*n]).clipExtent([[o-.214*n+zs,l+.166*n+zs],[o-.115*n-zs,l+.234*n-zs]]).stream(s),f()},l.fitExtent=function(t,n){return Fp(l,t,n)},l.fitSize=function(t,n){return jp(l,t,n)},l.scale(1070)};function td(t){return function(n,e){var r=Gs(n),i=Gs(e),o=t(r*i);return[o*i*Qs(n),o*Qs(e)]}}function nd(t){return function(n,e){var r=tl(n*n+e*e),i=t(r),o=Qs(i),a=Gs(i);return[Xs(n*o,r*a),rl(r&&e*o/r)]}}var ed=td((function(t){return tl(2/(1+t))}));ed.invert=nd((function(t){return 2*rl(t/2)}));var rd=function(){return Yp(ed).scale(124.75).clipAngle(179.999)},id=td((function(t){return(t=el(t))&&t/Qs(t)}));id.invert=nd((function(t){return t}));var od=function(){return Yp(id).scale(79.4188).clipAngle(179.999)};function ad(t,n){return[t,Zs(nl((Rs+n)/2))]}ad.invert=function(t,n){return[t,2*Ys($s(n))-Rs]};var ud=function(){return cd(ad).scale(961/qs)};function cd(t){var n,e,r,i=Yp(t),o=i.center,a=i.scale,u=i.translate,c=i.clipExtent,s=null;function l(){var o=js*a(),u=i(Ff(i.rotate()).invert([0,0]));return c(null==s?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===ad?[[Math.max(u[0]-o,s),n],[Math.min(u[0]+o,e),r]]:[[s,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),l()):a()},i.translate=function(t){return arguments.length?(u(t),l()):u()},i.center=function(t){return arguments.length?(o(t),l()):o()},i.clipExtent=function(t){return arguments.length?(null==t?s=n=e=r=null:(s=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),l()):null==s?null:[[s,n],[e,r]]},l()}function sd(t){return nl((Rs+t)/2)}function ld(t,n){var e=Gs(t),r=t===n?Qs(t):Zs(e/Gs(n))/Zs(sd(n)/sd(t)),i=e*Js(sd(t),r)/r;if(!r)return ad;function o(t,n){i>0?n<-Rs+zs&&(n=-Rs+zs):n>Rs-zs&&(n=Rs-zs);var e=i/Js(sd(n),r);return[e*Qs(r*t),i-e*Gs(r*t)]}return o.invert=function(t,n){var e=i-n,o=Ks(r)*tl(t*t+e*e);return[Xs(t,Vs(e))/r*Ks(e),2*Ys(Js(i/o,1/r))-Rs]},o}var fd=function(){return Gp(ld).scale(109.5).parallels([30,30])};function hd(t,n){return[t,n]}hd.invert=hd;var pd=function(){return Yp(hd).scale(152.63)};function dd(t,n){var e=Gs(t),r=t===n?Qs(t):(e-Gs(n))/(n-t),i=e/r+t;if(Vs(r)2?t[2]+90:90]):(t=e(),[t[0],t[1],t[2]-90])},e([0,0,90]).scale(159.155)};function Ed(t,n){return t.parent===n.parent?1:2}function Nd(t){return t.reduce(Td,0)/t.length}function Td(t,n){return t+n.x}function Ad(t){return 1+t.reduce(Cd,0)}function Cd(t,n){return Math.max(t,n.y)}function Od(t){var n;while(n=t.children)t=n[0];return t}function Pd(t){var n;while(n=t.children)t=n[n.length-1];return t}var Ld=function(){var t=Ed,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=Nd(e),n.y=Ad(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=Od(i),c=Pd(i),s=u.x-t(u,c)/2,l=c.x+t(c,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-s)/(l-s)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i};function Ud(t){var n=0,e=t.children,r=e&&e.length;if(r)while(--r>=0)n+=e[r].value;else n=1;t.value=n}var Dd=function(){return this.eachAfter(Ud)},zd=function(t){var n,e,r,i,o=this,a=[o];do{n=a.reverse(),a=[];while(o=n.pop())if(t(o),e=o.children,e)for(r=0,i=e.length;r=0;--e)i.push(n[e]);return this},jd=function(t){var n,e,r,i=this,o=[i],a=[];while(i=o.pop())if(a.push(i),n=i.children,n)for(e=0,r=n.length;e=0)e+=r[i].value;n.value=e}))},Id=function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},qd=function(t){var n=this,e=Bd(n,t),r=[n];while(n!==e)n=n.parent,r.push(n);var i=r.length;while(t!==e)r.splice(i,0,t),t=t.parent;return r};function Bd(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();while(t===n)i=t,t=e.pop(),n=r.pop();return i}var Hd=function(){var t=this,n=[t];while(t=t.parent)n.push(t);return n},Vd=function(){var t=[];return this.each((function(n){t.push(n)})),t},Yd=function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},Xd=function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n};function Gd(t,n){var e,r,i,o,a,u=new Qd(t),c=+t.value&&(u.value=t.value),s=[u];null==n&&(n=$d);while(e=s.pop())if(c&&(e.value=+e.data.value),(i=n(e.data))&&(a=i.length))for(e.children=new Array(a),o=a-1;o>=0;--o)s.push(r=e.children[o]=new Qd(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(Jd)}function Wd(){return Gd(this).eachBefore(Zd)}function $d(t){return t.children}function Zd(t){t.data=t.data.data}function Jd(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function Qd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Kd(t){this._=t,this.next=null}Qd.prototype=Gd.prototype={constructor:Qd,count:Dd,each:zd,eachAfter:jd,eachBefore:Fd,sum:Rd,sort:Id,path:qd,ancestors:Hd,descendants:Vd,leaves:Yd,links:Xd,copy:Wd};var tv=function(t){var n,e=(t=t.slice()).length,r=null,i=r;while(e){var o=new Kd(t[e-1]);i=i?i.next=o:r=o,t[n]=t[--e]}return{head:r,tail:i}},nv=function(t){return rv(tv(t),[])};function ev(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r-n.r;return i*i+1e-6>e*e+r*r}function rv(t,n){var e,r,i,o=null,a=t.head;switch(n.length){case 1:e=iv(n[0]);break;case 2:e=ov(n[0],n[1]);break;case 3:e=av(n[0],n[1],n[2]);break}while(a)i=a._,r=a.next,e&&ev(e,i)?o=a:(o?(t.tail=o,o.next=null):t.head=t.tail=null,n.push(i),e=rv(t,n),n.pop(),t.head?(a.next=t.head,t.head=a):(a.next=null,t.head=t.tail=a),o=t.tail,o.next=r),a=r;return t.tail=o,e}function iv(t){return{x:t.x,y:t.y,r:t.r}}function ov(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,c=o-e,s=a-r,l=u-i,f=Math.sqrt(c*c+s*s);return{x:(e+o+c/f*l)/2,y:(r+a+s/f*l)/2,r:(f+i+u)/2}}function av(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,c=n.r,s=e.x,l=e.y,f=e.r,h=2*(r-a),p=2*(i-u),d=2*(c-o),v=r*r+i*i-o*o-a*a-u*u+c*c,y=2*(r-s),g=2*(i-l),_=2*(f-o),m=r*r+i*i-o*o-s*s-l*l+f*f,x=y*p-h*g,w=(p*m-g*v)/x-r,b=(g*d-p*_)/x,M=(y*v-h*m)/x-i,k=(h*_-y*d)/x,S=b*b+k*k-1,E=2*(w*b+M*k+o),N=w*w+M*M-o*o,T=(-E-Math.sqrt(E*E-4*S*N))/(2*S);return{x:w+b*T+r,y:M+k*T+i,r:T}}function uv(t,n,e){var r=t.x,i=t.y,o=n.r+e.r,a=t.r+e.r,u=n.x-r,c=n.y-i,s=u*u+c*c;if(s){var l=.5+((a*=a)-(o*=o))/(2*s),f=Math.sqrt(Math.max(0,2*o*(a+s)-(a-=s)*a-o*o))/(2*s);e.x=r+l*u+f*c,e.y=i+l*c-f*u}else e.x=r+a,e.y=i}function cv(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return i*i-1e-6>e*e+r*r}function sv(t,n,e){var r=t._,i=t.next._,o=r.r+i.r,a=(r.x*i.r+i.x*r.r)/o-n,u=(r.y*i.r+i.y*r.r)/o-e;return a*a+u*u}function lv(t){this._=t,this.next=null,this.previous=null}function fv(t){if(!(i=t.length))return 0;var n,e,r,i;if(n=t[0],n.x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;uv(e,n,r=t[2]);var o,a,u,c,s,l,f,h=n.r*n.r,p=e.r*e.r,d=r.r*r.r,v=h+p+d,y=h*n.x+p*e.x+d*r.x,g=h*n.y+p*e.y+d*r.y;n=new lv(n),e=new lv(e),r=new lv(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(u=3;u0)throw new Error("cycle");return o}return e.id=function(n){return arguments.length?(t=dv(n),e):t},e.parentId=function(t){return arguments.length?(n=dv(t),e):n},e};function Ov(t,n){return t.parent===n.parent?1:2}function Pv(t){var n=t.children;return n?n[0]:t.t}function Lv(t){var n=t.children;return n?n[n.length-1]:t.t}function Uv(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Dv(t){var n,e=0,r=0,i=t.children,o=i.length;while(--o>=0)n=i[o],n.z+=e,n.m+=e,e+=n.s+(r+=n.c)}function zv(t,n,e){return t.a.parent===n.parent?t.a:e}function Fv(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function jv(t){var n,e,r,i,o,a=new Fv(t,0),u=[a];while(n=u.pop())if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new Fv(r[i],i)),e.parent=n;return(a.parent=new Fv(null,0)).children=[a],a}Fv.prototype=Object.create(Qd.prototype);var Rv=function(){var t=Ov,n=1,e=1,r=null;function i(i){var u=jv(i);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),r)i.eachBefore(c);else{var s=i,l=i,f=i;i.eachBefore((function(t){t.xl.x&&(l=t),t.depth>f.depth&&(f=t)}));var h=s===l?1:t(s,l)/2,p=h-s.x,d=n/(l.x+h+p),v=e/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+p)*d,t.y=t.depth*v}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){Dv(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=u(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(n,e,r){if(e){var i,o=n,a=n,u=e,c=o.parent.children[0],s=o.m,l=a.m,f=u.m,h=c.m;while(u=Lv(u),o=Pv(o),u&&o)c=Pv(c),a=Lv(a),a.a=n,i=u.z+f-o.z-s+t(u._,o._),i>0&&(Uv(zv(u,n,r),n,i),s+=i,l+=i),f+=u.m,s+=o.m,h+=c.m,l+=a.m;u&&!Lv(a)&&(a.t=u,a.m+=f-l),o&&!Pv(c)&&(c.t=o,c.m+=s-h,r=n)}return r}function c(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},Iv=function(t,n,e,r,i){var o,a=t.children,u=-1,c=a.length,s=t.value&&(i-e)/t.value;while(++uh&&(h=u),y=l*l*v,p=Math.max(h/y,y/f),p>d){l-=u;break}d=p}g.push(a={value:l,dice:c1?n:1)},e}(qv),Vv=function(){var t=Hv,n=!1,e=1,r=1,i=[0],o=vv,a=vv,u=vv,c=vv,s=vv;function l(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(bv),t}function f(n){var e=i[n.depth],r=n.x0+e,l=n.y0+e,f=n.x1-e,h=n.y1-e;f=n-1){var c=u[t];return c.x0=r,c.y0=i,c.x1=o,void(c.y1=a)}var f=s[t],h=e/2+f,p=t+1,d=n-1;while(p>>1;s[v]a-i){var _=(r*g+o*y)/e;l(t,p,y,r,i,_,a),l(p,n,g,_,i,o,a)}else{var m=(i*g+a*y)/e;l(t,p,y,r,i,o,m),l(p,n,g,r,m,o,a)}}l(0,c,t.value,n,e,r,i)},Xv=function(t,n,e,r,i){(1&t.depth?Iv:Mv)(t,n,e,r,i)},Gv=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n){var a,u,c,s,l,f=-1,h=a.length,p=t.value;while(++f1?n:1)},e}(qv),Wv=function(t){var n,e=-1,r=t.length,i=t[r-1],o=0;while(++e1&&Zv(t[e[r-2]],t[e[r-1]],t[i])<=0)--r;e[r++]=i}return e.slice(0,r)}var Kv=function(t){if((e=t.length)<3)return null;var n,e,r=new Array(e),i=new Array(e);for(n=0;n=0;--n)s.push(t[r[o[n]][2]]);for(n=+u;nu!==s>u&&a<(c-e)*(u-r)/(s-r)+e&&(l=!l),c=e,s=r;return l},ny=function(t){var n,e,r=-1,i=t.length,o=t[i-1],a=o[0],u=o[1],c=0;while(++r=0)if((e=t._tasks[r])&&(t._tasks[r]=null,e.abort))try{e.abort()}catch(n){}t._active=NaN,sy(t)}function sy(t){if(!t._active&&t._call){var n=t._data;t._data=void 0,t._call(t._error,n)}}function ly(t){if(null==t)t=1/0;else if(!((t=+t)>=1))throw new Error("invalid concurrency");return new iy(t)}iy.prototype=ly.prototype={constructor:iy,defer:function(t){if("function"!==typeof t)throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(null!=this._error)return this;var n=ey.call(arguments,1);return n.push(t),++this._waiting,this._tasks.push(n),oy(this),this},abort:function(){return null==this._error&&cy(this,new Error("abort")),this},await:function(t){if("function"!==typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(n,e){t.apply(null,[n].concat(e))},sy(this),this},awaitAll:function(t){if("function"!==typeof t)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=t,sy(this),this}};var fy=function(){return Math.random()},hy=function t(n){function e(t,e){return t=null==t?0:+t,e=null==e?1:+e,1===arguments.length?(e=t,t=0):e-=t,function(){return n()*e+t}}return e.source=t,e}(fy),py=function t(n){function e(t,e){var r,i;return t=null==t?0:+t,e=null==e?1:+e,function(){var o;if(null!=r)o=r,r=null;else do{r=2*n()-1,o=2*n()-1,i=r*r+o*o}while(!i||i>1);return t+e*o*Math.sqrt(-2*Math.log(i)/i)}}return e.source=t,e}(fy),dy=function t(n){function e(){var t=py.source(n).apply(this,arguments);return function(){return Math.exp(t())}}return e.source=t,e}(fy),vy=function t(n){function e(t){return function(){for(var e=0,r=0;r=200&&r<300||304===r){if(i)try{n=i.call(e,c)}catch(o){return void a.call("error",e,o)}else n=c;a.call("load",e,n)}else a.call("error",e,t)}if("undefined"!==typeof XDomainRequest&&!("withCredentials"in c)&&/^(http(s)?:)?\/\//.test(t)&&(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=c.ontimeout=h:c.onreadystatechange=function(t){c.readyState>3&&h(t)},c.onprogress=function(t){a.call("progress",e,t)},e={header:function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?u.get(t):(null==n?u.remove(t):u.set(t,n+""),e)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",e):r},responseType:function(t){return arguments.length?(o=t,e):o},timeout:function(t){return arguments.length?(f=+t,e):f},user:function(t){return arguments.length<1?s:(s=null==t?null:t+"",e)},password:function(t){return arguments.length<1?l:(l=null==t?null:t+"",e)},response:function(t){return i=t,e},get:function(t,n){return e.send("GET",t,n)},post:function(t,n){return e.send("POST",t,n)},send:function(n,i,h){return c.open(n,t,!0,s,l),null==r||u.has("accept")||u.set("accept",r+",*/*"),c.setRequestHeader&&u.each((function(t,n){c.setRequestHeader(n,t)})),null!=r&&c.overrideMimeType&&c.overrideMimeType(r),null!=o&&(c.responseType=o),f>0&&(c.timeout=f),null==h&&"function"===typeof i&&(h=i,i=null),null!=h&&1===h.length&&(h=my(h)),null!=h&&e.on("error",h).on("load",(function(t){h(null,t)})),a.call("beforesend",e,c),c.send(null==i?null:i),e},abort:function(){return c.abort(),e},on:function(){var t=a.on.apply(a,arguments);return t===a?e:t}},null!=n){if("function"!==typeof n)throw new Error("invalid callback: "+n);return e.get(n)}return e};function my(t){return function(n,e){t(null==n?e:null)}}function xy(t){var n=t.responseType;return n&&"text"!==n?t.response:t.responseText}var wy=function(t,n){return function(e,r){var i=_y(e).mimeType(t).response(n);if(null!=r){if("function"!==typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}},by=wy("text/html",(function(t){return document.createRange().createContextualFragment(t.responseText)})),My=wy("application/json",(function(t){return JSON.parse(t.responseText)})),ky=wy("text/plain",(function(t){return t.responseText})),Sy=wy("application/xml",(function(t){var n=t.responseXML;if(!n)throw new Error("parse error");return n})),Ey=function(t,n){return function(e,r,i){arguments.length<3&&(i=r,r=null);var o=_y(e).mimeType(t);return o.row=function(t){return arguments.length?o.response(Ny(n,r=t)):r},o.row(r),i?o.get(i):o}};function Ny(t,n){return function(e){return t(e.responseText,n)}}var Ty=Ey("text/csv",_c),Ay=Ey("text/tab-separated-values",Mc),Cy=Array.prototype,Oy=Cy.map,Py=Cy.slice,Ly={name:"implicit"};function Uy(t){var n=nc(),e=[],r=Ly;function i(i){var o=i+"",a=n.get(o);if(!a){if(r!==Ly)return r;n.set(o,a=e.push(i))}return t[(a-1)%t.length]}return t=null==t?[]:Py.call(t),i.domain=function(t){if(!arguments.length)return e.slice();e=[],n=nc();var r,o,a=-1,u=t.length;while(++a=e?1:r(t)}}}function Hy(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function Vy(t,n,e,r){var i=t[0],o=t[1],a=n[0],u=n[1];return o2?Yy:Vy,r=i=null,l}function l(n){return(r||(r=e(o,a,c?By(t):t,u)))(+n)}return l.invert=function(t){return(i||(i=e(a,o,qy,c?Hy(n):n)))(+t)},l.domain=function(t){return arguments.length?(o=Oy.call(t,Ry),s()):o.slice()},l.range=function(t){return arguments.length?(a=Py.call(t),s()):a.slice()},l.rangeRound=function(t){return a=Py.call(t),u=ti,s()},l.clamp=function(t){return arguments.length?(c=!!t,s()):c},l.interpolate=function(t){return arguments.length?(u=t,s()):u},s()}var Wy=function(n,e,r){var i,o=n[0],a=n[n.length-1],u=N(o,a,null==e?10:e);switch(r=bs(null==r?",f":r),r.type){case"s":var c=Math.max(Math.abs(o),Math.abs(a));return null!=r.precision||isNaN(i=Cs(u,c))||(r.precision=i),t.formatPrefix(r,c);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Os(u,Math.max(Math.abs(o),Math.abs(a))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=As(u))||(r.precision=i-2*("%"===r.type));break}return t.format(r)};function $y(t){var n=t.domain;return t.ticks=function(t){var e=n();return S(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return Wy(n(),t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),o=0,a=i.length-1,u=i[o],c=i[a];return c0?(u=Math.floor(u/r)*r,c=Math.ceil(c/r)*r,r=E(u,c,e)):r<0&&(u=Math.ceil(u*r)/r,c=Math.floor(c*r)/r,r=E(u,c,e)),r>0?(i[o]=Math.floor(u/r)*r,i[a]=Math.ceil(c/r)*r,n(i)):r<0&&(i[o]=Math.ceil(u*r)/r,i[a]=Math.floor(c*r)/r,n(i)),t},t}function Zy(){var t=Gy(qy,Br);return t.copy=function(){return Xy(t,Zy())},$y(t)}function Jy(){var t=[0,1];function n(t){return+t}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=Oy.call(e,Ry),n):t.slice()},n.copy=function(){return Jy().domain(t)},$y(n)}var Qy=function(t,n){t=t.slice();var e,r=0,i=t.length-1,o=t[r],a=t[i];return a0){for(;hc)break;v.push(f)}}else for(;h=1;--l)if(f=s*l,!(fc)break;v.push(f)}}else v=S(h,p,Math.min(p-h,d)).map(o);return n?v.reverse():v},n.tickFormat=function(e,a){if(null==a&&(a=10===r?".0e":","),"function"!==typeof a&&(a=t.format(a)),e===1/0)return a;null==e&&(e=10);var u=Math.max(1,r*e/n.ticks().length);return function(t){var n=t/o(Math.round(i(t)));return n*r0?r[i-1]:t[0],i=e?[r[e-1],n]:[r[a-1],r[a]]},o.copy=function(){return lg().domain([t,n]).range(i)},$y(o)}function fg(){var t=[.5],n=[0,1],e=1;function r(r){if(r<=r)return n[a(t,r,0,e)]}return r.domain=function(i){return arguments.length?(t=Py.call(i),e=Math.min(t.length,n.length-1),r):t.slice()},r.range=function(i){return arguments.length?(n=Py.call(i),e=Math.min(t.length,n.length-1),r):n.slice()},r.invertExtent=function(e){var r=n.indexOf(e);return[t[r-1],t[r]]},r.copy=function(){return fg().domain(t).range(n)},r}var hg=new Date,pg=new Date;function dg(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n0))return a;do{a.push(new Date(+e))}while(n(e,o),t(e),e=n)while(t(n),!e(n))n.setTime(n-1)}),(function(t,r){if(t>=t)while(--r>=0)while(n(t,1),!e(t));}))},e&&(i.count=function(n,r){return hg.setTime(+n),pg.setTime(+r),t(hg),t(pg),Math.floor(e(hg,pg))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t===0}:function(n){return i.count(0,n)%t===0}):i:null}),i}var vg=dg((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));vg.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?dg((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):vg:null};var yg=vg.range,gg=1e3,_g=6e4,mg=36e5,xg=864e5,wg=6048e5,bg=dg((function(t){t.setTime(Math.floor(t/gg)*gg)}),(function(t,n){t.setTime(+t+n*gg)}),(function(t,n){return(n-t)/gg}),(function(t){return t.getUTCSeconds()})),Mg=bg.range,kg=dg((function(t){t.setTime(Math.floor(t/_g)*_g)}),(function(t,n){t.setTime(+t+n*_g)}),(function(t,n){return(n-t)/_g}),(function(t){return t.getMinutes()})),Sg=kg.range,Eg=dg((function(t){var n=t.getTimezoneOffset()*_g%mg;n<0&&(n+=mg),t.setTime(Math.floor((+t-n)/mg)*mg+n)}),(function(t,n){t.setTime(+t+n*mg)}),(function(t,n){return(n-t)/mg}),(function(t){return t.getHours()})),Ng=Eg.range,Tg=dg((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*_g)/xg}),(function(t){return t.getDate()-1})),Ag=Tg.range;function Cg(t){return dg((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*_g)/wg}))}var Og=Cg(0),Pg=Cg(1),Lg=Cg(2),Ug=Cg(3),Dg=Cg(4),zg=Cg(5),Fg=Cg(6),jg=Og.range,Rg=Pg.range,Ig=Lg.range,qg=Ug.range,Bg=Dg.range,Hg=zg.range,Vg=Fg.range,Yg=dg((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),Xg=Yg.range,Gg=dg((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Gg.every=function(t){return isFinite(t=Math.floor(t))&&t>0?dg((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var Wg=Gg.range,$g=dg((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+n*_g)}),(function(t,n){return(n-t)/_g}),(function(t){return t.getUTCMinutes()})),Zg=$g.range,Jg=dg((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+n*mg)}),(function(t,n){return(n-t)/mg}),(function(t){return t.getUTCHours()})),Qg=Jg.range,Kg=dg((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/xg}),(function(t){return t.getUTCDate()-1})),t_=Kg.range;function n_(t){return dg((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/wg}))}var e_=n_(0),r_=n_(1),i_=n_(2),o_=n_(3),a_=n_(4),u_=n_(5),c_=n_(6),s_=e_.range,l_=r_.range,f_=i_.range,h_=o_.range,p_=a_.range,d_=u_.range,v_=c_.range,y_=dg((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),g_=y_.range,__=dg((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));__.every=function(t){return isFinite(t=Math.floor(t))&&t>0?dg((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var m_=__.range;function x_(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function w_(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function b_(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function M_(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,c=t.shortMonths,s=O_(i),l=P_(i),f=O_(o),h=P_(o),p=O_(a),d=P_(a),v=O_(u),y=P_(u),g=O_(c),_=P_(c),m={a:L,A:U,b:D,B:z,c:null,d:G_,e:G_,H:W_,I:$_,j:Z_,L:J_,m:Q_,M:K_,p:F,S:tm,U:nm,w:em,W:rm,x:null,X:null,y:im,Y:om,Z:am,"%":wm},x={a:j,A:R,b:I,B:q,c:null,d:um,e:um,H:cm,I:sm,j:lm,L:fm,m:hm,M:pm,p:B,S:dm,U:vm,w:ym,W:gm,x:null,X:null,y:_m,Y:mm,Z:xm,"%":wm},w={a:E,A:N,b:T,B:A,c:C,d:I_,e:I_,H:B_,I:B_,j:q_,L:Y_,m:R_,M:H_,p:S,S:V_,U:U_,w:L_,W:D_,x:O,X:P,y:F_,Y:z_,Z:j_,"%":X_};function b(t,n){return function(e){var r,i,o,a=[],u=-1,c=0,s=t.length;e instanceof Date||(e=new Date(+e));while(++u=c)return-1;if(i=n.charCodeAt(a++),37===i){if(i=n.charAt(a++),o=w[i in S_?n.charAt(a++):i],!o||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function S(t,n,e){var r=s.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1}function E(t,n,e){var r=p.exec(n.slice(e));return r?(t.w=d[r[0].toLowerCase()],e+r[0].length):-1}function N(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1}function T(t,n,e){var r=g.exec(n.slice(e));return r?(t.m=_[r[0].toLowerCase()],e+r[0].length):-1}function A(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1}function C(t,e,r){return k(t,n,e,r)}function O(t,n,r){return k(t,e,n,r)}function P(t,n,e){return k(t,r,n,e)}function L(t){return a[t.getDay()]}function U(t){return o[t.getDay()]}function D(t){return c[t.getMonth()]}function z(t){return u[t.getMonth()]}function F(t){return i[+(t.getHours()>=12)]}function j(t){return a[t.getUTCDay()]}function R(t){return o[t.getUTCDay()]}function I(t){return c[t.getUTCMonth()]}function q(t){return u[t.getUTCMonth()]}function B(t){return i[+(t.getUTCHours()>=12)]}return m.x=b(e,m),m.X=b(r,m),m.c=b(n,m),x.x=b(e,x),x.X=b(r,x),x.c=b(n,x),{format:function(t){var n=b(t+="",m);return n.toString=function(){return t},n},parse:function(t){var n=M(t+="",x_);return n.toString=function(){return t},n},utcFormat:function(t){var n=b(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=M(t,w_);return n.toString=function(){return t},n}}}var k_,S_={"-":"",_:" ",0:"0"},E_=/^\s*\d+/,N_=/^%/,T_=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;function A_(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+r[0].length):-1}function j_(t,n,e){var r=/^(Z)|([+-]\d\d)(?:\:?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function R_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function I_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function q_(t,n,e){var r=E_.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function B_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function H_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function V_(t,n,e){var r=E_.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Y_(t,n,e){var r=E_.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function X_(t,n,e){var r=N_.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function G_(t,n){return A_(t.getDate(),n,2)}function W_(t,n){return A_(t.getHours(),n,2)}function $_(t,n){return A_(t.getHours()%12||12,n,2)}function Z_(t,n){return A_(1+Tg.count(Gg(t),t),n,3)}function J_(t,n){return A_(t.getMilliseconds(),n,3)}function Q_(t,n){return A_(t.getMonth()+1,n,2)}function K_(t,n){return A_(t.getMinutes(),n,2)}function tm(t,n){return A_(t.getSeconds(),n,2)}function nm(t,n){return A_(Og.count(Gg(t),t),n,2)}function em(t){return t.getDay()}function rm(t,n){return A_(Pg.count(Gg(t),t),n,2)}function im(t,n){return A_(t.getFullYear()%100,n,2)}function om(t,n){return A_(t.getFullYear()%1e4,n,4)}function am(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+A_(n/60|0,"0",2)+A_(n%60,"0",2)}function um(t,n){return A_(t.getUTCDate(),n,2)}function cm(t,n){return A_(t.getUTCHours(),n,2)}function sm(t,n){return A_(t.getUTCHours()%12||12,n,2)}function lm(t,n){return A_(1+Kg.count(__(t),t),n,3)}function fm(t,n){return A_(t.getUTCMilliseconds(),n,3)}function hm(t,n){return A_(t.getUTCMonth()+1,n,2)}function pm(t,n){return A_(t.getUTCMinutes(),n,2)}function dm(t,n){return A_(t.getUTCSeconds(),n,2)}function vm(t,n){return A_(e_.count(__(t),t),n,2)}function ym(t){return t.getUTCDay()}function gm(t,n){return A_(r_.count(__(t),t),n,2)}function _m(t,n){return A_(t.getUTCFullYear()%100,n,2)}function mm(t,n){return A_(t.getUTCFullYear()%1e4,n,4)}function xm(){return"+0000"}function wm(){return"%"}function bm(n){return k_=M_(n),t.timeFormat=k_.format,t.timeParse=k_.parse,t.utcFormat=k_.utcFormat,t.utcParse=k_.utcParse,k_}bm({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Mm="%Y-%m-%dT%H:%M:%S.%LZ";function km(t){return t.toISOString()}var Sm=Date.prototype.toISOString?km:t.utcFormat(Mm);function Em(t){var n=new Date(t);return isNaN(n)?null:n}var Nm=+new Date("2000-01-01T00:00:00.000Z")?Em:t.utcParse(Mm),Tm=1e3,Am=60*Tm,Cm=60*Am,Om=24*Cm,Pm=7*Om,Lm=30*Om,Um=365*Om;function Dm(t){return new Date(t)}function zm(t){return t instanceof Date?+t:+new Date(+t)}function Fm(t,n,e,i,o,a,u,c,s){var l=Gy(qy,Br),f=l.invert,h=l.domain,p=s(".%L"),d=s(":%S"),v=s("%I:%M"),y=s("%I %p"),g=s("%a %d"),_=s("%b %d"),m=s("%B"),x=s("%Y"),w=[[u,1,Tm],[u,5,5*Tm],[u,15,15*Tm],[u,30,30*Tm],[a,1,Am],[a,5,5*Am],[a,15,15*Am],[a,30,30*Am],[o,1,Cm],[o,3,3*Cm],[o,6,6*Cm],[o,12,12*Cm],[i,1,Om],[i,2,2*Om],[e,1,Pm],[n,1,Lm],[n,3,3*Lm],[t,1,Um]];function b(r){return(u(r)1)&&(t-=Math.floor(t));var n=Math.abs(t-.5);return Wm.h=360*t-100,Wm.s=1.5-1.5*n,Wm.l=.8-.9*n,Wm+""};function Zm(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}}var Jm=Zm(Im("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Qm=Zm(Im("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Km=Zm(Im("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),tx=Zm(Im("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function nx(t){var n=0,e=1,r=!1;function i(i){var o=(i-n)/(e-n);return t(r?Math.max(0,Math.min(1,o)):o)}return i.domain=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.clamp=function(t){return arguments.length?(r=!!t,i):r},i.interpolator=function(n){return arguments.length?(t=n,i):t},i.copy=function(){return nx(t).domain([n,e]).clamp(r)},$y(i)}var ex=function(t){return function(){return t}},rx=Math.abs,ix=Math.atan2,ox=Math.cos,ax=Math.max,ux=Math.min,cx=Math.sin,sx=Math.sqrt,lx=1e-12,fx=Math.PI,hx=fx/2,px=2*fx;function dx(t){return t>1?0:t<-1?fx:Math.acos(t)}function vx(t){return t>=1?hx:t<=-1?-hx:Math.asin(t)}function yx(t){return t.innerRadius}function gx(t){return t.outerRadius}function _x(t){return t.startAngle}function mx(t){return t.endAngle}function xx(t){return t&&t.padAngle}function wx(t,n,e,r,i,o,a,u){var c=e-t,s=r-n,l=a-i,f=u-o,h=(l*(n-o)-f*(t-i))/(f*c-l*s);return[t+h*c,n+h*s]}function bx(t,n,e,r,i,o,a){var u=t-e,c=n-r,s=(a?o:-o)/sx(u*u+c*c),l=s*c,f=-s*u,h=t+l,p=n+f,d=e+l,v=r+f,y=(h+d)/2,g=(p+v)/2,_=d-h,m=v-p,x=_*_+m*m,w=i-o,b=h*v-d*p,M=(m<0?-1:1)*sx(ax(0,w*w*x-b*b)),k=(b*m-_*M)/x,S=(-b*_-m*M)/x,E=(b*m+_*M)/x,N=(-b*_+m*M)/x,T=k-y,A=S-g,C=E-y,O=N-g;return T*T+A*A>C*C+O*O&&(k=E,S=N),{cx:k,cy:S,x01:-l,y01:-f,x11:k*(i/w-1),y11:S*(i/w-1)}}var Mx=function(){var t=yx,n=gx,e=ex(0),r=null,i=_x,o=mx,a=xx,u=null;function c(){var c,s,l=+t.apply(this,arguments),f=+n.apply(this,arguments),h=i.apply(this,arguments)-hx,p=o.apply(this,arguments)-hx,d=rx(p-h),v=p>h;if(u||(u=c=Xu()),flx)if(d>px-lx)u.moveTo(f*ox(h),f*cx(h)),u.arc(0,0,f,h,p,!v),l>lx&&(u.moveTo(l*ox(p),l*cx(p)),u.arc(0,0,l,p,h,v));else{var y,g,_=h,m=p,x=h,w=p,b=d,M=d,k=a.apply(this,arguments)/2,S=k>lx&&(r?+r.apply(this,arguments):sx(l*l+f*f)),E=ux(rx(f-l)/2,+e.apply(this,arguments)),N=E,T=E;if(S>lx){var A=vx(S/l*cx(k)),C=vx(S/f*cx(k));(b-=2*A)>lx?(A*=v?1:-1,x+=A,w-=A):(b=0,x=w=(h+p)/2),(M-=2*C)>lx?(C*=v?1:-1,_+=C,m-=C):(M=0,_=m=(h+p)/2)}var O=f*ox(_),P=f*cx(_),L=l*ox(w),U=l*cx(w);if(E>lx){var D=f*ox(m),z=f*cx(m),F=l*ox(x),j=l*cx(x);if(dlx?wx(O,P,F,j,D,z,L,U):[L,U],I=O-R[0],q=P-R[1],B=D-R[0],H=z-R[1],V=1/cx(dx((I*B+q*H)/(sx(I*I+q*q)*sx(B*B+H*H)))/2),Y=sx(R[0]*R[0]+R[1]*R[1]);N=ux(E,(l-Y)/(V-1)),T=ux(E,(f-Y)/(V+1))}}M>lx?T>lx?(y=bx(F,j,O,P,f,T,v),g=bx(D,z,L,U,f,T,v),u.moveTo(y.cx+y.x01,y.cy+y.y01),Tlx&&b>lx?N>lx?(y=bx(L,U,D,z,l,-N,v),g=bx(O,P,F,j,l,-N,v),u.lineTo(y.cx+y.x01,y.cy+y.y01),N=l;--f)u.point(y[f],g[f]);u.lineEnd(),u.areaEnd()}v&&(y[s]=+t(h,s,c),g[s]=+e(h,s,c),u.point(n?+n(h,s,c):y[s],r?+r(h,s,c):g[s]))}if(p)return u=null,p+""||null}function s(){return Tx().defined(i).curve(a).context(o)}return c.x=function(e){return arguments.length?(t="function"===typeof e?e:ex(+e),n=null,c):t},c.x0=function(n){return arguments.length?(t="function"===typeof n?n:ex(+n),c):t},c.x1=function(t){return arguments.length?(n=null==t?null:"function"===typeof t?t:ex(+t),c):n},c.y=function(t){return arguments.length?(e="function"===typeof t?t:ex(+t),r=null,c):e},c.y0=function(t){return arguments.length?(e="function"===typeof t?t:ex(+t),c):e},c.y1=function(t){return arguments.length?(r=null==t?null:"function"===typeof t?t:ex(+t),c):r},c.lineX0=c.lineY0=function(){return s().x(t).y(e)},c.lineY1=function(){return s().x(t).y(r)},c.lineX1=function(){return s().x(n).y(e)},c.defined=function(t){return arguments.length?(i="function"===typeof t?t:ex(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c},Cx=function(t,n){return nt?1:n>=t?0:NaN},Ox=function(t){return t},Px=function(){var t=Ox,n=Cx,e=null,r=ex(0),i=ex(px),o=ex(0);function a(a){var u,c,s,l,f,h=a.length,p=0,d=new Array(h),v=new Array(h),y=+r.apply(this,arguments),g=Math.min(px,Math.max(-px,i.apply(this,arguments)-y)),_=Math.min(Math.abs(g)/h,o.apply(this,arguments)),m=_*(g<0?-1:1);for(u=0;u0&&(p+=f);for(null!=n?d.sort((function(t,e){return n(v[t],v[e])})):null!=e&&d.sort((function(t,n){return e(a[t],a[n])})),u=0,s=p?(g-h*m)/p:0;u0?f*s:0)+m,v[c]={data:a[c],index:u,value:f,startAngle:y,endAngle:l,padAngle:_};return v}return a.value=function(n){return arguments.length?(t="function"===typeof n?n:ex(+n),a):t},a.sortValues=function(t){return arguments.length?(n=t,e=null,a):n},a.sort=function(t){return arguments.length?(e=t,n=null,a):e},a.startAngle=function(t){return arguments.length?(r="function"===typeof t?t:ex(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"===typeof t?t:ex(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"===typeof t?t:ex(+t),a):o},a},Lx=Dx(Sx);function Ux(t){this._curve=t}function Dx(t){function n(n){return new Ux(t(n))}return n._curve=t,n}function zx(t){var n=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?n(Dx(t)):n()._curve},t}Ux.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,n){this._curve.point(n*Math.sin(t),n*-Math.cos(t))}};var Fx=function(){return zx(Tx().curve(Lx))},jx=function(){var t=Ax().curve(Lx),n=t.curve,e=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return zx(e())},delete t.lineX0,t.lineEndAngle=function(){return zx(r())},delete t.lineX1,t.lineInnerRadius=function(){return zx(i())},delete t.lineY0,t.lineOuterRadius=function(){return zx(o())},delete t.lineY1,t.curve=function(t){return arguments.length?n(Dx(t)):n()._curve},t},Rx=Array.prototype.slice,Ix=function(t,n){return[(n=+n)*Math.cos(t-=Math.PI/2),n*Math.sin(t)]};function qx(t){return t.source}function Bx(t){return t.target}function Hx(t){var n=qx,e=Bx,r=Ex,i=Nx,o=null;function a(){var a,u=Rx.call(arguments),c=n.apply(this,u),s=e.apply(this,u);if(o||(o=a=Xu()),t(o,+r.apply(this,(u[0]=c,u)),+i.apply(this,u),+r.apply(this,(u[0]=s,u)),+i.apply(this,u)),a)return o=null,a+""||null}return a.source=function(t){return arguments.length?(n=t,a):n},a.target=function(t){return arguments.length?(e=t,a):e},a.x=function(t){return arguments.length?(r="function"===typeof t?t:ex(+t),a):r},a.y=function(t){return arguments.length?(i="function"===typeof t?t:ex(+t),a):i},a.context=function(t){return arguments.length?(o=null==t?null:t,a):o},a}function Vx(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n=(n+r)/2,e,n,i,r,i)}function Yx(t,n,e,r,i){t.moveTo(n,e),t.bezierCurveTo(n,e=(e+i)/2,r,e,r,i)}function Xx(t,n,e,r,i){var o=Ix(n,e),a=Ix(n,e=(e+i)/2),u=Ix(r,e),c=Ix(r,i);t.moveTo(o[0],o[1]),t.bezierCurveTo(a[0],a[1],u[0],u[1],c[0],c[1])}function Gx(){return Hx(Vx)}function Wx(){return Hx(Yx)}function $x(){var t=Hx(Xx);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}var Zx={draw:function(t,n){var e=Math.sqrt(n/fx);t.moveTo(e,0),t.arc(0,0,e,0,px)}},Jx={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},Qx=Math.sqrt(1/3),Kx=2*Qx,tw={draw:function(t,n){var e=Math.sqrt(n/Kx),r=e*Qx;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},nw=.8908130915292852,ew=Math.sin(fx/10)/Math.sin(7*fx/10),rw=Math.sin(px/10)*ew,iw=-Math.cos(px/10)*ew,ow={draw:function(t,n){var e=Math.sqrt(n*nw),r=rw*e,i=iw*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var a=px*o/5,u=Math.cos(a),c=Math.sin(a);t.lineTo(c*e,-u*e),t.lineTo(u*r-c*i,c*r+u*i)}t.closePath()}},aw={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},uw=Math.sqrt(3),cw={draw:function(t,n){var e=-Math.sqrt(n/(3*uw));t.moveTo(0,2*e),t.lineTo(-uw*e,-e),t.lineTo(uw*e,-e),t.closePath()}},sw=-.5,lw=Math.sqrt(3)/2,fw=1/Math.sqrt(12),hw=3*(fw/2+1),pw={draw:function(t,n){var e=Math.sqrt(n/hw),r=e/2,i=e*fw,o=r,a=e*fw+e,u=-o,c=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(u,c),t.lineTo(sw*r-lw*i,lw*r+sw*i),t.lineTo(sw*o-lw*a,lw*o+sw*a),t.lineTo(sw*u-lw*c,lw*u+sw*c),t.lineTo(sw*r+lw*i,sw*i-lw*r),t.lineTo(sw*o+lw*a,sw*a-lw*o),t.lineTo(sw*u+lw*c,sw*c-lw*u),t.closePath()}},dw=[Zx,Jx,tw,aw,ow,cw,pw],vw=function(){var t=ex(Zx),n=ex(64),e=null;function r(){var r;if(e||(e=r=Xu()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"===typeof n?n:ex(n),r):t},r.size=function(t){return arguments.length?(n="function"===typeof t?t:ex(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r},yw=function(){};function gw(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function _w(t){this._context=t}_w.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:gw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:gw(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var mw=function(t){return new _w(t)};function xw(t){this._context=t}xw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:gw(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var ww=function(t){return new xw(t)};function bw(t){this._context=t}bw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:gw(this,t,n);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}};var Mw=function(t){return new bw(t)};function kw(t,n){this._basis=new _w(t),this._beta=n}kw.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0){var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,c=-1;while(++c<=e)r=c/e,this._basis.point(this._beta*t[c]+(1-this._beta)*(i+r*a),this._beta*n[c]+(1-this._beta)*(o+r*u))}this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Sw=function t(n){function e(t){return 1===n?new _w(t):new kw(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Ew(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Nw(t,n){this._context=t,this._k=(1-n)/6}Nw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Ew(this,this._x1,this._y1);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Ew(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Tw=function t(n){function e(t){return new Nw(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Aw(t,n){this._context=t,this._k=(1-n)/6}Aw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Ew(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Cw=function t(n){function e(t){return new Aw(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Ow(t,n){this._context=t,this._k=(1-n)/6}Ow.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Ew(this,t,n);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Pw=function t(n){function e(t){return new Ow(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Lw(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>lx){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,c=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/c,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/c}if(t._l23_a>lx){var s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-n*t._l12_2a)/l,a=(a*s+t._y1*t._l23_2a-e*t._l12_2a)/l}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Uw(t,n){this._context=t,this._alpha=n}Uw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Lw(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Dw=function t(n){function e(t){return n?new Uw(t,n):new Nw(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function zw(t,n){this._context=t,this._alpha=n}zw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Lw(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Fw=function t(n){function e(t){return n?new zw(t,n):new Aw(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function jw(t,n){this._context=t,this._alpha=n}jw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Lw(this,t,n);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Rw=function t(n){function e(t){return n?new jw(t,n):new Ow(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Iw(t){this._context=t}Iw.prototype={areaStart:yw,areaEnd:yw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}};var qw=function(t){return new Iw(t)};function Bw(t){return t<0?-1:1}function Hw(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(Bw(o)+Bw(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function Vw(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Yw(t,n,e){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*n,o-u,a-u*e,o,a)}function Xw(t){this._context=t}function Gw(t){this._context=new Ww(t)}function Ww(t){this._context=t}function $w(t){return new Xw(t)}function Zw(t){return new Gw(t)}function Jw(t){this._context=t}function Qw(t){var n,e,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],n=1;n=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}break}this._x=t,this._y=n}};var nb=function(t){return new tb(t,.5)};function eb(t){return new tb(t,0)}function rb(t){return new tb(t,1)}var ib=function(t,n){if((i=t.length)>1)for(var e,r,i,o=1,a=t[n[0]],u=a.length;o=0)e[n]=n;return e};function ab(t,n){return t[n]}var ub=function(){var t=ex([]),n=ob,e=ib,r=ab;function i(i){var o,a,u=t.apply(this,arguments),c=i.length,s=u.length,l=new Array(s);for(o=0;o0){for(var e,r,i,o=0,a=t[0].length;o1)for(var e,r,i,o,a,u,c=0,s=t[n[0]].length;c=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},lb=function(t,n){if((e=t.length)>0){for(var e,r=0,i=t[n[0]],o=i.length;r0&&(r=(e=t[n[0]]).length)>0){for(var e,r,i,o=0,a=1;a0)){if(o/=d,d<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=r-c,d||!(o<0)){if(o/=d,d<0){if(o>p)return;o>h&&(h=o)}else if(d>0){if(o0)){if(o/=v,v<0){if(o0){if(o>p)return;o>h&&(h=o)}if(o=i-s,v||!(o<0)){if(o/=v,v<0){if(o>p)return;o>h&&(h=o)}else if(v>0){if(o0||p<1)||(h>0&&(t[0]=[c+h*d,s+h*v]),p<1&&(t[1]=[c+p*d,s+p*v]),!0)}}}}}function Ab(t,n,e,r,i){var o=t[1];if(o)return!0;var a,u,c=t[0],s=t.left,l=t.right,f=s[0],h=s[1],p=l[0],d=l[1],v=(f+p)/2,y=(h+d)/2;if(d===h){if(v=r)return;if(f>p){if(c){if(c[1]>=i)return}else c=[v,e];o=[v,i]}else{if(c){if(c[1]1)if(f>p){if(c){if(c[1]>=i)return}else c=[(e-u)/a,e];o=[(i-u)/a,i]}else{if(c){if(c[1]=r)return}else c=[n,a*n+u];o=[r,a*r+u]}else{if(c){if(c[0]tM||Math.abs(i[0][1]-i[1][1])>tM)||delete Kb[o]}function Ob(t){return Jb[t.index]={site:t,halfedges:[]}}function Pb(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function Lb(t,n){return n[+(n.left!==t.site)]}function Ub(t,n){return n[+(n.left===t.site)]}function Db(){for(var t,n,e,r,i=0,o=Jb.length;itM||Math.abs(v-h)>tM)&&(c.splice(u,0,Kb.push(Eb(a,p,Math.abs(d-t)tM?[t,Math.abs(f-t)tM?[Math.abs(h-r)tM?[e,Math.abs(f-e)tM?[Math.abs(h-n)=-nM)){var p=c*c+s*s,d=l*l+f*f,v=(f*p-s*d)/h,y=(c*d-l*p)/h,g=jb.pop()||new Rb;g.arc=t,g.site=i,g.x=v+a,g.y=(g.cy=y+u)+Math.sqrt(v*v+y*y),t.circle=g;var _=null,m=Qb._;while(m)if(g.ytM)u=u.L;else{if(i=o-$b(u,a),!(i>tM)){r>-tM?(n=u.P,e=u):i>-tM?(n=u,e=u.N):n=e=u;break}if(!u.R){n=u;break}u=u.R}Ob(t);var c=Vb(t);if(Zb.insert(n,c),n||e){if(n===e)return qb(n),e=Vb(n.site),Zb.insert(c,e),c.edge=e.edge=Sb(n.site,c.site),Ib(n),void Ib(e);if(e){qb(n),qb(e);var s=n.site,l=s[0],f=s[1],h=t[0]-l,p=t[1]-f,d=e.site,v=d[0]-l,y=d[1]-f,g=2*(h*y-p*v),_=h*h+p*p,m=v*v+y*y,x=[(y*_-p*m)/g+l,(h*m-v*_)/g+f];Nb(e.edge,s,d,x),c.edge=Sb(s,t,null,x),e.edge=Sb(t,d,null,x),Ib(n),Ib(e)}else c.edge=Sb(n.site,c.site)}}function Wb(t,n){var e=t.site,r=e[0],i=e[1],o=i-n;if(!o)return r;var a=t.P;if(!a)return-1/0;e=a.site;var u=e[0],c=e[1],s=c-n;if(!s)return u;var l=u-r,f=1/o-1/s,h=l/s;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*s)-c+s/2+i-o/2)))/f+r:(r+u)/2}function $b(t,n){var e=t.N;if(e)return Wb(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var Zb,Jb,Qb,Kb,tM=1e-6,nM=1e-12;function eM(t,n,e){return(t[0]-e[0])*(n[1]-t[1])-(t[0]-n[0])*(e[1]-t[1])}function rM(t,n){return n[1]-t[1]||n[0]-t[0]}function iM(t,n){var e,r,i,o=t.sort(rM).pop();Kb=[],Jb=new Array(t.length),Zb=new xb,Qb=new xb;while(1)if(i=Fb,o&&(!i||o[1]=u)return null;var c=t-i.site[0],s=n-i.site[1],l=c*c+s*s;do{i=o.cells[r=a],a=null,i.halfedges.forEach((function(e){var r=o.edges[e],u=r.left;if(u!==i.site&&u||(u=r.right)){var c=t-u[0],s=n-u[1],f=c*c+s*s;fe?(e+r)/2:Math.min(0,e)||Math.max(0,r),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function b(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function M(t,n,e){t.on("start.zoom",(function(){k(this,arguments).start()})).on("interrupt.zoom end.zoom",(function(){k(this,arguments).end()})).tween("zoom",(function(){var t=this,r=arguments,o=k(t,r),a=i.apply(t,r),u=e||b(a),c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),s=t.__zoom,l="function"===typeof n?n.apply(t,r):n,f=h(s.invert(u).concat(c/s.k),l.invert(u).concat(c/l.k));return function(t){if(1===t)t=l;else{var n=f(t),e=c/n[2];t=new cM(e,u[0]-n[0]*e,u[1]-n[1]*e)}o.zoom(null,t)}}))}function k(t,n){for(var e,r=0,i=p.length;rg}n.zoom("mouse",w(x(n.that.__zoom,n.mouse[0]=Ft(n.that),n.mouse[1]),n.extent))}function s(){i.on("mousemove.zoom mouseup.zoom",null),ve(t.event.view,n.moved),hM(),n.end()}}function T(){if(r.apply(this,arguments)){var n=this.__zoom,e=Ft(this),o=n.invert(e),a=n.k*(t.event.shiftKey?.5:2),u=w(x(m(n,a),e,o),i.apply(this,arguments));hM(),f>0?ce(this).transition().duration(f).call(M,u,e):ce(this).call(_.transform,u)}}function A(){if(r.apply(this,arguments)){var e,i,o,a,u=k(this,arguments),c=t.event.changedTouches,s=c.length;for(fM(),i=0;i=w&&(w=x+1);while(!(m=y[w])&&++w=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},B=function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=H);for(var e=this._groups,r=e.length,i=new Array(r),o=0;on?1:t>=n?0:NaN}var V=function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},Y=function(){var t=new Array(this.size()),n=-1;return this.each((function(){t[++n]=this})),t},X=function(){for(var t=this._groups,n=0,e=t.length;n=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),J.hasOwnProperty(n)?{space:J[n],local:t}:t};function K(t){return function(){this.removeAttribute(t)}}function tt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function nt(t,n){return function(){this.setAttribute(t,n)}}function et(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function rt(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function it(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}var ot=function(t,n){var e=Q(t);if(arguments.length<2){var r=this.node();return e.local?r.getAttributeNS(e.space,e.local):r.getAttribute(e)}return this.each((null==n?e.local?tt:K:"function"===typeof n?e.local?it:rt:e.local?et:nt)(e,n))},at=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function ut(t){return function(){this.style.removeProperty(t)}}function ct(t,n,e){return function(){this.style.setProperty(t,n,e)}}function st(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}var lt=function(t,n,e){return arguments.length>1?this.each((null==n?ut:"function"===typeof n?st:ct)(t,n,null==e?"":e)):ft(this.node(),t)};function ft(t,n){return t.style.getPropertyValue(n)||at(t).getComputedStyle(t,null).getPropertyValue(n)}function ht(t){return function(){delete this[t]}}function pt(t,n){return function(){this[t]=n}}function dt(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}var vt=function(t,n){return arguments.length>1?this.each((null==n?ht:"function"===typeof n?dt:pt)(t,n)):this.node()[t]};function yt(t){return t.trim().split(/^|\s+/)}function gt(t){return t.classList||new _t(t)}function _t(t){this._node=t,this._names=yt(t.getAttribute("class")||"")}function mt(t,n){var e=gt(t),r=-1,i=n.length;while(++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var kt=function(t,n){var e=yt(t+"");if(arguments.length<2){var r=gt(this.node()),i=-1,o=e.length;while(++i=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function nn(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;rt&&(t=n.depth)})),h((a[0]-i)/t)}function h(t){u.forEach((function(n){n.x*=t}))}function p(n){var r=t.nest().key((function(t){return t.x})).sortKeys(t.ascending).entries(u).map((function(t){return t.values}));s(),h();for(var i=1;n>0;--n)f(i*=.99),h(),l(i),h();function s(){var n=t.min(r,(function(n){var e=t.sum(n,y);return e?(a[1]-(n.length-1)*o)/e:0}));r.forEach((function(t){t.forEach((function(t,r){if(t.y=r,t.dy=t.value*n,e(t))return t.sourceLinks.forEach((function(n){n.scaleNodeDy=25/t.dy,n.scaleNodeMax=25})),void(t.dy=25);t.dy<4&&(t.sourceLinks.forEach((function(n){n.scaleNodeDy=4/t.dy,n.scaleNodeMax=4})),t.dy=4)}))})),c.forEach((function(t){t.dy=t.value*n,t.scaleNodeDy&&(t.dy*=t.scaleNodeDy),t.scaleNodeMax&&t.dy>t.scaleNodeMax&&(t.dy=t.scaleNodeMax)}))}function l(n){function e(t){return v(t.source)*t.value}r.forEach((function(r,i){r.forEach((function(r){if(r.targetLinks.length){var i=t.sum(r.targetLinks,e)/t.sum(r.targetLinks,y);r.y+=(i-v(r))*n}}))}))}function f(n){function e(t){return v(t.target)*t.value}r.slice().reverse().forEach((function(r){r.forEach((function(r){if(r.sourceLinks.length){var i=t.sum(r.sourceLinks,e)/t.sum(r.sourceLinks,y);r.y+=(i-v(r))*n}}))}))}function h(){r.forEach((function(t){var n,e,r,i=0,a=t.length;for(r=0;r0&&(n.y+=e),i=n.y+n.dy+o}))}}function d(){function t(t,n){return t.source.y-n.source.y}function n(t,n){return t.target.y-n.target.y}u.forEach((function(e){e.sourceLinks.sort(n),e.targetLinks.sort(t)})),u.forEach((function(t){var n=0,e=0;t.sourceLinks.forEach((function(t){t.sy=n,n+=t.dy})),t.targetLinks.forEach((function(t){t.ty=e,e+=t.dy}))}))}function v(t){return 0}function y(t){return t.value}return r.nodeWidth=function(t){return arguments.length?(i=+t,r):i},r.nodePadding=function(t){return arguments.length?(o=+t,r):o},r.nodes=function(t){return arguments.length?(u=t,r):u},r.links=function(t){return arguments.length?(c=t,r):c},r.size=function(t){return arguments.length?(a=t,r):a},r.layout=function(t){return s(),l(),f(),p(t),d(),r},r.relayout=function(){return d(),r},r.link=function(){var e=.5;function r(r){if(n(r.target.name)){var i=r.source.x+r.source.dx,o=r.source.y+r.sy+r.dy/2;return"M"+i+","+o+" L"+(i+15)+","+o}i=r.source.x+r.source.dx;var a=r.target.x,u=t.interpolateNumber(i,a),c=u(e),s=u(1-e),l=(o=r.source.y+r.sy+r.dy/2,r.target.y+r.ty+r.dy/2);return"M"+i+","+o+"C"+c+","+o+" "+s+","+l+" "+a+","+l}return r.curvature=function(t){return arguments.length?(e=+t,r):e},r},r}};gn(d);var _n="_out_",mn="Others",xn=Object(vn["translate"])("General_Others"),wn=window,bn=wn.$;function Mn(t){return t===_n}function kn(t){return t===mn||t===xn}var Sn=Object(o["defineComponent"])({props:{actionsPerStep:Number,levelOfDetail:Number,userFlowSource:String},components:{Field:yn["Field"],ActivityIndicator:vn["ActivityIndicator"]},data:function(){return{numSteps:4,hasData:!0,isLoading:!1,maxSankeyChartDepth:0,maxNodeLength:0,isExploringTraffic:!1,exploreStep:!1,exploreUrl:!1,flowSources:[],numActionsPerStep:this.actionsPerStep||5,rawResponse:null,actualLevelOfDetail:this.levelOfDetail||5,actualUserFlowSource:this.userFlowSource}},watch:{numActionsPerStep:function(t){null!==t&&(this.fetchData(),this.updateViewParams())},actualUserFlowSource:function(t){null!==t&&(this.fetchData(),this.updateViewParams())}},created:function(){var t=this;vn["AjaxHelper"].fetch({method:"UsersFlow.getAvailableDataSources"}).then((function(n){t.flowSources=n.map((function(t){return{key:t.value,value:t.name}}))})),this.fetchData()},beforeUnmount:function(){this.clearSankeyChart()},methods:{isUrlLike:function(t){return!!t&&("page_url"===this.actualUserFlowSource&&/^(.+)[.](.+)\/(.*)$/.test(t))},completeUrl:function(t){return 0===t.indexOf("http")?t:"".concat(window.location.protocol,"//").concat(t)},showGroupDetails:function(t,n,e,r){var i=vn["MatomoUrl"].stringify({showtitle:1,widget:1,module:"UsersFlow",action:"getInteractionActions",interactionPosition:n,offsetActionsPerStep:e?this.numActionsPerStep:void 0,rowLabel:t||void 0,idSubtable:r||void 0,dataSource:this.actualUserFlowSource||void 0});window.Piwik_Popover.createPopupAndLoadUrl(i,Object(vn["translate"])("UsersFlow_Interactions"))},setSankeyStep:function(t){t>this.maxSankeyChartDepth?this.numSteps=1:this.numSteps=t<1?1:t,this.clearSankeyChart();var n=this.buildNodesAndIndexes(this.rawResponse||[]);this.drawSankeyChart(n)},addSankeyStep:function(){this.setSankeyStep(this.numSteps+1)},clearSankeyChart:function(){var t=this.$refs.sankeyChart;if(t){var n=d["select"](t).selectAll("svg");n&&d["select"](t).selectAll("svg").remove()}},makeToolTip:function(t){return''.concat(t,"")},setMaxSankeyChartDepth:function(t){this.maxSankeyChartDepth=parseInt(t,10)},setMaxNodeLength:function(t){this.maxNodeLength=parseInt(t,10)},getPercentage:function(t,n){var e=Math.round(t/n*100*100)/100;return"".concat(e,"%")},drawSankeyChart:function(t){var n=this,e=t.nodes,r=t.links,i=t.depthNodes,o=this,a=!1;function u(t,n){d["select"]("#link-".concat(t)).classed("highlightedLink",n)}function c(t){var n,e=[],r=d["select"](this);"1"===r.attr("data-clicked")?(r.attr("data-clicked","0"),n=!1):(d["select"](this).attr("data-clicked","1"),n=!0),r.classed("highlightedNode",n);var i=[{linkType:"sourceLinks",nodeType:"target"},{linkType:"targetLinks",nodeType:"source"}],o=function(t,e,r){Mn(t.target.name)||(r.push(t[e.nodeType]),u(t.id,n))};i.forEach((function(n){t[n.linkType].forEach((function(t){return o(t,n,e)}));var r=function(){var t=[];e.forEach((function(e){e[n.linkType].forEach((function(e){return o(e,n,t)}))})),e=t};while(e.length)r()}))}function s(t){var n=t.depth+1;kn(t.name)?o.showGroupDetails(t.name,n,!0):t.idSubtable&&o.showGroupDetails(t.name,n,!1,t.idSubtable)}function l(t){var n=this,e=d["event"];e.preventDefault(),e.stopPropagation();var r="1"===d["select"](this).attr("data-clicked");a||(bn("body > .usersFlowPopupMenu").length||bn(".usersFlowPopupMenu").appendTo("body"),a=!0,d["select"]("body").on("click",(function(){var t=d["select"]("body > .usersFlowPopupMenu");t.style("display","none"),t.html("")})));var i="UsersFlow_ActionHighlightTraffic";r&&(i="UsersFlow_ActionClearHighlight");var u=d["select"]("body > .usersFlowPopupMenu");u.html("");var l=u.append("ul");l.append("li").attr("class","highlightTraffic").on("click",(function(){c.call(n,t)})).text(Object(vn["translate"])(i)),o.canEnableExploreTraffic&&!kn(t.name)&&(l.append("li").attr("class","divider").html("
"),l.append("li").attr("class","exploreTraffic").on("click",(function(){o.exploreStep=t.depth+1,o.exploreUrl=t.name,o.numSteps=o.exploreStep+2,o.fetchData()})).text(Object(vn["translate"])("UsersFlow_ExploreTraffic"))),o.isExploringTraffic?(l.append("li").attr("class","divider").html("
"),l.append("li").attr("class","unexploreTraffic").on("click",(function(){o.exploreStep=!1,o.exploreUrl=!1,o.fetchData()})).text(Object(vn["translate"])("UsersFlow_UnexploreTraffic"))):(t.idSubtable||kn(t.name))&&(l.append("li").attr("class","divider").html("
"),l.append("li").attr("class","showNodeDetails").on("click",(function(){s.apply(n,[t])})).text(Object(vn["translate"])("UsersFlow_ActionShowDetails"))),o.isUrlLike(t.name)&&!kn(t.name)&&(l.append("li").attr("class","divider").html("
"),l.append("li").attr("class","openPageUrl").append("a").attr("href",o.completeUrl(t.name)).attr("rel","noreferrer").attr("target","_blank").text(Object(vn["translate"])("Installation_SystemCheckOpenURL"))),u.style("left","".concat(e.pageX-2,"px")).style("top","".concat(e.pageY-2,"px")).style("display","block")}var f=200,h=40,p=350,v={top:70,right:20,bottom:20,left:5},y=550+(this.numSteps-2)*p+150,g=y-150,_=100*this.maxNodeLength+v.top,m=this.$refs.sankeyChart;bn(m).css("width",y+v.left+v.right).css("height",_+v.top+v.bottom+5);var x=d["format"](",.0f"),w=function(t){return x(t)},b=d["select"](m).append("svg").attr("width",y+v.left+v.right).attr("height",_+v.top+v.bottom).append("g").attr("transform","translate(".concat(v.left,",").concat(v.top,")")),M=b.append("svg:defs").append("svg:linearGradient").attr("id","normalGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");M.append("svg:stop").attr("offset","0%").attr("stop-color","#F2FFE9").attr("stop-opacity",1),M.append("svg:stop").attr("offset","100%").attr("stop-color","#84D04D").attr("stop-opacity",1);var k=b.append("svg:defs").append("svg:linearGradient").attr("id","pageOutGradient").attr("x1","0%").attr("y1","0%").attr("x2","0%").attr("y2","100%").attr("spreadMethod","pad");k.append("svg:stop").attr("offset","0%").attr("stop-color","#FCE8E8").attr("stop-opacity",1),k.append("svg:stop").attr("offset","100%").attr("stop-color","#FA5858").attr("stop-opacity",1);var S=d["sankey"]().nodeWidth(f).nodePadding(h).size([g,_]),E=S.link();if(e&&r&&i){var N=b.append("g").selectAll(".depthInfo").data(i).enter().append("g").attr("class",(function(t){return"depthInfo depth".concat(t.depth+1)}));N.append("rect").attr("height",50).attr("width",f).attr("x",(function(t){return t.depth*p})).attr("y",-80).style("fill","none");var T=N.append("text").attr("y",-60);if(this.numSteps>1){var A=N.append("svg").attr("viewBox","-100 -100 1500 1500").attr("width","18").attr("height","18").attr("y","-68").attr("x",(function(t){return t.depth*p+f-10})).attr("class","removeStep").on("click",(function(t){n.setSankeyStep(t.depth)})).style("visibility",(function(t){return t.depth>1?"visible":"hidden"})).attr("dy",1);A.append("path").attr("d","M874.048 810.048c-199.936 199.936-524.16 199.936-724.096 0s-199.936-524.16 0-724.096c199.936-199.936 524.16-199.936 724.096 0s199.936 524.16 0 724.096zM692.992 267.008c-33.344-33.344-87.36-33.344-120.64 0l-60.352 60.288-60.352-60.352c-33.344-33.344-87.36-33.344-120.64 0-33.344 33.344-33.344 87.36 0 120.704l60.352 60.352-60.352 60.352c-33.344 33.344-33.344 87.36 0 120.704s87.36 33.344 120.64 0l60.352-60.352 60.352 60.352c33.344 33.344 87.36 33.344 120.64 0 33.344-33.344 33.344-87.36 0-120.704l-60.288-60.352 60.352-60.352c33.28-33.344 33.28-87.36-0.064-120.64z").attr("fill","#999").append("title").text(Object(vn["translate"])("UsersFlow_ActionRemoveStep")),A.append("rect").attr("fill","transparent").attr("width","900").attr("height","900").attr("x",50).append("title").text(Object(vn["translate"])("UsersFlow_ActionRemoveStep"))}T.append("svg:tspan").attr("x",(function(t){return t.depth*p})).attr("dy",5).attr("fill","black").style("font-weight","bold").attr("class","depthContainerTitle").text((function(t){return"".concat(Object(vn["translate"])("UsersFlow_ColumnInteraction")," ").concat(t.depth+1)})).on("click",(function(t){var e=parseInt(t.depth,10)+1;n.showGroupDetails("",e,!1)})).append("svg:tspan").attr("x",(function(t){return t.depth*p})).attr("dy",20).style("font-weight","normal").style("font-size","13px").text((function(t){if("undefined"===typeof t.totalIn)return null;var n="".concat(Object(vn["translate"])("General_NVisits",t.totalIn),", ");return n+="".concat(Object(vn["translate"])("UsersFlow_NProceededInline",t.totalOut),", "),n+=Object(vn["translate"])("Transitions_ExitsInline",t.totalExits),n})).attr("fill","black"),S.nodes(e).links(r).layout(32);var C=dn().attr("class","d3-tip").offset([-10,0]).html((function(t){var e=w(t.value);if(t.source&&t.source.totalIn&&(e+=" (".concat(n.getPercentage(t.value,t.source.totalIn),")")),Mn(t.target.name)){var r=Object(vn["translate"])("Transitions_ExitsInline",e),i=vn["Matomo"].helper.htmlEntities(window.vueSanitize(t.source.name));return n.makeToolTip("".concat(i,": ").concat(r,""))}var o='"'.concat(vn["Matomo"].helper.htmlEntities(vn["Matomo"].helper.escape(t.source.name)),'"'),a='"'.concat(vn["Matomo"].helper.htmlEntities(vn["Matomo"].helper.escape(t.target.name)),'"'),u=Object(vn["translate"])("UsersFlow_InteractionXToY",o,a);return n.makeToolTip("".concat(u,"
").concat(e))})),O=b.append("g").selectAll(".link").data(r).enter().append("path").attr("class",(function(t){var n="link ";if(Mn(t.target.name))return"".concat(n," outNodeLink");var e=0;return t.source.totalOut>0&&(e=t.value/t.source.totalOut*100),n+=e<=8?" linkSize1":e<=16?" linkSize2":e<=24?" linkSize3":e<=32?" linkSize4":e<=42?" linkSize5":" linkSize6",n})).attr("d",E).attr("id",(function(t,n){return t.id=n,"link-".concat(n)})).style("stroke",(function(t){return Mn(t.target.name)?"#ec5540":"#A9E2F3"})).style("stroke-width",(function(t){return Math.max(1,t.dy)})).sort((function(t,n){return n.dy-t.dy}));O&&!O.empty()&&O.call(C).on("mouseover",C.show).on("mouseout",C.hide);var P=dn().attr("class","d3-tip").offset([-10,0]).html((function(t){if(Mn(t.name))return"";var e=vn["Matomo"].helper.htmlEntities(vn["Matomo"].helper.escape(t.name)),r=Object(vn["translate"])("General_ColumnNbVisits"),i="\n".concat(t.totalOut," (").concat(n.getPercentage(t.totalOut,t.totalIn),")\n"),o="\n".concat(t.totalExits," (").concat(n.getPercentage(t.totalExits,t.totalIn),")\n");return n.makeToolTip("".concat(e,"
\n").concat(r,": ").concat(t.totalIn,"
\n").concat(Object(vn["translate"])("UsersFlow_ColumnProceeded"),": ").concat(i,"
\n").concat(Object(vn["translate"])("General_ColumnExits"),": ").concat(o))})),L=b.append("g").selectAll(".node").data(e).enter().append("g").attr("class",(function(t){var n="node nodeDepth".concat(t.depth+1);return Mn(t.name)&&(n+=" outNode"),n})).attr("transform",(function(t){return"translate(".concat(t.x,",").concat(t.y,")")}));if(L.on("click",l),L.call(P).on("mouseover",P.show).on("mouseout",P.hide),L.append("rect").attr("height",(function(t){return t.dy})).attr("width",S.nodeWidth()).style("fill",(function(t){return Mn(t.name)?"url(#pageOutGradient)":"url(#normalGradient)"})).style("stroke","#333"),L.append("text").attr("x",4).attr("y",-5).attr("text-anchor","left").attr("transform","rotate(0)").text((function(t){if(Mn(t.name))return"";var e=t.name;return kn(e)?(t.pagesInGroup&&(e+=" (>".concat(Object(vn["translate"])("VisitorInterest_NPages",t.pagesInGroup),")")),e):(n.isUrlLike(e)&&(e=e.substr(e.indexOf("/"))),e.length>33?"".concat(e.substr(0,15),"...").concat(e.substr(-15)):e)})).attr("fill","black"),L.append("text").attr("x",4).attr("y",18).attr("transform","rotate(0)").attr("text-anchor","left").text((function(t){return w(t.totalIn)})).attr("fill","black"),this.numSteps div").width();t&&bn(".sankeyChartOuter").animate({scrollLeft:t-3})}),20)}));U.append("path").attr("d","M512 960c-282.752 0-512-229.248-512-512s229.248-512 512-512 512 229.248 512 512-229.248 512-512 512zM682.688 362.688h-85.376v-85.312c0-47.168-38.208-85.376-85.312-85.376s-85.312 38.208-85.312 85.312v85.376h-85.376c-47.104 0-85.312 38.208-85.312 85.312s38.208 85.312 85.312 85.312h85.312v85.376c0.064 47.104 38.272 85.312 85.376 85.312s85.312-38.208 85.312-85.312v-85.312h85.312c47.168-0.064 85.376-38.272 85.376-85.376s-38.208-85.312-85.312-85.312z").attr("dx",y-50).attr("dy",-30).attr("transform","translate(".concat(y-50,",-66) scale(0.04)")).attr("text-anchor","middle").attr("class","addNewStep").append("title").text(Object(vn["translate"])("UsersFlow_ActionAddStep")),U.append("rect").attr("x",y-50).attr("y","-69").attr("width","40").attr("height","40").attr("fill","transparent").style("cursor","pointer").append("title").text(Object(vn["translate"])("UsersFlow_ActionAddStep"))}}},buildNodesAndIndexes:function(t){var n=this;this.maxSankeyChartDepth=0,this.maxNodeLength=0;var e,r=[],i=[],o=[];t.forEach((function(t){e=parseInt(t.label,10),e>n.maxSankeyChartDepth&&(n.maxSankeyChartDepth=e)})),this.numSteps>this.maxSankeyChartDepth&&(this.numSteps=this.maxSankeyChartDepth);var a=0;return t.forEach((function(t){if(e=parseInt(t.label,10),t.subtable&&(t.subtable.length+1>n.maxNodeLength&&(n.maxNodeLength=t.subtable.length+1),!(e>n.numSteps))){var u={depth:e-1,in:0,out:0,totalIn:t.nb_visits,totalOut:t.nb_proceeded,totalExits:t.nb_exits};t.subtable.forEach((function(t){var o=t.label;kn(o)||(u.in+=t.nb_visits,u.out+=t.nb_proceeded),i.push({depth:e-1,name:o,node:a,totalIn:t.nb_visits,totalOut:t.nb_proceeded,totalExits:t.nb_exits,pagesInGroup:t.nb_pages_in_group?t.nb_pages_in_group:0,isSummaryNode:kn(o),idSubtable:t.idsubdatatable?t.idsubdatatable:null}),a+=1,e>=n.numSteps||t.subtable&&((t.subtable||[]).forEach((function(t){r.push({depth:e,source:a-1,target:t.label,value:t.nb_visits})})),t.nb_exits&&r.push({depth:e,source:a-1,target:_n,value:t.nb_exits}))})),o.push(u),e>1&&(i.push({depth:e-1,name:_n,node:a,value:0,totalIn:0}),a+=1)}})),r.forEach((function(t){i.some((function(n){return t.target===n.name&&t.depth===n.depth&&(t.target=n.node,!0)}))})),{nodes:i,links:r,depthNodes:o}},fetchData:function(){var t=this;this.clearSankeyChart(),this.isExploringTraffic=!(!this.exploreStep||!this.exploreUrl),this.isLoading=!0,this.rawResponse=[],vn["AjaxHelper"].fetch({method:"UsersFlow.getUsersFlow",expanded:"1",filter_limit:"-1",dataSource:this.actualUserFlowSource,limitActionsPerStep:this.numActionsPerStep,exploreStep:this.isExploringTraffic?this.exploreStep:void 0,exploreUrl:this.isExploringTraffic?this.exploreUrl:void 0}).then((function(n){if(t.isLoading=!1,t.rawResponse=n,t.clearSankeyChart(),(null===n||void 0===n?void 0:n.length)>0){var e=t.buildNodesAndIndexes(t.rawResponse);t.drawSankeyChart(e)}else t.hasData=!1}))},updateViewParams:function(){var t={numActionsPerStep:this.numActionsPerStep,levelOfDetail:this.actualLevelOfDetail,userFlowSource:this.actualUserFlowSource};vn["AjaxHelper"].post({module:"CoreHome",action:"saveViewDataTableParameters",report_id:"UsersFlow.getUsersFlow",segment:""},{parameters:JSON.stringify(t)},{withTokenInUrl:!0,format:"html"}).catch((function(){}))}},computed:{canEnableExploreTraffic:function(){return"year"!==vn["Matomo"].period},actionsPerStepOptions:function(){for(var t=[{key:4,value:4},{key:5,value:5}],n=6;n<=20;n+=2)t.push({key:n,value:n});return t},levelOfDetailOptions:function(){return[{key:1,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail1")},{key:2,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail2")},{key:3,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail3")},{key:4,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail4")},{key:5,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail5")},{key:6,value:Object(vn["translate"])("UsersFlow_OptionLevelOfDetail6")}]}}});Sn.render=p;var En=Sn,Nn={key:0},Tn={class:"widgetBody usersFlowIntroduction"},An={key:1,class:"card"},Cn={class:"card-content"},On={key:2,class:"widgetBody"};function Pn(t,n,e,r,i,a){var u=Object(o["resolveComponent"])("EnrichedHeadline"),c=Object(o["resolveComponent"])("Visualization");return Object(o["openBlock"])(),Object(o["createElementBlock"])(o["Fragment"],null,[t.showTitle?(Object(o["openBlock"])(),Object(o["createElementBlock"])("h2",Nn,[Object(o["createVNode"])(u,null,{default:Object(o["withCtx"])((function(){return[Object(o["createTextVNode"])(Object(o["toDisplayString"])(t.translate("UsersFlow_UsersFlow")),1)]})),_:1})])):Object(o["createCommentVNode"])("",!0),Object(o["createElementVNode"])("p",Tn,Object(o["toDisplayString"])(t.translate("UsersFlow_UsersFlowVisualizationDescription1"))+" "+Object(o["toDisplayString"])(t.usersFlowDesc2),1),t.showTitle?(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",An,[Object(o["createElementVNode"])("div",Cn,[Object(o["createVNode"])(c,{"actions-per-step":t.actionsPerStep,"level-of-detail":t.levelOfDetail,"user-flow-source":t.userFlowSource},null,8,["actions-per-step","level-of-detail","user-flow-source"])])])):(Object(o["openBlock"])(),Object(o["createElementBlock"])("div",On,[Object(o["createVNode"])(c,{"actions-per-step":t.actionsPerStep,"level-of-detail":t.levelOfDetail,"user-flow-source":t.userFlowSource},null,8,["actions-per-step","level-of-detail","user-flow-source"])]))],64)}var Ln=Object(o["defineComponent"])({props:{showTitle:String,actionsPerStep:Number,levelOfDetail:Number,userFlowSource:String},components:{EnrichedHeadline:vn["EnrichedHeadline"],Visualization:En},computed:{usersFlowDesc2:function(){return Object(vn["translate"])("UsersFlow_UsersFlowVisualizationDescription2",Object(vn["translate"])("General_Others"),Object(vn["translate"])("UsersFlow_ColumnInteraction"),Object(vn["translate"])("UsersFlow_ActionShowDetails"),Object(vn["translate"])("UsersFlow_ExploreTraffic"))}}});Ln.render=Pn;var Un=Ln; +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */}})})); +//# sourceMappingURL=UsersFlow.umd.min.js.map \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/vue/dist/umd.metadata.json b/files/plugin-UsersFlow-5.0.6/vue/dist/umd.metadata.json new file mode 100644 index 0000000..dce4477 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/dist/umd.metadata.json @@ -0,0 +1,6 @@ +{ + "dependsOn": [ + "CoreHome", + "CorePluginsAdmin" + ] +} \ No newline at end of file diff --git a/files/plugin-UsersFlow-5.0.6/vue/src/GetUsersFlow/GetUsersFlow.vue b/files/plugin-UsersFlow-5.0.6/vue/src/GetUsersFlow/GetUsersFlow.vue new file mode 100644 index 0000000..07eefd9 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/src/GetUsersFlow/GetUsersFlow.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/files/plugin-UsersFlow-5.0.6/vue/src/Visualization/Visualization.less b/files/plugin-UsersFlow-5.0.6/vue/src/Visualization/Visualization.less new file mode 100644 index 0000000..908a2a6 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/src/Visualization/Visualization.less @@ -0,0 +1,230 @@ +.uiTest { + .piwikUsersFlowVisualization { + .sankeyChartOuter { + overflow: visible; + } + } + + #widgetUsersFlowgetUsersFlow, + #widgetUsersFlowgetUsersFlow .card { + width: 4000px; + } +} +.reporting-page { + .piwikUsersFlowVisualization { + .sankeyChart { + margin-left: -5px; + } + } +} +body.widgetized { + .piwikUsersFlowVisualization { + margin-left: 10px; + margin-right: 10px; + .sankeyChart { + margin-left: -5px; + } + } + .usersFlowIntroduction { + margin: 10px; + } +} + +.piwikUsersFlowVisualization { + .sankeyChartOuter { + overflow: scroll; + } + + .exploringTraffic { + margin-bottom: 30px !important; + } + + .userFlowSource, + .actionsPerStep, + .levelOfDetail { + .form-group { + margin: 0 !important; + } + width: 250px; + display: inline-block; + } + + .usersFlowActionBar { + margin-left: -0.75rem; + } + + .linkDetail1 { + .linkSize1 { + display: none; + } + .linkSize2 { + display: none; + } + .linkSize3 { + display: none; + } + .linkSize4 { + display: none; + } + .linkSize5 { + display: none; + } + } + + .linkDetail2 { + .linkSize1 { + display: none; + } + .linkSize2 { + display: none; + } + .linkSize3 { + display: none; + } + .linkSize4 { + display: none; + } + } + + .linkDetail3 { + .linkSize1 { + display: none; + } + .linkSize2 { + display: none; + } + .linkSize3 { + display: none; + } + } + + .linkDetail4 { + .linkSize1 { + display: none; + } + .linkSize2 { + display: none; + } + } + + .linkDetail5 { + .linkSize1 { + display: none; + } + } + + .depthContainerTitle { + font-weight:bold; + } + + .addNewStepContainer rect, + .depthContainerTitle, + .addNewStepContainer, + .addNewStep, + .removeStep { + cursor: pointer; + } + + .addNewStep { + fill: #999; + } + + .link { + fill: none; + stroke: #A9E2F3; + stroke-opacity: .8; + } + + + .highlightedLink, + .link:not(.outNodeLink):hover { + stroke-opacity: 1 !important; + stroke: #94c8d8 !important; + } + + .node { + &.highlightedNode rect { + fill-opacity: 1 !important; + stroke-opacity: 1 !important; + stroke-width: 2; + } + + &.outNode { + display: none; + } + rect { + cursor: pointer; + fill-opacity: .9; + shape-rendering: crispEdges; + stroke-width: 1; + } + text { + pointer-events: none; + font: normal 12px Arial; + } + } + +} + +.usersFlowPopupMenu { + position: absolute; + display: none; + border-radius: 4px; + font-size: 13px; + background-color: @theme-color-background-tinyContrast; + border: 1px solid @theme-color-border; + min-width: 160px; + z-index:1500; + + ul { + margin: 0; + list-style-type: none; + padding: 0; + cursor: default; + li { + cursor: pointer; + padding: 4px 16px; + + a { + color: @theme-color-text; + text-decoration: none; + } + + &:not(.divider):hover a, + &:not(.divider):hover { + background-color: @theme-color-link; + color: @theme-color-background-lowContrast; + text-decoration: none; + } + } + } + + .divider { + cursor: default; + padding: 0; + border: 0; + height: 0; + border-top: 1px solid rgba(0, 0, 0, 0.1); + border-bottom: 1px solid rgba(255, 255, 255, 0.3); + background-color: @theme-color-background-tinyContrast; + } +} + +.userFlowNodeTooltip { + font-size: 14px; + line-height: 21px; + font-weight: normal; + + .nodeTooltipVisits { + color: #ff9800; + } + + .nodeTooltipProceeded { + color: #84D04D; + } + + .nodeTooltipExits { + color: #FA5858; + } + +} diff --git a/files/plugin-UsersFlow-5.0.6/vue/src/Visualization/Visualization.vue b/files/plugin-UsersFlow-5.0.6/vue/src/Visualization/Visualization.vue new file mode 100644 index 0000000..74cae65 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/src/Visualization/Visualization.vue @@ -0,0 +1,1110 @@ + + + + + diff --git a/files/plugin-UsersFlow-5.0.6/vue/src/index.ts b/files/plugin-UsersFlow-5.0.6/vue/src/index.ts new file mode 100644 index 0000000..6c8d378 --- /dev/null +++ b/files/plugin-UsersFlow-5.0.6/vue/src/index.ts @@ -0,0 +1,17 @@ +/** + * Copyright (C) InnoCraft Ltd - All rights reserved. + * + * NOTICE: All information contained herein is, and remains the property of InnoCraft Ltd. + * The intellectual and technical concepts contained herein are protected by trade secret + * or copyright law. Redistribution of this information or reproduction of this material is + * strictly forbidden unless prior written permission is obtained from InnoCraft Ltd. + * + * You shall use this code only in accordance with the license agreement obtained from + * InnoCraft Ltd. + * + * @link https://www.innocraft.com/ + * @license For license details see https://www.innocraft.com/license + */ + +export { default as Visualization } from './Visualization/Visualization.vue'; +export { default as GetUsersFlow } from './GetUsersFlow/GetUsersFlow.vue';