From 24d4399269aadccf23a5e89f0a409d81e21f5203 Mon Sep 17 00:00:00 2001 From: fmsthird Date: Fri, 1 Sep 2023 07:48:18 +0800 Subject: [PATCH 1/2] Feature: Add Merge PDFs (Packing slip and Trunkrs Label) --- Controller/Adminhtml/LabelAbstract.php | 75 ++ .../Order/PrintLabelAndPackingSlips.php | 201 ++++ Controller/Adminhtml/PdfDownload.php | 58 + Service/Framework/FileFactory.php | 131 +++ Service/Shipment/Labelling/GetLabels.php | 54 + .../Compatibility/DataHelperFactoryProxy.php | 50 + .../Compatibility/FoomanPdfCustomiser.php | 92 ++ .../Compatibility/GeneratePdfFactoryProxy.php | 50 + .../OrderShipmentFactoryProxy.php | 48 + .../Compatibility/PdfRendererFactoryProxy.php | 48 + .../Compatibility/ShipmentFactoryProxy.php | 48 + .../Compatibility/XtentoPdfCustomizer.php | 80 ++ Service/Shipment/Packingslip/Factory.php | 100 ++ Service/Shipment/Packingslip/Generate.php | 78 ++ .../Shipment/Packingslip/GetPackingslip.php | 61 + .../Shipment/Packingslip/Items/Barcode.php | 180 +++ .../Packingslip/Items/ItemsInterface.php | 16 + composer.json | 6 +- etc/adminhtml/routes.xml | 9 + etc/module.xml | 2 +- .../templates/system/config/trunkrs.phtml | 2 +- .../ui_component/sales_order_grid.xml | 11 + view/adminhtml/web/js/trunkrs.bundle.min.js | 1035 ++++++++++++++++- 23 files changed, 2430 insertions(+), 5 deletions(-) create mode 100644 Controller/Adminhtml/LabelAbstract.php create mode 100644 Controller/Adminhtml/Order/PrintLabelAndPackingSlips.php create mode 100644 Controller/Adminhtml/PdfDownload.php create mode 100644 Service/Framework/FileFactory.php create mode 100644 Service/Shipment/Labelling/GetLabels.php create mode 100644 Service/Shipment/Packingslip/Compatibility/DataHelperFactoryProxy.php create mode 100644 Service/Shipment/Packingslip/Compatibility/FoomanPdfCustomiser.php create mode 100644 Service/Shipment/Packingslip/Compatibility/GeneratePdfFactoryProxy.php create mode 100644 Service/Shipment/Packingslip/Compatibility/OrderShipmentFactoryProxy.php create mode 100644 Service/Shipment/Packingslip/Compatibility/PdfRendererFactoryProxy.php create mode 100644 Service/Shipment/Packingslip/Compatibility/ShipmentFactoryProxy.php create mode 100644 Service/Shipment/Packingslip/Compatibility/XtentoPdfCustomizer.php create mode 100644 Service/Shipment/Packingslip/Factory.php create mode 100644 Service/Shipment/Packingslip/Generate.php create mode 100644 Service/Shipment/Packingslip/GetPackingslip.php create mode 100644 Service/Shipment/Packingslip/Items/Barcode.php create mode 100644 Service/Shipment/Packingslip/Items/ItemsInterface.php create mode 100644 etc/adminhtml/routes.xml diff --git a/Controller/Adminhtml/LabelAbstract.php b/Controller/Adminhtml/LabelAbstract.php new file mode 100644 index 0000000..a3a0943 --- /dev/null +++ b/Controller/Adminhtml/LabelAbstract.php @@ -0,0 +1,75 @@ +getLabels = $getLabels; + $this->getPdf = $getPdf; + $this->getPackingSlip = $getPackingSlip; + } + + /** + * @param $shipmentId + * @return void + * @throws NotFoundException|PdfParserException|\Zend_Pdf_Exception + */ + protected function setPackingslip($shipmentId) + { + $packingslip = $this->getPackingSlip->get($shipmentId); + if (is_array($packingslip)) { + $this->messageManager->addSuccessMessage( + __('Something went wrong.') + ); + return; + } + + if (strlen($packingslip) === 0) { + return; + } + + $this->labels[] = $packingslip; + } +} diff --git a/Controller/Adminhtml/Order/PrintLabelAndPackingSlips.php b/Controller/Adminhtml/Order/PrintLabelAndPackingSlips.php new file mode 100644 index 0000000..4083a8b --- /dev/null +++ b/Controller/Adminhtml/Order/PrintLabelAndPackingSlips.php @@ -0,0 +1,201 @@ +collectionFactory = $collectionFactory; + $this->orderCollectionFactory = $orderCollectionFactory; + $this->fileFactory = $fileFactory; + $this->labelGenerator = $labelGenerator; + $this->shipmentRepository = $shipmentRepository; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->logger = $logger; + $this->filter = $filter; + parent::__construct($context, $getLabels, $getPdf, $getPackingSlip); + } + + /** + * @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface|null + * @throws NotFoundException|PdfParserException|\Zend_Pdf_Exception + */ + public function execute() + { + $collection = $this->orderCollectionFactory->create(); + + try { + $collection = $this->filter->getCollection($collection); + } catch (LocalizedException $exception) { + $this->messageManager->addWarningMessage($exception->getMessage()); + return null; + } + + foreach ($collection as $order) { + $trunkrsShipment = $order->getShippingMethod() === $this::TRUNKRS_SHIPPING_CODE; + if($trunkrsShipment) { + $this->orderIds[] = $order->getId(); + $this->handleShipmentDataFromOrder($order); + } + } + + if (empty($this->orderIds)) { + $this->messageManager->addErrorMessage( + __('No pdf generated. Trunkrs shipment not found.') + ); + return $this->_redirect($this->_redirect->getRefererUrl()); + } + + return $this->getPdf->get($this->labels, self::TRUNKRS_LABEL_IN_PACKINGSLIPS); + } + + /** + * @param $order + * @return void + * @throws NotFoundException|PdfParserException|\Zend_Pdf_Exception + */ + private function handleShipmentDataFromOrder($order) + { + $shipments = $this->getShipmentDataByOrderId($order->getId()); + + if (!$shipments) { + return; + } + + $this->loadLabels($shipments); + } + + /** + * Shipment by Order id + * + * @param int $orderId + * @return ShipmentInterface[]|null + */ + public function getShipmentDataByOrderId(int $orderId) + { + $searchCriteria = $this->searchCriteriaBuilder + ->addFilter('order_id', $orderId)->create(); + try { + $shipments = $this->shipmentRepository->getList($searchCriteria); + $shipmentRecords = $shipments->getItems(); + } catch (\Exception $exception) { + $this->logger->critical($exception->getMessage()); + $shipmentRecords = null; + } + return $shipmentRecords; + } + + /** + * Handle loading shipments + * @param $shipments + * @return void + * @throws NotFoundException|PdfParserException|\Zend_Pdf_Exception + */ + private function loadLabels($shipments) + { + if (!is_array($shipments)) { + $this->loadLabel($shipments); + return; + } + + foreach ($shipments as $shipment) { + $this->loadLabel($shipment); + } + + } + + /** + * @param $shipment + * @return void + * @throws NotFoundException|\Zend_Pdf_Exception|PdfParserException + */ + private function loadLabel($shipment) + { + $this->setPackingslip($shipment->getId()); + } +} diff --git a/Controller/Adminhtml/PdfDownload.php b/Controller/Adminhtml/PdfDownload.php new file mode 100644 index 0000000..dac885e --- /dev/null +++ b/Controller/Adminhtml/PdfDownload.php @@ -0,0 +1,58 @@ +fileFactory = $fileFactory; + $this->packingslipGenerator = $packingslipGenerator; + } + + /** + * @param $labels + * @param string $filename + * @return ResponseInterface + */ + public function get($labels, $filename = 'ShippingLabels') + { + $pdfLabel = $this->generateLabel($labels); + + return $this->fileFactory->create( + $filename . '.pdf', + $pdfLabel + ); + } + + /** + * @param $labels + * @return string + */ + private function generateLabel($labels) + { + return $this->packingslipGenerator->run($labels); + } +} diff --git a/Service/Framework/FileFactory.php b/Service/Framework/FileFactory.php new file mode 100644 index 0000000..6194328 --- /dev/null +++ b/Service/Framework/FileFactory.php @@ -0,0 +1,131 @@ +response = $response; + $this->filesystem = $filesystem; + } + + public function create( + $fileName, + $content, + $responseType = 'attachment', + $baseDir = DirectoryList::VAR_DIR, + $contentType = 'application/pdf', + $contentLength = null + ) + { + $dir = $this->filesystem->getDirectoryWrite($baseDir); + if (is_array($content)) { + $contentLength = $this->getContentLenghtAndSetFile($dir, $content); + } + + $this->response->setHttpResponseCode(200) + ->setHeader('Pragma', 'public', true) + ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true) + ->setHeader('Content-type', $contentType, true) + ->setHeader('Content-Length', $contentLength === null ? strlen((string)$content) : $contentLength, true) + ->setHeader('Content-Disposition', $responseType . '; filename="' . $fileName . '"', true) + ->setHeader('Last-Modified', date('r'), true); + + if ($content !== null) { + $this->openStreamAndFlush($fileName, $content, $dir); + } + + return $this->response; + } + + /** + * @param $fileName + * @param $content + * @param WriteInterface $dir + * @throws FileSystemException + */ + private function openStreamAndFlush($fileName, $content, $dir) + { + $this->response->sendHeaders(); + if ($this->isFile) { + $stream = $dir->openFile($this->file, 'r'); + while (!$stream->eof()) { + echo $stream->read(1024); + } + } else { + $dir->writeFile($fileName, $content); + $stream = $dir->openFile($fileName, 'r'); + while (!$stream->eof()) { + echo $stream->read(1024); + } + } + + $stream->close(); + flush(); + if (!empty($content['rm'])) { + $dir->delete($this->file); + } + } + + /** + * @param WriteInterface $dir + * @param $content + * + * @return string + * @throws \Exception + */ + private function getContentLenghtAndSetFile($dir, $content) + { + if (!isset($content['type']) || !isset($content['value'])) { + throw new \InvalidArgumentException("Invalid arguments. Keys 'type' and 'value' are required."); + } + + if ($content['type'] !== 'filename') { + return null; + } + + $this->isFile = true; + $this->file = $content['value']; + if (!$dir->isFile($this->file)) { + throw new \Magento\Framework\Exception\LocalizedException((__('File not found'))); + } + + return $dir->stat($this->file)['size']; + } +} diff --git a/Service/Shipment/Labelling/GetLabels.php b/Service/Shipment/Labelling/GetLabels.php new file mode 100644 index 0000000..de79e69 --- /dev/null +++ b/Service/Shipment/Labelling/GetLabels.php @@ -0,0 +1,54 @@ +shipmentRepository = $shipmentRepository; + } + + /** + * @param $shipmentId + * @return array|\Magento\Sales\Api\Data\ShipmentItemInterface[] + */ + public function get($shipmentId) + { + $shipment = $this->shipmentRepository->get($shipmentId); + + if (!$shipment) { + return []; + } + + return $this->getLabels($shipment); + } + + /** + * @param ShipmentInterface $shipment + * @return array|\Magento\Sales\Api\Data\ShipmentItemInterface[] + */ + private function getLabels(ShipmentInterface $shipment) + { + $labels = $shipment->getItems(); + + if ($labels) { + return $labels; + } + + return []; + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/DataHelperFactoryProxy.php b/Service/Shipment/Packingslip/Compatibility/DataHelperFactoryProxy.php new file mode 100644 index 0000000..d40cc07 --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/DataHelperFactoryProxy.php @@ -0,0 +1,50 @@ +objectManager = $objectManager; + } + + /** + * @return mixed|Data + */ + private function getSubject() + { + if (!$this->subject) { + $this->subject = $this->objectManager->get(\Xtento\PdfCustomizer\Helper\DataFactory::class); + } + + return $this->subject; + } + + /** + * @param array $data + * + * @return mixed + */ + public function create(array $data = []) + { + return $this->getSubject()->create($data); + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/FoomanPdfCustomiser.php b/Service/Shipment/Packingslip/Compatibility/FoomanPdfCustomiser.php new file mode 100644 index 0000000..16515d7 --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/FoomanPdfCustomiser.php @@ -0,0 +1,92 @@ +orderRepository = $orderRepository; + $this->scopeConfig = $scopeConfig; + $this->orderShipmentFactoryProxy = $orderShipmentFactoryProxy; + $this->shipmentFactoryProxy = $shipmentFactoryProxy; + $this->pdfRendererFactoryProxy = $pdfRendererFactoryProxy; + } + + /** + * @param Factory $factory + * @param ShipmentInterface $magentoShipment + * + * @return string + * @throws NotFoundException + */ + public function getPdf(Factory $factory, ShipmentInterface $magentoShipment) + { + $document = $this->getPdfDocument($magentoShipment); + /** @var \Fooman\PdfCore\Model\PdfRenderer $pdfRenderer */ + $pdfRenderer = $this->pdfRendererFactoryProxy->create(); + + $pdfRenderer->addDocument($document); + + if (!$pdfRenderer->hasPrintContent()) { + throw new NotFoundException(__('Nothing to print')); + } + + $factory->changeY(500); + + return $pdfRenderer->getPdfAsString(); + } + + /** + * @param ShipmentInterface $magentoShipment + * + * @return \Fooman\PdfCustomiser\Block\OrderShipment|\Fooman\PdfCustomiser\Block\Shipment + */ + private function getPdfDocument(ShipmentInterface $magentoShipment) + { + if ($this->scopeConfig->isSetFlag('sales_pdf/shipment/shipmentuseorder')) { + $orderId = $magentoShipment->getOrderId(); + $order = $this->orderRepository->get($orderId); + return $this->orderShipmentFactoryProxy->create(['data' => ['order' => $order]]); + } + return $this->shipmentFactoryProxy->create(['data' => ['shipment' => $magentoShipment]]); + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/GeneratePdfFactoryProxy.php b/Service/Shipment/Packingslip/Compatibility/GeneratePdfFactoryProxy.php new file mode 100644 index 0000000..97c5e06 --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/GeneratePdfFactoryProxy.php @@ -0,0 +1,50 @@ +objectManager = $objectManager; + } + + /** + * @return mixed|Data + */ + private function getSubject() + { + if (!$this->subject) { + $this->subject = $this->objectManager->get(\Xtento\PdfCustomizer\Helper\GeneratePdfFactory::class); + } + + return $this->subject; + } + + /** + * @param array $data + * + * @return mixed + */ + public function create(array $data = []) + { + return $this->getSubject()->create($data); + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/OrderShipmentFactoryProxy.php b/Service/Shipment/Packingslip/Compatibility/OrderShipmentFactoryProxy.php new file mode 100644 index 0000000..b7cb456 --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/OrderShipmentFactoryProxy.php @@ -0,0 +1,48 @@ +objectManager = $objectManager; + } + + /** + * @return \Fooman\PdfCustomiser\Block\OrderShipmentFactory + */ + private function getSubject() + { + if (!$this->subject) { + $this->subject = $this->objectManager->get(\Fooman\PdfCustomiser\Block\OrderShipmentFactory::class); + } + return $this->subject; + } + + /** + * @param array $data + * + * @return \Fooman\PdfCustomiser\Block\OrderShipment + */ + public function create(array $data = []) + { + return $this->getSubject()->create($data); + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/PdfRendererFactoryProxy.php b/Service/Shipment/Packingslip/Compatibility/PdfRendererFactoryProxy.php new file mode 100644 index 0000000..b83505f --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/PdfRendererFactoryProxy.php @@ -0,0 +1,48 @@ +objectManager = $objectManager; + } + + /** + * @return \Fooman\PdfCore\Model\PdfRendererFactory + */ + private function getSubject() + { + if (!$this->subject) { + $this->subject = $this->objectManager->get(\Fooman\PdfCore\Model\PdfRendererFactory::class); + } + return $this->subject; + } + + /** + * @param array $data + * + * @return \Fooman\PdfCore\Model\PdfRendererFactory + */ + public function create(array $data = []) + { + return $this->getSubject()->create($data); + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/ShipmentFactoryProxy.php b/Service/Shipment/Packingslip/Compatibility/ShipmentFactoryProxy.php new file mode 100644 index 0000000..90824e8 --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/ShipmentFactoryProxy.php @@ -0,0 +1,48 @@ +objectManager = $objectManager; + } + + /** + * @return \Fooman\PdfCustomiser\Block\ShipmentFactory + */ + private function getSubject() + { + if (!$this->subject) { + $this->subject = $this->objectManager->get(\Fooman\PdfCustomiser\Block\ShipmentFactory\Proxy::class); + } + return $this->subject; + } + + /** + * @param array $data + * + * @return \Fooman\PdfCustomiser\Block\Shipment + */ + public function create(array $data = []) + { + return $this->getSubject()->create($data); + } +} diff --git a/Service/Shipment/Packingslip/Compatibility/XtentoPdfCustomizer.php b/Service/Shipment/Packingslip/Compatibility/XtentoPdfCustomizer.php new file mode 100644 index 0000000..41e50c4 --- /dev/null +++ b/Service/Shipment/Packingslip/Compatibility/XtentoPdfCustomizer.php @@ -0,0 +1,80 @@ +orderRepository = $orderRepository; + $this->dataHelper = $dataHelper; + $this->pdfGenerator = $pdfGenerator; + } + + /** + * @param Factory $factory + * @param ShipmentInterface $magentoShipment + * + * @return mixed + */ + public function getPdf(ShipmentInterface $magentoShipment) + { + $orderId = $magentoShipment->getOrderId(); + $order = $this->orderRepository->get($orderId); + + $xtentoDataHelper = $this->dataHelper->create(); + $template = $xtentoDataHelper->getDefaultTemplate($order, TemplateType::TYPE_SHIPMENT); + $templateId = $template->getId(); + + $generatePdfHelper = $this->pdfGenerator->create(); + $document = $generatePdfHelper->generatePdfForObject('shipment', $magentoShipment->getId(), $templateId); + + return $document['output']; + } + + /** + * @return bool + */ + public function isShipmentPdfEnabled() + { + $xtentoDataHelper = $this->dataHelper->create(); + + if ($xtentoDataHelper->isEnabled(Data::ENABLE_SHIPMENT)) { + return true; + } + + return false; + } +} diff --git a/Service/Shipment/Packingslip/Factory.php b/Service/Shipment/Packingslip/Factory.php new file mode 100644 index 0000000..4955344 --- /dev/null +++ b/Service/Shipment/Packingslip/Factory.php @@ -0,0 +1,100 @@ +moduleManager = $manager; + $this->magentoPdf = $pdfShipment; + $this->foomanPdfCustomiser = $foomanPdfCustomiser; + $this->xtentoPdfCustomizer = $xtentoPdfCustomizer; + } + + /** + * @param $magentoShipment + * @param $forceMagento + * @return mixed|string + * @throws NotFoundException|Zend_Pdf_Exception + */ + public function create($magentoShipment, $forceMagento = false) + { + if (!$forceMagento && $this->moduleManager->isEnabled('Fooman_PdfCustomiser')) { + return $this->foomanPdfCustomiser->getPdf($this, $magentoShipment); + } + + if (!$forceMagento && + $this->moduleManager->isEnabled('Xtento_PdfCustomizer') && + $this->xtentoPdfCustomizer->isShipmentPdfEnabled() + ) { + return $this->xtentoPdfCustomizer->getPdf($magentoShipment); + } + + $renderer = $this->magentoPdf->getPdf([$magentoShipment]); + $this->changeY($this->magentoPdf->y); + return $renderer->render(); + } + + /** + * @return int + */ + public function getY() + { + return $this->yCoordinate; + } + + /** + * @param $coordinate + */ + public function changeY($coordinate) + { + $this->yCoordinate = $coordinate; + } +} diff --git a/Service/Shipment/Packingslip/Generate.php b/Service/Shipment/Packingslip/Generate.php new file mode 100644 index 0000000..4fa2dc0 --- /dev/null +++ b/Service/Shipment/Packingslip/Generate.php @@ -0,0 +1,78 @@ +logger = $logger; + } + + /** + * @param array $labels + * + * @return string + */ + public function run(array $labels) + { + $pdf = new Fpdi(); + + foreach ($labels as $label) { + $pdf = $this->addLabelToPdf($label, $pdf); + } + + return $pdf->Output('S'); + } + + /** + * @param $label + * @param $pdf + * @return mixed + */ + private function addLabelToPdf($label, $pdf) + { + if (empty($label)) { + return $pdf; + } + + try { + $stream = StreamReader::createByString($label); + $pageCount = $pdf->setSourceFile($stream); + } catch (PdfParserException $parserException) { + $this->logger->error('Error while parsing sourcefile: ' . $parserException->getMessage()); + return $pdf; + } + + for ($pageIndex = 0; $pageIndex < $pageCount; $pageIndex++) { + try { + $templateId = $pdf->importPage($pageIndex + 1); + $pageSize = $pdf->getTemplateSize($templateId); + + $pdf->AddPage($pageSize['orientation'], $pageSize); + + $pdf->useTemplate($templateId); + } catch (PdfParserException $fpdiException) { + $this->logger->error('PdfParserException: ' . $fpdiException->getMessage()); + } catch (PdfReaderException $readerException) { + $this->logger->error('ReaderException: ' . $readerException->getMessage()); + } + } + + return $pdf; + } +} diff --git a/Service/Shipment/Packingslip/GetPackingslip.php b/Service/Shipment/Packingslip/GetPackingslip.php new file mode 100644 index 0000000..e276815 --- /dev/null +++ b/Service/Shipment/Packingslip/GetPackingslip.php @@ -0,0 +1,61 @@ +shipmentRepository = $shipmentLabelRepository; + $this->pdfShipment = $pdfShipment; + $this->barcodeMerger = $barcode; + } + + /** + * @param $shipmentId + * @return string + * @throws NotFoundException|PdfParserException|\Zend_Pdf_Exception + */ + public function get($shipmentId) + { + $shipment = $this->shipmentRepository->get($shipmentId); + + if (!$shipment) { + return ''; + } + + $packingSlip = $this->pdfShipment->create($shipment); + return $this->barcodeMerger->add($packingSlip, $shipment); + } +} diff --git a/Service/Shipment/Packingslip/Items/Barcode.php b/Service/Shipment/Packingslip/Items/Barcode.php new file mode 100644 index 0000000..4e4b936 --- /dev/null +++ b/Service/Shipment/Packingslip/Items/Barcode.php @@ -0,0 +1,180 @@ +directoryList = $directoryList; + $this->ioFile = $ioFile; + $this->logger = $logger; + } + + /** + * @param $packingSlip + * @param $shipment + * @return string + * @throws PdfParserException + */ + public function add($packingSlip, $shipment) + { + $this->getFileName(); + $pdf = $this->loadPdfAndAddBarcode($packingSlip, $shipment->getShippingLabel()); + $this->cleanup(); + return $pdf->Output('S'); + } + + /** + * @param $packingSlip + * @param $label + * @return Fpdi + * @throws PdfParserException + */ + private function loadPdfAndAddBarcode($packingSlip, $label) + { + $pdf = new Fpdi(); + try { + $stream = StreamReader::createByString($packingSlip); + $pageCount = $pdf->setSourceFile($stream); + } catch (PdfReaderException $readerException) { + $this->logger->error('Error while loading sourcefile: ' . $readerException->getMessage()); + return $pdf; + } + + for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { + try { + $isLastPage = $pageCount === $pageNo; + $templateId = $pdf->importPage($pageNo); + $pageSize = $pdf->getTemplateSize($templateId); + + $pdf->AddPage($pageSize['orientation'], $pageSize); + $pdf->useTemplate($templateId); + + $this->addBarcodeToPage($isLastPage, $pageCount > 1, $pdf, $pageSize, $label); + + $pageCount = $pdf->setSourceFile($stream); + + } catch (PdfParserException $fpdiException) { + $this->logger->error('[Barcode] PdfParserException: ' . $fpdiException->getMessage()); + } catch (PdfReaderException $readerException) { + $this->logger->error('[Barcode] ReaderException: ' . $readerException->getMessage()); + } catch (FileSystemException $fileSystemException) { + $this->logger->error('[Barcode] FileSystemException: ' . $fileSystemException->getMessage()); + } + } + + return $pdf; + } + + /** + * @param $units + * @return float + */ + private function zendPdfUnitsToMM($units) + { + return ($units / 72) * 25.4; + } + + /** + * @param $isLastPage + * @param $isMultiplePages + * @param $pdf + * @param $pageSize + * @param $label + * @return void + * @throws FileSystemException + */ + private function addBarcodeToPage($isLastPage, $isMultiplePages, $pdf, $pageSize, $label) + { + $position = [0, 0, 345, 220]; + + // Zend_PDF used BOTTOMLEFT as 0,0 and every point was 1/72 inch + $x = $this->zendPdfUnitsToMM($position[0]); + $y = $pageSize['height'] - $this->zendPdfUnitsToMM($position[3]); + $w = $this->zendPdfUnitsToMM($position[2]) - $x; + $h = $this->zendPdfUnitsToMM($position[3]) - $this->zendPdfUnitsToMM($position[1]); + + $tempAttachmentFile = $this->directoryList->getPath('var') . DIRECTORY_SEPARATOR . static::TMP_TRUNKRS_LABEL_PATH . '/' . uniqid('trunkrs-') . '.pdf'; + file_put_contents($tempAttachmentFile, $label); + + if (($isLastPage && !$isMultiplePages) || ($isLastPage && $isMultiplePages)) { + $pdf->setSourceFile($tempAttachmentFile); + $overlayTemplate = $pdf->importPage(1); + $pdf->useTemplate($overlayTemplate, $x, $y, $w, $h); + } + + unlink($tempAttachmentFile); + } + + /** + * Cleanup old files. + */ + private function cleanup() + { + foreach ($this->fileList as $file) { + $this->ioFile->rm($file); + } + } + + /** + * @return void + * @throws FileSystemException + * @throws \Magento\Framework\Exception\LocalizedException + */ + private function getFileName() + { + $pathFile = $this->directoryList->getPath('var') . DIRECTORY_SEPARATOR . static::TMP_TRUNKRS_LABEL_PATH; + $this->ioFile->checkAndCreateFolder($pathFile); + + $tempFileName = sha1(microtime()) . '-' . time() . '-' . static::TMP_TRUNKRS_LABEL_FILE; + $this->fileName = $pathFile . DIRECTORY_SEPARATOR . $tempFileName; + $this->fileList[] = $this->fileName; + } +} diff --git a/Service/Shipment/Packingslip/Items/ItemsInterface.php b/Service/Shipment/Packingslip/Items/ItemsInterface.php new file mode 100644 index 0000000..7b7cbda --- /dev/null +++ b/Service/Shipment/Packingslip/Items/ItemsInterface.php @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/etc/module.xml b/etc/module.xml index e2b6974..3e47afc 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,7 +1,7 @@ - + diff --git a/view/adminhtml/templates/system/config/trunkrs.phtml b/view/adminhtml/templates/system/config/trunkrs.phtml index 005363b..d292f96 100644 --- a/view/adminhtml/templates/system/config/trunkrs.phtml +++ b/view/adminhtml/templates/system/config/trunkrs.phtml @@ -31,7 +31,7 @@ echo "
"; 'browserInfo' => $_SERVER['HTTP_USER_AGENT'], 'phpVersion' => phpversion(), 'phpExtensions' => get_loaded_extensions(), - 'pluginVersion' => 'v2.2.0' + 'pluginVersion' => 'v2.3.0' ], 'disableAutoShipment' => $block->getDisableAutoShipment() ]); diff --git a/view/adminhtml/ui_component/sales_order_grid.xml b/view/adminhtml/ui_component/sales_order_grid.xml index 1ac7952..4ad7ef6 100644 --- a/view/adminhtml/ui_component/sales_order_grid.xml +++ b/view/adminhtml/ui_component/sales_order_grid.xml @@ -1,5 +1,16 @@ + + + + + + trunkrs_print_shipping_label_and_packing_slips + + + + + diff --git a/view/adminhtml/web/js/trunkrs.bundle.min.js b/view/adminhtml/web/js/trunkrs.bundle.min.js index b82a147..0fe3ad6 100644 --- a/view/adminhtml/web/js/trunkrs.bundle.min.js +++ b/view/adminhtml/web/js/trunkrs.bundle.min.js @@ -1,2 +1,1033 @@ -/*! For license information please see trunkrs.bundle.js.LICENSE.txt */ -!function(){var e={5550:function(e,t,n){"use strict";n.r(t),n.d(t,{Authentication:function(){return ur},Management:function(){return cr},WebAuth:function(){return ar},version:function(){return Dt}});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function o(e,t){return e(t={exports:{}},t.exports),t.exports}var i=o((function(e){var t,n;t=r,n=function(){function e(e){var t=[];if(0===e.length)return"";if("string"!=typeof e[0])throw new TypeError("Url must be a string. Received "+e[0]);if(e[0].match(/^[^/:]+:\/*$/)&&e.length>1){var n=e.shift();e[0]=n+e[0]}e[0].match(/^file:\/\/\//)?e[0]=e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0]=e[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r0&&(o=o.replace(/^[\/]+/,"")),o=r0?"?":"")+a.join("&")}return function(){return e("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=n():t.urljoin=n()})),a=r.Symbol,s="Function.prototype.bind called on incompatible ",l=Array.prototype.slice,u=Object.prototype.toString,c=Function.prototype.bind||function(e){var t=this;if("function"!=typeof t||"[object Function]"!==u.call(t))throw new TypeError(s+t);for(var n,r=l.call(arguments,1),o=function(){if(this instanceof n){var o=t.apply(this,r.concat(l.call(arguments)));return Object(o)===o?o:this}return t.apply(e,r.concat(l.call(arguments)))},i=Math.max(0,t.length-r.length),a=[],c=0;c1&&"boolean"!=typeof t)throw new h('"allowMissing" argument must be a boolean');var n=A(e),r=n.length>0?n[0]:"",o=D("%"+r+"%",t),i=o.name,a=o.value,s=!1,l=o.alias;l&&(r=l[0],T(n,O([0,1],l)));for(var u=1,c=!0;u=n.length){var v=y(a,d);a=(c=!!v)&&"get"in v&&!("originalValue"in v.get)?v.get:a[d]}else c=f(a,d),a=a[d];c&&!s&&(x[i]=a)}}return a},R=o((function(e){var t=N("%Function.prototype.apply%"),n=N("%Function.prototype.call%"),r=N("%Reflect.apply%",!0)||c.call(n,t),o=N("%Object.getOwnPropertyDescriptor%",!0),i=N("%Object.defineProperty%",!0),a=N("%Math.max%");if(i)try{i({},"a",{value:1})}catch(e){i=null}e.exports=function(e){var t=r(c,n,arguments);if(o&&i){var s=o(t,"length");s.configurable&&i(t,"length",{value:1+a(0,e.length-(arguments.length-1))})}return t};var s=function(){return r(c,t,arguments)};i?i(e.exports,"apply",{value:s}):e.exports.apply=s})),I=(R.apply,R(N("String.prototype.indexOf"))),M=function(e,t){var n=N(e,!!t);return"function"==typeof n&&I(e,".prototype.")>-1?R(n):n},L=function(e){return e&&e.default||e}(Object.freeze({__proto__:null,default:{}})),U="function"==typeof Map&&Map.prototype,z=Object.getOwnPropertyDescriptor&&U?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,q=U&&z&&"function"==typeof z.get?z.get:null,F=U&&Map.prototype.forEach,B="function"==typeof Set&&Set.prototype,H=Object.getOwnPropertyDescriptor&&B?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,W=B&&H&&"function"==typeof H.get?H.get:null,V=B&&Set.prototype.forEach,$="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,Q="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,Z="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,J=Boolean.prototype.valueOf,K=Object.prototype.toString,X=Function.prototype.toString,G=String.prototype.match,Y="function"==typeof BigInt?BigInt.prototype.valueOf:null,ee=Object.getOwnPropertySymbols,te="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,ne="function"==typeof Symbol&&"object"==typeof Symbol.iterator,re=Object.prototype.propertyIsEnumerable,oe=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),ie=L.custom,ae=ie&&pe(ie)?ie:null,se="function"==typeof Symbol&&void 0!==Symbol.toStringTag?Symbol.toStringTag:null,le=function e(t,n,r,o){var i=n||{};if(he(i,"quoteStyle")&&"single"!==i.quoteStyle&&"double"!==i.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(he(i,"maxStringLength")&&("number"==typeof i.maxStringLength?i.maxStringLength<0&&i.maxStringLength!==1/0:null!==i.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=!he(i,"customInspect")||i.customInspect;if("boolean"!=typeof a&&"symbol"!==a)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(he(i,"indent")&&null!==i.indent&&"\t"!==i.indent&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return function e(t,n){if(t.length>n.maxStringLength){var r=t.length-n.maxStringLength,o="... "+r+" more character"+(r>1?"s":"");return e(t.slice(0,n.maxStringLength),n)+o}return ue(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,ge),"single",n)}(t,i);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var s=void 0===i.depth?5:i.depth;if(void 0===r&&(r=0),r>=s&&s>0&&"object"==typeof t)return fe(t)?"[Array]":"[Object]";var l=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=Array(e.indent+1).join(" ")}return{base:n,prev:Array(t+1).join(n)}}(i,r);if(void 0===o)o=[];else if(ye(o,t)>=0)return"[Circular]";function u(t,n,a){if(n&&(o=o.slice()).push(n),a){var s={depth:i.depth};return he(i,"quoteStyle")&&(s.quoteStyle=i.quoteStyle),e(t,s,r+1,o)}return e(t,i,r+1,o)}if("function"==typeof t){var c=function(e){if(e.name)return e.name;var t=G.call(X.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}(t),f=_e(t,u);return"[Function"+(c?": "+c:" (anonymous)")+"]"+(f.length>0?" { "+f.join(", ")+" }":"")}if(pe(t)){var p=ne?String(t).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):te.call(t);return"object"!=typeof t||ne?p:ve(p)}if(function(e){return!(!e||"object"!=typeof e)&&("undefined"!=typeof HTMLElement&&e instanceof HTMLElement||"string"==typeof e.nodeName&&"function"==typeof e.getAttribute)}(t)){for(var d="<"+String(t.nodeName).toLowerCase(),h=t.attributes||[],m=0;m"}if(fe(t)){if(0===t.length)return"[]";var y=_e(t,u);return l&&!function(e){for(var t=0;t=0)return!1;return!0}(y)?"["+ke(y,l)+"]":"[ "+y.join(", ")+" ]"}if(function(e){return!("[object Error]"!==me(e)||se&&"object"==typeof e&&se in e)}(t)){var g=_e(t,u);return 0===g.length?"["+String(t)+"]":"{ ["+String(t)+"] "+g.join(", ")+" }"}if("object"==typeof t&&a){if(ae&&"function"==typeof t[ae])return t[ae]();if("symbol"!==a&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!q||!e||"object"!=typeof e)return!1;try{q.call(e);try{W.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var v=[];return F.call(t,(function(e,n){v.push(u(n,t,!0)+" => "+u(e,t))})),we("Map",q.call(t),v,l)}if(function(e){if(!W||!e||"object"!=typeof e)return!1;try{W.call(e);try{q.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var b=[];return V.call(t,(function(e){b.push(u(e,t))})),we("Set",W.call(t),b,l)}if(function(e){if(!$||!e||"object"!=typeof e)return!1;try{$.call(e,$);try{Q.call(e,Q)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return be("WeakMap");if(function(e){if(!Q||!e||"object"!=typeof e)return!1;try{Q.call(e,Q);try{$.call(e,$)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return be("WeakSet");if(function(e){if(!Z||!e||"object"!=typeof e)return!1;try{return Z.call(e),!0}catch(e){}return!1}(t))return be("WeakRef");if(function(e){return!("[object Number]"!==me(e)||se&&"object"==typeof e&&se in e)}(t))return ve(u(Number(t)));if(function(e){if(!e||"object"!=typeof e||!Y)return!1;try{return Y.call(e),!0}catch(e){}return!1}(t))return ve(u(Y.call(t)));if(function(e){return!("[object Boolean]"!==me(e)||se&&"object"==typeof e&&se in e)}(t))return ve(J.call(t));if(function(e){return!("[object String]"!==me(e)||se&&"object"==typeof e&&se in e)}(t))return ve(u(String(t)));if(!function(e){return!("[object Date]"!==me(e)||se&&"object"==typeof e&&se in e)}(t)&&!function(e){return!("[object RegExp]"!==me(e)||se&&"object"==typeof e&&se in e)}(t)){var w=_e(t,u),k=oe?oe(t)===Object.prototype:t instanceof Object||t.constructor===Object,_=t instanceof Object?"":"null prototype",x=!k&&se&&Object(t)===t&&se in t?me(t).slice(8,-1):_?"Object":"",S=(k||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(x||_?"["+[].concat(x||[],_||[]).join(": ")+"] ":"");return 0===w.length?S+"{}":l?S+"{"+ke(w,l)+"}":S+"{ "+w.join(", ")+" }"}return String(t)};function ue(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function ce(e){return String(e).replace(/"/g,""")}function fe(e){return!("[object Array]"!==me(e)||se&&"object"==typeof e&&se in e)}function pe(e){if(ne)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!te)return!1;try{return te.call(e),!0}catch(e){}return!1}var de=Object.prototype.hasOwnProperty||function(e){return e in this};function he(e,t){return de.call(e,t)}function me(e){return K.call(e)}function ye(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n1;){var t=e.pop(),n=t.obj[t.prop];if(ze(n)){for(var r=[],o=0;o=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||o===Le.RFC1738&&(40===l||41===l)?a+=i.charAt(s):l<128?a+=qe[l]:l<2048?a+=qe[192|l>>6]+qe[128|63&l]:l<55296||l>=57344?a+=qe[224|l>>12]+qe[128|l>>6&63]+qe[128|63&l]:(s+=1,l=65536+((1023&l)<<10|1023&i.charCodeAt(s)),a+=qe[240|l>>18]+qe[128|l>>12&63]+qe[128|l>>6&63]+qe[128|63&l])}return a},isBuffer:function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(ze(e)){for(var n=[],r=0;r0?y.join(",")||null:void 0}];else if(Ve(s))g=s;else{var b=Object.keys(y);g=l?b.sort(l):b}for(var w=0;w-1?e.split(","):e},rt=function(e,t,n,r){if(e){var o=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/g,a=n.depth>0&&/(\[[^[\]]*])/.exec(o),s=a?o.slice(0,a.index):o,l=[];if(s){if(!n.plainObjects&&Ge.call(Object.prototype,s)&&!n.allowPrototypes)return;l.push(s)}for(var u=0;n.depth>0&&null!==(a=i.exec(o))&&u=0;--i){var a,s=e[i];if("[]"===s&&n.parseArrays)a=[].concat(o);else{a=n.plainObjects?Object.create(null):{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,u=parseInt(l,10);n.parseArrays||""!==l?!isNaN(u)&&s!==l&&String(u)===l&&u>=0&&n.parseArrays&&u<=n.arrayLimit?(a=[])[u]=o:a[l]=o:a={0:o}}o=a}return o}(l,t,n,r)}},ot=function(e,t){var n,r=e,o=function(e){if(!e)return Ke;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||Ke.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=Le.default;if(void 0!==e.format){if(!He.call(Le.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var r=Le.formatters[n],o=Ke.filter;return("function"==typeof e.filter||Ve(e.filter))&&(o=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:Ke.addQueryPrefix,allowDots:void 0===e.allowDots?Ke.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:Ke.charsetSentinel,delimiter:void 0===e.delimiter?Ke.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:Ke.encode,encoder:"function"==typeof e.encoder?e.encoder:Ke.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:Ke.encodeValuesOnly,filter:o,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:Ke.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:Ke.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:Ke.strictNullHandling}}(t);"function"==typeof o.filter?r=(0,o.filter)("",r):Ve(o.filter)&&(n=o.filter);var i,a=[];if("object"!=typeof r||null===r)return"";i=t&&t.arrayFormat in We?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var s=We[i];n||(n=Object.keys(r)),o.sort&&n.sort(o.sort);for(var l=Ne(),u=0;u0?p+f:""},it=o((function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;ot?1:0}function ft(e,t,n){var r,o=function e(t,n,r,o){var i;if("object"==typeof t&&null!==t){for(i=0;i0)for(var r=0;r=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&t.status>=500&&501!==t.status)return!0;if(e){if(e.code&&vt.includes(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},gt.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},gt.prototype.then=function(e,t){var n=this;if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){r.on("abort",(function(){if(!(n._maxRetries&&n._maxRetries>n._retries))if(n.timedout&&n.timedoutError)t(n.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=n.status,e.method=n.method,e.url=n.url,t(e)}})),r.end((function(n,r){n?t(n):e(r)}))}))}return this._fullfilledPromise.then(e,t)},gt.prototype.catch=function(e){return this.then(void 0,e)},gt.prototype.use=function(e){return e(this),this},gt.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},gt.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},gt.prototype.get=function(e){return this._header[e.toLowerCase()]},gt.prototype.getHeader=gt.prototype.get,gt.prototype.set=function(e,t){if(ht(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},gt.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},gt.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(ht(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(e,t[r]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),this._getFormData().append(e,t),this},gt.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},gt.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic ".concat(r("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},gt.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},gt.prototype.redirects=function(e){return this._maxRedirects=e,this},gt.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},gt.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},gt.prototype.send=function(e){var t=ht(e),n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&ht(this._data))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._data[r]=e[r]);else"string"==typeof e?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"===n?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},gt.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},gt.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.slice(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.slice(0,t)+"?"+n.join("&")}}},gt.prototype._appendQueryString=function(){console.warn("Unsupported")},gt.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error("".concat(e+t,"ms exceeded"));r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.timedoutError=r,this.abort(),this.callback(r)}},gt.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))};var bt=wt;function wt(e){if(e)return function(e){for(var t in wt.prototype)Object.prototype.hasOwnProperty.call(wt.prototype,t)&&(e[t]=wt.prototype[t]);return e}(e)}function kt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0||e instanceof Object)?t(e):null)},f.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,r="cannot ".concat(t," ").concat(n," (").concat(this.status,")"),o=new Error(r);return o.status=this.status,o.method=t,o.url=n,o},i.Response=f,it(p.prototype),yt(p.prototype),p.prototype.type=function(e){return this.set("Content-Type",i.types[e]||e),this},p.prototype.accept=function(e){return this.set("Accept",i.types[e]||e),this},p.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var o=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,o)},p.prototype.query=function(e){return"string"!=typeof e&&(e=s(e)),e&&this._query.push(e),this},p.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},p.prototype._getFormData=function(){return this._formData||(this._formData=new r.FormData),this._formData},p.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},p.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},p.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},p.prototype.ca=p.prototype.agent,p.prototype.buffer=p.prototype.ca,p.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},p.prototype.pipe=p.prototype.write,p.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},p.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||o,this._finalizeQueryString(),this._end()},p.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},p.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=i.getXHR();var t=this.xhr,n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){var o=this._header["content-type"],a=this._serializer||i.serialize[o?o.split(";")[0]:""];!a&&c(o)&&(a=i.serialize["application/json"]),a&&(n=a(n))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},i.agent=function(){return new xt},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){xt.prototype[e.toLowerCase()]=function(t,n){var r=new i.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}})),xt.prototype.del=xt.prototype.delete,i.get=function(e,t,n){var r=i("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},i.head=function(e,t,n){var r=i("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},i.options=function(e,t,n){var r=i("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},i.del=d,i.delete=d,i.patch=function(e,t,n){var r=i("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},i.post=function(e,t,n){var r=i("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},i.put=function(e,t,n){var r=i("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}})),Ot=(St.Request,[]),Tt=[],Et=("undefined"!=typeof Uint8Array&&Uint8Array,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ct=0,jt=Et.length;Ct>18&63]+Ot[o>>12&63]+Ot[o>>6&63]+Ot[63&o]);return i.join("")}Tt["-".charCodeAt(0)]=62,Tt["_".charCodeAt(0)]=63;var At=function(e){return function(e){for(var t,n=e.length,r=n%3,o=[],i=0,a=n-r;ia?a:i+16383));return 1===r?(t=e[n-1],o.push(Ot[t>>2]+Ot[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(Ot[t>>10]+Ot[t>>4&63]+Ot[t<<2&63]+"=")),o.join("")}(function(e){for(var t=new Array(e.length),n=0;n=65&&t<=90||!o&&t>=48&&t<=57?(n+="_",n+=e[r].toLowerCase()):n+=e[r].toLowerCase(),o=t>=48&&t<=57,i=t>=65&&t<=90,r++;return n}(o):o]=e(t[o]),r}),{}))},toCamelCase:function e(t,n,r){return"object"!=typeof t||Lt.isArray(t)||null===t?t:(n=n||[],r=r||{},Object.keys(t).reduce((function(o,i){var a,s=-1===n.indexOf(i)?(a=i.split("_")).reduce((function(e,t){return e+t.charAt(0).toUpperCase()+t.slice(1)}),a.shift()):i;return o[s]=e(t[s]||t[i],[],r),r.keepOriginal&&(o[i]=e(t[i],[],r)),o}),{}))},blacklist:function(e,t){return Object.keys(e).reduce((function(n,r){return-1===t.indexOf(r)&&(n[r]=e[r]),n}),{})},merge:function(e,t){return{base:t?qt(e,t):e,with:function(e,t){return e=t?qt(e,t):e,Bt(this.base,e)}}},pick:qt,getKeysNotIn:function(e,t){var n=[];for(var r in e)-1===t.indexOf(r)&&n.push(r);return n},extend:Bt,getOriginFromUrl:function(e){if(e){var t=Ht(e);if(!t)return null;var n=t.protocol+"//"+t.hostname;return t.port&&(n+=":"+t.port),n}},getLocationFromUrl:Ht,trimUserDetails:function(e){return function(e,t){return["username","email","phoneNumber"].reduce(Wt,e)}(e)},updatePropertyOn:function e(t,n,r){"string"==typeof n&&(n=n.split("."));var o=n[0];t.hasOwnProperty(o)&&(1===n.length?t[o]=r:e(t[o],n.slice(1),r))}};function $t(e){this.request=e,this.method=e.method,this.url=e.url,this.body=e._data,this.headers=e._header}function Qt(e){this.request=e}function Zt(e){this._sendTelemetry=!1!==e._sendTelemetry||e._sendTelemetry,this._telemetryInfo=e._telemetryInfo||null,this._timesToRetryFailedRequests=e._timesToRetryFailedRequests,this.headers=e.headers||{},this._universalLoginPage=e.universalLoginPage}function Jt(){return window}$t.prototype.abort=function(){this.request.abort()},$t.prototype.getMethod=function(){return this.method},$t.prototype.getBody=function(){return this.body},$t.prototype.getUrl=function(){return this.url},$t.prototype.getHeaders=function(){return this.headers},Qt.prototype.set=function(e,t){return this.request=this.request.set(e,t),this},Qt.prototype.send=function(e){return this.request=this.request.send(Vt.trimUserDetails(e)),this},Qt.prototype.withCredentials=function(){return this.request=this.request.withCredentials(),this},Qt.prototype.end=function(e){return this.request.end(e),new $t(this.request)},Zt.prototype.setCommonConfiguration=function(e,t){if(t=t||{},this._timesToRetryFailedRequests>0&&(e=e.retry(this._timesToRetryFailedRequests)),t.noHeaders)return e;var n=this.headers;e=e.set("Content-Type","application/json"),t.xRequestLanguage&&(e=e.set("X-Request-Language",t.xRequestLanguage));for(var r=Object.keys(this.headers),o=0;o>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else for(var a=0;a>>2]=n[a>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=s.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new l.init(n,t/2)}},f=u.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;o>>2]>>>24-o%4*8&255));return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new l.init(n,t)}},p=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},d=a.BufferedBlockAlgorithm=s.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,c=e.min(4*u,i);if(u){for(var f=0;f>>7)^(h<<14|h>>>18)^h>>>3)+u[d-7]+((m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10)+u[d-16]}var y=r&o^r&i^o&i,g=p+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&f)+l[d]+u[d];p=f,f=c,c=s,s=a+g|0,a=i,i=o,o=r,r=g+(((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+y)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+f|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,o=8*t.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=e.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(c),t.HmacSHA256=i._createHmacHelper(c)}(Math),n.SHA256)})),gn=pn((function(e,t){var n,r;e.exports=(r=(n=mn).lib.WordArray,n.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var o=[],i=0;i>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var l=r.charAt(64);if(l)for(;o.length%4;)o.push(l);return o.join("")},parse:function(e){var t=e.length,n=this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var i=0;i>>6-a%4*2;o[i>>>2]|=(s|l)<<24-i%4*8,i++}return r.create(o,i)}(e,t,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)})),vn=pn((function(e,t){e.exports=mn.enc.Hex})),bn=pn((function(e,t){(function(){var t;function n(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):this.fromString(e,null==t&&"string"!=typeof e?256:t))}function r(){return new n(null)}var o="undefined"!=typeof navigator;o&&"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=function(e,t,n,r,o,i){for(var a=32767&t,s=t>>15;--i>=0;){var l=32767&this[e],u=this[e++]>>15,c=s*l+u*a;o=((l=a*l+((32767&c)<<15)+n[r]+(1073741823&o))>>>30)+(c>>>15)+s*u+(o>>>30),n[r++]=1073741823&l}return o},t=30):o&&"Netscape"!=navigator.appName?(n.prototype.am=function(e,t,n,r,o,i){for(;--i>=0;){var a=t*this[e++]+n[r]+o;o=Math.floor(a/67108864),n[r++]=67108863&a}return o},t=26):(n.prototype.am=function(e,t,n,r,o,i){for(var a=16383&t,s=t>>14;--i>=0;){var l=16383&this[e],u=this[e++]>>14,c=s*l+u*a;o=((l=a*l+((16383&c)<<14)+n[r]+o)>>28)+(c>>14)+s*u,n[r++]=268435455&l}return o},t=28),n.prototype.DB=t,n.prototype.DM=(1<>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function p(e){this.m=e}function d(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function b(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function w(){}function k(e){return e}function _(e){this.r2=r(),this.q3=r(),n.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}p.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},p.prototype.revert=function(e){return e},p.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},p.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},p.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},d.prototype.convert=function(e){var t=r();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(n.ZERO)>0&&this.m.subTo(t,t),t},d.prototype.revert=function(e){var t=r();return e.copyTo(t),this.reduce(t),t},d.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},d.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},d.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},n.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},n.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},n.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var o=e.length,i=!1,a=0;--o>=0;){var s=8==r?255&e[o]:u(e,o);s<0?"-"==e.charAt(o)&&(i=!0):(i=!1,0==a?this[this.t++]=s:a+r>this.DB?(this[this.t-1]|=(s&(1<>this.DB-a):this[this.t-1]|=s<=this.DB&&(a-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==e;)--this.t},n.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},n.prototype.drShiftTo=function(e,t){for(var n=e;n=0;--n)t[n+a+1]=this[n]>>o|s,s=(this[n]&i)<=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()},n.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,o=this.DB-r,i=(1<>r;for(var a=n+1;a>r;r>0&&(t[this.t-n-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},n.prototype.multiplyTo=function(e,t){var r=this.abs(),o=e.abs(),i=r.t;for(t.t=i+o.t;--i>=0;)t[i]=0;for(i=0;i=0;)e[n]=0;for(n=0;n=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},n.prototype.divRemTo=function(e,t,o){var i=e.abs();if(!(i.t<=0)){var a=this.abs();if(a.t0?(i.lShiftTo(c,s),a.lShiftTo(c,o)):(i.copyTo(s),a.copyTo(o));var p=s.t,d=s[p-1];if(0!=d){var h=d*(1<1?s[p-2]>>this.F2:0),m=this.FV/h,y=(1<=0&&(o[o.t++]=1,o.subTo(w,o)),n.ONE.dlShiftTo(p,w),w.subTo(s,s);s.t=0;){var k=o[--v]==d?this.DM:Math.floor(o[v]*m+(o[v-1]+g)*y);if((o[v]+=s.am(0,k,o,b,0,p))0&&o.rShiftTo(c,o),l<0&&n.ZERO.subTo(o,o)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},n.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},n.prototype.exp=function(e,t){if(e>4294967295||e<1)return n.ONE;var o=r(),i=r(),a=t.convert(this),s=f(e)-1;for(a.copyTo(o);--s>=0;)if(t.sqrTo(o,i),(e&1<0)t.mulTo(i,a,o);else{var l=o;o=i,i=l}return t.revert(o)},n.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<0)for(s>s)>0&&(o=!0,i=l(n));a>=0;)s>(s+=this.DB-t)):(n=this[a]>>(s-=t)&r,s<=0&&(s+=this.DB,--a)),n>0&&(o=!0),o&&(i+=l(n));return o?i:"0"},n.prototype.negate=function(){var e=r();return n.ZERO.subTo(this,e),e},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+f(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(e){var t=r();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(n.ZERO)>0&&e.subTo(t,t),t},n.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new p(t):new d(t),this.exp(e,n)},n.ZERO=c(0),n.ONE=c(1),w.prototype.convert=k,w.prototype.revert=k,w.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},w.prototype.sqrTo=function(e,t){e.squareTo(t)},_.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=r();return e.copyTo(t),this.reduce(t),t},_.prototype.revert=function(e){return e},_.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var x,S,O,T=[2,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],E=(1<<26)/T[T.length-1];function C(){var e;e=(new Date).getTime(),S[O++]^=255&e,S[O++]^=e>>8&255,S[O++]^=e>>16&255,S[O++]^=e>>24&255,O>=I&&(O-=I)}if(n.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},n.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),o=c(n),i=r(),a=r(),s="";for(this.divRemTo(o,i,a);i.signum()>0;)s=(n+a.intValue()).toString(e).substr(1)+s,i.divRemTo(o,i,a);return a.intValue().toString(e)+s},n.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),o=Math.pow(t,r),i=!1,a=0,s=0,l=0;l=r&&(this.dMultiply(o),this.dAddOffset(s,0),a=0,s=0))}a>0&&(this.dMultiply(Math.pow(t,a)),this.dAddOffset(s,0)),i&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(n.ONE.shiftLeft(e-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(n.ONE.shiftLeft(e-1),this);else{var o=new Array,i=7&e;o.length=1+(e>>3),t.nextBytes(o),i>0?o[0]&=(1<>=this.DB;if(e.t>=this.DB;r+=this.s}else{for(r+=this.s;n>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},n.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},n.prototype.multiplyLowerTo=function(e,t,n){var r,o=Math.min(this.t+e.t,t);for(n.s=0,n.t=o;o>0;)n[--o]=0;for(r=n.t-this.t;o=0;)n[r]=0;for(r=Math.max(t-this.t,0);r0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n},n.prototype.millerRabin=function(e){var t=this.subtract(n.ONE),o=t.getLowestSetBit();if(o<=0)return!1;var i=t.shiftRight(o);(e=e+1>>1)>T.length&&(e=T.length);for(var a=r(),s=0;s>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var n,r=this.DB-e*this.DB%8,o=0;if(e-- >0)for(r>r)!=(this.s&this.DM)>>r&&(t[o++]=n|this.s<=0;)r<8?(n=(this[e]&(1<>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==o&&(128&this.s)!=(128&n)&&++o,(o>0||n!=this.s)&&(t[o++]=n);return t},n.prototype.equals=function(e){return 0==this.compareTo(e)},n.prototype.min=function(e){return this.compareTo(e)<0?this:e},n.prototype.max=function(e){return this.compareTo(e)>0?this:e},n.prototype.and=function(e){var t=r();return this.bitwiseTo(e,h,t),t},n.prototype.or=function(e){var t=r();return this.bitwiseTo(e,m,t),t},n.prototype.xor=function(e){var t=r();return this.bitwiseTo(e,y,t),t},n.prototype.andNot=function(e){var t=r();return this.bitwiseTo(e,g,t),t},n.prototype.not=function(){for(var e=r(),t=0;t=this.t?0!=this.s:0!=(this[t]&1<1){var m=r();for(o.sqrTo(s[1],m);l<=h;)s[l]=r(),o.mulTo(m,s[l-2],s[l]),l+=2}var y,g,v=e.t-1,b=!0,w=r();for(i=f(e[v])-1;v>=0;){for(i>=u?y=e[v]>>i-u&h:(y=(e[v]&(1<0&&(y|=e[v-1]>>this.DB+i-u)),l=n;0==(1&y);)y>>=1,--l;if((i-=l)<0&&(i+=this.DB,--v),b)s[y].copyTo(a),b=!1;else{for(;l>1;)o.sqrTo(a,w),o.sqrTo(w,a),l-=2;l>0?o.sqrTo(a,w):(g=a,a=w,w=g),o.mulTo(w,s[y],a)}for(;v>=0&&0==(e[v]&1<=0?(r.subTo(o,r),t&&i.subTo(s,i),a.subTo(l,a)):(o.subTo(r,o),t&&s.subTo(i,s),l.subTo(a,l))}return 0!=o.compareTo(n.ONE)?n.ZERO:l.compareTo(e)>=0?l.subtract(e):l.signum()<0?(l.addTo(e,l),l.signum()<0?l.add(e):l):l},n.prototype.pow=function(e){return this.exp(e,new w)},n.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var o=t.getLowestSetBit(),i=n.getLowestSetBit();if(i<0)return t;for(o0&&(t.rShiftTo(i,t),n.rShiftTo(i,n));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return i>0&&n.lShiftTo(i,n),n},n.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=T[T.length-1]){for(t=0;t>>8,S[O++]=255&j;O=0,C()}function D(){if(null==x){for(C(),(x=new R).init(S),O=0;O0&&t.length>0))throw new Error("Invalid key data");this.n=new bn.BigInteger(e,16),this.e=parseInt(t,16)}_n.prototype.verify=function(e,t){t=t.replace(/[^0-9a-f]|[\s\n]]/gi,"");var n=new bn.BigInteger(t,16);if(n.bitLength()>this.n.bitLength())throw new Error("Signature does not match with the key modulus.");var r=function(e){for(var t in wn){var n=wn[t],r=n.length;if(e.substring(0,r)===n)return{alg:t,hash:e.substring(r)}}return[]}(n.modPowInt(this.e,this.n).toString(16).replace(/^1f+00/,""));if(0===r.length)return!1;if(!kn.hasOwnProperty(r.alg))throw new Error("Hashing algorithm is not supported.");var o=kn[r.alg](e).toString();return r.hash===o};for(var xn=[],Sn=[],On="undefined"!=typeof Uint8Array?Uint8Array:Array,Tn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",En=0,Cn=Tn.length;En0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}(e),o=r[0],i=r[1],a=new On(function(e,t,n){return 3*(t+n)/4-n}(0,o,i)),s=0,l=i>0?o-4:o;for(n=0;n>16&255,a[s++]=t>>8&255,a[s++]=255&t;return 2===i&&(t=Sn[e.charCodeAt(n)]<<2|Sn[e.charCodeAt(n+1)]>>4,a[s++]=255&t),1===i&&(t=Sn[e.charCodeAt(n)]<<10|Sn[e.charCodeAt(n+1)]<<4|Sn[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t),a};function Pn(e){var t=e.length%4;return 0===t?e:e+new Array(4-t+1).join("=")}function An(e){return e=Pn(e).replace(/\-/g,"+").replace(/_/g,"/"),decodeURIComponent(function(e){for(var t="",n=0;n1){var n=e.shift();e[0]=n+e[0]}e[0]=e[0].match(/^file:\/\/\//)?e[0].replace(/^([^/:]+):\/*/,"$1:///"):e[0].replace(/^([^/:]+):\/*/,"$1://");for(var r=0;r0&&(o=o.replace(/^[\/]+/,"")),o=o.replace(/[\/]+$/,r0?"?":"")+a.join("&")}return function(){return e("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}},e.exports?e.exports=n():t.urljoin=n()}));function Rn(e,t){return t=t||{},new Promise((function(n,r){var o=new XMLHttpRequest,i=[],a=[],s={},l=function(){return{ok:2==(o.status/100|0),statusText:o.statusText,status:o.status,url:o.responseURL,text:function(){return Promise.resolve(o.responseText)},json:function(){return Promise.resolve(o.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([o.response]))},clone:l,headers:{keys:function(){return i},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var u in o.open(t.method||"get",e,!0),o.onload=function(){o.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,n){i.push(t=t.toLowerCase()),a.push([t,n]),s[t]=s[t]?s[t]+","+n:n})),n(l())},o.onerror=r,o.withCredentials="include"==t.credentials,t.headers)o.setRequestHeader(u,t.headers[u]);o.send(t.body||null)}))}function In(e){if(e.ok)return e.json();var t=new Error(e.statusText);return t.response=e,Promise.reject(t)}function Mn(e){this.name="ConfigurationError",this.message=e||""}function Ln(e){this.name="TokenValidationError",this.message=e||""}Mn.prototype=Error.prototype,Ln.prototype=Error.prototype;var Un=function(){function e(){}var t=e.prototype;return t.get=function(){return null},t.has=function(){return null},t.set=function(){return null},e}();dn.polyfill();var zn=function(e){return"number"==typeof e},qn=function(){return new Date};function Fn(e){var t=e||{};if(this.jwksCache=t.jwksCache||new Un,this.expectedAlg=t.expectedAlg||"RS256",this.issuer=t.issuer,this.audience=t.audience,this.leeway=0===t.leeway?0:t.leeway||60,this.jwksURI=t.jwksURI,this.maxAge=t.maxAge,this.__clock="function"==typeof t.__clock?t.__clock:qn,this.leeway<0||this.leeway>300)throw new Mn("The leeway should be positive and lower than five minutes.");if("RS256"!==this.expectedAlg)throw new Mn('Signature algorithm of "'+this.expectedAlg+'" is not supported. Expected the ID token to be signed with "RS256".')}function Bn(e,t){this.plugins=t;for(var n=0;n1){if(!h||"string"!=typeof h)return n(new Ln("Authorized Party (azp) claim must be a string present in the ID token when Audience (aud) claim has multiple values"),null);if(h!==v.audience)return n(new Ln('Authorized Party (azp) claim mismatch in the ID token; expected "'+v.audience+'", found "'+h+'"'),null)}if(!f||!zn(f))return n(new Ln("Expiration Time (exp) claim must be a number present in the ID token"),null);if(!d||!zn(d))return n(new Ln("Issued At (iat) claim must be a number present in the ID token"),null);var s=f+v.leeway,b=new Date(0);if(b.setUTCSeconds(s),g>b)return n(new Ln('Expiration Time (exp) claim error in the ID token; current time "'+g+'" is after expiration time "'+b+'"'),null);if(p&&zn(p)){var w=p-v.leeway,k=new Date(0);if(k.setUTCSeconds(w),gx)return n(new Ln('Authentication Time (auth_time) claim in the ID token indicates that too much time has passed since the last end-user authentication. Current time "'+g+'" is after last auth time at "'+x+'"'),null)}return n(null,r.payload)}))},Fn.prototype.getRsaVerifier=function(e,t,n){var r=this,o=e+t;Promise.resolve(this.jwksCache.has(o)).then((function(n){return n?r.jwksCache.get(o):(i={jwksURI:r.jwksURI,iss:e,kid:t},("undefined"==typeof fetch?Rn:fetch)(i.jwksURI||Nn(i.iss,".well-known","jwks.json")).then(In).then((function(e){var t,n,r,o=null;for(t=0;t-1&&null!==new RegExp("rv:([0-9]{2,2}[.0-9]{0,})").exec(t)&&(e=parseFloat(RegExp.$1)),e>=8}();return"undefined"!=typeof window&&window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage?{open:function(o,i){if(!i)throw"missing required callback argument";var a,s;o.url||(a="missing required 'url' parameter"),o.relay_url||(a="missing required 'relay_url' parameter"),a&&setTimeout((function(){i(a)}),0),o.window_name||(o.window_name=null),o.window_features&&!function(){try{var e=navigator.userAgent;return-1!=e.indexOf("Fennec/")||-1!=e.indexOf("Firefox/")&&-1!=e.indexOf("Android")}catch(e){}return!1}()||(o.window_features=void 0);var l,u=o.origin||n(o.url);if(u!==n(o.relay_url))return setTimeout((function(){i("invalid arguments: origin of url and relay_url must match")}),0);r&&((s=document.createElement("iframe")).setAttribute("src",o.relay_url),s.style.display="none",s.setAttribute("name","__winchan_relay_frame"),document.body.appendChild(s),l=s.contentWindow);var c=o.popup||window.open(o.url,o.window_name,o.window_features);o.popup&&(c.location.href=o.url),l||(l=c);var f=setInterval((function(){c&&c.closed&&(d(),i&&(i("User closed the popup window"),i=null))}),500),p=JSON.stringify({a:"request",d:o.params});function d(){if(s&&document.body.removeChild(s),s=void 0,f&&(f=clearInterval(f)),t(window,"message",h),t(window,"unload",d),c)try{c.close()}catch(e){l.postMessage("die",u)}c=l=void 0}function h(e){if(e.origin===u){try{var t=JSON.parse(e.data)}catch(e){if(i)return i(e);throw e}"ready"===t.a?l.postMessage(p,u):"error"===t.a?(d(),i&&(i(t.d),i=null)):"response"===t.a&&(d(),i&&(i(null,t.d),i=null))}}return e(window,"unload",d),e(window,"message",h),{originalPopup:c,close:d,focus:function(){if(c)try{c.focus()}catch(e){}}}},onOpen:function(n){var o="*",i=r?function(){for(var e=window.opener.frames,t=e.length-1;t>=0;t--)try{if(e[t].location.protocol===window.location.protocol&&e[t].location.host===window.location.host&&"__winchan_relay_frame"===e[t].name)return e[t]}catch(e){}}():window.opener;if(!i)throw"can't find relay frame";function a(e){e=JSON.stringify(e),r?i.doPost(e,o):i.postMessage(e,o)}function s(e){if("die"===e.data)try{window.close()}catch(e){}}e(r?i:window,"message",(function e(r){var i;try{i=JSON.parse(r.data)}catch(e){}i&&"request"===i.a&&(t(window,"message",e),o=r.origin,n&&setTimeout((function(){n(o,i.d,(function(e){n=void 0,a({a:"response",d:e})}))}),0))})),e(r?i:window,"message",s);try{a({a:"ready"})}catch(t){e(i,"load",(function(e){a({a:"ready"})}))}var l=function(){try{t(r?i:window,"message",s)}catch(e){}n&&a({a:"error",d:"client closed window"}),n=void 0;try{window.close()}catch(e){}};return e(window,"unload",l),{detach:function(){t(window,"unload",l)}}}}:{open:function(e,t,n,r){setTimeout((function(){r("unsupported browser")}),0)},onOpen:function(e){setTimeout((function(){e("unsupported browser")}),0)}}}();e.exports&&(e.exports=t)}));function Xn(){this._current_popup=null}function Gn(e,t){this.baseOptions=t,this.baseOptions.popupOrigin=t.popupOrigin,this.client=e.client,this.webAuth=e,this.transactionManager=new Wn(this.baseOptions),this.crossOriginAuthentication=new Qn(e,this.baseOptions),this.warn=new tn({disableWarnings:!!t._disableDeprecationWarnings})}function Yn(e){this.authenticationUrl=e.authenticationUrl,this.timeout=e.timeout||6e4,this.handler=null,this.postMessageDataType=e.postMessageDataType||!1,this.postMessageOrigin=e.postMessageOrigin||Kt.getWindow().location.origin||Kt.getWindow().location.protocol+"//"+Kt.getWindow().location.hostname+(Kt.getWindow().location.port?":"+Kt.getWindow().location.port:"")}function er(e){this.baseOptions=e,this.request=new Zt(e),this.transactionManager=new Wn(this.baseOptions)}function tr(e,t){this.baseOptions=t,this.client=e,this.baseOptions.universalLoginPage=!0,this.request=new Zt(this.baseOptions),this.warn=new tn({disableWarnings:!!t._disableDeprecationWarnings})}Xn.prototype.calculatePosition=function(e){var t=e.width||500,n=e.height||600,r=Kt.getWindow(),o=void 0!==r.screenX?r.screenX:r.screenLeft,i=void 0!==r.screenY?r.screenY:r.screenTop,a=void 0!==r.outerWidth?r.outerWidth:r.document.body.clientWidth,s=void 0!==r.outerHeight?r.outerHeight:r.document.body.clientHeight;return{width:t,height:n,left:e.left||o+(a-t)/2,top:e.top||i+(s-n)/2}},Xn.prototype.preload=function(e){var t=this,n=Kt.getWindow(),r=this.calculatePosition(e.popupOptions||{}),o=Vt.merge(r).with(e.popupOptions),i=e.url||"about:blank",a=ot(o,{encode:!1,delimiter:","});return this._current_popup&&!this._current_popup.closed||(this._current_popup=n.open(i,"auth0_signup_popup",a),this._current_popup.kill=function(){this.close(),t._current_popup=null}),this._current_popup},Xn.prototype.load=function(e,t,n,r){var o=this,i=this.calculatePosition(n.popupOptions||{}),a=Vt.merge(i).with(n.popupOptions),s=Vt.merge({url:e,relay_url:t,window_features:ot(a,{delimiter:",",encode:!1}),popup:this._current_popup}).with(n),l=Kn.open(s,(function(e,t){if(!e||"SyntaxError"!==e.name)return o._current_popup=null,r(e,t)}));return l.focus(),l},Gn.prototype.buildPopupHandler=function(){var e=this.baseOptions.plugins.get("popup.getPopupHandler");return e?e.getPopupHandler():new Xn},Gn.prototype.preload=function(e){e=e||{};var t=this.buildPopupHandler();return t.preload(e),t},Gn.prototype.getPopupHandler=function(e,t){return e.popupHandler?e.popupHandler:t?this.preload(e):this.buildPopupHandler()},Gn.prototype.callback=function(e){var t=this,n=Kt.getWindow(),r=(e=e||{}).popupOrigin||this.baseOptions.popupOrigin||Kt.getOrigin();n.opener?Kn.onOpen((function(n,o,i){if(n!==r)return i({error:"origin_mismatch",error_description:"The popup's origin ("+n+") should match the `popupOrigin` parameter ("+r+")."});t.webAuth.parseHash(e||{},(function(e,t){return i(e||t)}))})):n.doPost=function(e){n.parent&&n.parent.postMessage(e,r)}},Gn.prototype.authorize=function(e,t){var n,r,o={},a=this.baseOptions.plugins.get("popup.authorize"),s=Vt.merge(this.baseOptions,["clientID","scope","domain","audience","tenant","responseType","redirectUri","_csrf","state","_intstate","nonce","organization","invitation"]).with(Vt.blacklist(e,["popupHandler"]));return Lt.check(s,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),r=i(this.baseOptions.rootUrl,"relay.html"),e.owp?s.owp=!0:(o.origin=function(e){/^https?:\/\//.test(e)||(e=window.location.href);var t=/^(https?:\/\/[-_a-zA-Z.0-9:]+)/.exec(e);return t?t[1]:e}(s.redirectUri),r=s.redirectUri),e.popupOptions&&(o.popupOptions=Vt.pick(e.popupOptions,["width","height","top","left"])),a&&(s=a.processParams(s)),(s=this.transactionManager.process(s)).scope=s.scope||"openid profile email",delete s.domain,n=this.client.buildAuthorizeUrl(s),this.getPopupHandler(e).load(n,r,o,ln(t,{keepOriginalCasing:!0}))},Gn.prototype.loginWithCredentials=function(e,t){e.realm=e.realm||e.connection,e.popup=!0,e=Vt.merge(this.baseOptions,["redirectUri","responseType","state","nonce"]).with(Vt.blacklist(e,["popupHandler","connection"])),e=this.transactionManager.process(e),this.crossOriginAuthentication.login(e,t)},Gn.prototype.passwordlessVerify=function(e,t){var n=this;return this.client.passwordless.verify(Vt.blacklist(e,["popupHandler"]),(function(r){if(r)return t(r);e.username=e.phoneNumber||e.email,e.password=e.verificationCode,delete e.email,delete e.phoneNumber,delete e.verificationCode,delete e.type,n.client.loginWithResourceOwner(e,t)}))},Gn.prototype.signupAndLogin=function(e,t){var n=this;return this.client.dbConnection.signup(e,(function(r){if(r)return t(r);n.loginWithCredentials(e,t)}))},Yn.create=function(e){return new Yn(e)},Yn.prototype.login=function(e,t){this.handler=new Vn({auth0:this.auth0,url:this.authenticationUrl,eventListenerType:e?"message":"load",callback:this.getCallbackHandler(t,e),timeout:this.timeout,eventValidator:this.getEventValidator(),timeoutCallback:function(){t(null,"#error=timeout&error_description=Timeout+during+authentication+renew.")},usePostMessage:e||!1}),this.handler.init()},Yn.prototype.getEventValidator=function(){var e=this;return{isValid:function(t){switch(t.event.type){case"message":return t.event.origin===e.postMessageOrigin&&t.event.source===e.handler.iframe.contentWindow&&(!1===e.postMessageDataType||t.event.data.type&&t.event.data.type===e.postMessageDataType);case"load":if("about:"===t.sourceObject.contentWindow.location.protocol)return!1;default:return!0}}}},Yn.prototype.getCallbackHandler=function(e,t){return function(n){var r;r=t?"object"==typeof n.event.data&&n.event.data.hash?n.event.data.hash:n.event.data:n.sourceObject.contentWindow.location.hash,e(null,r)}},er.prototype.login=function(e,t){var n,r;return n=i(this.baseOptions.rootUrl,"usernamepassword","login"),e.username=e.username||e.email,e=Vt.blacklist(e,["email","onRedirecting"]),r=Vt.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience"]).with(e),r=this.transactionManager.process(r),r=Vt.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(ln(t))},er.prototype.callback=function(e){var t,n=Kt.getDocument();(t=n.createElement("div")).innerHTML=e,n.body.appendChild(t).children[0].submit()},tr.prototype.login=function(e,t){if(Kt.getWindow().location.host!==this.baseOptions.domain)throw new Error("This method is meant to be used only inside the Universal Login Page.");var n,r=Vt.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience","_csrf","state","_intstate","nonce"]).with(e);return Lt.check(r,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),(n=new er(this.baseOptions)).login(r,(function(r,o){if(r)return t(r);function i(){n.callback(o)}if("function"==typeof e.onRedirecting)return e.onRedirecting((function(){i()}));i()}))},tr.prototype.signupAndLogin=function(e,t){var n=this;return n.client.client.dbConnection.signup(e,(function(r){return r?t(r):n.login(e,t)}))},tr.prototype.getSSOData=function(e,t){var n,r="";return"function"==typeof e&&(t=e,e=!1),Lt.check(e,{type:"boolean",message:"withActiveDirectories parameter is not valid"}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),e&&(r="?"+ot({ldaps:1,client_id:this.baseOptions.clientID})),n=i(this.baseOptions.rootUrl,"user","ssodata",r),this.request.get(n,{noHeaders:!0}).withCredentials().end(ln(t))};var nr=function(){},rr={lang:"en",templates:{auth0:function(e){var t="code"===e.type?"Enter the code shown above":"Solve the formula shown above";return'
\n \n \n
\n'},recaptcha_v2:function(){return'
'},recaptcha_enterprise:function(){return'
'},error:function(){return'
Error getting the bot detection challenge. Please contact the system administrator.
'}}};function or(e){switch(e){case"recaptcha_v2":return window.grecaptcha;case"recaptcha_enterprise":return window.grecaptcha.enterprise;default:throw new Error("Unknown captcha provider")}}function ir(){return new Date}function ar(e){Lt.check(e,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},popupOrigin:{optional:!0,type:"string",message:"popupOrigin is not valid"},leeway:{optional:!0,type:"number",message:"leeway is not valid"},plugins:{optional:!0,type:"array",message:"plugins is not valid"},maxAge:{optional:!0,type:"number",message:"maxAge is not valid"},stateExpiration:{optional:!0,type:"number",message:"stateExpiration is not valid"},legacySameSiteCookie:{optional:!0,type:"boolean",message:"legacySameSiteCookie option is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"},_timesToRetryFailedRequests:{optional:!0,type:"number",message:"_timesToRetryFailedRequests option is not valid"}}),e.overrides&&Lt.check(e.overrides,{type:"object",message:"overrides option is not valid"},{__tenant:{optional:!0,type:"string",message:"__tenant option is required"},__token_issuer:{optional:!0,type:"string",message:"__token_issuer option is required"},__jwks_uri:{optional:!0,type:"string",message:"__jwks_uri is required"}}),this.baseOptions=e,this.baseOptions.plugins=new Bn(this,this.baseOptions.plugins||[]),this.baseOptions._sendTelemetry=!1!==this.baseOptions._sendTelemetry||this.baseOptions._sendTelemetry,this.baseOptions._timesToRetryFailedRequests=e._timesToRetryFailedRequests?parseInt(e._timesToRetryFailedRequests):0,this.baseOptions.tenant=this.baseOptions.overrides&&this.baseOptions.overrides.__tenant||this.baseOptions.domain.split(".")[0],this.baseOptions.token_issuer=this.baseOptions.overrides&&this.baseOptions.overrides.__token_issuer||"https://"+this.baseOptions.domain+"/",this.baseOptions.jwksURI=this.baseOptions.overrides&&this.baseOptions.overrides.__jwks_uri,!1!==e.legacySameSiteCookie&&(this.baseOptions.legacySameSiteCookie=!0),this.transactionManager=new Wn(this.baseOptions),this.client=new ur(this.baseOptions),this.redirect=new Jn(this,this.baseOptions),this.popup=new Gn(this,this.baseOptions),this.crossOriginAuthentication=new Qn(this,this.baseOptions),this.webMessageHandler=new $n(this),this._universalLogin=new tr(this,this.baseOptions),this.ssodataStorage=new on(this.baseOptions)}function sr(e,t){this.baseOptions=t,this.request=e}function lr(e,t){this.baseOptions=t,this.request=e}function ur(e,t){2===arguments.length?this.auth0=e:t=e,Lt.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=t,this.baseOptions._sendTelemetry=!1!==this.baseOptions._sendTelemetry||this.baseOptions._sendTelemetry,this.baseOptions.rootUrl=this.baseOptions.domain&&0===this.baseOptions.domain.toLowerCase().indexOf("http")?this.baseOptions.domain:"https://"+this.baseOptions.domain,this.request=new Zt(this.baseOptions),this.passwordless=new sr(this.request,this.baseOptions),this.dbConnection=new lr(this.request,this.baseOptions),this.warn=new tn({disableWarnings:!!t._disableDeprecationWarnings}),this.ssodataStorage=new on(this.baseOptions)}function cr(e){Lt.check(e,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},token:{type:"string",message:"token option is required"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=e,this.baseOptions.headers={Authorization:"Bearer "+this.baseOptions.token},this.request=new Zt(this.baseOptions),this.baseOptions.rootUrl=i("https://"+this.baseOptions.domain,"api","v2")}ar.prototype.parseHash=function(e,t){var n,r;t||"function"!=typeof e?e=e||{}:(t=e,e={});var o=void 0===e.hash?Kt.getWindow().location.hash:e.hash;if((n=function(e,t){var n=et;if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var r="string"==typeof e?function(e,t){var n,r={},o=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,i=t.parameterLimit===1/0?void 0:t.parameterLimit,a=o.split(t.delimiter,i),s=-1,l=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(c=Ye(c)?[c]:c),Ge.call(r,u)?r[u]=Be.combine(r[u],c):r[u]=c}return r}(e,n):e,o=n.plainObjects?Object.create(null):{},i=Object.keys(r),a=0;a0&&-1!==i.indexOf("token")&&!n.hasOwnProperty("access_token")?t(sn.buildResponse("invalid_hash","response_type contains `token`, but the parsed hash does not contain an `access_token` property")):i.length>0&&-1!==i.indexOf("id_token")&&!n.hasOwnProperty("id_token")?t(sn.buildResponse("invalid_hash","response_type contains `id_token`, but the parsed hash does not contain an `id_token` property")):this.validateAuthenticationResponse(e,n,t)},ar.prototype.validateAuthenticationResponse=function(e,t,n){var r=this;e.__enableIdPInitiatedLogin=e.__enableIdPInitiatedLogin||e.__enableImpersonation;var o=t.state,i=this.transactionManager.getStoredTransaction(o),a=e.state||i&&i.state||null,s=a===o;if((o||a||!e.__enableIdPInitiatedLogin)&&!s)return n({error:"invalid_token",errorDescription:"`state` does not match."});var l=e.nonce||i&&i.nonce||null,u=i&&i.organization,c=e.state||i&&i.appState||null,f=function(e,o){return e?n(e):(i&&i.lastUsedConnection&&(o&&(a=o.sub),r.ssodataStorage.set(i.lastUsedConnection,a)),n(null,function(e,t,n){return{accessToken:e.access_token||null,idToken:e.id_token||null,idTokenPayload:n||null,appState:t||null,refreshToken:e.refresh_token||null,state:e.state||null,expiresIn:e.expires_in?parseInt(e.expires_in,10):null,tokenType:e.token_type||null,scope:e.scope||null}}(t,c,o)));var a};return t.id_token?this.validateToken(t.id_token,l,(function(e,n){if(!e){if(u){if(!n.org_id)return f(sn.invalidToken("Organization Id (org_id) claim must be a string present in the ID token"));if(n.org_id!==u)return f(sn.invalidToken('Organization Id (org_id) claim value mismatch in the ID token; expected "'+u+'", found "'+n.org_id+'"'))}return t.access_token&&n.at_hash?(new Fn).validateAccessToken(t.access_token,"RS256",n.at_hash,(function(e){return e?f(sn.invalidToken(e.message)):f(null,n)})):f(null,n)}if("invalid_token"!==e.error||e.errorDescription&&e.errorDescription.indexOf("Nonce (nonce) claim value mismatch in the ID token")>-1)return f(e);var o=(new Fn).decode(t.id_token);return"HS256"!==o.header.alg?f(e):(o.payload.nonce||null)!==l?f({error:"invalid_token",errorDescription:'Nonce (nonce) claim value mismatch in the ID token; expected "'+l+'", found "'+o.payload.nonce+'"'}):t.access_token?r.client.userInfo(t.access_token,(function(e,t){return e?f(e):f(null,t)})):f({error:"invalid_token",description:"The id_token cannot be validated because it was signed with the HS256 algorithm and public clients (like a browser) can’t store secrets. Please read the associated doc for possible ways to fix this. Read more: https://auth0.com/docs/errors/libraries/auth0-js/invalid-token#parsing-an-hs256-signed-id-token-without-an-access-token"})})):f(null,null)},ar.prototype.validateToken=function(e,t,n){new Fn({issuer:this.baseOptions.token_issuer,jwksURI:this.baseOptions.jwksURI,audience:this.baseOptions.clientID,leeway:this.baseOptions.leeway||60,maxAge:this.baseOptions.maxAge,__clock:this.baseOptions.__clock||ir}).verify(e,t,(function(e,t){if(e)return n(sn.invalidToken(e.message));n(null,t)}))},ar.prototype.renewAuth=function(e,t){var n=!!e.usePostMessage,r=e.postMessageDataType||!1,o=e.postMessageOrigin||Kt.getWindow().origin,i=e.timeout,a=this,s=Vt.merge(this.baseOptions,["clientID","redirectUri","responseType","scope","audience","_csrf","state","_intstate","nonce"]).with(e);s.responseType=s.responseType||"token",s.responseMode=s.responseMode||"fragment",s=this.transactionManager.process(s),Lt.check(s,{type:"object",message:"options parameter is not valid"}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),s.prompt="none",s=Vt.blacklist(s,["usePostMessage","tenant","postMessageDataType","postMessageOrigin"]),Yn.create({authenticationUrl:this.client.buildAuthorizeUrl(s),postMessageDataType:r,postMessageOrigin:o,timeout:i}).login(n,(function(e,n){if("object"==typeof n)return t(e,n);a.parseHash({hash:n},t)}))},ar.prototype.checkSession=function(e,t){var n=Vt.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(e);return"code"===n.responseType?t({error:"error",error_description:"responseType can't be `code`"}):(e.nonce||(n=this.transactionManager.process(n)),n.redirectUri?(Lt.check(n,{type:"object",message:"options parameter is not valid"}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=Vt.blacklist(n,["usePostMessage","tenant","postMessageDataType"]),void this.webMessageHandler.run(n,ln(t,{forceLegacyError:!0,ignoreCasing:!0}))):t({error:"error",error_description:"redirectUri can't be empty"}))},ar.prototype.changePassword=function(e,t){return this.client.dbConnection.changePassword(e,t)},ar.prototype.passwordlessStart=function(e,t){var n=Vt.merge(this.baseOptions,["responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(e.authParams);return e.authParams=this.transactionManager.process(n),this.client.passwordless.start(e,t)},ar.prototype.signup=function(e,t){return this.client.dbConnection.signup(e,t)},ar.prototype.authorize=function(e){var t=Vt.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce","organization","invitation"]).with(e);Lt.check(t,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),(t=this.transactionManager.process(t)).scope=t.scope||"openid profile email",Kt.redirect(this.client.buildAuthorizeUrl(t))},ar.prototype.signupAndAuthorize=function(e,t){var n=this;return this.client.dbConnection.signup(Vt.blacklist(e,["popupHandler"]),(function(r){if(r)return t(r);e.realm=e.connection,e.username||(e.username=e.email),n.client.login(e,t)}))},ar.prototype.login=function(e,t){var n=Vt.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce","onRedirecting","organization","invitation"]).with(e);n=this.transactionManager.process(n),Kt.getWindow().location.host===this.baseOptions.domain?(n.connection=n.realm,delete n.realm,this._universalLogin.login(n,t)):this.crossOriginAuthentication.login(n,t)},ar.prototype.passwordlessLogin=function(e,t){var n=Vt.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce","onRedirecting"]).with(e);if(n=this.transactionManager.process(n),Kt.getWindow().location.host===this.baseOptions.domain)this.passwordlessVerify(n,t);else{var r=Vt.extend({credentialType:"http://auth0.com/oauth/grant-type/passwordless/otp",realm:n.connection,username:n.email||n.phoneNumber,otp:n.verificationCode},Vt.blacklist(n,["connection","email","phoneNumber","verificationCode"]));this.crossOriginAuthentication.login(r,t)}},ar.prototype.crossOriginAuthenticationCallback=function(){this.crossOriginVerification()},ar.prototype.crossOriginVerification=function(){this.crossOriginAuthentication.callback()},ar.prototype.logout=function(e){Kt.redirect(this.client.buildLogoutUrl(e))},ar.prototype.passwordlessVerify=function(e,t){var n=this,r=Vt.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce","onRedirecting"]).with(e);return Lt.check(r,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),r=this.transactionManager.process(r),this.client.passwordless.verify(r,(function(o){if(o)return t(o);function i(){Kt.redirect(n.client.passwordless.buildVerifyUrl(r))}if("function"==typeof e.onRedirecting)return e.onRedirecting((function(){i()}));i()}))},ar.prototype.renderCaptcha=function(e,t,n){return function(e,t,n,r){function o(r){r=r||nr,e.getChallenge((function(e,i){return e?(t.innerHTML=n.templates.error(e),r(e)):i.required?(t.style.display="","auth0"===i.provider?function(e,t,n,r){e.innerHTML=t.templates[n.provider](n),e.querySelector(".captcha-reload").addEventListener("click",(function(e){e.preventDefault(),r()}))}(t,n,i,o):"recaptcha_v2"!==i.provider&&"recaptcha_enterprise"!==i.provider||function(e,t,n){var r=e.hasAttribute("data-wid")&&e.getAttribute("data-wid");function o(t){e.querySelector('input[name="captcha"]').value=t||""}if(r)return o(),void or(n.provider).reset(r);e.innerHTML=t.templates[n.provider](n);var i=e.querySelector(".recaptcha");!function(e,t,n){var r="recaptchaCallback_"+Math.floor(1000001*Math.random());window[r]=function(){delete window[r],n()};var o=window.document.createElement("script");o.src=function(e,t,n){switch(e){case"recaptcha_v2":return"https://www.recaptcha.net/recaptcha/api.js?hl="+t+"&onload="+n;case"recaptcha_enterprise":return"https://www.recaptcha.net/recaptcha/enterprise.js?render=explicit&hl="+t+"&onload="+n;default:throw new Error("Unknown captcha provider")}}(t.provider,t.lang,r),o.async=!0,window.document.body.appendChild(o)}(0,{lang:t.lang,provider:n.provider},(function(){var t=or(n.provider);r=t.render(i,{callback:o,"expired-callback":function(){o()},"error-callback":function(){o()},sitekey:n.siteKey}),e.setAttribute("data-wid",r)}))}(t,n,i),void r()):(t.style.display="none",void(t.innerHTML=""))}))}return n=Vt.merge(rr).with(n||{}),o(r),{reload:o,getValue:function(){var e=t.querySelector('input[name="captcha"]');if(e)return e.value}}}(this.client,e,t,n)},sr.prototype.buildVerifyUrl=function(e){var t,n;return Lt.check(e,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(e){return!e.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(e){return!e.phoneNumber}}}),t=Vt.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","protocol","nonce"]).with(e),this.baseOptions._sendTelemetry&&(t.auth0Client=this.request.getTelemetryData()),t=Vt.toSnakeCase(t,["auth0Client"]),n=ot(t),i(this.baseOptions.rootUrl,"passwordless","verify_redirect","?"+n)},sr.prototype.start=function(e,t){var n,r;Lt.check(e,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},send:{type:"string",message:"send option is required",values:["link","code"],value_message:"send is not valid ([link, code])"},phoneNumber:{optional:!0,type:"string",message:"phoneNumber option is required",condition:function(e){return"code"===e.send||!e.email}},email:{optional:!0,type:"string",message:"email option is required",condition:function(e){return"link"===e.send||!e.phoneNumber}},authParams:{optional:!0,type:"object",message:"authParams option is required"}}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"passwordless","start");var o=e.xRequestLanguage;delete e.xRequestLanguage,(r=Vt.merge(this.baseOptions,["clientID","responseType","redirectUri","scope"]).with(e)).scope&&(r.authParams=r.authParams||{},r.authParams.scope=r.authParams.scope||r.scope),r.redirectUri&&(r.authParams=r.authParams||{},r.authParams.redirect_uri=r.authParams.redirectUri||r.redirectUri),r.responseType&&(r.authParams=r.authParams||{},r.authParams.response_type=r.authParams.responseType||r.responseType),delete r.redirectUri,delete r.responseType,delete r.scope,r=Vt.toSnakeCase(r,["auth0Client","authParams"]);var a=o?{xRequestLanguage:o}:void 0;return this.request.post(n,a).send(r).end(ln(t))},sr.prototype.verify=function(e,t){var n,r;return Lt.check(e,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(e){return!e.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(e){return!e.phoneNumber}}}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),r=Vt.pick(e,["connection","verificationCode","phoneNumber","email","auth0Client","clientID"]),r=Vt.toSnakeCase(r,["auth0Client"]),n=i(this.baseOptions.rootUrl,"passwordless","verify"),this.request.post(n).send(r).end(ln(t))},lr.prototype.signup=function(e,t){var n,r,o;return Lt.check(e,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"},password:{type:"string",message:"password option is required"}}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"dbconnections","signup"),o=(r=Vt.merge(this.baseOptions,["clientID","state"]).with(e)).user_metadata||r.userMetadata,r=Vt.blacklist(r,["scope","userMetadata","user_metadata"]),r=Vt.toSnakeCase(r,["auth0Client"]),o&&(r.user_metadata=o),this.request.post(n).send(r).end(ln(t))},lr.prototype.changePassword=function(e,t){var n,r;return Lt.check(e,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"}}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"dbconnections","change_password"),r=Vt.merge(this.baseOptions,["clientID"]).with(e,["email","connection"]),r=Vt.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(ln(t))},ur.prototype.buildAuthorizeUrl=function(e){var t,n;return Lt.check(e,{type:"object",message:"options parameter is not valid"}),t=Vt.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience"]).with(e),Lt.check(t,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},redirectUri:{optional:!0,type:"string",message:"redirectUri option is required"},responseType:{type:"string",message:"responseType option is required"},nonce:{type:"string",message:"nonce option is required",condition:function(e){return-1===e.responseType.indexOf("code")&&-1!==e.responseType.indexOf("id_token")}},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),this.baseOptions._sendTelemetry&&(t.auth0Client=this.request.getTelemetryData()),t.connection_scope&&Lt.isArray(t.connection_scope)&&(t.connection_scope=t.connection_scope.join(",")),t=Vt.blacklist(t,["username","popupOptions","domain","tenant","timeout","appState"]),t=Vt.toSnakeCase(t,["auth0Client"]),t=function(e,t){var n=Vt.getKeysNotIn(t,cn);return n.length>0&&e.warning("Following parameters are not allowed on the `/authorize` endpoint: ["+n.join(",")+"]"),t}(this.warn,t),n=ot(t),i(this.baseOptions.rootUrl,"authorize","?"+n)},ur.prototype.buildLogoutUrl=function(e){var t,n;return Lt.check(e,{optional:!0,type:"object",message:"options parameter is not valid"}),t=Vt.merge(this.baseOptions,["clientID"]).with(e||{}),this.baseOptions._sendTelemetry&&(t.auth0Client=this.request.getTelemetryData()),t=Vt.toSnakeCase(t,["auth0Client","returnTo"]),n=ot(Vt.blacklist(t,["federated"])),e&&void 0!==e.federated&&!1!==e.federated&&"false"!==e.federated&&(n+="&federated"),i(this.baseOptions.rootUrl,"v2","logout","?"+n)},ur.prototype.loginWithDefaultDirectory=function(e,t){return Lt.check(e,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),e.grantType="password",this.oauthToken(e,t)},ur.prototype.login=function(e,t){return Lt.check(e,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},realm:{type:"string",message:"realm option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),e.grantType="http://auth0.com/oauth/grant-type/password-realm",this.oauthToken(e,t)},ur.prototype.oauthToken=function(e,t){var n,r,o;return Lt.check(e,{type:"object",message:"options parameter is not valid"}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"oauth","token"),r=Vt.merge(this.baseOptions,["clientID","scope","audience"]).with(e),Lt.check(r,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},grantType:{type:"string",message:"grantType option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),r=Vt.toSnakeCase(r,["auth0Client"]),this.warn,o=r,r=Vt.pick(o,un),this.request.post(n).send(r).end(ln(t))},ur.prototype.loginWithResourceOwner=function(e,t){var n,r;return Lt.check(e,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},connection:{type:"string",message:"connection option is required"},scope:{optional:!0,type:"string",message:"scope option is required"}}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"oauth","ro"),r=Vt.merge(this.baseOptions,["clientID","scope"]).with(e,["username","password","scope","connection","device"]),(r=Vt.toSnakeCase(r,["auth0Client"])).grant_type=r.grant_type||"password",this.request.post(n).send(r).end(ln(t))},ur.prototype.getSSOData=function(e,t){if(this.auth0||(this.auth0=new ar(this.baseOptions)),Kt.getWindow().location.host===this.baseOptions.domain)return this.auth0._universalLogin.getSSOData(e,t);"function"==typeof e&&(t=e),Lt.check(t,{type:"function",message:"cb parameter is not valid"});var n=this.baseOptions.clientID,r=this.ssodataStorage.get()||{};this.auth0.checkSession({responseType:"token id_token",scope:"openid profile email",connection:r.lastUsedConnection,timeout:5e3},(function(e,o){return e?"login_required"===e.error?t(null,{sso:!1}):("consent_required"===e.error&&(e.error_description="Consent required. When using `getSSOData`, the user has to be authenticated with the following scope: `openid profile email`."),t(e,{sso:!1})):r.lastUsedSub&&r.lastUsedSub!==o.idTokenPayload.sub?t(e,{sso:!1}):t(null,{lastUsedConnection:{name:r.lastUsedConnection},lastUsedUserID:o.idTokenPayload.sub,lastUsedUsername:o.idTokenPayload.email||o.idTokenPayload.name,lastUsedClientID:n,sessionClients:[n],sso:!0})}))},ur.prototype.userInfo=function(e,t){var n;return Lt.check(e,{type:"string",message:"accessToken parameter is not valid"}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"userinfo"),this.request.get(n).set("Authorization","Bearer "+e).end(ln(t,{ignoreCasing:!0}))},ur.prototype.getChallenge=function(e){if(Lt.check(e,{type:"function",message:"cb parameter is not valid"}),!this.baseOptions.state)return e();var t=i(this.baseOptions.rootUrl,"usernamepassword","challenge");return this.request.post(t).send({state:this.baseOptions.state}).end(ln(e,{ignoreCasing:!0}))},ur.prototype.delegation=function(e,t){var n,r;return Lt.check(e,{type:"object",message:"options parameter is not valid"},{grant_type:{type:"string",message:"grant_type option is required"}}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"delegation"),r=Vt.merge(this.baseOptions,["clientID"]).with(e),r=Vt.toSnakeCase(r,["auth0Client"]),this.request.post(n).send(r).end(ln(t))},ur.prototype.getUserCountry=function(e){var t;return Lt.check(e,{type:"function",message:"cb parameter is not valid"}),t=i(this.baseOptions.rootUrl,"user","geoloc","country"),this.request.get(t).end(ln(e))},cr.prototype.getUser=function(e,t){var n;return Lt.check(e,{type:"string",message:"userId parameter is not valid"}),Lt.check(t,{type:"function",message:"cb parameter is not valid"}),n=i(this.baseOptions.rootUrl,"users",e),this.request.get(n).end(ln(t,{ignoreCasing:!0}))},cr.prototype.patchUserMetadata=function(e,t,n){var r;return Lt.check(e,{type:"string",message:"userId parameter is not valid"}),Lt.check(t,{type:"object",message:"userMetadata parameter is not valid"}),Lt.check(n,{type:"function",message:"cb parameter is not valid"}),r=i(this.baseOptions.rootUrl,"users",e),this.request.patch(r).send({user_metadata:t}).end(ln(n,{ignoreCasing:!0}))},cr.prototype.patchUserAttributes=function(e,t,n){var r;return Lt.check(e,{type:"string",message:"userId parameter is not valid"}),Lt.check(t,{type:"object",message:"user parameter is not valid"}),Lt.check(n,{type:"function",message:"cb parameter is not valid"}),r=i(this.baseOptions.rootUrl,"users",e),this.request.patch(r).send(t).end(ln(n,{ignoreCasing:!0}))},cr.prototype.linkUser=function(e,t,n){var r;return Lt.check(e,{type:"string",message:"userId parameter is not valid"}),Lt.check(t,{type:"string",message:"secondaryUserToken parameter is not valid"}),Lt.check(n,{type:"function",message:"cb parameter is not valid"}),r=i(this.baseOptions.rootUrl,"users",e,"identities"),this.request.post(r).send({link_with:t}).end(ln(n,{ignoreCasing:!0}))};var fr={Authentication:ur,Management:cr,WebAuth:ar,version:Dt};t.default=fr},9669:function(e,t,n){e.exports=n(1609)},5448:function(e,t,n){"use strict";var r=n(4867),o=n(6026),i=n(4372),a=n(5327),s=n(4097),l=n(4109),u=n(7985),c=n(5061);e.exports=function(e){return new Promise((function(t,n){var f=e.data,p=e.headers,d=e.responseType;r.isFormData(f)&&delete p["Content-Type"];var h=new XMLHttpRequest;if(e.auth){var m=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";p.Authorization="Basic "+btoa(m+":"+y)}var g=s(e.baseURL,e.url);function v(){if(h){var r="getAllResponseHeaders"in h?l(h.getAllResponseHeaders()):null,i={data:d&&"text"!==d&&"json"!==d?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h};o(t,n,i),h=null}}if(h.open(e.method.toUpperCase(),a(g,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,"onloadend"in h?h.onloadend=v:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(v)},h.onabort=function(){h&&(n(c("Request aborted",e,"ECONNABORTED",h)),h=null)},h.onerror=function(){n(c("Network Error",e,null,h)),h=null},h.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(c(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var b=(e.withCredentials||u(g))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;b&&(p[e.xsrfHeaderName]=b)}"setRequestHeader"in h&&r.forEach(p,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete p[t]:h.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(h.withCredentials=!!e.withCredentials),d&&"json"!==d&&(h.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){h&&(h.abort(),n(e),h=null)})),f||(f=null),h.send(f)}))}},1609:function(e,t,n){"use strict";var r=n(4867),o=n(1849),i=n(321),a=n(7185);function s(e){var t=new i(e),n=o(i.prototype.request,t);return r.extend(n,i.prototype,t),r.extend(n,t),n}var l=s(n(5655));l.Axios=i,l.create=function(e){return s(a(l.defaults,e))},l.Cancel=n(5263),l.CancelToken=n(4972),l.isCancel=n(6502),l.all=function(e){return Promise.all(e)},l.spread=n(8713),l.isAxiosError=n(6268),e.exports=l,e.exports.default=l},5263:function(e){"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},4972:function(e,t,n){"use strict";var r=n(5263);function o(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}o.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},o.source=function(){var e;return{token:new o((function(t){e=t})),cancel:e}},e.exports=o},6502:function(e){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:function(e,t,n){"use strict";var r=n(4867),o=n(5327),i=n(782),a=n(3572),s=n(7185),l=n(4875),u=l.validators;function c(e){this.defaults=e,this.interceptors={request:new i,response:new i}}c.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&l.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var c=[a,void 0];for(Array.prototype.unshift.apply(c,n),c=c.concat(i),o=Promise.resolve(e);c.length;)o=o.then(c.shift(),c.shift());return o}for(var f=e;n.length;){var p=n.shift(),d=n.shift();try{f=p(f)}catch(e){d(e);break}}try{o=a(f)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},c.prototype.getUri=function(e){return e=s(this.defaults,e),o(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){c.prototype[e]=function(t,n,r){return this.request(s(r||{},{method:e,url:t,data:n}))}})),e.exports=c},782:function(e,t,n){"use strict";var r=n(4867);function o(){this.handlers=[]}o.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},o.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},o.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=o},4097:function(e,t,n){"use strict";var r=n(1793),o=n(7303);e.exports=function(e,t){return e&&!r(t)?o(e,t):t}},5061:function(e,t,n){"use strict";var r=n(481);e.exports=function(e,t,n,o,i){var a=new Error(e);return r(a,t,n,o,i)}},3572:function(e,t,n){"use strict";var r=n(4867),o=n(8527),i=n(6502),a=n(5655);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=o.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return s(e),t.data=o.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(s(e),t&&t.response&&(t.response.data=o.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:function(e){"use strict";e.exports=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},7185:function(e,t,n){"use strict";var r=n(4867);e.exports=function(e,t){t=t||{};var n={},o=["url","method","data"],i=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function l(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function u(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=l(void 0,e[o])):n[o]=l(e[o],t[o])}r.forEach(o,(function(e){r.isUndefined(t[e])||(n[e]=l(void 0,t[e]))})),r.forEach(i,u),r.forEach(a,(function(o){r.isUndefined(t[o])?r.isUndefined(e[o])||(n[o]=l(void 0,e[o])):n[o]=l(void 0,t[o])})),r.forEach(s,(function(r){r in t?n[r]=l(e[r],t[r]):r in e&&(n[r]=l(void 0,e[r]))}));var c=o.concat(i).concat(a).concat(s),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return r.forEach(f,u),n}},6026:function(e,t,n){"use strict";var r=n(5061);e.exports=function(e,t,n){var o=n.config.validateStatus;n.status&&o&&!o(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},8527:function(e,t,n){"use strict";var r=n(4867),o=n(5655);e.exports=function(e,t,n){var i=this||o;return r.forEach(n,(function(n){e=n.call(i,e,t)})),e}},5655:function(e,t,n){"use strict";var r=n(4867),o=n(6016),i=n(481),a={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=n(5448)),l),transformRequest:[function(e,t){return o(t,"Accept"),o(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(s(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(0,JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,o=t&&t.forcedJSONParsing,a=!n&&"json"===this.responseType;if(a||o&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(a){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(a)})),e.exports=u},1849:function(e){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},8713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},4875:function(e,t,n){"use strict";var r=n(8593),o={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){o[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var i={},a=r.version.split(".");function s(e,t){for(var n=t?t.split("."):a,r=e.split("."),o=0;o<3;o++){if(n[o]>r[o])return!0;if(n[o]0;){var i=r[o],a=t[i];if(a){var s=e[i],l=void 0===s||a(s,i,e);if(!0!==l)throw new TypeError("option "+i+" must be "+l)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:o}},4867:function(e,t,n){"use strict";var r=n(1849),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function a(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]p{margin:0;font-size:14px}.tr-mage-connectionPanel .tr-mage-panelContent{display:flex;justify-content:space-between;flex:1;padding:16px 24px}.tr-mage-connectionPanel .tr-mage-panelContent h4{padding-left:0 !important}.tr-mage-connectionPanel .tr-mage-panelContent .tr-mage-connectionStatus>h3,.tr-mage-connectionPanel .tr-mage-panelContent .tr-mage-connectionStatus>p{margin:0}.tr-mage-connectionPanel .tr-mage-panelContent .tr-mage-connectionStatus>p{margin-top:8px}",""]),t.Z=a},5102:function(e,t,n){"use strict";var r=n(8081),o=n.n(r),i=n(3645),a=n.n(i)()(o());a.push([e.id,".tr-mage-detailsPanel{display:flex;flex-direction:column;width:700px;margin-bottom:32px}.tr-mage-detailsPanel .tr-mage-panelHeader{display:flex;align-items:center;flex:1;padding:16px 24px;border-bottom:1px solid #e2e4e7}.tr-mage-detailsPanel .tr-mage-panelHeader>p{margin:0;font-size:14px;font-weight:bold}.tr-mage-detailsPanel .tr-mage-panelContent,.tr-mage-detailsPanel .tr-mage-panelFooter{padding:16px 24px}.tr-mage-detailsPanel .tr-mage-panelContent{display:flex;flex-direction:column;justify-content:space-between;flex:1}.tr-mage-detailsPanel .tr-mage-panelContent.tr-mage-extraPanel{border-top:1px solid #e2e4e7}.tr-mage-detailsPanel .tr-mage-panelContent .tr-mage-detailsPanel-connected{display:flex;align-items:center;margin-bottom:8px}.tr-mage-detailsPanel .tr-mage-panelContent .tr-mage-detailsPanel-connected span{display:flex;flex-direction:column}.tr-mage-detailsPanel .tr-mage-panelContent .tr-mage-detailsPanel-connected .tr-mage-checkVector{width:32px;margin-right:16px}.tr-mage-detailsPanel .tr-mage-panelContent .tr-mage-detailsPanel-connected h3{margin:0}.tr-mage-detailsPanel .tr-mage-panelContent h4{padding-left:0 !important;margin-bottom:4px}.tr-mage-detailsPanel .tr-mage-panelContent h4.tr-mage-switchLabel{margin:0}.tr-mage-detailsPanel .tr-mage-panelContent p{margin:0}.tr-mage-detailsPanel .tr-mage-panelContent p:last-child{margin-bottom:0}.tr-mage-detailsPanel .tr-mage-panelFooter{display:flex;justify-content:flex-end;border-top:1px solid #e2e4e7;padding:24px;padding-top:32px !important}.tr-mage-detailsPanel .tr-mage-panelFooter .tr-mage-buttonVector{width:16px;margin-right:8px;margin-top:1px}",""]),t.Z=a},4658:function(e,t,n){"use strict";var r=n(8081),o=n.n(r),i=n(3645),a=n.n(i)()(o());a.push([e.id,".tr-mage-switchContainer{display:flex;align-items:center}.tr-mage-switchContainer .tr-mage-switch{position:relative;width:48px;height:24px;background-color:#e0e0e0;border-radius:16px;cursor:pointer}.tr-mage-switchContainer .tr-mage-switch.tr-mage-switch-checked{background-color:#8000ff}.tr-mage-switchContainer .tr-mage-switch.tr-mage-switch-checked .tr-mage-switchKnob{left:24px;border-color:#8000ff}.tr-mage-switchContainer .tr-mage-switch .tr-mage-switchKnob{position:absolute;display:block;left:0;width:24px;height:24px;border:2px solid #ccc;border-radius:50%;background-color:#fff;box-sizing:border-box}.tr-mage-switchContainer .tr-mage-switch,.tr-mage-switchContainer .tr-mage-switchKnob{transition:background-color 250ms ease-out,border-color 250ms ease-out,left 175ms ease-out}.tr-mage-switchContainer .tr-mage-switchContent{margin-left:8px}",""]),t.Z=a},3645:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var s=0;s0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=i),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),t.push(c))}},t}},8081:function(e){"use strict";e.exports=function(e){return e[1]}},7418:function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,i){for(var a,s,l=o(e),u=1;u